Fix Error: Solvento el error de carga de una segunda tabla y añado un log para ver posibles errores con el audio
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
IPSERVER = 192.168.82.156
|
IPSERVER=192.168.82.156
|
||||||
PORT=5000
|
PORT=5000
|
||||||
ORA_DIRECTORY="C:/oracle/product/11.2.0.4"
|
ORA_DIRECTORY="C:/oracle/product/11.2.0.4"
|
||||||
DB_USER=CSMKIOSCOS
|
DB_USER=CSMKIOSCOS
|
||||||
@@ -8,7 +8,7 @@ DB_PORT=1521
|
|||||||
DB_SID=REALRAC1
|
DB_SID=REALRAC1
|
||||||
MODE="1"
|
MODE="1"
|
||||||
THEME="csm"
|
THEME="csm"
|
||||||
MONITOR_ID_1=1
|
MONITOR_ID_1=0
|
||||||
MONITOR_ID_2=2
|
MONITOR_ID_2=0
|
||||||
IS_QUIRO_1=0
|
IS_QUIRO_1=0
|
||||||
IS_QUIRO_2=1
|
IS_QUIRO_2=0
|
||||||
+14
-17
@@ -1,13 +1,17 @@
|
|||||||
const sonido = new Audio("/static/media/0457.wav");
|
const sonido = new Audio("/static/media/0457.wav");
|
||||||
const estadoAnterior = {};
|
sonido.preload = "auto";
|
||||||
|
|
||||||
|
const estadoAnterior = {};
|
||||||
let ultimoFooter = "";
|
let ultimoFooter = "";
|
||||||
|
|
||||||
function cargarTabla(endpoint, tablaId, esQuiro) {
|
function cargarTabla(endpoint, tablaId, esQuiro) {
|
||||||
|
const tbody = document.getElementById(tablaId);
|
||||||
|
if (!tbody) return;
|
||||||
|
|
||||||
fetch(endpoint)
|
fetch(endpoint)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(filas => {
|
.then(filas => {
|
||||||
const tbody = document.getElementById(tablaId);
|
|
||||||
tbody.innerHTML = "";
|
tbody.innerHTML = "";
|
||||||
|
|
||||||
let sizeClass = "";
|
let sizeClass = "";
|
||||||
@@ -19,21 +23,16 @@ function cargarTabla(endpoint, tablaId, esQuiro) {
|
|||||||
|
|
||||||
filas.forEach(fila => {
|
filas.forEach(fila => {
|
||||||
const id = fila[0];
|
const id = fila[0];
|
||||||
|
|
||||||
const tr = document.createElement("tr");
|
const tr = document.createElement("tr");
|
||||||
|
|
||||||
|
// Crear celda 1
|
||||||
const td1 = document.createElement("td");
|
const td1 = document.createElement("td");
|
||||||
td1.textContent = fila[0];
|
td1.textContent = fila[0];
|
||||||
td1.className = `border align-middle ${sizeClass} m`;
|
td1.className = `border align-middle ${sizeClass} m`;
|
||||||
if (esQuiro === "1") {
|
td1.style.backgroundColor = esQuiro === "1" ? "#008968" : window.themeColors.bg1;
|
||||||
td1.style.backgroundColor = "#008968";
|
|
||||||
} else {
|
|
||||||
td1.style.backgroundColor = window.themeColors.bg1;
|
|
||||||
}
|
|
||||||
tr.appendChild(td1);
|
tr.appendChild(td1);
|
||||||
|
|
||||||
const td2 = document.createElement("td");
|
const td2 = document.createElement("td");
|
||||||
|
|
||||||
const estadoConsulta = fila[1];
|
const estadoConsulta = fila[1];
|
||||||
const estadoTurno = fila[3];
|
const estadoTurno = fila[3];
|
||||||
|
|
||||||
@@ -42,16 +41,13 @@ function cargarTabla(endpoint, tablaId, esQuiro) {
|
|||||||
td2.className = `border bg-[#a9a9a9] align-middle ${sizeClass}`;
|
td2.className = `border bg-[#a9a9a9] align-middle ${sizeClass}`;
|
||||||
} else if (estadoConsulta == 1) {
|
} else if (estadoConsulta == 1) {
|
||||||
td2.textContent = fila[2];
|
td2.textContent = fila[2];
|
||||||
if (esQuiro === "1") {
|
td2.style.backgroundColor = esQuiro === "1" ? "#008968" : window.themeColors.bg1;
|
||||||
td2.style.backgroundColor = "#00aa7a";
|
|
||||||
} else {
|
|
||||||
td2.style.backgroundColor = window.themeColors.bg2;
|
|
||||||
}
|
|
||||||
const originalText = fila[2];
|
const originalText = fila[2];
|
||||||
const blinkText = `<span class="text-[2.25rem]">PASE A<br>CONSULTA</span>`;
|
const blinkText = `<span class="text-[2.25rem]">PASE A<br>CONSULTA</span>`;
|
||||||
let blink = false;
|
let blink = false;
|
||||||
|
|
||||||
if (estadoTurno == 1) {
|
if (estadoTurno == 1) {
|
||||||
|
//Activar parapdeo
|
||||||
td2.className = `border align-middle ${sizeClass}`;
|
td2.className = `border align-middle ${sizeClass}`;
|
||||||
td2.innerHTML = originalText;
|
td2.innerHTML = originalText;
|
||||||
td2.style.backgroundColor = '#ffff00';
|
td2.style.backgroundColor = '#ffff00';
|
||||||
@@ -105,15 +101,16 @@ function cargarTabla(endpoint, tablaId, esQuiro) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (estadoAnterior[id] === 2 && estadoTurno === 1) {
|
if (estadoAnterior[id] === 2 && estadoTurno === 1) {
|
||||||
sonido.play();
|
sonido.currentTime = 0;
|
||||||
|
sonido.play().catch(err => console.warn("No se pudo reproducir el sonido: ", err));
|
||||||
}
|
}
|
||||||
|
|
||||||
estadoAnterior[id] = estadoTurno;
|
estadoAnterior[id] = estadoTurno;
|
||||||
|
|
||||||
tr.appendChild(td2);
|
tr.appendChild(td2);
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
.catch(err => console.error("Error cargando tabla: ", err));
|
||||||
}
|
}
|
||||||
|
|
||||||
function cargarFooter() {
|
function cargarFooter() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
const quiro2 = "{{ quiro2 }}";
|
const quiro2 = "{{ quiro2 }}";
|
||||||
</script>
|
</script>
|
||||||
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/scripts.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/scripts.js') }}" defer></script>
|
||||||
<style>:root {--blink-start-color: {{ theme_colors.bg2 }};}</style>
|
<style>:root {--blink-start-color: {{ theme_colors.bg2 }};}</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user