diff --git a/public/index.html b/public/index.html index 8385246..2a677f1 100644 --- a/public/index.html +++ b/public/index.html @@ -67,9 +67,14 @@
- - +
-
- -
... @@ -649,19 +644,19 @@ export function injectToolbar() { // ============================================================ export function setStatus(s) { filterStatus = s; saveSettings(); renderInvoiceView(); } -export function toggleItemType() { - filterItemType = !filterItemType; - if (!filterItemType) filterEmptyCost = false; +export function toggleParts() { + filterParts = !filterParts; + if (!filterParts) filterEmptyCost = false; saveSettings(); const itemBtn = document.getElementById('filter-item-type'); const emptyBtn = document.getElementById('filter-empty-cost'); if (itemBtn) { - itemBtn.className = filterItemType + itemBtn.className = filterParts ? 'px-3 py-1.5 text-xs font-medium rounded-md transition-colors bg-blue-500 text-white' : 'px-3 py-1.5 text-xs font-medium rounded-md transition-colors bg-white text-gray-600'; } if (emptyBtn) { - emptyBtn.style.display = filterItemType ? '' : 'none'; + emptyBtn.style.display = filterParts ? '' : 'none'; emptyBtn.className = filterEmptyCost ? 'px-3 py-1.5 text-xs font-medium rounded-md transition-colors bg-blue-500 text-white' : 'px-3 py-1.5 text-xs font-medium rounded-md transition-colors bg-white text-gray-600'; @@ -669,7 +664,7 @@ export function toggleItemType() { loadInvoices(); } export function toggleEmptyCost() { - if (!filterItemType) return; + if (!filterParts) return; filterEmptyCost = !filterEmptyCost; saveSettings(); const btn = document.getElementById('filter-empty-cost'); @@ -920,5 +915,5 @@ async function populateWorkerFilter() { window.invoiceView = { viewPDF, viewHTML, syncFromQBO, resetQbo, markPaid, setEmailStatus, edit, remove, - loadInvoices, renderInvoiceView, setStatus, toggleItemType, toggleEmptyCost, checkStripePayment, editSentDates ,_addSentDateRow, _saveSentDates + loadInvoices, renderInvoiceView, setStatus, toggleParts, toggleEmptyCost, checkStripePayment, editSentDates ,_addSentDateRow, _saveSentDates }; \ No newline at end of file diff --git a/src/routes/invoices.js b/src/routes/invoices.js index 540bafe..ef9de61 100644 --- a/src/routes/invoices.js +++ b/src/routes/invoices.js @@ -50,17 +50,17 @@ function buildPaymentLinkHtml(invoice) { // GET all invoices router.get('/', async (req, res) => { try { - const { has_parts_or_subscription, empty_cost_only } = req.query; + const { has_parts, empty_cost_only } = req.query; let whereClauses = []; - if (has_parts_or_subscription === 'true') { + if (has_parts === 'true') { const costCondition = empty_cost_only === 'true' ? `AND (ii.unit_cost IS NULL OR ii.unit_cost = '')` : ''; whereClauses.push(`EXISTS ( SELECT 1 FROM invoice_items ii WHERE ii.invoice_id = i.id - AND (ii.qbo_item_id = '9' OR ii.qbo_item_id = '115') + AND ii.qbo_item_id = '9' ${costCondition} )`); }