This commit is contained in:
Lizandro Guarnizo
2026-06-16 16:55:22 -05:00
parent a4a062095e
commit ff8454fa5a
5 changed files with 160 additions and 7 deletions
+20 -6
View File
@@ -715,14 +715,28 @@ async function reenviarConsentimiento(turnoId) {
}
// ── Modal de firma presencial ─────────────────────────────────
function abrirFirmaPresencial(token, consentId, nombreForm) {
const url = BASE_WA + 'ver_formulario_enviado.php?token=' + encodeURIComponent(token);
document.getElementById('modal-firma-titulo').textContent = 'Firmar: ' + nombreForm;
document.getElementById('firma-iframe').src = url;
async function abrirFirmaPresencial(token, consentId, nombreForm) {
document.getElementById('modal-firma-titulo').textContent = 'Cargando…';
document.getElementById('firma-iframe').src = '';
document.getElementById('modal-firma').classList.add('open');
// Al cerrar, refrescar consentimientos
window._firmaConsentId = consentId;
try {
const res = await fetch(API + 'crear_envio_presencial.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ consent_token: token }),
});
const json = await res.json();
if (!json.ok || !json.form_token) throw new Error(json.error || 'Error al crear envío');
document.getElementById('modal-firma-titulo').textContent = 'Firmar: ' + nombreForm;
document.getElementById('firma-iframe').src = BASE_WA + 'form_cliente.php?t=' + encodeURIComponent(json.form_token);
} catch (err) {
document.getElementById('modal-firma-titulo').textContent = 'Error';
document.getElementById('firma-iframe').src = '';
alert('No se pudo cargar el formulario: ' + err.message);
cerrarModalFirma();
}
}
function cerrarModalFirma() {