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:
@@ -172,7 +172,7 @@ const Config = (() => {
|
|||||||
+ '<div class="device-card__name">' + escHtml(b.name) + '</div>'
|
+ '<div class="device-card__name">' + escHtml(b.name) + '</div>'
|
||||||
+ '<div class="device-card__detail">' + statusBadge
|
+ '<div class="device-card__detail">' + statusBadge
|
||||||
+ (b.rfc ? ' · RFC: ' + escHtml(b.rfc) : '')
|
+ (b.rfc ? ' · RFC: ' + escHtml(b.rfc) : '')
|
||||||
+ (b.codigo_postal ? ' · CP: ' + escHtml(b.codigo_postal) : '')
|
+ (b.cp ? ' · CP: ' + escHtml(b.cp) : '')
|
||||||
+ '</div>'
|
+ '</div>'
|
||||||
+ (b.address ? '<div class="device-card__detail">' + escHtml(b.address) + '</div>' : '')
|
+ (b.address ? '<div class="device-card__detail">' + escHtml(b.address) + '</div>' : '')
|
||||||
+ (b.phone ? '<div class="device-card__detail">' + escHtml(b.phone) + '</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-rfc').value = branch ? (branch.rfc || '') : '';
|
||||||
document.getElementById('branch-razon').value = branch ? (branch.razon_social || '') : '';
|
document.getElementById('branch-razon').value = branch ? (branch.razon_social || '') : '';
|
||||||
document.getElementById('branch-regimen').value = branch ? (branch.regimen_fiscal || '') : '';
|
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-serie').value = branch ? (branch.serie_cfdi || '') : '';
|
||||||
document.getElementById('branch-folio').value = branch ? (branch.folio_inicial || '') : '';
|
document.getElementById('branch-folio-inicio').value = branch ? (branch.folio_inicio || '') : '';
|
||||||
document.getElementById('branch-licencia').value = branch ? (branch.licencia_fiscal || '') : '';
|
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-address').value = branch ? (branch.address || '') : '';
|
||||||
document.getElementById('branch-phone').value = branch ? (branch.phone || '') : '';
|
document.getElementById('branch-phone').value = branch ? (branch.phone || '') : '';
|
||||||
document.getElementById('branch-main').checked = branch ? !!branch.is_main : false;
|
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');
|
openModal('modal-branch');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,15 +465,15 @@ const Config = (() => {
|
|||||||
rfc: document.getElementById('branch-rfc').value.trim() || null,
|
rfc: document.getElementById('branch-rfc').value.trim() || null,
|
||||||
razon_social: document.getElementById('branch-razon').value.trim() || null,
|
razon_social: document.getElementById('branch-razon').value.trim() || null,
|
||||||
regimen_fiscal: document.getElementById('branch-regimen').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,
|
serie_cfdi: document.getElementById('branch-serie').value.trim() || null,
|
||||||
folio_inicial: document.getElementById('branch-folio').value ? parseInt(document.getElementById('branch-folio').value, 10) : null,
|
folio_inicio: document.getElementById('branch-folio-inicio').value ? parseInt(document.getElementById('branch-folio-inicio').value, 10) : null,
|
||||||
licencia_fiscal: document.getElementById('branch-licencia').value.trim() || 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,
|
address: document.getElementById('branch-address').value.trim() || null,
|
||||||
phone: document.getElementById('branch-phone').value.trim() || null,
|
phone: document.getElementById('branch-phone').value.trim() || null,
|
||||||
is_main: document.getElementById('branch-main').checked,
|
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');
|
toast('Sucursal guardada');
|
||||||
closeModal('modal-branch');
|
closeModal('modal-branch');
|
||||||
@@ -484,14 +484,14 @@ const Config = (() => {
|
|||||||
document.getElementById('branch-razon').value = '';
|
document.getElementById('branch-razon').value = '';
|
||||||
document.getElementById('branch-regimen').value = '';
|
document.getElementById('branch-regimen').value = '';
|
||||||
document.getElementById('branch-cp').value = '';
|
document.getElementById('branch-cp').value = '';
|
||||||
|
document.getElementById('branch-direccion-fiscal').value = '';
|
||||||
document.getElementById('branch-serie').value = '';
|
document.getElementById('branch-serie').value = '';
|
||||||
document.getElementById('branch-folio').value = '';
|
document.getElementById('branch-folio-inicio').value = '';
|
||||||
document.getElementById('branch-licencia').value = '';
|
document.getElementById('branch-folio-actual').value = '';
|
||||||
|
document.getElementById('branch-email').value = '';
|
||||||
document.getElementById('branch-address').value = '';
|
document.getElementById('branch-address').value = '';
|
||||||
document.getElementById('branch-phone').value = '';
|
document.getElementById('branch-phone').value = '';
|
||||||
document.getElementById('branch-main').checked = false;
|
document.getElementById('branch-main').checked = false;
|
||||||
document.getElementById('branch-cert').value = '';
|
|
||||||
document.getElementById('branch-key').value = '';
|
|
||||||
await loadBranches();
|
await loadBranches();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast(e.message, 'error');
|
toast(e.message, 'error');
|
||||||
|
|||||||
@@ -748,17 +748,25 @@
|
|||||||
<label class="form-label">Codigo Postal</label>
|
<label class="form-label">Codigo Postal</label>
|
||||||
<input class="form-input" id="branch-cp" type="text" placeholder="00000" maxlength="5" />
|
<input class="form-input" id="branch-cp" type="text" placeholder="00000" maxlength="5" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group form-group--full">
|
||||||
|
<label class="form-label">Direccion Fiscal</label>
|
||||||
|
<input class="form-input" id="branch-direccion-fiscal" type="text" placeholder="Calle, Colonia, Ciudad" />
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">Serie CFDI</label>
|
<label class="form-label">Serie CFDI</label>
|
||||||
<input class="form-input" id="branch-serie" type="text" placeholder="A" maxlength="10" />
|
<input class="form-input" id="branch-serie" type="text" placeholder="A" maxlength="10" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">Folio Inicial</label>
|
<label class="form-label">Folio Inicio</label>
|
||||||
<input class="form-input" id="branch-folio" type="number" placeholder="1" />
|
<input class="form-input" id="branch-folio-inicio" type="number" placeholder="1" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">Licencia Fiscal</label>
|
<label class="form-label">Folio Actual</label>
|
||||||
<input class="form-input" id="branch-licencia" type="text" placeholder="Opcional" />
|
<input class="form-input" id="branch-folio-actual" type="number" placeholder="1" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">Email</label>
|
||||||
|
<input class="form-input" id="branch-email" type="email" placeholder="sucursal@empresa.com" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-group--full">
|
<div class="form-group form-group--full">
|
||||||
<label class="form-label">Direccion</label>
|
<label class="form-label">Direccion</label>
|
||||||
@@ -774,14 +782,6 @@
|
|||||||
<span>Sucursal principal (datos fiscales por defecto)</span>
|
<span>Sucursal principal (datos fiscales por defecto)</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-group--full">
|
|
||||||
<label class="form-label">Certificado PEM (opcional)</label>
|
|
||||||
<textarea class="form-input" id="branch-cert" rows="3" placeholder="-----BEGIN CERTIFICATE-----"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="form-group form-group--full">
|
|
||||||
<label class="form-label">Llave PEM (opcional)</label>
|
|
||||||
<textarea class="form-input" id="branch-key" rows="3" placeholder="-----BEGIN PRIVATE KEY-----"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cfg-modal__footer">
|
<div class="cfg-modal__footer">
|
||||||
|
|||||||
Reference in New Issue
Block a user