Facturapi: fix legal payload (name/legal_name/tax_system, address, no tax_id), reuse local org, status via user key; add fiscal address fields; embed Carta Manifiesto iframe
This commit is contained in:
@@ -397,6 +397,13 @@ const Invoicing = (() => {
|
||||
const cpEl = document.getElementById('cp-fiscal');
|
||||
const razonEl = document.getElementById('razon-social');
|
||||
const regimenEl = document.getElementById('regimen-fiscal');
|
||||
const direccionEl = document.getElementById('direccion-fiscal');
|
||||
const exteriorEl = document.getElementById('numero-exterior');
|
||||
const interiorEl = document.getElementById('numero-interior');
|
||||
const coloniaEl = document.getElementById('colonia-fiscal');
|
||||
const ciudadEl = document.getElementById('ciudad-fiscal');
|
||||
const municipioEl = document.getElementById('municipio-fiscal');
|
||||
const estadoEl = document.getElementById('estado-fiscal');
|
||||
if (!rfcEl || !cpEl || !razonEl || !regimenEl) return;
|
||||
|
||||
try {
|
||||
@@ -406,6 +413,13 @@ const Invoicing = (() => {
|
||||
rfcEl.value = data.rfc || '';
|
||||
cpEl.value = data.cp || '';
|
||||
razonEl.value = data.razon_social || '';
|
||||
if (direccionEl) direccionEl.value = data.direccion || '';
|
||||
if (exteriorEl) exteriorEl.value = data.numero_exterior || '';
|
||||
if (interiorEl) interiorEl.value = data.numero_interior || '';
|
||||
if (coloniaEl) coloniaEl.value = data.colonia || '';
|
||||
if (ciudadEl) ciudadEl.value = data.ciudad || '';
|
||||
if (municipioEl) municipioEl.value = data.municipio || '';
|
||||
if (estadoEl) estadoEl.value = data.estado || '';
|
||||
const regimen = data.regimen_fiscal || '601';
|
||||
regimenEl.value = regimen + ' — ' + (regimenEl.querySelector('option[value^="' + regimen + '"')?.textContent.split('—')[1]?.trim() || '');
|
||||
// If exact value not matched, leave first option selected by SAT code prefix
|
||||
@@ -425,6 +439,13 @@ const Invoicing = (() => {
|
||||
const razon_social = (document.getElementById('razon-social')?.value || '').trim();
|
||||
const regimenValue = document.getElementById('regimen-fiscal')?.value || '601';
|
||||
const regimen_fiscal = regimenValue.split('—')[0].trim();
|
||||
const direccion = (document.getElementById('direccion-fiscal')?.value || '').trim();
|
||||
const numero_exterior = (document.getElementById('numero-exterior')?.value || '').trim();
|
||||
const numero_interior = (document.getElementById('numero-interior')?.value || '').trim();
|
||||
const colonia = (document.getElementById('colonia-fiscal')?.value || '').trim();
|
||||
const ciudad = (document.getElementById('ciudad-fiscal')?.value || '').trim();
|
||||
const municipio = (document.getElementById('municipio-fiscal')?.value || '').trim();
|
||||
const estado = (document.getElementById('estado-fiscal')?.value || '').trim();
|
||||
const statusEl = document.getElementById('emisor-save-status');
|
||||
|
||||
if (!rfc || !razon_social || !cp) {
|
||||
@@ -436,7 +457,11 @@ const Invoicing = (() => {
|
||||
const res = await fetch('/pos/api/config/business', {
|
||||
method: 'PUT',
|
||||
headers: headers(),
|
||||
body: JSON.stringify({ rfc, razon_social, regimen_fiscal, cp, cfdi_regimen_fiscal: regimen_fiscal, cfdi_serie: 'A' })
|
||||
body: JSON.stringify({
|
||||
rfc, razon_social, regimen_fiscal, cp,
|
||||
direccion, numero_exterior, numero_interior, colonia, ciudad, municipio, estado,
|
||||
cfdi_regimen_fiscal: regimen_fiscal, cfdi_serie: 'A'
|
||||
})
|
||||
});
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({ error: res.statusText }));
|
||||
@@ -483,6 +508,13 @@ const Invoicing = (() => {
|
||||
document.getElementById('csd-key-label').textContent = 'Subir llave privada .key';
|
||||
}
|
||||
|
||||
function reloadManifiesto() {
|
||||
const iframe = document.getElementById('manifiesto-iframe');
|
||||
if (iframe) {
|
||||
iframe.src = iframe.src;
|
||||
}
|
||||
}
|
||||
|
||||
function updateFileLabels() {
|
||||
const cer = document.getElementById('csd-cer');
|
||||
const key = document.getElementById('csd-key');
|
||||
@@ -836,7 +868,7 @@ const Invoicing = (() => {
|
||||
showDetail, showCancelModal, confirmCancel, processQueue,
|
||||
showNewInvoiceModal, closeNewInvoiceModal, submitNewInvoice, notaCreditoPlaceholder,
|
||||
openGlobalInvoiceModal, previewGlobalInvoice, generateGlobalInvoice, setupFacturapi,
|
||||
uploadCsd, resetCsdForm,
|
||||
uploadCsd, resetCsdForm, reloadManifiesto,
|
||||
filterFacturas, exportFacturasCSV, exportNotasCSV,
|
||||
newCreditNote, newPaymentComplement,
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// The fetch handler normalizes static asset URLs (strips ?v= query strings)
|
||||
// so templates can use cache-busting query params freely.
|
||||
|
||||
const VERSION = 41;
|
||||
const VERSION = 43;
|
||||
const CACHE_NAME = 'nexus-pos-v' + VERSION;
|
||||
|
||||
const APP_SHELL = [
|
||||
|
||||
Reference in New Issue
Block a user