feat: buscador de formularios en lab_formularios.php
- Input de búsqueda filtra tarjetas por nombre o tipo en tiempo real Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a6f6449707
commit
3b5c26214c
@@ -85,6 +85,13 @@ require_once __DIR__ . '/shared/components/sidebar.php';
|
||||
|
||||
<!-- ── LISTA ──────────────────────────────────────────────── -->
|
||||
<div id="panel-lista">
|
||||
<div class="mb-3">
|
||||
<div class="input-group input-group-sm" style="max-width:320px">
|
||||
<span class="input-group-text"><i class="fas fa-search"></i></span>
|
||||
<input type="text" id="inp-buscar-form" class="form-control"
|
||||
placeholder="Buscar formulario…" oninput="filtrarFormularios(this.value)" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-3" id="formularios-grid">
|
||||
<div class="col-12 text-center py-5 text-muted">
|
||||
<div class="spinner-border spinner-border-sm"></div> Cargando…
|
||||
@@ -393,6 +400,20 @@ async function cargarFormularios() {
|
||||
renderFormularios();
|
||||
}
|
||||
|
||||
function filtrarFormularios(q) {
|
||||
q = q.trim().toLowerCase();
|
||||
const grid = $('formularios-grid');
|
||||
if (!q) { renderFormularios(); return; }
|
||||
const filtrados = _formularios.filter(f =>
|
||||
(f.nombre || '').toLowerCase().includes(q) ||
|
||||
(f.tipo || '').toLowerCase().includes(q)
|
||||
);
|
||||
const orig = _formularios;
|
||||
_formularios = filtrados;
|
||||
renderFormularios();
|
||||
_formularios = orig;
|
||||
}
|
||||
|
||||
function renderFormularios() {
|
||||
const grid = $('formularios-grid');
|
||||
if (!_formularios.length) {
|
||||
|
||||
Reference in New Issue
Block a user