Commit 4079da6d by Tu Nombre

Auto actualizacion andando

1 parent 9deeb531
document.addEventListener('DOMContentLoaded', () => {
function CargarLista() {
const requestData = {
"token": "sdñÑREgerqw3$E#]ÑgdfbversdfFfew435",
"url": "https://validacion.hgtsa.com.ar/api_rto/diaria",
......@@ -24,22 +24,51 @@ document.addEventListener('DOMContentLoaded', () => {
.catch(error => {
console.error('Error:', error);
});
});
};
// Function to create the list items
function createHistoricoList(data) {
const historicoDiv = document.getElementById('div_historico');
data.inspecciones.forEach(inspeccion => {
const div = document.createElement('div');
div.textContent = inspeccion.name;
div.textContent = inspeccion.name + " " + inspeccion.resultado + " " + inspeccion.fecha + " ";
const button = document.createElement('button');
button.className = 'PDFButton';
button.id = inspeccion.name;
button.textContent = 'ir historico';
button.textContent = 'Ir dominio ';
div.appendChild(button);
historicoDiv.appendChild(div);
historicoDiv.appendChild(document.createElement('br'));
});
}
const chatUrl = 'https://api.hgt.com.ar/poll/rto_061_update/dewfrfgbeolkgkteprlk,hptrlk,hqff';
let pendingRequests = 0;
async function fetchChat() {
while (true) {
try {
const response = await fetch(chatUrl);
const data = await response.json();
if (data.proccess === true) {
// Agregamos el mensaje al div id="chat-messages" debajo del último mensaje
//alert("se deve actualizar")
CargarLista();
}
} catch (error) {
// Si ocurre un error, esperamos 5 segundos antes de volver a intentarlo
await new Promise(resolve => setTimeout(resolve, 5000));
}
}
}
window.addEventListener('load', () => {
CargarLista();
fetchChat();
});
......@@ -220,11 +220,16 @@
<button class="PDFButton" onclick="collectToSearch('data')">
Ticket Fosa
</button>
<button class="PDFButton" onclick= "location.href='/historico'">
Historico
</button>
</div>
<button class="PDFButton loginB" onclick= "location.href='/login'">
Login
</button>
</div>
<div id="message" class="MessageContainer" onclick="this.style.display = 'none'" style="display: none;">
<div class="Message" style="text-align: center;">
......
......@@ -24,43 +24,11 @@
</div>
<div class="PDFButtonContainerFixed">
<button class="PDFButton" onclick=
"window.open(
compile(
(new PDF2()).pdf( collectToConvert() ),
new jsPDF('portrait', 'pt', 'a4')
)
.output('bloburl')
)";
>
Pdf Informe
<button class="PDFButton" onclick= "location.href='/'">
Carga
</button>
<img id="maha" src="{{ url_for('static', filename = 'assets/maha.png') }}" style="display: none;">
</div>
<!--
<div class="PDFButtonContainerFixed">
<button class="PDFButton" id="boton_pdf_maha_reporte">
Linea 1
</button>
<button class="PDFButton" id="boton_pdf_maha_reporte2">
Linea 2
</button>
<button class="PDFButton" onclick=
"window.open(
compile(
(new PDF2()).pdf( collectToConvert() ),
new jsPDF('portrait', 'pt', 'a4')
)
.output('bloburl')
)";
>
Linea 2
</button>
<img id="maha" src="{{ url_for('static', filename = 'assets/maha2.png') }}" style="display: none;">
</div>
-->
</div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!