feat(bandeja): filtro de muestras pendientes

Añade conteo de muestras_pendientes por turno en la lista y opción
de filtro en el selector de estados de la bandeja del día.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-29 20:21:06 -05:00
co-authored by Claude Sonnet 4.6
parent 2e3534ab02
commit 4cb133010a
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -99,7 +99,8 @@ $stmt = $pdo->prepare("
GROUP_CONCAT(DISTINCT et.codigo ORDER BY et.codigo SEPARATOR ' ') AS examenes_txt,
SUM(tc.tipo = 'recepcion') AS com_recepcion,
SUM(tc.tipo = 'muestras') AS com_muestras,
SUM(tc.tipo = 'general') AS com_general
SUM(tc.tipo = 'general') AS com_general,
(SELECT COUNT(*) FROM turnero_muestras tm2 WHERE tm2.solicitud_id = ts.id AND tm2.estado = 'pendiente') AS muestras_pendientes
FROM turnero_turnos t
JOIN turnero_solicitudes ts ON ts.turno_id = t.id
JOIN turnero_lugares l ON l.id = t.lugar_destino_id
+2 -1
View File
@@ -364,6 +364,7 @@ Layout::open('Bandeja del día', 'fas fa-layer-group');
<option value="finalizado">Finalizado</option>
<option value="ausente">Ausente</option>
<option value="cancelado">Cancelado</option>
<option value="muestras_pendientes">Muestras pendientes</option>
</select>
<button class="bnd-refresh-btn" onclick="_bndRefrescarLista()">
<i class="fas fa-sync-alt" id="bnd-spin"></i> Actualizar
@@ -453,7 +454,7 @@ function _bndFiltrar() {
const st = document.getElementById('bnd-filtro-estado')?.value || '';
const match = t =>
(!q || (t.paciente_nombre || '').toLowerCase().includes(q) || (t.examenes_txt || '').toLowerCase().includes(q)) &&
(!st || t.estado === st);
(!st || (st === 'muestras_pendientes' ? +t.muestras_pendientes > 0 : t.estado === st));
_renderLista(
_bndAllData.pendientes?.filter(match) || [],