fix(pos): wire buttons in contabilidad, facturacion, inventario, dashboard
- Contabilidad: Nueva Poliza modal + Exportar placeholder - Facturacion: Nueva Factura modal (sale_id input) + Nota Credito placeholder - Inventario: click en producto abre detalle con historial - Dashboard: Ver Detalles navega a paginas relevantes, campana a alertas Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -438,11 +438,56 @@ const Invoicing = (() => {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
|
||||
// ---- Nueva Factura modal ----
|
||||
function showNewInvoiceModal() {
|
||||
const overlay = document.getElementById('newInvoiceModalOverlay');
|
||||
if (!overlay) return;
|
||||
const input = overlay.querySelector('#invoiceSaleId');
|
||||
if (input) input.value = '';
|
||||
document.getElementById('invoiceResult').innerHTML = '';
|
||||
overlay.style.display = 'flex';
|
||||
}
|
||||
|
||||
function closeNewInvoiceModal() {
|
||||
const overlay = document.getElementById('newInvoiceModalOverlay');
|
||||
if (overlay) overlay.style.display = 'none';
|
||||
}
|
||||
|
||||
async function submitNewInvoice() {
|
||||
const saleId = parseInt(document.getElementById('invoiceSaleId').value);
|
||||
const resultEl = document.getElementById('invoiceResult');
|
||||
if (!saleId) {
|
||||
resultEl.innerHTML = '<span style="color:var(--color-error);">Ingrese un ID de venta valido.</span>';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const result = await api('/invoice', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ sale_id: saleId }),
|
||||
});
|
||||
resultEl.innerHTML = '<span style="color:var(--color-success);">Factura generada: ' + (result.provisional_folio || 'CFDI-' + (result.id || '')) + '</span>';
|
||||
loadFacturas();
|
||||
setTimeout(() => closeNewInvoiceModal(), 1500);
|
||||
} catch (e) {
|
||||
resultEl.innerHTML = '<span style="color:var(--color-error);">Error: ' + e.message + '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Nota de Credito placeholder ----
|
||||
function notaCreditoPlaceholder() {
|
||||
alert('Nota de credito: proximamente');
|
||||
}
|
||||
|
||||
// Expose switchTab globally for onclick handlers in HTML
|
||||
window.switchTab = switchTab;
|
||||
window.showNewInvoiceModal = showNewInvoiceModal;
|
||||
window.closeNewInvoiceModal = closeNewInvoiceModal;
|
||||
window.submitNewInvoice = submitNewInvoice;
|
||||
window.notaCreditoPlaceholder = notaCreditoPlaceholder;
|
||||
|
||||
return {
|
||||
switchTab, loadFacturas, loadNotas, loadComplementos, loadCancelaciones,
|
||||
showDetail, showCancelModal, confirmCancel, processQueue,
|
||||
showNewInvoiceModal, closeNewInvoiceModal, submitNewInvoice, notaCreditoPlaceholder,
|
||||
};
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user