From 9df5f19c08da0a7da989bda05589059dfb35ea3b Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Thu, 16 Jul 2026 20:09:58 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20b=C3=BAsqueda=20de=20paciente=20en=20ti?= =?UTF-8?q?empo=20real=20+=20Enter=20selecciona=20el=20primero?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Búsqueda automática con debounce 300ms al escribir (sin necesidad de lupa) - Enter: si ya hay resultados selecciona el primero, si no dispara la búsqueda Co-Authored-By: Claude Sonnet 4.6 --- modules/turnero/views/recepcion.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/turnero/views/recepcion.php b/modules/turnero/views/recepcion.php index 2d4f79d..c5eb0af 100644 --- a/modules/turnero/views/recepcion.php +++ b/modules/turnero/views/recepcion.php @@ -1107,8 +1107,19 @@ document.addEventListener('DOMContentLoaded', () => { cargarCola(); pollingColaId = setInterval(cargarCola, 3000); - document.getElementById('inp-buscar-pac') - .addEventListener('keydown', e => { if (e.key === 'Enter') buscarPaciente(); }); + let _pacBusqTimer; + const _inpPac = document.getElementById('inp-buscar-pac'); + _inpPac.addEventListener('input', () => { + clearTimeout(_pacBusqTimer); + _pacBusqTimer = setTimeout(buscarPaciente, 300); + }); + _inpPac.addEventListener('keydown', e => { + if (e.key !== 'Enter') return; + e.preventDefault(); + const first = document.querySelector('#lista-pacientes-res .pac-resultado'); + if (first) { first.click(); return; } + buscarPaciente(); + }); document.getElementById('sel-lugar') .addEventListener('change', onLugarChange); document.addEventListener('visibilitychange', () => {