11092025 - UPDATE: Integración de quirofanos

This commit is contained in:
2025-09-11 13:48:49 +02:00
parent eaeff5e80f
commit 400e0c19ff
4 changed files with 76 additions and 28 deletions
+44 -18
View File
@@ -3,7 +3,7 @@ const estadoAnterior = {};
let ultimoFooter = "";
function cargarTabla(endpoint, tablaId) {
function cargarTabla(endpoint, tablaId, esQuiro) {
fetch(endpoint)
.then(res => res.json())
.then(filas => {
@@ -25,7 +25,11 @@ function cargarTabla(endpoint, tablaId) {
const td1 = document.createElement("td");
td1.textContent = fila[0];
td1.className = `border align-middle ${sizeClass} m`;
td1.style.backgroundColor = window.themeColors.bg1;
if (esQuiro === "1") {
td1.style.backgroundColor = "#008968";
} else {
td1.style.backgroundColor = window.themeColors.bg1;
}
tr.appendChild(td1);
const td2 = document.createElement("td");
@@ -38,7 +42,11 @@ function cargarTabla(endpoint, tablaId) {
td2.className = `border bg-[#a9a9a9] align-middle ${sizeClass}`;
} else if (estadoConsulta == 1) {
td2.textContent = fila[2];
td2.style.backgroundColor = window.themeColors.bg2;
if (esQuiro === "1") {
td2.style.backgroundColor = "#00aa7a";
} else {
td2.style.backgroundColor = window.themeColors.bg2;
}
const originalText = fila[2];
const blinkText = `<span class="text-[2.25rem]">PASE A<br>CONSULTA</span>`;
let blink = false;
@@ -53,20 +61,37 @@ function cargarTabla(endpoint, tablaId) {
clearInterval(td2.blinkInterval);
}
td2.blinkInterval = setInterval(() => {
blink = !blink;
if (blink) {
td2.innerHTML = blinkText;
td2.style.fontWeight = "bold";
} else {
td2.textContent = originalText;
td2.style.fontWeight = "";
}
}, 1000);
if (esQuiro === "1") {
td2.blinkInterval = setInterval(() => {
blink = !blink;
if (blink) {
td2.style.backgroundColor = "#00aa7a";
td2.style.color = "#FFFFFF";
} else {
td2.style.backgroundColor = '#ffff00';
td2.style.color = "#000000";
}
}, 1500);
} else {
td2.blinkInterval = setInterval(() => {
blink = !blink;
if (blink) {
td2.innerHTML = blinkText;
td2.style.fontWeight = "bold";
} else {
td2.textContent = originalText;
td2.style.fontWeight = "";
}
}, 1500);
}
} else {
td2.className = `border align-middle ${sizeClass}`;
td2.style.backgroundColor = window.themeColors.bg2;
if (esQuiro === "1") {
td2.style.backgroundColor = "#00aa7a";
} else {
td2.style.backgroundColor = window.themeColors.bg2;
}
td2.textContent = originalText;
if (td2.blinkInterval) {
@@ -108,10 +133,11 @@ function cargarFooter() {
}
function actualizarTablas() {
cargarTabla("/api/datos1", "turnos1");
if (document.getElementById("turnos2")) {
cargarTabla("/api/datos2", "turnos2");
}
cargarTabla("/api/datos1", "turnos1", quiro1);
cargarTabla("/api/datos2", "turnos2", quiro2);
//if (document.getElementById("turnos2")) {
// cargarTabla("/api/datos2", "turnos2");
//}
}
//cargarFooter();