Update ver_formulario_enviado.php
This commit is contained in:
+15
-22
@@ -447,20 +447,12 @@ function esc2(mixed $v): string {
|
||||
<?php
|
||||
$paciente = $datosPrefilled['__paciente'] ?? [];
|
||||
|
||||
// ── Pre-computar firma compartida por tipo ──────────────────────────
|
||||
// Si el paciente firmó una vez (cualquier campo o via turnero widget),
|
||||
// esa firma se usa en TODOS los campos firma del mismo tipo.
|
||||
$firmaSharedPaciente = $envio['firma_svg'] ?? null; // turnero widget
|
||||
$firmaSharedProfesional = $envio['firma_profesional_svg'] ?? null; // turnero profesional
|
||||
foreach ($esquema as $_c) {
|
||||
$_t = $_c['tipo'] ?? '';
|
||||
$_id = $_c['id'] ?? null;
|
||||
if (!$_id) continue;
|
||||
if ($_t === 'firma' && !$firmaSharedPaciente) $firmaSharedPaciente = $datosCliente[$_id . '_svg'] ?? null;
|
||||
if ($_t === 'firma_profesional' && !$firmaSharedProfesional) $firmaSharedProfesional = $datosCliente[$_id . '_svg'] ?? null;
|
||||
}
|
||||
// Rastrear si ya renderizamos el widget de cada tipo para no duplicar el canvas
|
||||
$_renderedFirmaPaciente = false;
|
||||
// Firma global del profesional (un solo valor para todos los campos firma_profesional)
|
||||
$firmaSharedProfesional = $envio['firma_profesional_svg'] ?? null;
|
||||
// Firma global del paciente: fallback para cuando no hay datos_cliente por campo
|
||||
$firmaSharedPaciente = $envio['firma_svg'] ?? null;
|
||||
|
||||
// Rastrear campos profesional con canvas ya renderizado (para no duplicar)
|
||||
$_renderedFirmaProfesional = false;
|
||||
|
||||
foreach ($esquema as $campo):
|
||||
@@ -469,25 +461,26 @@ function esc2(mixed $v): string {
|
||||
<div class="esquema-sep"><?= esc2($campo['label'] ?? '') ?></div>
|
||||
<?php continue; endif;
|
||||
|
||||
// ── Firmas inline: se muestran en su posición dentro del esquema ──
|
||||
// ── Firmas inline: cada campo muestra su propia firma ──
|
||||
if ($tipo === 'firma' || $tipo === 'firma_profesional'):
|
||||
$cid = $campo['id'] ?? null;
|
||||
if (!$cid) continue;
|
||||
$isPro = ($tipo === 'firma_profesional');
|
||||
// Usar firma compartida del tipo correspondiente
|
||||
$fSvg = $isPro ? $firmaSharedProfesional : $firmaSharedPaciente;
|
||||
$isPro = ($tipo === 'firma_profesional');
|
||||
|
||||
// Cada campo busca su firma propia; solo si no existe usa el fallback global
|
||||
$fSvg = $isPro
|
||||
? $firmaSharedProfesional
|
||||
: ($datosCliente[$cid . '_svg'] ?? $firmaSharedPaciente ?? null);
|
||||
$fFoto = $datosCliente[$cid . '_foto'] ?? null;
|
||||
$fIcon = $isPro ? 'fa-user-md' : 'fa-signature';
|
||||
$fColor = $isPro ? '#198754' : '#1565c0';
|
||||
$fLabel = htmlspecialchars($campo['label'] ?? ($isPro ? 'Firma profesional' : 'Firma paciente'));
|
||||
|
||||
// Firma sin contenido: omitir (no hay nada que mostrar)
|
||||
// Campo paciente sin firma: omitir (no hay nada que mostrar)
|
||||
if (!$fSvg && !$fFoto && !$isPro) continue;
|
||||
|
||||
// Rastrear si este tipo ya tiene canvas activo (para no duplicar el widget de dibujo)
|
||||
$yaHayCanvasPro = $isPro && $_renderedFirmaProfesional;
|
||||
if (!$isPro) $_renderedFirmaPaciente = true;
|
||||
if ($isPro) $_renderedFirmaProfesional = true;
|
||||
if ($isPro) $_renderedFirmaProfesional = true;
|
||||
?>
|
||||
<div class="section-title mt-3" style="color:<?= $fColor ?>">
|
||||
<i class="fas <?= $fIcon ?> me-1"></i><?= $fLabel ?>
|
||||
|
||||
Reference in New Issue
Block a user