From 182dc01a77bfcaa2cdad58116421dd645603538e Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Thu, 16 Jul 2026 10:25:12 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20restaurar=20selecci=C3=B3n=20de=20examen?= =?UTF-8?q?=20tras=20reload=20del=20panel=20de=20config=20de=20tomas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tras guardar la config de tomas (_mpGuardarConfig), location.reload() borraba el checkbox seleccionado → _mpApplyExamVisibility(null) ocultaba toda la UI. Ahora se guarda el examen en sessionStorage antes del reload y se restaura en DOMContentLoaded, reactivando la visibilidad de firmas y tiempos. Co-Authored-By: Claude Sonnet 4.6 --- ver_formulario_enviado.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ver_formulario_enviado.php b/ver_formulario_enviado.php index 5e937a3..c1e462f 100644 --- a/ver_formulario_enviado.php +++ b/ver_formulario_enviado.php @@ -1244,7 +1244,10 @@ function _mpGuardarConfig(config, examType, onOk, onErr) { body: JSON.stringify({ token: _mpCfgToken, tomas_config: config, exam_type: examType }) }) .then(function(r) { return r.json(); }) - .then(function(d) { d.ok ? onOk() : onErr(d.error || 'Error desconocido'); }) + .then(function(d) { + if (d.ok) { try { sessionStorage.setItem('_mpExamRestore', examType || ''); } catch(e) {} onOk(); } + else onErr(d.error || 'Error desconocido'); + }) .catch(function() { onErr('Error de conexión.'); }); } @@ -1348,7 +1351,19 @@ document.addEventListener('change', function(e) { document.addEventListener('DOMContentLoaded', function() { var radio = document.querySelector('[name="_c8j2g16"]:checked'); var examName = radio ? radio.value : null; - _mpApplyExamVisibility(examName); // null → oculta todas las secciones de tomas + // Restaurar selección de examen tras el reload del panel de config + if (!examName) { + try { + var saved = sessionStorage.getItem('_mpExamRestore'); + if (saved) { + sessionStorage.removeItem('_mpExamRestore'); + examName = saved; + var el = document.querySelector('[name="_c8j2g16"][value="' + saved.replace(/"/g, '\\"') + '"]'); + if (el) el.checked = true; + } + } catch(e) {} + } + _mpApplyExamVisibility(examName); if (!_mpModoTurnero || _mpTomasConfig !== null || !examName) return; var groups = _mpGetGroupsForExam(examName); if (Object.keys(groups).length) _mpShowCfgPanel(examName, groups);