From 333e856f389689e64fcfa3e316e81ccff5478480 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 7 Jul 2026 22:53:16 -0500 Subject: [PATCH] =?UTF-8?q?feat(turnero):=20buscador=20y=20paginaci=C3=B3n?= =?UTF-8?q?=20en=20tab=20de=20examenes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Filtrado en tiempo real + paginación client-side (15 por página). Categorías vacías se ocultan automáticamente al buscar. Co-Authored-By: Claude Sonnet 4.6 --- modules/turnero/views/configuracion.php | 63 ++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/modules/turnero/views/configuracion.php b/modules/turnero/views/configuracion.php index 4d943eb..42c7425 100644 --- a/modules/turnero/views/configuracion.php +++ b/modules/turnero/views/configuracion.php @@ -466,7 +466,13 @@ $tab = $_GET['tab'] ?? 'lugares'; TAB 2 — EXÁMENES Y CONSENTIMIENTOS ════════════════════════════════════════ --> -

Tipos de examen y sus formularios de consentimiento

+
+

Tipos de examen y sus formularios de consentimiento

+
+ +
+
+
$items): ?>
@@ -513,6 +520,8 @@ $tab = $_GET['tab'] ?? 'lugares';
+
+

No hay tipos de examen configurados

@@ -1203,6 +1212,58 @@ async function eliminarExamen(id, nombre) { } catch (e) { toast('Error de conexión', 'error'); } } +// ───────────────────────────────────────────────────────────── +// BUSCADOR + PAGINADOR — Tab examenes +// ───────────────────────────────────────────────────────────── +(function () { + const PAGE = 15; + let page = 1, q = ''; + + function update() { + const lista = document.getElementById('exam-lista'); + if (!lista) return; + const rows = Array.from(lista.querySelectorAll('.item-row')); + const term = q.toLowerCase(); + const matched = rows.filter(r => r.textContent.toLowerCase().includes(term)); + + rows.forEach(r => r.hidden = true); + const start = (page - 1) * PAGE; + matched.slice(start, start + PAGE).forEach(r => r.hidden = false); + + // Ocultar categorías vacías + lista.querySelectorAll('.mb-3').forEach(cat => { + cat.hidden = Array.from(cat.querySelectorAll('.item-row')).every(r => r.hidden); + }); + + renderPager(matched.length); + } + + function renderPager(total) { + const el = document.getElementById('exam-pager'); + if (!el) return; + const pages = Math.ceil(total / PAGE); + if (pages <= 1) { el.innerHTML = total ? `${total} resultado${total!==1?'s':''}` : ''; return; } + const prev = ``; + const next = ``; + el.innerHTML = `
+ ${total} resultados +
+ ${prev} + Página ${page} de ${pages} + ${next} +
+
`; + } + + window.examPag = function (p) { page = p; update(); }; + + document.addEventListener('DOMContentLoaded', () => { + const inp = document.getElementById('exam-buscar'); + if (inp) inp.addEventListener('input', () => { q = inp.value; page = 1; update(); }); + update(); + }); +})(); + // ───────────────────────────────────────────────────────────── // TAB 3: PRIORIDADES // ─────────────────────────────────────────────────────────────