fix: onLugarChange no longer hides desk consents
The sel-lugar dropdown is only for selecting the patient's next destination. Desk consents are loaded by cargarConsentimientosDesk() on turno open and must not be affected by destination lugar changes. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
d8a6581fe5
commit
9872f50104
@@ -471,40 +471,9 @@ async function refrescarConsentimientosLugar() {
|
||||
} catch (_) {}
|
||||
}
|
||||
// ── Formularios del lugar (aparecen al seleccionar lugar) ────
|
||||
async function onLugarChange() {
|
||||
const sec = document.getElementById('sec-consentimientos');
|
||||
const lista = document.getElementById('lista-consentimientos');
|
||||
const lugarId = parseInt(document.getElementById('sel-lugar').value);
|
||||
if (!lugarId) { sec.style.display = 'none'; return; }
|
||||
|
||||
try {
|
||||
const res = await fetch(`${API}get_lugar_formularios.php?lugar_id=${lugarId}`);
|
||||
const json = await res.json();
|
||||
if (!json.ok || !json.formularios?.length) {
|
||||
sec.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
lista.innerHTML = json.formularios.map(f => {
|
||||
const nom = escHtml(f.nombre);
|
||||
const disabled = !turnoActivo ? 'disabled title="Llama el turno primero"' : '';
|
||||
return `<div class="consent-item pendiente">
|
||||
<i class="fas fa-file-signature"></i>
|
||||
<span class="c-nom">${nom}</span>
|
||||
<div class="consent-acciones">
|
||||
<button class="btn btn-outline-primary" ${disabled}
|
||||
onclick="abrirFormularioLugar(${f.id}, '${nom.replace(/'/g, "\\'")}')"
|
||||
title="Abrir formulario en nueva pestaña">
|
||||
<i class="fas fa-external-link-alt"></i> Firmar
|
||||
</button>
|
||||
</div>
|
||||
</div>`;
|
||||
}).join('');
|
||||
sec.style.display = '';
|
||||
} catch (_) {
|
||||
sec.style.display = 'none';
|
||||
}
|
||||
}
|
||||
// El dropdown sel-lugar es solo para elegir destino del paciente.
|
||||
// Los consentimientos del desk se cargan via cargarConsentimientosDesk() y no dependen de este cambio.
|
||||
function onLugarChange() {}
|
||||
async function abrirFormularioLugar(formularioId, nombre) {
|
||||
if (!turnoActivo) { mostrarError('Llama un turno primero.'); return; }
|
||||
if (!pacienteActivo) { mostrarError('Vincula el paciente antes de abrir el consentimiento.'); return; }
|
||||
|
||||
Reference in New Issue
Block a user