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
This commit is contained in:
2026-06-11 18:28:31 +00:00
parent 2cbd69d5fa
commit 041efd5c5c
3 changed files with 18 additions and 6 deletions

View File

@@ -52,6 +52,7 @@ def list_customers():
# Fetch # Fetch
cur.execute(f""" cur.execute(f"""
SELECT c.id, c.name, c.rfc, c.razon_social, c.phone, c.email, 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.price_tier, c.credit_limit, c.credit_balance, c.vehicle_info,
c.branch_id c.branch_id
FROM customers c FROM customers c
@@ -64,11 +65,12 @@ def list_customers():
for r in cur.fetchall(): for r in cur.fetchall():
customers.append({ customers.append({
'id': r[0], 'name': r[1], 'rfc': r[2], 'razon_social': r[3], 'id': r[0], 'name': r[1], 'rfc': r[2], 'razon_social': r[3],
'phone': r[4], 'email': r[5], 'price_tier': r[6], 'phone': r[4], 'email': r[5], 'address': r[6], 'cp': r[7],
'credit_limit': float(r[7]) if r[7] else 0, 'price_tier': r[8],
'credit_balance': float(r[8]) if r[8] else 0, 'credit_limit': float(r[9]) if r[9] else 0,
'vehicle_info': r[9], 'credit_balance': float(r[10]) if r[10] else 0,
'branch_id': r[10], 'vehicle_info': r[11],
'branch_id': r[12],
}) })
cur.close() cur.close()

View File

@@ -112,7 +112,7 @@ const Customers = (() => {
'<td class="cell-num">' + num + '</td>' + '<td class="cell-num">' + num + '</td>' +
'<td>' + '<td>' +
'<div class="cell-name">' + (c.name || '') + '</div>' + '<div class="cell-name">' + (c.name || '') + '</div>' +
'<div class="cell-name-sub hide-mobile">' + (c.email || '') + '</div>' + '<div class="cell-name-sub hide-mobile">' + (c.razon_social || c.email || '') + '</div>' +
'</td>' + '</td>' +
'<td class="cell-rfc hide-mobile">' + (c.rfc || '-') + '</td>' + '<td class="cell-rfc hide-mobile">' + (c.rfc || '-') + '</td>' +
'<td class="hide-mobile">' + (c.phone || '-') + '</td>' + '<td class="hide-mobile">' + (c.phone || '-') + '</td>' +
@@ -249,7 +249,9 @@ const Customers = (() => {
// Contact // Contact
const set = (id, val) => { const el = document.getElementById(id); if (el) el.textContent = val || '-'; }; const set = (id, val) => { const el = document.getElementById(id); if (el) el.textContent = val || '-'; };
set('detailRazonSocial', c.razon_social);
set('detailAddress', c.address); set('detailAddress', c.address);
set('detailCp', c.cp);
set('detailPhone', c.phone); set('detailPhone', c.phone);
set('detailEmail', c.email); set('detailEmail', c.email);
set('detailSince', formatDate(c.created_at)); set('detailSince', formatDate(c.created_at));

View File

@@ -384,10 +384,18 @@
<div class="detail-section"> <div class="detail-section">
<div class="detail-section__title">Información de Contacto</div> <div class="detail-section__title">Información de Contacto</div>
<div class="info-grid"> <div class="info-grid">
<div class="info-row info-row--full">
<span class="info-label">Razón Social</span>
<span class="info-value" id="detailRazonSocial"></span>
</div>
<div class="info-row info-row--full"> <div class="info-row info-row--full">
<span class="info-label">Dirección</span> <span class="info-label">Dirección</span>
<span class="info-value" id="detailAddress">Av. Insurgentes Sur 1602, Col. Crédito Constructor, CDMX</span> <span class="info-value" id="detailAddress">Av. Insurgentes Sur 1602, Col. Crédito Constructor, CDMX</span>
</div> </div>
<div class="info-row">
<span class="info-label">CP</span>
<span class="info-value info-value--mono" id="detailCp"></span>
</div>
<div class="info-row"> <div class="info-row">
<span class="info-label">Teléfono</span> <span class="info-label">Teléfono</span>
<span class="info-value info-value--mono" id="detailPhone">+52 55 1234-5678</span> <span class="info-value info-value--mono" id="detailPhone">+52 55 1234-5678</span>