From 2cbd69d5fa50e278718c7b9cdd549a3011892edf Mon Sep 17 00:00:00 2001 From: consultoria-as Date: Thu, 11 Jun 2026 09:37:00 +0000 Subject: [PATCH] fix(config): update frontend branch fields to match DB schema v4.0 - Replace codigo_postal with cp, folio_inicial with folio_inicio/folio_actual - Add direccion_fiscal and email fields - Remove non-existent licencia_fiscal, certificado_pem, llave_pem - Update config.js and config.html form --- pos/static/js/config.js | 30 +++++++++++++++--------------- pos/templates/config.html | 24 ++++++++++++------------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pos/static/js/config.js b/pos/static/js/config.js index 15f6225..836dbd2 100644 --- a/pos/static/js/config.js +++ b/pos/static/js/config.js @@ -172,7 +172,7 @@ const Config = (() => { + '
' + escHtml(b.name) + '
' + '
' + statusBadge + (b.rfc ? ' · RFC: ' + escHtml(b.rfc) : '') - + (b.codigo_postal ? ' · CP: ' + escHtml(b.codigo_postal) : '') + + (b.cp ? ' · CP: ' + escHtml(b.cp) : '') + '
' + (b.address ? '
' + escHtml(b.address) + '
' : '') + (b.phone ? '
' + escHtml(b.phone) + '
' : '') @@ -216,15 +216,15 @@ const Config = (() => { document.getElementById('branch-rfc').value = branch ? (branch.rfc || '') : ''; document.getElementById('branch-razon').value = branch ? (branch.razon_social || '') : ''; document.getElementById('branch-regimen').value = branch ? (branch.regimen_fiscal || '') : ''; - document.getElementById('branch-cp').value = branch ? (branch.codigo_postal || '') : ''; + document.getElementById('branch-cp').value = branch ? (branch.cp || '') : ''; + document.getElementById('branch-direccion-fiscal').value = branch ? (branch.direccion_fiscal || '') : ''; document.getElementById('branch-serie').value = branch ? (branch.serie_cfdi || '') : ''; - document.getElementById('branch-folio').value = branch ? (branch.folio_inicial || '') : ''; - document.getElementById('branch-licencia').value = branch ? (branch.licencia_fiscal || '') : ''; + document.getElementById('branch-folio-inicio').value = branch ? (branch.folio_inicio || '') : ''; + document.getElementById('branch-folio-actual').value = branch ? (branch.folio_actual || '') : ''; + document.getElementById('branch-email').value = branch ? (branch.email || '') : ''; document.getElementById('branch-address').value = branch ? (branch.address || '') : ''; document.getElementById('branch-phone').value = branch ? (branch.phone || '') : ''; document.getElementById('branch-main').checked = branch ? !!branch.is_main : false; - document.getElementById('branch-cert').value = branch ? (branch.certificado_pem || '') : ''; - document.getElementById('branch-key').value = branch ? (branch.llave_pem || '') : ''; openModal('modal-branch'); } @@ -465,15 +465,15 @@ const Config = (() => { rfc: document.getElementById('branch-rfc').value.trim() || null, razon_social: document.getElementById('branch-razon').value.trim() || null, regimen_fiscal: document.getElementById('branch-regimen').value.trim() || null, - codigo_postal: document.getElementById('branch-cp').value.trim() || null, + cp: document.getElementById('branch-cp').value.trim() || null, + direccion_fiscal: document.getElementById('branch-direccion-fiscal').value.trim() || null, serie_cfdi: document.getElementById('branch-serie').value.trim() || null, - folio_inicial: document.getElementById('branch-folio').value ? parseInt(document.getElementById('branch-folio').value, 10) : null, - licencia_fiscal: document.getElementById('branch-licencia').value.trim() || null, + folio_inicio: document.getElementById('branch-folio-inicio').value ? parseInt(document.getElementById('branch-folio-inicio').value, 10) : null, + folio_actual: document.getElementById('branch-folio-actual').value ? parseInt(document.getElementById('branch-folio-actual').value, 10) : null, + email: document.getElementById('branch-email').value.trim() || null, address: document.getElementById('branch-address').value.trim() || null, phone: document.getElementById('branch-phone').value.trim() || null, is_main: document.getElementById('branch-main').checked, - certificado_pem: document.getElementById('branch-cert').value.trim() || null, - llave_pem: document.getElementById('branch-key').value.trim() || null, }); toast('Sucursal guardada'); closeModal('modal-branch'); @@ -484,14 +484,14 @@ const Config = (() => { document.getElementById('branch-razon').value = ''; document.getElementById('branch-regimen').value = ''; document.getElementById('branch-cp').value = ''; + document.getElementById('branch-direccion-fiscal').value = ''; document.getElementById('branch-serie').value = ''; - document.getElementById('branch-folio').value = ''; - document.getElementById('branch-licencia').value = ''; + document.getElementById('branch-folio-inicio').value = ''; + document.getElementById('branch-folio-actual').value = ''; + document.getElementById('branch-email').value = ''; document.getElementById('branch-address').value = ''; document.getElementById('branch-phone').value = ''; document.getElementById('branch-main').checked = false; - document.getElementById('branch-cert').value = ''; - document.getElementById('branch-key').value = ''; await loadBranches(); } catch (e) { toast(e.message, 'error'); diff --git a/pos/templates/config.html b/pos/templates/config.html index c5d4aa5..ae06426 100644 --- a/pos/templates/config.html +++ b/pos/templates/config.html @@ -748,17 +748,25 @@ +
+ + +
- - + +
- - + + +
+
+ +
@@ -774,14 +782,6 @@ Sucursal principal (datos fiscales por defecto)
-
- - -
-
- - -