Tomas: panel de ciclos dinámico activado al seleccionar tipo de examen

- Panel ya no se renderiza server-side, sino que JS lo muestra al instante
  cuando el usuario selecciona un tipo de examen del selector _c8j2g16
- _mpGetGroupsForExam() filtra los grupos correspondientes al examen elegido
- Si solo hay 1 toma por grupo, auto-guarda sin mostrar panel
- Si al cargar ya hay examen seleccionado y sin _tomas_config, muestra panel
- configurar_tomas.php: guarda también _c8j2g16 (exam_type) en datos_respuestas

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-10 11:19:55 -05:00
co-authored by Claude Sonnet 4.6
parent f0fb0c7492
commit da2b67589e
2 changed files with 120 additions and 110 deletions
+5 -3
View File
@@ -11,9 +11,10 @@
require_once __DIR__ . '/_helpers.php';
requireMethod('POST');
$body = inputJson();
$token = trim($body['token'] ?? '');
$cfg = $body['tomas_config'] ?? null;
$body = inputJson();
$token = trim($body['token'] ?? '');
$cfg = $body['tomas_config'] ?? null;
$examType = trim($body['exam_type'] ?? '');
if (!$token) jsonError('token requerido.');
if (!is_array($cfg) || empty($cfg)) jsonError('tomas_config requerido.');
@@ -40,6 +41,7 @@ if ($tc['datos_respuestas']) {
}
$dr['_tomas_config'] = $cfg;
if ($examType !== '') $dr['_c8j2g16'] = $examType;
$pdo->prepare("UPDATE turnero_consentimientos SET datos_respuestas = ? WHERE id = ?")
->execute([json_encode($dr, JSON_UNESCAPED_UNICODE), $tc['id']]);