Toma progresiva: auto-scroll, cierre automático, countdown en cola y fix filtro por examen
- guardar_toma.php: filtrar firmas por condición del examen seleccionado; corrige countdown espurio y detección de 'completado' cuando hay múltiples tipos de examen. También descarta siguiente_toma_at si ya es pasado (minuto 0). - ver_formulario_enviado.php: auto-scroll a primera firma pendiente al cargar el modal; si el examen se selecciona y la firma no está en DOM, guarda y recarga el iframe. Al completar tomas, cierra el modal directamente sin botón "Finalizar". - get_cola.php: incluye siguiente_toma_at y en_toma_progresiva por turno desde turnero_consentimientos para mostrar cuenta regresiva en tarjetas. - lugar.php: muestra chip de cuenta regresiva en tarjetas de cola para pacientes en toma progresiva; color cambia a warn (<2 min) y crit (¡Ahora!). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
c2605fb274
commit
848dd8e4d0
@@ -188,6 +188,16 @@ try {
|
||||
font-size: .6rem; font-weight: 700; color: #ea580c;
|
||||
background: #fff7ed; border-radius: 99px; padding: 0 6px; line-height: 1.7;
|
||||
}
|
||||
.toma-prog-chip {
|
||||
font-size: .6rem; font-weight: 700; border-radius: 99px;
|
||||
padding: 0 6px; line-height: 1.7; white-space: nowrap;
|
||||
}
|
||||
.toma-prog-chip.ok { background: #eff6ff; color: #1d4ed8; }
|
||||
.toma-prog-chip.warn { background: #fffbeb; color: #92400e; }
|
||||
.toma-prog-chip.crit { background: #fef2f2; color: #991b1b; animation: parpadeo-alerta 1s infinite; }
|
||||
@keyframes parpadeo-alerta { 0%,100%{opacity:1} 50%{opacity:.55} }
|
||||
.cola-card.toma-prog { border-color: #f97316 !important; }
|
||||
.cola-card.toma-prog.crit-card { border-color: #dc2626 !important; background: #fef2f2 !important; }
|
||||
|
||||
.card-en-servicio-pill {
|
||||
flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
|
||||
@@ -945,9 +955,11 @@ function renderCola(snap) {
|
||||
}
|
||||
|
||||
function renderColaCard(t) {
|
||||
const enServicio = t.estado === 'en_servicio';
|
||||
const esActivo = turnoActivo?.id == t.id;
|
||||
const esMuestra = t.solo_muestras == 1;
|
||||
const enServicio = t.estado === 'en_servicio';
|
||||
const esActivo = turnoActivo?.id == t.id;
|
||||
const esMuestra = t.solo_muestras == 1;
|
||||
const enTomaProg = t.en_toma_progresiva == 1;
|
||||
const sigTomaAt = t.siguiente_toma_at || null;
|
||||
|
||||
const tiempo = tiempoEspera(t.creado_at);
|
||||
const tiempoBadge = tiempo
|
||||
@@ -956,8 +968,13 @@ function renderColaCard(t) {
|
||||
const muestraBadge = esMuestra
|
||||
? `<span class="muestra-chip"><i class="fas fa-plus me-1"></i>MUESTRAS</span>`
|
||||
: '';
|
||||
const badgeRow = (tiempoBadge || muestraBadge)
|
||||
? `<div class="t-badge-row">${tiempoBadge}${muestraBadge}</div>`
|
||||
const tomaBadge = enTomaProg
|
||||
? `<span class="toma-prog-chip ok" data-toma-at="${escHtml(sigTomaAt || '')}" data-turno-id="${t.id}">
|
||||
<i class="fas fa-syringe me-1"></i><span class="toma-cd-txt">${sigTomaAt ? '...' : '¡Ahora!'}</span>
|
||||
</span>`
|
||||
: '';
|
||||
const badgeRow = (tiempoBadge || muestraBadge || tomaBadge)
|
||||
? `<div class="t-badge-row">${tiempoBadge}${muestraBadge}${tomaBadge}</div>`
|
||||
: '';
|
||||
|
||||
const rightEl = enServicio
|
||||
@@ -967,11 +984,12 @@ function renderColaCard(t) {
|
||||
<i class="fas fa-bell"></i>
|
||||
</button>`;
|
||||
|
||||
const bg = esMuestra ? 'border:2px solid #ea580c!important;background:#fff7ed!important' : '';
|
||||
const prioBg = esMuestra ? '#ea580c' : (t.prioridad_color || '#6366f1');
|
||||
let bg = esMuestra ? 'border:2px solid #ea580c!important;background:#fff7ed!important' : '';
|
||||
const prioBg = esMuestra ? '#ea580c' : (t.prioridad_color || '#6366f1');
|
||||
const prioLbl = esMuestra ? '<i class="fas fa-plus"></i>' : escHtml(t.prioridad_codigo || '?');
|
||||
const tomaClass = enTomaProg ? ' toma-prog' : '';
|
||||
|
||||
return `<div class="cola-card ${enServicio ? 'en-servicio-card' : ''} ${esActivo ? 'activo' : ''}"
|
||||
return `<div class="cola-card ${enServicio ? 'en-servicio-card' : ''} ${esActivo ? 'activo' : ''}${tomaClass}"
|
||||
style="${bg}" onclick="seleccionarSinLlamar(${t.id})">
|
||||
<div class="prio-dot" style="background:${prioBg}">${prioLbl}</div>
|
||||
<div class="turno-info">
|
||||
@@ -1180,6 +1198,28 @@ const CONSENT_LBL = {
|
||||
en_progreso:'En progreso',
|
||||
};
|
||||
|
||||
// ── Countdown en tarjetas de cola (toma progresiva) ──────────
|
||||
setInterval(function() {
|
||||
const ahora = Date.now();
|
||||
document.querySelectorAll('.toma-prog-chip[data-toma-at]').forEach(function(chip) {
|
||||
const at = chip.dataset.tomaAt;
|
||||
const txt = chip.querySelector('.toma-cd-txt');
|
||||
if (!at || !txt) return;
|
||||
const diff = Math.floor((new Date(at.replace(' ','T')).getTime() - ahora) / 1000);
|
||||
const card = chip.closest('.cola-card');
|
||||
if (diff <= 0) {
|
||||
txt.textContent = '¡Ahora!';
|
||||
chip.className = 'toma-prog-chip crit';
|
||||
if (card) card.classList.add('crit-card');
|
||||
} else {
|
||||
const m = Math.floor(diff / 60), s = diff % 60;
|
||||
txt.textContent = m + ':' + String(s).padStart(2,'0');
|
||||
chip.className = diff < 120 ? 'toma-prog-chip warn' : 'toma-prog-chip ok';
|
||||
if (card) card.classList.remove('crit-card');
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
// ── Tomas progresivas: actualiza countdowns cada segundo ──────
|
||||
let _tomaTimers = {}; // consent_id → { siguiente_toma_at, es_alerta }
|
||||
setInterval(() => {
|
||||
|
||||
Reference in New Issue
Block a user