fix: formatea fechas de historial de inventario a hora local del navegador
This commit is contained in:
@@ -374,7 +374,7 @@ def get_movement_history(conn, inventory_id, limit=50):
|
||||
history.append({
|
||||
'id': r[0], 'type': r[1], 'quantity': r[2],
|
||||
'cost': float(r[3]) if r[3] else None,
|
||||
'notes': r[4], 'date': str(r[5]),
|
||||
'notes': r[4], 'date': r[5].isoformat() if r[5] else None,
|
||||
'employee': r[6], 'branch_id': r[7]
|
||||
})
|
||||
cur.close()
|
||||
|
||||
@@ -46,6 +46,15 @@
|
||||
d.textContent = s;
|
||||
return d.innerHTML;
|
||||
}
|
||||
function formatDateTime(isoStr) {
|
||||
if (!isoStr) return '-';
|
||||
var d = new Date(isoStr);
|
||||
if (isNaN(d.getTime())) return esc(isoStr);
|
||||
return d.toLocaleString('es-MX', {
|
||||
day: '2-digit', month: '2-digit', year: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit'
|
||||
});
|
||||
}
|
||||
|
||||
// --- Dashboard summary badges ---
|
||||
function loadSummary() {
|
||||
@@ -1004,7 +1013,7 @@
|
||||
history.forEach(function (h) {
|
||||
var qtyColor = h.quantity > 0 ? 'var(--color-success)' : 'var(--color-error)';
|
||||
html += '<tr>' +
|
||||
'<td style="font-size:var(--text-caption);">' + esc(h.date) + '</td>' +
|
||||
'<td style="font-size:var(--text-caption);">' + formatDateTime(h.date) + '</td>' +
|
||||
'<td>' + esc(h.type) + '</td>' +
|
||||
'<td style="color:' + qtyColor + ';font-weight:600;">' + (h.quantity > 0 ? '+' : '') + h.quantity + '</td>' +
|
||||
'<td class="td--amount">' + (h.cost ? '$' + fmt(h.cost) : '—') + '</td>' +
|
||||
@@ -1828,7 +1837,7 @@
|
||||
history.forEach(function (h) {
|
||||
var qtyColor = h.quantity > 0 ? 'var(--color-success)' : 'var(--color-error)';
|
||||
html += '<tr>' +
|
||||
'<td style="font-size:var(--text-caption);">' + esc(h.date) + '</td>' +
|
||||
'<td style="font-size:var(--text-caption);">' + formatDateTime(h.date) + '</td>' +
|
||||
'<td>' + esc(h.type) + '</td>' +
|
||||
'<td style="color:' + qtyColor + ';font-weight:600;">' + (h.quantity > 0 ? '+' : '') + h.quantity + '</td>' +
|
||||
'<td class="td--amount">' + (h.cost ? '$' + fmt(h.cost) : '\u2014') + '</td>' +
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// The fetch handler normalizes static asset URLs (strips ?v= query strings)
|
||||
// so templates can use cache-busting query params freely.
|
||||
|
||||
const CACHE_NAME = 'nexus-pos-v20';
|
||||
const CACHE_NAME = 'nexus-pos-v21';
|
||||
|
||||
const APP_SHELL = [
|
||||
'/pos/static/css/tokens.css',
|
||||
|
||||
@@ -1059,7 +1059,7 @@
|
||||
<script src="/pos/static/js/pos-utils.js?v=2" defer></script>
|
||||
<script src="/pos/static/js/sidebar.js" defer></script>
|
||||
<script src="/pos/static/js/virtual-scroll.js?v=2" defer></script>
|
||||
<script src="/pos/static/js/inventory.js?v=18" defer></script>
|
||||
<script src="/pos/static/js/inventory.js?v=19" defer></script>
|
||||
<script src="/pos/static/js/offline-banner.js" defer></script>
|
||||
<script src="/pos/static/js/sync-engine.js" defer></script>
|
||||
<script>if('serviceWorker' in navigator){navigator.serviceWorker.register('/pos/sw.js',{scope:'/pos/'});}</script>
|
||||
|
||||
Reference in New Issue
Block a user