fix: nota obligatoria para completar domicilio es la ficha clínica

- Cambia condición: solo exige cache.clinica !== null (no notas libres)
- Abre directamente el formulario de ficha clínica al bloquear
- Actualiza mensaje del banner a 'Ficha clínica obligatoria'
This commit is contained in:
Lizandro Guarnizo
2026-04-02 11:34:03 -05:00
parent 6bf14cbb1b
commit f325eb5d9b
+4 -6
View File
@@ -714,20 +714,18 @@ const portal = {
cache = { clinica: null, libres: [] }; cache = { clinica: null, libres: [] };
} }
} }
const tieneNota = cache.clinica || cache.libres.length > 0; const tieneNota = cache.clinica !== null;
if (!tieneNota) { if (!tieneNota) {
// Abrir el sheet de notas para que registre una antes de completar // Abrir la ficha clínica directamente (es la nota obligatoria)
// Guardamos el intento para retomarlo al cerrar la nota
notasManager._pendingCompleteId = domId; notasManager._pendingCompleteId = domId;
// Mostrar aviso visual dentro del sheet notasManager.abrirFicha(domId);
notasManager.abrirLibre(domId, null);
// Colocar banner de advertencia en la parte superior del sheet // Colocar banner de advertencia en la parte superior del sheet
const inner = document.getElementById('nota-sheet-inner'); const inner = document.getElementById('nota-sheet-inner');
if (inner) { if (inner) {
const banner = document.createElement('div'); const banner = document.createElement('div');
banner.id = 'nota-required-banner'; banner.id = 'nota-required-banner';
banner.style.cssText = 'background:#fff3cd;border:1px solid #ffc107;border-radius:8px;padding:10px 12px;margin-bottom:12px;font-size:.82rem;color:#856404;'; banner.style.cssText = 'background:#fff3cd;border:1px solid #ffc107;border-radius:8px;padding:10px 12px;margin-bottom:12px;font-size:.82rem;color:#856404;';
banner.innerHTML = '<i class="fas fa-exclamation-triangle me-1"></i><strong>Nota obligatoria</strong> — Debes registrar al menos una nota antes de marcar este domicilio como completado.'; banner.innerHTML = '<i class="fas fa-exclamation-triangle me-1"></i><strong>Ficha clínica obligatoria</strong> — Debes completar la ficha clínica antes de marcar este domicilio como completado.';
inner.prepend(banner); inner.prepend(banner);
} }
return; return;