From 53b483d51a304511e0b1d534b92e4ebcdfede710 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Sat, 4 Jul 2026 13:46:32 -0500 Subject: [PATCH] =?UTF-8?q?feat(turnero):=20UX=20audit=20improvements=20?= =?UTF-8?q?=E2=80=94=20lugar=20&=20recepcion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lugar.php: - Bell button enlarged to 44×44px touch target - Fecha nac. / Celular fields hidden from bacteriologist ficha - Cancel button added to station-selector overlay; shows only when changing - ESC key closes overlay when a station is already selected - visibilitychange pauses polling when tab hidden, resumes on return recepcion.php: - Consent action buttons: padding 2px 8px → 5px 12px, font-size .72→.82rem - Exam list: per-category select-all checkbox with indeterminate state support - guardarSolicitud: auto-calls pasarALugar() when no consents required - abrirModalPaciente: nome field auto-focused for both new and edit cases Co-Authored-By: Claude Sonnet 4.6 --- modules/turnero/views/lugar.php | 32 ++++++++++++++--- modules/turnero/views/recepcion.php | 53 ++++++++++++++++++++++------- 2 files changed, 69 insertions(+), 16 deletions(-) diff --git a/modules/turnero/views/lugar.php b/modules/turnero/views/lugar.php index e54670b..6173c4a 100644 --- a/modules/turnero/views/lugar.php +++ b/modules/turnero/views/lugar.php @@ -148,9 +148,9 @@ $adminNombre = $_SESSION['admin_user']['full_name'] ?? $_SESSION['admin_user'][' .card-bell-btn { flex-shrink: 0; background: #2563eb; border: none; color: #fff; - border-radius: 8px; width: 34px; height: 34px; + border-radius: 10px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; - font-size: .82rem; cursor: pointer; transition: background .12s; + font-size: .95rem; cursor: pointer; transition: background .12s; } .card-bell-btn:hover { background: #1d4ed8; } @@ -411,6 +411,11 @@ require_once __DIR__ . '/../../../shared/components/sidebar.php'; + @@ -510,8 +515,8 @@ require_once __DIR__ . '/../../../shared/components/sidebar.php';
Nombre
Documento
-
Fecha nac.
-
Celular
+
Fecha nac.
+
Celular
Paciente embarazada @@ -707,6 +712,24 @@ function iniciarPuesto() { recuperarTurnoActivo(); cargarCola(); pollingColaId = setInterval(cargarCola, 7000); + + document.addEventListener('visibilitychange', () => { + if (document.hidden) { + clearInterval(pollingColaId); + clearInterval(pollingConsentId); + pollingColaId = pollingConsentId = null; + } else if (lugarId) { + cargarCola(); + pollingColaId = setInterval(cargarCola, 7000); + } + }); + + document.addEventListener('keydown', e => { + if (e.key === 'Escape' && lugarId && + document.getElementById('overlay-selector').style.display !== 'none') { + document.getElementById('overlay-selector').style.display = 'none'; + } + }); } async function recuperarTurnoActivo() { @@ -735,6 +758,7 @@ function cambiarLugar() { clearInterval(pollingConsentId); turnoActivo = null; resetFicha(); + document.getElementById('btn-cancelar-selector').style.display = ''; document.getElementById('overlay-selector').style.display = 'flex'; } diff --git a/modules/turnero/views/recepcion.php b/modules/turnero/views/recepcion.php index 41ca4cf..b19a500 100644 --- a/modules/turnero/views/recepcion.php +++ b/modules/turnero/views/recepcion.php @@ -166,6 +166,8 @@ $adminNombre = $_SESSION['admin_user']['full_name'] ?? $_SESSION['admin_user'][' /* ── Checkboxes de exámenes ── */ .exam-group-title { font-size: .75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .08em; margin: .6rem 0 .3rem; } + .exam-cat-label { display: flex; align-items: center; gap: .35rem; cursor: pointer; } + .exam-cat-label input[type=checkbox] { cursor: pointer; } .exam-check-item { display: flex; align-items: center; gap: .5rem; padding: .3rem .4rem; border-radius: 6px; cursor: pointer; transition: background .1s; font-size: .88rem; } @@ -188,7 +190,7 @@ $adminNombre = $_SESSION['admin_user']['full_name'] ?? $_SESSION['admin_user'][' .consent-item .c-badge { font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; opacity: .85; } .consent-acciones { display: flex; gap: .3rem; flex-shrink: 0; } - .consent-acciones .btn { font-size: .72rem; padding: 2px 8px; border-radius: 7px; } + .consent-acciones .btn { font-size: .82rem; padding: 5px 12px; border-radius: 7px; } .consent-prof-row { display:flex; align-items:center; gap:.4rem; font-size:.75rem; margin-top:.25rem; padding-top:.25rem; border-top:1px solid rgba(0,0,0,.07); } .consent-prof-row .badge { font-size:.65rem; } @@ -576,12 +578,21 @@ document.addEventListener('DOMContentLoaded', function() {
$items): ?> -
+
+ +
@@ -1452,17 +1463,17 @@ async function guardarSolicitud() { pollingConsentimientosId = null; } - // No mostrar consentimientos post-guardado aquí (ya vienen de create_solicitud) - // Solo renderizar si vienen nuevos if (consentimientos && consentimientos.length > 0) { renderConsentimientos(consentimientos); document.getElementById('sec-consentimientos').style.display = ''; document.getElementById('btn-enviar-consent').classList.remove('d-none'); + document.getElementById('btn-pasar-lugar').classList.remove('d-none'); + document.getElementById('btn-guardar').classList.add('d-none'); + } else { + // Sin consentimientos → pasar directamente al lugar + await pasarALugar(); } - document.getElementById('btn-pasar-lugar').classList.remove('d-none'); - document.getElementById('btn-guardar').classList.add('d-none'); - } catch (err) { mostrarError(err.message); btn.disabled = false; @@ -1701,7 +1712,7 @@ async function pasarALugar() { if (!turnoActivo || !solicitudActiva) return; const btn = document.getElementById('btn-pasar-lugar'); - btn.disabled = true; + if (btn) btn.disabled = true; try { const res = await fetch(API + 'cambiar_estado.php', { @@ -1714,7 +1725,7 @@ async function pasarALugar() { }), }); const json = await res.json(); - if (!json.ok) { mostrarError(json.error); btn.disabled = false; return; } + if (!json.ok) { mostrarError(json.error); if (btn) btn.disabled = false; return; } // Reiniciar ficha turnoActivo = null; @@ -1731,7 +1742,7 @@ async function pasarALugar() { } catch (err) { mostrarError(err.message); - btn.disabled = false; + if (btn) btn.disabled = false; } } @@ -1860,6 +1871,24 @@ function filtrarExamenes(q) { } function toggleTodosExamenes(val) { document.querySelectorAll('.exam-chk').forEach(c => c.checked = val); + document.querySelectorAll('.exam-cat-chk').forEach(c => c.checked = val); +} + +function toggleCategoria(chk) { + const cat = chk.dataset.cat; + document.querySelectorAll(`.exam-chk[data-cat="${CSS.escape(cat)}"]`).forEach(c => { + if (c.closest('.exam-check-item')?.style.display !== 'none') c.checked = chk.checked; + }); +} + +function actualizarCatChk(cat) { + const catChk = document.querySelector(`.exam-cat-chk[data-cat="${CSS.escape(cat)}"]`); + if (!catChk) return; + const items = Array.from(document.querySelectorAll(`.exam-chk[data-cat="${CSS.escape(cat)}"]`)) + .filter(c => c.closest('.exam-check-item')?.style.display !== 'none'); + const checked = items.filter(c => c.checked).length; + catChk.checked = checked === items.length && items.length > 0; + catChk.indeterminate = checked > 0 && checked < items.length; } function escHtml(str) { @@ -2114,8 +2143,8 @@ async function abrirModalPaciente(id, nombrePrefill) { mpacAvatar(nombrePrefill); } _mpacModal().show(); - setTimeout(() => document.getElementById('mpac-nombre').focus(), 300); } + setTimeout(() => document.getElementById('mpac-nombre').focus(), 300); } function mpacRellenar(p) {