Update lugar.php
This commit is contained in:
@@ -304,7 +304,7 @@ require_once __DIR__ . '/../../../shared/components/sidebar.php';
|
||||
|
||||
<div id="bloqueo-banner" class="bloqueo-banner d-none">
|
||||
<i class="fas fa-lock"></i>
|
||||
<span>Hay consentimientos pendientes. No puede iniciar la atención hasta que estén <strong>firmados</strong> o <strong>rechazados</strong>.</span>
|
||||
<span>Hay consentimientos pendientes. No puede <strong>finalizar</strong> la atención hasta que estén <strong>firmados</strong> o <strong>rechazados</strong>.</span>
|
||||
</div>
|
||||
|
||||
<div id="lista-consent"></div>
|
||||
@@ -619,7 +619,9 @@ function renderConsentimientos(lista) {
|
||||
|
||||
sinEl.classList.add('d-none');
|
||||
banner.classList.toggle('d-none', !hayPendientes);
|
||||
btnIni.disabled = hayPendientes;
|
||||
btnIni.disabled = false;
|
||||
const btnFin = document.getElementById('btn-finalizar');
|
||||
if (btnFin) btnFin.disabled = hayPendientes;
|
||||
|
||||
listEl.innerHTML = lista.map(c => {
|
||||
const ya = ['firmado','rechazado'].includes(c.estado);
|
||||
@@ -702,13 +704,15 @@ async function abrirFirmaPresencial(token, consentId, nombreForm) {
|
||||
// ── Acciones del turno ────────────────────────────────────────
|
||||
async function iniciarAtencion() {
|
||||
if (!turnoActivo) return;
|
||||
if (hayPendientes) return;
|
||||
// Llamar via llamar_turno.php para que suene la campana y notifique el display
|
||||
await _llamar({ turno_id: turnoActivo.id });
|
||||
}
|
||||
|
||||
async function finalizarAtencion() {
|
||||
if (!turnoActivo) return;
|
||||
if (hayPendientes) {
|
||||
alert('Debe firmar todos los consentimientos antes de finalizar la atención.');
|
||||
return;
|
||||
}
|
||||
if (!confirm(`¿Finalizar atención del turno ${turnoActivo.codigo}?`)) return;
|
||||
|
||||
await cambiarEstadoTurno('finalizado');
|
||||
@@ -798,7 +802,7 @@ function actualizarEstadoBadge(estado) {
|
||||
const btnReg = document.getElementById('btn-regresar');
|
||||
const btnRellamar = document.getElementById('btn-rellamar');
|
||||
if (estado === 'en_espera_lugar') {
|
||||
btnIni.classList.remove('d-none'); btnIni.disabled = hayPendientes;
|
||||
btnIni.classList.remove('d-none'); btnIni.disabled = false;
|
||||
btnFin.classList.add('d-none');
|
||||
btnReg.classList.add('d-none');
|
||||
btnRellamar.classList.add('d-none');
|
||||
|
||||
Reference in New Issue
Block a user