diff --git a/modules/turnero/api/get_historial.php b/modules/turnero/api/get_historial.php index d86025d..0d224b0 100644 --- a/modules/turnero/api/get_historial.php +++ b/modules/turnero/api/get_historial.php @@ -144,7 +144,6 @@ $turnoIds = array_column($turnos, 'id'); $examenes = []; $consentimientos = []; $comentarios = []; -$tomas = []; if ($turnoIds) { $ph = implode(',', array_fill(0, count($turnoIds), '?')); @@ -195,25 +194,6 @@ if ($turnoIds) { } } - // Tomas de muestra — batch (una solicitud por turno, varias tomas por solicitud) - $stmtTom = $pdo->prepare( - "SELECT ts.turno_id, tm.tipo_muestra, tm.estado, tm.creado_at, tm.recibida_at, - ar.full_name AS recibida_por_nombre - FROM turnero_muestras tm - JOIN turnero_solicitudes ts ON ts.id = tm.solicitud_id - LEFT JOIN admin_users ar ON ar.id = tm.recibida_por - WHERE ts.turno_id IN ($ph) - ORDER BY tm.creado_at ASC" - ); - $stmtTom->execute($turnoIds); - foreach ($stmtTom->fetchAll(PDO::FETCH_ASSOC) as $row) { - $tid = (int)$row['turno_id']; - unset($row['turno_id']); - $row['tiempo_min'] = ($row['creado_at'] && $row['recibida_at']) - ? round((strtotime($row['recibida_at']) - strtotime($row['creado_at'])) / 60, 1) - : null; - $tomas[$tid][] = $row; - } } foreach ($turnos as &$turno) { @@ -221,7 +201,6 @@ foreach ($turnos as &$turno) { $turno['examenes'] = $examenes[$tid] ?? []; $turno['consentimientos'] = $consentimientos[$tid] ?? []; $turno['comentarios'] = $comentarios[$tid] ?? []; - $turno['tomas'] = $tomas[$tid] ?? []; } // ── Resumen por estado (del rango filtrado) ─────────────────── diff --git a/modules/turnero/views/historial.php b/modules/turnero/views/historial.php index 4116270..1e16069 100644 --- a/modules/turnero/views/historial.php +++ b/modules/turnero/views/historial.php @@ -533,25 +533,6 @@ function renderDetalle(t) { `; } - // Tomas de muestra (solo si hay más de una — turno prolongado por varias tomas) - let tomasHtml = ''; - if (t.tomas && t.tomas.length > 1) { - tomasHtml = `
-
Tomas de muestra (${t.tomas.length})
- - - - ${t.tomas.map(m => ` - - - - - `).join('')} - -
MuestraRecibióRecibidaTiempo
${esc(m.tipo_muestra)}${esc(m.recibida_por_nombre || '—')}${m.recibida_at ? new Date(m.recibida_at.replace(' ','T')).toLocaleTimeString('es-CO',{hour:'2-digit',minute:'2-digit'}) : '—'}${m.tiempo_min != null ? m.tiempo_min + ' m' : '—'}
-
`; - } - // Comentarios let comHtml = ''; if (t.comentarios && t.comentarios.length) { @@ -574,7 +555,7 @@ function renderDetalle(t) {
${it.val}
`).join('')} - ${examHtml}${tomasHtml}${comHtml} + ${examHtml}${comHtml}
Documentos
Cargando… @@ -615,15 +596,19 @@ async function cargarDocumentosTurno(turnoId, container) { const pills = list.map(c => { const est = c.estado || 'pendiente'; const nombre = esc(c.formulario_nombre || 'Documento'); + // Formulario de tomas progresivas (ej. Control de Tomas de Muestras Prolongadas F-LAB-28) + const tomas = c.es_toma_progresiva + ? ` ${c.tomas_firmadas||0}/${c.tomas_total||0} tomas` + : ''; if (est === 'firmado' && c.token) { const url = BASE_URL_ROOT + 'ver_formulario_enviado.php?token=' + encodeURIComponent(c.token); return ` - ${nombre} + ${nombre}${tomas} `; } const cls = est === 'enviado' || est === 'visto' ? 'enviado' : 'pendiente'; const ico = est === 'enviado' ? 'fa-paper-plane' : (est === 'visto' ? 'fa-eye' : 'fa-clock'); - return `${nombre}`; + return `${nombre}${tomas}`; }).join(''); container.innerHTML = '
Documentos
' + pills; } catch(_) {