Update lugar.php
This commit is contained in:
@@ -145,27 +145,7 @@ $adminNombre = $_SESSION['admin_user']['full_name'] ?? $_SESSION['admin_user']['
|
||||
}
|
||||
|
||||
/* ── Modal de firma ── */
|
||||
.modal-firma-backdrop {
|
||||
position: fixed; inset: 0; background: rgba(0,0,0,.55);
|
||||
z-index: 1050; display: none; align-items: center; justify-content: center;
|
||||
}
|
||||
.modal-firma-backdrop.open { display: flex; }
|
||||
.modal-firma-box {
|
||||
background: #fff; border-radius: 16px;
|
||||
width: min(96vw, 800px); height: min(90vh, 700px);
|
||||
display: flex; flex-direction: column;
|
||||
overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35);
|
||||
}
|
||||
.modal-firma-hdr {
|
||||
padding: .75rem 1rem; border-bottom: 1px solid #e2e8f0;
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.modal-firma-box iframe {
|
||||
flex: 1; border: none; width: 100%;
|
||||
}
|
||||
|
||||
/* ── Selector de lugar (pantalla inicial) ── */
|
||||
/* ── Selector de lugar (pantalla inicial) ── */
|
||||
.selector-lugar-overlay {
|
||||
position: fixed; inset: 0; background: #f1f5f9;
|
||||
z-index: 200; display: flex; align-items: center; justify-content: center;
|
||||
@@ -359,18 +339,6 @@ require_once __DIR__ . '/../../../shared/components/sidebar.php';
|
||||
</div><!-- /lugar-layout -->
|
||||
</main>
|
||||
|
||||
<!-- ══ Modal de firma presencial ══════════════════════════════ -->
|
||||
<div class="modal-firma-backdrop" id="modal-firma">
|
||||
<div class="modal-firma-box">
|
||||
<div class="modal-firma-hdr">
|
||||
<strong id="modal-firma-titulo">Firmar consentimiento</strong>
|
||||
<button class="btn btn-sm btn-outline-secondary" onclick="cerrarModalFirma()">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
<iframe id="firma-iframe" src="" title="Formulario de consentimiento"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// ── Estado global ─────────────────────────────────────────────
|
||||
@@ -716,11 +684,6 @@ async function reenviarConsentimiento(turnoId) {
|
||||
|
||||
// ── Modal de firma presencial ─────────────────────────────────
|
||||
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');
|
||||
window._firmaConsentId = consentId;
|
||||
|
||||
try {
|
||||
const res = await fetch(API + 'crear_envio_presencial.php', {
|
||||
method: 'POST',
|
||||
@@ -729,35 +692,12 @@ async function abrirFirmaPresencial(token, consentId, nombreForm) {
|
||||
});
|
||||
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);
|
||||
window.open(BASE_WA + 'form_cliente.php?t=' + encodeURIComponent(json.form_token), '_blank');
|
||||
} catch (err) {
|
||||
document.getElementById('modal-firma-titulo').textContent = 'Error';
|
||||
document.getElementById('firma-iframe').src = '';
|
||||
alert('No se pudo cargar el formulario: ' + err.message);
|
||||
cerrarModalFirma();
|
||||
alert('No se pudo abrir el formulario: ' + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
function cerrarModalFirma() {
|
||||
document.getElementById('modal-firma').classList.remove('open');
|
||||
document.getElementById('firma-iframe').src = '';
|
||||
if (turnoActivo) actualizarConsentimientos(turnoActivo.id);
|
||||
}
|
||||
|
||||
// Cerrar modal al hacer clic fuera del cuadro
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.getElementById('modal-firma').addEventListener('click', function(e) {
|
||||
if (e.target === this) cerrarModalFirma();
|
||||
});
|
||||
|
||||
// Escuchar mensaje del iframe (firma completada desde ver_formulario_enviado.php)
|
||||
window.addEventListener('message', function(e) {
|
||||
if (e.data && e.data.type === 'turneroFirmado') {
|
||||
cerrarModalFirma();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ── Acciones del turno ────────────────────────────────────────
|
||||
async function iniciarAtencion() {
|
||||
|
||||
Reference in New Issue
Block a user