diff --git a/modules/turnero/views/recepcion.php b/modules/turnero/views/recepcion.php index cf6ca6b..65c3894 100644 --- a/modules/turnero/views/recepcion.php +++ b/modules/turnero/views/recepcion.php @@ -496,16 +496,21 @@ async function cargarCola() { function renderCola(snap) { const lista = document.getElementById('cola-items'); const todos = snap.cola || []; - const espera = todos.filter(t => t.estado === 'espera'); const badge = document.getElementById('badge-count'); - badge.textContent = espera.length; - if (espera.length === 0) { + // Filtrar: 'espera' todos; 'en_recepcion' solo los de este escritorio + const visibles = todos.filter(t => + t.estado === 'espera' || + (t.estado === 'en_recepcion' && (t.recepcion_desk_id === null || t.recepcion_desk_id == DESK_ID)) + ); + badge.textContent = visibles.length; + + if (visibles.length === 0) { lista.innerHTML = `
Cola vacĂ­a
`; return; } - lista.innerHTML = espera.map(t => ` + lista.innerHTML = visibles.map(t => `
${t.prioridad_codigo}
@@ -513,10 +518,10 @@ function renderCola(snap) {
${escHtml(t.paciente_nombre || 'Sin nombre')}
`).join(''); }