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 += '