diff --git a/ver_formulario_enviado.php b/ver_formulario_enviado.php index a47e8fb..e2e4b83 100644 --- a/ver_formulario_enviado.php +++ b/ver_formulario_enviado.php @@ -2048,13 +2048,13 @@ function _guardarFirmaMP(widget, svg, msgEl, entry, campoId) { _mpRefreshCards(campoId, data.completado ? null : entry.next_firma_id); if (data.completado) { - // Toma completada: mostrar resumen de tomas y cerrar modal + // Toma completada: mostrar resumen 10 s y luego cerrar modal var cd = document.getElementById('mp-countdown'); if (cd) { clearInterval(cd._mpTick); cd.remove(); } - _mpMostrarResumen(entry.exam_type || 'Examen'); + _mpMostrarResumen(entry.exam_type || 'Examen', 10); setTimeout(function() { try { window.parent.postMessage({ type: 'turneroFirmado' }, '*'); } catch(e) {} - }, 2000); + }, 10000); } else if (data.siguiente_toma_at) { // Fix 2: pasar timestamp exacto; evita el redondeo de Math.round var targetMs = new Date(data.siguiente_toma_at.replace(' ', 'T')).getTime(); @@ -2169,8 +2169,9 @@ function _mpIniciarCountdown(targetMsOrMins, nextLabel, nextFirmaId) { }, 1000); } -function _mpMostrarResumen(examType) { +function _mpMostrarResumen(examType, segs) { if (document.getElementById('mp-resumen')) return; + segs = segs || 10; // Recopilar horas y resultados de las tomas visibles var rows = []; if (window._muestrasMap) { @@ -2199,8 +2200,24 @@ function _mpMostrarResumen(examType) { }).join('') + '' : ''; wrap.innerHTML = '
' + '
' + (examType || 'Examen') + ' completado.
' - + 'Todas las tomas registradas. Cerrando...
' + rowsHtml; + + 'Todas las tomas registradas. Cerrando en ' + segs + 's…' + + rowsHtml + + '
' + + '
'; document.querySelector('.doc-body').appendChild(wrap); + // Animar barra y cuenta regresiva + requestAnimationFrame(function() { requestAnimationFrame(function() { + var bar = document.getElementById('mp-resumen-bar'); + if (bar) bar.style.width = '0%'; + }); }); + var left = segs; + var tick = setInterval(function() { + left--; + var el = document.getElementById('mp-resumen-seg'); + if (el) el.textContent = left; + if (left <= 0) clearInterval(tick); + }, 1000); // Ocultar countdown si queda var cd = document.getElementById('mp-countdown'); if (cd) { clearInterval(cd._mpTick); cd.remove(); }