From 041efd5c5c46c0557324e18770a173d9a27adadd Mon Sep 17 00:00:00 2001 From: consultoria-as Date: Thu, 11 Jun 2026 18:28:31 +0000 Subject: [PATCH] feat(customers): show razon_social, address, cp in customer views - Add address and cp to list_customers() backend response - Show razon_social as subtitle in customer table rows - Add razon_social and cp fields to detail panel - Update customers.html detail panel layout --- pos/blueprints/customers_bp.py | 12 +++++++----- pos/static/js/customers.js | 4 +++- pos/templates/customers.html | 8 ++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pos/blueprints/customers_bp.py b/pos/blueprints/customers_bp.py index 794cbf5..bd00503 100644 --- a/pos/blueprints/customers_bp.py +++ b/pos/blueprints/customers_bp.py @@ -52,6 +52,7 @@ def list_customers(): # Fetch cur.execute(f""" SELECT c.id, c.name, c.rfc, c.razon_social, c.phone, c.email, + c.address, c.cp, c.price_tier, c.credit_limit, c.credit_balance, c.vehicle_info, c.branch_id FROM customers c @@ -64,11 +65,12 @@ def list_customers(): for r in cur.fetchall(): customers.append({ 'id': r[0], 'name': r[1], 'rfc': r[2], 'razon_social': r[3], - 'phone': r[4], 'email': r[5], 'price_tier': r[6], - 'credit_limit': float(r[7]) if r[7] else 0, - 'credit_balance': float(r[8]) if r[8] else 0, - 'vehicle_info': r[9], - 'branch_id': r[10], + 'phone': r[4], 'email': r[5], 'address': r[6], 'cp': r[7], + 'price_tier': r[8], + 'credit_limit': float(r[9]) if r[9] else 0, + 'credit_balance': float(r[10]) if r[10] else 0, + 'vehicle_info': r[11], + 'branch_id': r[12], }) cur.close() diff --git a/pos/static/js/customers.js b/pos/static/js/customers.js index ec22861..0ab14d1 100644 --- a/pos/static/js/customers.js +++ b/pos/static/js/customers.js @@ -112,7 +112,7 @@ const Customers = (() => { '' + num + '' + '' + '
' + (c.name || '') + '
' + - '
' + (c.email || '') + '
' + + '
' + (c.razon_social || c.email || '') + '
' + '' + '' + (c.rfc || '-') + '' + '' + (c.phone || '-') + '' + @@ -249,7 +249,9 @@ const Customers = (() => { // Contact const set = (id, val) => { const el = document.getElementById(id); if (el) el.textContent = val || '-'; }; + set('detailRazonSocial', c.razon_social); set('detailAddress', c.address); + set('detailCp', c.cp); set('detailPhone', c.phone); set('detailEmail', c.email); set('detailSince', formatDate(c.created_at)); diff --git a/pos/templates/customers.html b/pos/templates/customers.html index c3e1c03..254a3ee 100644 --- a/pos/templates/customers.html +++ b/pos/templates/customers.html @@ -384,10 +384,18 @@
Información de Contacto
+
+ Razón Social + +
Dirección Av. Insurgentes Sur 1602, Col. Crédito Constructor, CDMX
+
+ CP + +
Teléfono +52 55 1234-5678