ver_formulario: firmas inline en su posición original del esquema (no al final)

This commit is contained in:
Lizandro Guarnizo
2026-03-17 15:35:26 -05:00
parent d757bba23f
commit c0ed80d7d1
+29 -33
View File
@@ -276,8 +276,33 @@ function esc2(mixed $v): string {
if ($tipo === 'separador'): ?>
<div class="esquema-sep"><?= esc2($campo['label'] ?? '') ?></div>
<?php continue; endif;
if ($tipo === 'firma') continue;
if ($tipo === 'firma_profesional') continue;
// ── Firmas inline: se muestran en su posición dentro del esquema ──
if ($tipo === 'firma' || $tipo === 'firma_profesional'):
$cid = $campo['id'] ?? null;
if (!$cid) continue;
$fSvg = $datosCliente[$cid . '_svg'] ?? null;
$fFoto = $datosCliente[$cid . '_foto'] ?? null;
if (!$fSvg && !$fFoto) continue;
$isPro = ($tipo === 'firma_profesional');
$fIcon = $isPro ? 'fa-user-md' : 'fa-signature';
$fColor = $isPro ? '#198754' : '#1565c0';
$fLabel = htmlspecialchars($campo['label'] ?? ($isPro ? 'Firma profesional' : 'Firma paciente'));
?>
<div class="section-title mt-3" style="color:<?= $fColor ?>">
<i class="fas <?= $fIcon ?> me-1"></i><?= $fLabel ?>
</div>
<?php if ($fSvg): ?>
<div class="firma-box" style="border-color:<?= $fColor ?>">
<img src="<?= htmlspecialchars($fSvg) ?>" alt="<?= $fLabel ?>">
</div>
<?php endif; ?>
<?php if ($fFoto): ?>
<div class="firma-box mt-2" style="border-color:<?= $fColor ?>">
<img src="<?= htmlspecialchars($fFoto) ?>" alt="Foto - <?= $fLabel ?>">
</div>
<?php endif; ?>
<?php continue; endif;
// ── Parrafo estático ──────────────────────────────────
if ($tipo === 'parrafo'):
@@ -319,7 +344,7 @@ function esc2(mixed $v): string {
</div>
<?php endforeach; ?>
<!-- Firma digital (dibujo) -->
<!-- Firma digital global (dibujo) -->
<?php if ($envio['firma_svg']): ?>
<div class="section-title mt-4"><i class="fas fa-signature me-1"></i>Firma digital (dibujo)</div>
<div class="firma-box">
@@ -327,7 +352,7 @@ function esc2(mixed $v): string {
</div>
<?php endif; ?>
<!-- Firma foto -->
<!-- Firma foto global -->
<?php if (!empty($datosCliente['__firma_foto'])): ?>
<div class="section-title mt-4"><i class="fas fa-camera me-1"></i>Foto de firma / documento</div>
<div class="firma-box">
@@ -335,35 +360,6 @@ function esc2(mixed $v): string {
</div>
<?php endif; ?>
<!-- Firmas inline (firma_paciente y firma_profesional por campo) -->
<?php foreach ($esquema as $campo):
$tipo = $campo['tipo'] ?? '';
if ($tipo !== 'firma' && $tipo !== 'firma_profesional') continue;
$cid = $campo['id'] ?? null;
if (!$cid) continue;
$fSvg = $datosCliente[$cid . '_svg'] ?? null;
$fFoto = $datosCliente[$cid . '_foto'] ?? null;
if (!$fSvg && !$fFoto) continue;
$isPro = ($tipo === 'firma_profesional');
$icon = $isPro ? 'fa-user-md' : 'fa-signature';
$color = $isPro ? '#198754' : '#1565c0';
$titLabel = htmlspecialchars($campo['label'] ?? ($isPro ? 'Firma profesional' : 'Firma paciente'));
?>
<div class="section-title mt-4" style="color:<?= $color ?>">
<i class="fas <?= $icon ?> me-1"></i><?= $titLabel ?>
</div>
<?php if ($fSvg): ?>
<div class="firma-box" style="border-color:<?= $color ?>">
<img src="<?= htmlspecialchars($fSvg) ?>" alt="<?= $titLabel ?>">
</div>
<?php endif; ?>
<?php if ($fFoto): ?>
<div class="firma-box mt-2" style="border-color:<?= $color ?>">
<img src="<?= htmlspecialchars($fFoto) ?>" alt="Foto - <?= $titLabel ?>">
</div>
<?php endif; ?>
<?php endforeach; ?>
<!-- Info del envío -->
<div class="section-title mt-4"><i class="fas fa-clock me-1"></i>Información del envío</div>
<div class="campo-row">