diff --git a/public/invoice-view.js b/public/invoice-view.js index f7fe985..5adbba0 100644 --- a/public/invoice-view.js +++ b/public/invoice-view.js @@ -181,7 +181,7 @@ function renderInvoiceRow(invoice) { ? invoice.invoice_number : `Draft`; - // Status Badge + // Status Badge (left side, next to invoice number) let statusBadge = ''; if (paid && invoice.payment_status === 'Deposited') { statusBadge = `Deposited`; @@ -191,6 +191,10 @@ function renderInvoiceRow(invoice) { statusBadge = `Partial $${amountPaid.toFixed(2)}`; } else if (overdue) { statusBadge = `Overdue`; + } else if (hasQbo && invoice.email_status === 'sent') { + statusBadge = `Sent`; + } else if (hasQbo) { + statusBadge = `Open`; } // Send Date @@ -239,15 +243,10 @@ function renderInvoiceRow(invoice) { paidBtn = ``; } - // Send status — only for QBO invoices not yet paid/partial + // Mark Sent button (right side) — only when open, not paid/partial let sendBtn = ''; - if (hasQbo && !paid && !partial) { - const isSent = invoice.email_status === 'sent'; - if (isSent) { - sendBtn = `Sent`; - } else { - sendBtn = ``; - } + if (hasQbo && !paid && !partial && invoice.email_status !== 'sent') { + sendBtn = ``; } const delBtn = ``;