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
This commit is contained in:
2026-06-11 09:37:00 +00:00
parent 98b3b1c8c1
commit 2cbd69d5fa
2 changed files with 27 additions and 27 deletions

View File

@@ -172,7 +172,7 @@ const Config = (() => {
+ '<div class="device-card__name">' + escHtml(b.name) + '</div>'
+ '<div class="device-card__detail">' + statusBadge
+ (b.rfc ? ' · RFC: ' + escHtml(b.rfc) : '')
+ (b.codigo_postal ? ' · CP: ' + escHtml(b.codigo_postal) : '')
+ (b.cp ? ' · CP: ' + escHtml(b.cp) : '')
+ '</div>'
+ (b.address ? '<div class="device-card__detail">' + escHtml(b.address) + '</div>' : '')
+ (b.phone ? '<div class="device-card__detail">' + escHtml(b.phone) + '</div>' : '')
@@ -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');