fix(bandeja): default hoy + etiqueta Hoy/Ayer/fecha en cada registro

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-29 20:32:08 -05:00
co-authored by Claude Sonnet 4.6
parent 00f6e7f759
commit 2da5960596
+14 -1
View File
@@ -423,10 +423,23 @@ const VISTO_API= 'modules/turnero/api/marcar_visto.php';
let _bndTurnoId = null;
let _bndAllData = { pendientes: [], vistos: [] };
const _hoy = new Date().toISOString().slice(0,10);
const _ayer = new Date(Date.now()-86400000).toISOString().slice(0,10);
document.getElementById('bnd-desde').value = _hoy;
document.getElementById('bnd-hasta').value = _hoy;
function _hora(dt) {
if (!dt) return '';
return new Date(dt.replace(' ','T')).toLocaleTimeString('es-CO',{hour:'2-digit',minute:'2-digit'});
}
function _fechaLabel(dt) {
if (!dt) return '';
const d = dt.slice(0,10);
if (d === _hoy) return 'Hoy';
if (d === _ayer) return 'Ayer';
return new Date(dt.replace(' ','T')).toLocaleDateString('es-CO',{day:'2-digit',month:'2-digit'});
}
function _toast(msg, ms = 2200) {
const t = document.getElementById('bnd-toast');
t.textContent = msg;
@@ -516,7 +529,7 @@ function _renderLista(pendientes, vistos) {
</div>
<div class="bnd-card-bot">
<span class="bnd-lugar-badge">${t.lugar_nombre||''}</span>
<span class="bnd-hora">${_hora(t.inicio_lugar_at)}</span>
<span class="bnd-hora">${_hora(t.inicio_lugar_at)} <span style="opacity:.6">${_fechaLabel(t.inicio_lugar_at)}</span></span>
</div>
<div class="bnd-card-bot" style="margin-top:3px">
${estadoBadge}