fix: banner toma no se cierra al abrir directamente por 'Siguiente toma'
El banner de alerta solo se cerraba vía 'Ver paciente'. Si el profesional hacía clic en 'Siguiente toma' directamente, el banner seguía parpadeando y sonando aunque el formulario ya estuviera abierto. - abrirTomaProgresiva() ahora llama cerrarBannerToma() + _tomaAlertados.delete() - renderConsentimientos() preserva alertado:true si la siguiente_toma_at no cambió, evitando beep doble al re-sincronizar después de firmar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
d1ac82886d
commit
7a4413e173
@@ -1363,13 +1363,18 @@ function renderConsentimientos(lista) {
|
||||
sinEl.classList.add('d-none');
|
||||
banner.classList.toggle('d-none', !hayPendientes);
|
||||
|
||||
// Actualizar mapa de timers para tomas progresivas
|
||||
// Actualizar mapa de timers para tomas progresivas (preservar alertado si ya sonó)
|
||||
const _prevTimers = _tomaTimers;
|
||||
_tomaTimers = {};
|
||||
lista.forEach(c => {
|
||||
if (c.es_toma_progresiva && c.estado === 'en_progreso') {
|
||||
const prev = _prevTimers[c.id];
|
||||
const newAt = c.siguiente_toma_at ? new Date(c.siguiente_toma_at.replace(' ', 'T')).getTime() : null;
|
||||
// Si la siguiente_toma_at cambió (firmó una toma), resetear alertado para el nuevo tiempo
|
||||
const sameTime = prev && prev.siguiente_toma_at === newAt;
|
||||
_tomaTimers[c.id] = {
|
||||
siguiente_toma_at: c.siguiente_toma_at ? new Date(c.siguiente_toma_at.replace(' ', 'T')).getTime() : null,
|
||||
alertado: false,
|
||||
siguiente_toma_at: newAt,
|
||||
alertado: sameTime ? (prev.alertado || false) : false,
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -1497,6 +1502,8 @@ function abrirModalConsentimientoPorToken(token) {
|
||||
|
||||
// ── Toma progresiva: abre el modal con modo especial ──────────
|
||||
function abrirTomaProgresiva(token, turnoId, formularioId) {
|
||||
cerrarBannerToma();
|
||||
_tomaAlertados.delete(turnoId);
|
||||
const modal = document.getElementById('modal-consentimiento');
|
||||
const iframe = document.getElementById('modal-consent-iframe');
|
||||
const load = document.getElementById('modal-consent-loading');
|
||||
|
||||
Reference in New Issue
Block a user