From 05c7230eda94d220e6827c4d91c0d61c613a64ac Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:47:29 -0500 Subject: [PATCH] fix(formularios): pre-fill fecha_hoy and edad in ver_formulario_enviado MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Modo editar: fecha_hoy → type=date prefilled with today; edad → type=number prefilled from paciente.fecha_nacimiento - Modo vista: if no saved value, fecha_hoy shows today's date; edad calculates from DOB instead of skipping Co-Authored-By: Claude Sonnet 4.6 --- ver_formulario_enviado.php | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/ver_formulario_enviado.php b/ver_formulario_enviado.php index 086f392..c6c206e 100644 --- a/ver_formulario_enviado.php +++ b/ver_formulario_enviado.php @@ -642,15 +642,31 @@ function esc2(mixed $v): string { diff($bday)->y; + } + } + // texto, numero, fecha, hora, y calculados → input $inputType = match($tipo) { - 'numero' => 'number', 'fecha' => 'date', 'hora' => 'time', default => 'text' + 'numero', 'edad' => 'number', + 'fecha', 'fecha_hoy' => 'date', + 'hora' => 'time', + default => 'text' }; ?>
> + name="" value="" + >
diff(new DateTime($fnac))->y; + } + } } else { $valor = $todos[$cid] ?? null; }