up
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user