From e3216faaa585ecb35374378642c1ea9ab1c34072 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 29 Jul 2026 20:29:45 -0500 Subject: [PATCH] feat(bandeja): chips clickeables para muestras pend. y prog. en espera MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Chip "Muestras pend." y nuevo "Prog. en espera" son toggles de filtro - Se resaltan con borde al activarse; combinables entre sí y con el dropdown - API retorna muestras_pendientes (turnos con ≥1 muestra pendiente) y prolongadas_pendientes (toma progresiva en espera entre extracciones) Co-Authored-By: Claude Sonnet 4.6 --- modules/turnero/api/get_bandeja.php | 14 ++++++++------ modules/turnero/views/bandeja.php | 23 +++++++++++++++++++---- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/modules/turnero/api/get_bandeja.php b/modules/turnero/api/get_bandeja.php index 3136213..0cd2704 100644 --- a/modules/turnero/api/get_bandeja.php +++ b/modules/turnero/api/get_bandeja.php @@ -104,7 +104,7 @@ if ($desde && $hasta) { $stmt = $pdo->prepare(" SELECT t.id, t.codigo, t.paciente_nombre, t.estado, - t.inicio_lugar_at, t.fin_lugar_at, t.bandeja_visto_at, + t.inicio_lugar_at, t.fin_lugar_at, t.bandeja_visto_at, t.muestra_espera_at, ts.numero_orden, l.nombre AS lugar_nombre, GROUP_CONCAT(DISTINCT et.codigo ORDER BY et.codigo SEPARATOR ' ') AS examenes_txt, @@ -128,15 +128,17 @@ $todos = $stmt->fetchAll(PDO::FETCH_ASSOC); $pendientes = array_values(array_filter($todos, fn($t) => $t['bandeja_visto_at'] === null)); $vistos = array_values(array_filter($todos, fn($t) => $t['bandeja_visto_at'] !== null)); -$muestrasPendientes = array_sum(array_column($todos, 'muestras_pendientes')); +$muestrasPendientes = count(array_filter($todos, fn($t) => (int)$t['muestras_pendientes'] > 0)); +$prolongadasPendientes = count(array_filter($todos, fn($t) => !empty($t['muestra_espera_at']) && empty($t['fin_lugar_at']))); jsonOk([ 'pendientes' => $pendientes, 'vistos' => $vistos, 'stats' => [ - 'total' => count($todos), - 'pendientes' => count($pendientes), - 'vistos' => count($vistos), - 'muestras_pendientes' => $muestrasPendientes, + 'total' => count($todos), + 'pendientes' => count($pendientes), + 'vistos' => count($vistos), + 'muestras_pendientes' => $muestrasPendientes, + 'prolongadas_pendientes'=> $prolongadasPendientes, ], ]); diff --git a/modules/turnero/views/bandeja.php b/modules/turnero/views/bandeja.php index 8e7a984..5b35bc2 100644 --- a/modules/turnero/views/bandeja.php +++ b/modules/turnero/views/bandeja.php @@ -41,7 +41,10 @@ Layout::open('Bandeja del día', 'fas fa-layer-group'); .bnd-chip-total { background:#ede9fe; color:#5b21b6; } .bnd-chip-pend { background:#fef3c7; color:#92400e; } .bnd-chip-vis { background:#f1f5f9; color:#475569; } -.bnd-chip-mp { background:#fff7ed; color:#c2410c; } +.bnd-chip-mp { background:#fff7ed; color:#c2410c; cursor:pointer; transition:box-shadow .12s; } +.bnd-chip-prog { background:#ecfdf5; color:#065f46; cursor:pointer; transition:box-shadow .12s; } +.bnd-chip-mp.activo { box-shadow:0 0 0 2px #c2410c; } +.bnd-chip-prog.activo { box-shadow:0 0 0 2px #065f46; } .bnd-refresh-btn { margin-left: auto; background: none; @@ -356,7 +359,8 @@ Layout::open('Bandeja del día', 'fas fa-layer-group'); Por revisar: — Vistos: — - Muestras pend.: — + Muestras pend.: — + Prog. en espera: —