diff --git a/public/app.js b/public/app.js index 6790cf7..4454b5b 100644 --- a/public/app.js +++ b/public/app.js @@ -247,7 +247,8 @@ async function openQuoteModal(quoteId = null) { const data = await response.json(); // Set customer in Alpine component - const customer = customers.find(c => c.id === data.quote.customer_id); + const allCust = window.getCustomers ? window.getCustomers() : customers; + const customer = allCust.find(c => c.id === data.quote.customer_id); if (customer) { // Find the Alpine component and update it const customerInput = document.querySelector('#quote-modal input[placeholder="Search customer..."]'); @@ -652,7 +653,8 @@ async function openInvoiceModal(invoiceId = null) { const data = await response.json(); // Set customer in Alpine component - const customer = customers.find(c => c.id === data.invoice.customer_id); + const allCust = window.getCustomers ? window.getCustomers() : customers; + const customer = allCust.find(c => c.id === data.invoice.customer_id); if (customer) { const customerInput = document.querySelector('#invoice-modal input[placeholder="Search customer..."]'); if (customerInput) {