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: —