diff --git a/pos/services/inventory_engine.py b/pos/services/inventory_engine.py index 26251b6..e9c1e5a 100644 --- a/pos/services/inventory_engine.py +++ b/pos/services/inventory_engine.py @@ -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() diff --git a/pos/static/js/inventory.js b/pos/static/js/inventory.js index 9e397d2..f9862d7 100644 --- a/pos/static/js/inventory.js +++ b/pos/static/js/inventory.js @@ -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 += '' + - '' + esc(h.date) + '' + + '' + formatDateTime(h.date) + '' + '' + esc(h.type) + '' + '' + (h.quantity > 0 ? '+' : '') + h.quantity + '' + '' + (h.cost ? '$' + fmt(h.cost) : '—') + '' + @@ -1828,7 +1837,7 @@ history.forEach(function (h) { var qtyColor = h.quantity > 0 ? 'var(--color-success)' : 'var(--color-error)'; html += '' + - '' + esc(h.date) + '' + + '' + formatDateTime(h.date) + '' + '' + esc(h.type) + '' + '' + (h.quantity > 0 ? '+' : '') + h.quantity + '' + '' + (h.cost ? '$' + fmt(h.cost) : '\u2014') + '' + diff --git a/pos/static/pwa/sw.js b/pos/static/pwa/sw.js index 98cd6bd..1632e25 100644 --- a/pos/static/pwa/sw.js +++ b/pos/static/pwa/sw.js @@ -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', diff --git a/pos/templates/inventory.html b/pos/templates/inventory.html index 5a23c89..0f2c96a 100644 --- a/pos/templates/inventory.html +++ b/pos/templates/inventory.html @@ -1059,7 +1059,7 @@ - +