feat(tiempos): agregar tiempo total puerta a puerta en historial y dashboard

- APIs: total_min = creado_at → fin_lugar_at (solo finalizados)
- Dashboard: KPI card 'Total prom. puerta a puerta' + columna Total en tabla
- Historial: columna Total en tabla

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-30 18:14:13 -05:00
co-authored by Claude Sonnet 4.6
parent c357f18b61
commit 44b737c253
4 changed files with 24 additions and 5 deletions
+6 -1
View File
@@ -240,6 +240,7 @@ try {
<th>Estado</th>
<th>Espera</th>
<th>Serv.</th>
<th>Total</th>
<th></th>
</tr>
</thead>
@@ -344,6 +345,7 @@ function renderDashboard(json) {
const cancelados= parseInt(resumen.cancelados || 0);
const tEspera = resumen.tiempo_espera_promedio_min;
const tServicio = resumen.tiempo_servicio_promedio_min;
const tTotal = resumen.tiempo_total_promedio_min;
const pct = total > 0 ? Math.round(atendidos / total * 100) : 0;
document.getElementById('kpiGrid').innerHTML = `
@@ -352,8 +354,9 @@ function renderDashboard(json) {
${kpiCard(enEspera, '⏳ En espera', '')}
${kpiCard(ausentes, '🚫 Ausentes', '')}
${kpiCard(cancelados,'❌ Cancelados', '')}
${kpiCard(tEspera !== null ? tEspera + ' min' : '—', '⏱ Espera prom.', 'hasta recepción')}
${kpiCard(tEspera !== null ? tEspera + ' min' : '—', '⏱ Espera prom.', 'hasta recepción')}
${kpiCard(tServicio !== null ? tServicio + ' min' : '—', '⏱ Servicio prom.', 'en lugar')}
${kpiCard(tTotal !== null ? tTotal + ' min' : '—', '⏱ Total prom.', 'puerta a puerta')}
`;
// ── Consentimientos ────────────────────────────────────
@@ -451,6 +454,7 @@ function renderTabla(turnos) {
const estadoLbl = labelEstado[t.estado] || t.estado;
const espMin = t.espera_min !== null ? t.espera_min + ' m' : '—';
const srvMin = t.servicio_min !== null ? t.servicio_min + ' m' : '—';
const totMin = t.total_min !== null ? t.total_min + ' m' : '—';
const rowId = `dash-det-${t.id}`;
// Recepción
@@ -478,6 +482,7 @@ function renderTabla(turnos) {
<td><span class="estado-badge ${estadoCls}">${estadoLbl}</span></td>
<td>${espMin}</td>
<td>${srvMin}</td>
<td>${totMin}</td>
<td><i class="fas fa-chevron-right" style="font-size:.65rem;color:#94a3b8;transition:transform .2s" id="ico-${t.id}"></i></td>
</tr>
<tr id="${rowId}" class="det-row" style="display:none">