Update recepcion.php
This commit is contained in:
@@ -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 = `<div class="cola-vacia">
|
||||
<i class="fas fa-hourglass-start fa-2x mb-2 d-block"></i>Cola vacía</div>`;
|
||||
return;
|
||||
}
|
||||
lista.innerHTML = espera.map(t => `
|
||||
lista.innerHTML = visibles.map(t => `
|
||||
<div class="cola-card ${turnoActivo?.id === t.id ? 'activo' : ''}" data-id="${t.id}">
|
||||
<div class="prio-dot" style="background:${t.prioridad_color};cursor:pointer" onclick="seleccionarTurno(${t.id})">${t.prioridad_codigo}</div>
|
||||
<div class="turno-info" style="cursor:pointer" onclick="seleccionarTurno(${t.id})">
|
||||
@@ -513,10 +518,10 @@ function renderCola(snap) {
|
||||
<div class="pac">${escHtml(t.paciente_nombre || 'Sin nombre')}</div>
|
||||
</div>
|
||||
<button onclick="llamarTurnoEspecifico(${t.id}, '${t.estado}')"
|
||||
title="Llamar este turno ahora"
|
||||
title="${t.estado === 'en_recepcion' ? 'Re-llamar este turno' : 'Llamar este turno ahora'}"
|
||||
style="flex-shrink:0;background:#2563eb;border:none;color:#fff;
|
||||
border-radius:7px;padding:5px 9px;font-size:.78rem;cursor:pointer">
|
||||
<i class="fas fa-bell"></i>
|
||||
<i class="fas ${t.estado === 'en_recepcion' ? 'fa-volume-up' : 'fa-bell'}"></i>
|
||||
</button>
|
||||
</div>`).join('');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user