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);