diff --git a/modules/turnero/views/recepcion.php b/modules/turnero/views/recepcion.php index 500256d..bcd3f45 100644 --- a/modules/turnero/views/recepcion.php +++ b/modules/turnero/views/recepcion.php @@ -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);