diff --git a/app/templates/envios_erp.html b/app/templates/envios_erp.html index 895c2f7..461719e 100644 --- a/app/templates/envios_erp.html +++ b/app/templates/envios_erp.html @@ -343,7 +343,12 @@ async function cargarHistorialScheduler() { ${sched.map((r, i) => { - const fecha = r.created_at.replace('T', ' ').slice(0, 16); + const dt = new Date(r.created_at.replace(' ', 'T') + 'Z'); + const fecha = dt.toLocaleString('es-CO', { + timeZone: 'America/Bogota', + year: 'numeric', month: '2-digit', day: '2-digit', + hour: '2-digit', minute: '2-digit', hour12: false + }); const errDet = r.errores_det ? JSON.parse(r.errores_det) : []; const pacientes = r.detalle_json ? JSON.parse(r.detalle_json) : []; const rowId = 'hist-det-' + i; @@ -403,8 +408,10 @@ async function cargarHistorialScheduler() { ${r.total} ${r.created} ${r.updated} - - ${r.errores || '—'} + + ${r.errores > 0 + ? `` + : ''} ${pacientes.length ? ` @@ -412,9 +419,14 @@ async function cargarHistorialScheduler() { class="text-xs text-blue-500 hover:underline">Ver ${pacientes.length}` : '—'} - ${pacientes.length ? ` + ${(pacientes.length || errDet.length) ? ` + ${errDet.length ? ` +
+

${errDet.length} error(es):

+ +
` : ''}
${detHtml}