fix: botones Descargar PDF y Cerrar tras firmar consentimiento
Después de firmar (y en carga cuando ya está firmado) no había ninguna acción disponible — solo texto "Puede cerrar esta ventana" sin botón. Ahora aparecen dos botones: - Descargar PDF → window.print() (permite guardar como PDF) - Cerrar → window.close() (solo cuando no está en iframe) En modo embebido (iframe desde lugar.php) solo aparece Descargar PDF; el cierre lo maneja el postMessage ya existente al padre. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
99bfaa4c2f
commit
794db4f0d5
@@ -852,11 +852,19 @@ function esc2(mixed $v): string {
|
|||||||
<div class="turnero-msg mt-2 small"></div>
|
<div class="turnero-msg mt-2 small"></div>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($modoTurnero && $envio['estado'] === 'firmado'): ?>
|
<?php elseif ($modoTurnero && $envio['estado'] === 'firmado'): ?>
|
||||||
<div class="alert alert-success mt-4 d-flex align-items-center gap-2 no-print">
|
<div class="alert alert-success mt-4 d-flex align-items-start gap-3 no-print">
|
||||||
<i class="fas fa-check-circle fs-4"></i>
|
<i class="fas fa-check-circle fs-4 flex-shrink-0 mt-1"></i>
|
||||||
<div>
|
<div>
|
||||||
<strong>Consentimiento firmado</strong><br>
|
<strong>Consentimiento firmado</strong><br>
|
||||||
Puede cerrar esta ventana. El personal de salud ha sido notificado.
|
<span class="text-success-emphasis">El personal de salud ha sido notificado.</span>
|
||||||
|
<div class="mt-2 d-flex gap-2 flex-wrap">
|
||||||
|
<button onclick="window.print()" class="btn btn-warning btn-sm fw-semibold">
|
||||||
|
<i class="fas fa-file-pdf me-1"></i>Descargar PDF
|
||||||
|
</button>
|
||||||
|
<button onclick="window.close()" class="btn btn-outline-secondary btn-sm fw-semibold">
|
||||||
|
<i class="fas fa-times me-1"></i>Cerrar ventana
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -1103,8 +1111,17 @@ document.querySelectorAll('.turnero-firma-item').forEach(function(widget) {
|
|||||||
w.style.display = 'none';
|
w.style.display = 'none';
|
||||||
});
|
});
|
||||||
var ok = document.createElement('div');
|
var ok = document.createElement('div');
|
||||||
ok.className = 'alert alert-success mt-4 d-flex align-items-center gap-2 no-print';
|
ok.className = 'alert alert-success mt-4 d-flex align-items-start gap-3 no-print';
|
||||||
ok.innerHTML = '<i class="fas fa-check-circle fs-4"></i><div><strong>Firmado correctamente.</strong><br>Puede cerrar esta ventana.</div>';
|
var _enIframe = (function(){ try { return window.self !== window.top; } catch(e){ return true; } })();
|
||||||
|
ok.innerHTML = '<i class="fas fa-check-circle fs-4 flex-shrink-0 mt-1"></i>'
|
||||||
|
+ '<div><strong>Firmado correctamente.</strong><br>'
|
||||||
|
+ '<span>El personal de salud ha sido notificado.</span>'
|
||||||
|
+ '<div class="mt-2 d-flex gap-2 flex-wrap">'
|
||||||
|
+ '<button onclick="window.print()" class="btn btn-warning btn-sm fw-semibold">'
|
||||||
|
+ '<i class=\"fas fa-file-pdf me-1\"></i>Descargar PDF</button>'
|
||||||
|
+ (!_enIframe ? '<button onclick="window.close()" class="btn btn-outline-secondary btn-sm fw-semibold">'
|
||||||
|
+ '<i class=\"fas fa-times me-1\"></i>Cerrar</button>' : '')
|
||||||
|
+ '</div></div>';
|
||||||
widget.parentNode.insertBefore(ok, widget.nextSibling);
|
widget.parentNode.insertBefore(ok, widget.nextSibling);
|
||||||
try { window.parent.postMessage({ type: 'turneroFirmado' }, '*'); } catch(e) {}
|
try { window.parent.postMessage({ type: 'turneroFirmado' }, '*'); } catch(e) {}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user