feat(bandeja): chips clickeables para muestras pend. y prog. en espera

- 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 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-29 20:29:45 -05:00
co-authored by Claude Sonnet 4.6
parent 118e98b360
commit e3216faaa5
2 changed files with 27 additions and 10 deletions
+8 -6
View File
@@ -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,
],
]);