Commit 1a574118 by Tu Nombre

Implementacion de interfor de buscador

1 parent 206235a7
...@@ -71,6 +71,16 @@ def historico(): ...@@ -71,6 +71,16 @@ def historico():
bypass = False bypass = False
) )
@app.route('/buscador')
def buscador():
if "login" not in request.cookies:
return redirect(url_for("login"))
return render_template(
"buscador.html",
bypass = False
)
@app.route('/login', methods = ['GET', 'POST']) @app.route('/login', methods = ['GET', 'POST'])
def login(): def login():
if request.method == "GET": if request.method == "GET":
......
...@@ -10,7 +10,7 @@ function CargarLista() { ...@@ -10,7 +10,7 @@ function CargarLista() {
"clear": true, "clear": true,
"params": { "params": {
"ApiKey": "sdñÑREgerqw3$E#]ÑgdfbversdfFfew435", "ApiKey": "sdñÑREgerqw3$E#]ÑgdfbversdfFfew435",
"id_cent": id_cent "id_cent": idCentGlobal
} }
}; };
...@@ -66,7 +66,7 @@ function createHistoricoList(data) { ...@@ -66,7 +66,7 @@ function createHistoricoList(data) {
async function fetchChat() { async function fetchChat() {
const MensajeDiv = document.getElementById('DivMensajeFijo'); const MensajeDiv = document.getElementById('DivMensajeFijo');
const MensajeCaida = "Se perdio contacto con el server, revise conexcion a internet" const MensajeCaida = "Se perdio contacto con el server, revise conexcion a internet"
MensajeDiv.innerText = "Escuchando novedades" //MensajeDiv.innerText = "Escuchando novedades"
while (true) { while (true) {
try { try {
const response = await fetch(chatUrl); const response = await fetch(chatUrl);
...@@ -87,10 +87,57 @@ async function fetchChat() { ...@@ -87,10 +87,57 @@ async function fetchChat() {
} }
function BuscarLista(fecha,dominio) {
const requestData = {
"token": "sdñÑREgerqw3$E#]ÑgdfbversdfFfew435",
"url": "https://hgt.hgt.com.ar/api_rto/buscador",
"clear": true,
"params": {
"ApiKey": "sdñÑREgerqw3$E#]ÑgdfbversdfFfew435",
"id_cent": idCentGlobal,
//"id_cent": "61",
"fecha":fecha,
"dominio":dominio
}
};
fetch('https://api.hgt.com.ar/redirect', {
method: 'POST',
headers: {
'Accept': 'application/json',
"Content-Type": "application/json"
},
body: JSON.stringify(requestData)
})
.then(response => response.json())
.then(data => {
createHistoricoList(data);
})
.catch(error => {
console.error('Error:', error);
});
};
async function IniciarInterfaceBusqueda() {
const searchForm = document.getElementById('searchForm');
searchForm.addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the form from submitting normally
//console.log("Presionando boton busqueda")
const fecha = document.getElementById('date_input').value;
const dominio = document.getElementById('domain_input').value;
if (fecha === "" && dominio === "") {
alert("Carge los parametros de busqueda");
return; // Stop further execution if validation fails
} else {
BuscarLista(fecha,dominio);
}
})
}
////////////INICIO ACTIVIDAD ////////////INICIO ACTIVIDAD
...@@ -98,5 +145,6 @@ async function fetchChat() { ...@@ -98,5 +145,6 @@ async function fetchChat() {
window.addEventListener('load', () => { window.addEventListener('load', () => {
//CargarLista(); //CargarLista();
fetchChat(); //fetchChat();
IniciarInterfaceBusqueda();
}); });
\ No newline at end of file \ No newline at end of file
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="{{ url_for('static', filename = 'styles/general.css') }}">
<script src="/protected_static/buscador.js"></script>
<!--INCLUIMOS LA FUENTE
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cmu-typewriter" type="text/css" />
-->
<title>Pruebas de Alineamiento</title>
<style>
.custom-hr {
border: none;
border-top: 1px solid #000; /* Personaliza el color y grosor aquí */
width: 66.67%; /* Dos tercios del ancho de la página */
margin: 20px 0; /* Ajusta el espacio alrededor de la línea aquí */
margin-left: 0; /* Alinea la línea al inicio (izquierda) */
}
</style>
</head>
<body>
<div >
<!--
<div class="MessageFixed" id="DivMensajeFijo">
</div>
-->
<div class="DataCard" >
<form id="searchForm">
<div>
<label for="date_input">Fecha:</label>
<input type="date" id="date_input" name="date_input">
</div>
<div>
<label for="domain_input">Dominio:</label>
<input type="text" id="domain_input" name="domain_input">
</div>
<button class="PDFButton" type="submit" id="id_boton_busqueda">Buscar</button>
</form>
<hr class="custom-hr" >
Resultados de la busqueda
<br>
<div id="div_historico">
<hr class="custom-hr" >
Sin resultados
<hr class="custom-hr" >
</div>
</div>
<div class="PDFButtonContainerFixed">
<h3>Buscador</h3>
<button class="PDFButton" onclick= "location.href='/historico'">
Historico
</button>
<button class="PDFButton" onclick= "location.href='/'">
Carga
</button>
</div>
</div>
<div id="message" class="MessageContainer" onclick="this.style.display = 'none'" style="display: none;">
<div class="Message" style="text-align: center;">
<p id = "msg"></p>
<span class = "X">x<span>
</div>
</div>
</body>
</html>
\ No newline at end of file \ No newline at end of file
...@@ -224,6 +224,10 @@ ...@@ -224,6 +224,10 @@
<button class="PDFButton" onclick= "location.href='/historico'"> <button class="PDFButton" onclick= "location.href='/historico'">
Historico Historico
</button> </button>
<button class="PDFButton" onclick= "location.href='/buscador'">
Buscador
</button>
</div> </div>
<button class="PDFButton loginB" onclick= "location.href='/login'"> <button class="PDFButton loginB" onclick= "location.href='/login'">
......
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
<h3>Dominios del dia</h3> <h3>Dominios del dia</h3>
<button class="PDFButton" onclick= "location.href='/buscador'">
Buscador
</button>
<button class="PDFButton" onclick= "location.href='/'"> <button class="PDFButton" onclick= "location.href='/'">
Carga Carga
</button> </button>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!