fix: error de conexión falso al firmar consentimiento turnero

Al mover el canvas al esquema se eliminó la variable widget del JS,
pero el success handler seguía haciendo widget.outerHTML → ReferenceError
→ caía al catch y mostraba error de conexión aunque la firma se guardó.

Fix: envolver el canvas en div#turneroFirmaWidget y restaurar widget
en el JS para que el reemplazo al éxito funcione correctamente.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-24 01:32:12 -05:00
co-authored by Claude Sonnet 4.6
parent 64f2e7c784
commit 59addca960
+3 -1
View File
@@ -510,7 +510,7 @@ function esc2(mixed $v): string {
<img src="<?= htmlspecialchars($fFoto) ?>" alt="Foto - <?= $fLabel ?>">
</div>
<?php elseif (!$isPro && $modoTurnero && $modoEditar): ?>
<!-- Canvas firma paciente en la posición del esquema -->
<div id="turneroFirmaWidget">
<p class="text-muted small mb-2"><i class="fas fa-pen me-1"></i>He leído el documento. Dibuje su firma:</p>
<canvas id="turneroCv" width="500" height="160"
style="border:2px solid #1565c0;border-radius:8px;background:#f0f4ff;
@@ -524,6 +524,7 @@ function esc2(mixed $v): string {
</button>
</div>
<div id="turneroMsg" class="mt-2 small"></div>
</div>
<?php elseif ($isPro): ?>
<?php if (!$modoTurnero && !$modoPublico && !$yaHayCanvasPro): ?>
<!-- Canvas del profesional: solo aparece una vez -->
@@ -890,6 +891,7 @@ function esc2(mixed $v): string {
/* ── Firma de consentimiento turnero ────────────────────────────────── */
(function () {
var canvas = document.getElementById('turneroCv');
var widget = document.getElementById('turneroFirmaWidget');
if (!canvas) return;
var ctx = canvas.getContext('2d');
var btnLimp = document.getElementById('turneroLimpiar');