Update recepcion.php

This commit is contained in:
Lizandro Guarnizo
2026-04-21 13:13:49 -05:00
parent 5e1180c275
commit da1b32e1a3
+6 -4
View File
@@ -378,13 +378,14 @@ async function cargarCola() {
const res = await fetch(API + 'get_cola.php?area=recepcion');
const json = await res.json();
if (!json.ok) return;
renderCola(json.data);
renderCola(json);
} catch (_) {}
}
function renderCola(snap) {
const lista = document.getElementById('cola-items');
const espera = (snap.cola || []).filter(t => t.estado === 'espera');
const todos = snap.cola || [];
const espera = todos.filter(t => t.estado === 'espera' || t.estado === 'en_recepcion');
const badge = document.getElementById('badge-count');
badge.textContent = espera.length;
@@ -417,11 +418,12 @@ async function llamarSiguiente() {
const json = await res.json();
if (!json.ok) { mostrarError(json.error); return; }
if (!json.data.turno) {
const turnoLlamado = json.turno ?? json.data?.turno;
if (!turnoLlamado) {
mostrarAviso('Cola vacía', 'No hay turnos en espera.');
return;
}
abrirFicha(json.data.turno);
abrirFicha(turnoLlamado);
cargarCola();
} catch (err) {
mostrarError(err.message);