This commit is contained in:
Andreas Knuth 2026-02-24 17:55:50 -06:00
parent 851ca7a037
commit b7db400e53
1 changed files with 8 additions and 9 deletions

View File

@ -181,7 +181,7 @@ function renderInvoiceRow(invoice) {
? invoice.invoice_number ? invoice.invoice_number
: `<span class="text-gray-400 italic text-xs">Draft</span>`; : `<span class="text-gray-400 italic text-xs">Draft</span>`;
// Status Badge // Status Badge (left side, next to invoice number)
let statusBadge = ''; let statusBadge = '';
if (paid && invoice.payment_status === 'Deposited') { if (paid && invoice.payment_status === 'Deposited') {
statusBadge = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-blue-100 text-blue-800" title="Deposited ${formatDate(invoice.paid_date)}">Deposited</span>`; statusBadge = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-blue-100 text-blue-800" title="Deposited ${formatDate(invoice.paid_date)}">Deposited</span>`;
@ -191,6 +191,10 @@ function renderInvoiceRow(invoice) {
statusBadge = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800" title="Paid: $${amountPaid.toFixed(2)} / Balance: $${balance.toFixed(2)}">Partial $${amountPaid.toFixed(2)}</span>`; statusBadge = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800" title="Paid: $${amountPaid.toFixed(2)} / Balance: $${balance.toFixed(2)}">Partial $${amountPaid.toFixed(2)}</span>`;
} else if (overdue) { } else if (overdue) {
statusBadge = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-red-100 text-red-800" title="${daysSince(invoice.invoice_date)} days">Overdue</span>`; statusBadge = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-red-100 text-red-800" title="${daysSince(invoice.invoice_date)} days">Overdue</span>`;
} else if (hasQbo && invoice.email_status === 'sent') {
statusBadge = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-green-100 text-green-800">Sent</span>`;
} else if (hasQbo) {
statusBadge = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-sky-100 text-sky-800">Open</span>`;
} }
// Send Date // Send Date
@ -239,15 +243,10 @@ function renderInvoiceRow(invoice) {
paidBtn = `<button onclick="window.paymentModal.open([${invoice.id}])" class="text-emerald-600 hover:text-emerald-800" title="Record Payment in QBO">💰 Payment</button>`; paidBtn = `<button onclick="window.paymentModal.open([${invoice.id}])" class="text-emerald-600 hover:text-emerald-800" title="Record Payment in QBO">💰 Payment</button>`;
} }
// Send status — only for QBO invoices not yet paid/partial // Mark Sent button (right side) — only when open, not paid/partial
let sendBtn = ''; let sendBtn = '';
if (hasQbo && !paid && !partial) { if (hasQbo && !paid && !partial && invoice.email_status !== 'sent') {
const isSent = invoice.email_status === 'sent'; sendBtn = `<button onclick="window.invoiceView.setEmailStatus(${invoice.id}, 'sent')" class="text-indigo-600 hover:text-indigo-800 text-xs font-medium" title="Mark as sent to customer">📤 Mark Sent</button>`;
if (isSent) {
sendBtn = `<span class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-green-100 text-green-800">Sent</span>`;
} else {
sendBtn = `<button onclick="window.invoiceView.setEmailStatus(${invoice.id}, 'sent')" class="inline-block px-2 py-0.5 text-xs font-semibold rounded-full bg-blue-100 text-blue-800 hover:bg-blue-200 cursor-pointer" title="Mark as sent to customer">📤 Mark Sent</button>`;
}
} }
const delBtn = `<button onclick="window.invoiceView.remove(${invoice.id})" class="text-red-600 hover:text-red-900">Del</button>`; const delBtn = `<button onclick="window.invoiceView.remove(${invoice.id})" class="text-red-600 hover:text-red-900">Del</button>`;