fix: show all signature fields in print, canvas only once
- All firma/firma_profesional positions render with shared signature image - Canvas widget for nurse appears only once (no duplicate inputs) - Signed image replicates to every position of the same type Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
d7b1aea5a4
commit
275170f9d5
@@ -455,14 +455,13 @@ function esc2(mixed $v): string {
|
|||||||
$fColor = $isPro ? '#198754' : '#1565c0';
|
$fColor = $isPro ? '#198754' : '#1565c0';
|
||||||
$fLabel = htmlspecialchars($campo['label'] ?? ($isPro ? 'Firma profesional' : 'Firma paciente'));
|
$fLabel = htmlspecialchars($campo['label'] ?? ($isPro ? 'Firma profesional' : 'Firma paciente'));
|
||||||
|
|
||||||
// Si ya renderizamos la firma de este tipo, omitir duplicado
|
// Firma sin contenido: omitir (no hay nada que mostrar)
|
||||||
if (!$isPro && $_renderedFirmaPaciente) { continue; }
|
if (!$fSvg && !$fFoto && !$isPro) continue;
|
||||||
if ($isPro && $_renderedFirmaProfesional) { 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) $_renderedFirmaPaciente = true;
|
||||||
if ($isPro) $_renderedFirmaProfesional = true;
|
if ($isPro) $_renderedFirmaProfesional = true;
|
||||||
|
|
||||||
// Firma paciente sin contenido y sin widget turnero: omitir
|
|
||||||
if (!$isPro && !$fSvg && !$fFoto) continue;
|
|
||||||
?>
|
?>
|
||||||
<div class="section-title mt-3" style="color:<?= $fColor ?>">
|
<div class="section-title mt-3" style="color:<?= $fColor ?>">
|
||||||
<i class="fas <?= $fIcon ?> me-1"></i><?= $fLabel ?>
|
<i class="fas <?= $fIcon ?> me-1"></i><?= $fLabel ?>
|
||||||
@@ -476,8 +475,8 @@ function esc2(mixed $v): string {
|
|||||||
<img src="<?= htmlspecialchars($fFoto) ?>" alt="Foto - <?= $fLabel ?>">
|
<img src="<?= htmlspecialchars($fFoto) ?>" alt="Foto - <?= $fLabel ?>">
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($isPro): ?>
|
<?php elseif ($isPro): ?>
|
||||||
<?php if (!$modoPublico): ?>
|
<?php if (!$modoPublico && !$yaHayCanvasPro): ?>
|
||||||
<!-- Canvas para que el profesional firme (se replica en todos los campos firma_profesional) -->
|
<!-- Canvas del profesional: solo aparece una vez -->
|
||||||
<div class="firma-pro-widget no-print" id="fpw-<?= htmlspecialchars($cid) ?>"
|
<div class="firma-pro-widget no-print" id="fpw-<?= htmlspecialchars($cid) ?>"
|
||||||
data-envio="<?= (int)$envio['id'] ?>" data-campo="<?= htmlspecialchars($cid) ?>">
|
data-envio="<?= (int)$envio['id'] ?>" data-campo="<?= htmlspecialchars($cid) ?>">
|
||||||
<p class="text-muted small mb-2"><i class="fas fa-pen me-1"></i>Dibuje su firma en el recuadro:</p>
|
<p class="text-muted small mb-2"><i class="fas fa-pen me-1"></i>Dibuje su firma en el recuadro:</p>
|
||||||
@@ -488,12 +487,10 @@ function esc2(mixed $v): string {
|
|||||||
</div>
|
</div>
|
||||||
<div class="fpw-msg mt-2 small"></div>
|
<div class="fpw-msg mt-2 small"></div>
|
||||||
</div>
|
</div>
|
||||||
<?php else: ?>
|
<?php elseif ($modoPublico): ?>
|
||||||
<!-- Vista pública: el cliente no puede firmar como profesional -->
|
|
||||||
<div class="alert py-2 px-3 no-print" style="background:#fff8e1;border:1.5px dashed #f59e0b;border-radius:8px;color:#92400e;font-size:.85rem">
|
<div class="alert py-2 px-3 no-print" style="background:#fff8e1;border:1.5px dashed #f59e0b;border-radius:8px;color:#92400e;font-size:.85rem">
|
||||||
<i class="fas fa-hourglass-half me-2"></i>
|
<i class="fas fa-hourglass-half me-2"></i>
|
||||||
<strong>Pendiente de firma del profesional.</strong>
|
<strong>Pendiente de firma del profesional.</strong>
|
||||||
Esta sección será completada por el profesional de salud.
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user