This commit is contained in:
2026-04-25 15:00:05 -05:00
parent 93db2f237f
commit 6638030e2e
2 changed files with 49 additions and 13 deletions

View File

@@ -171,6 +171,30 @@ function groupInvoices(filtered) {
return new Map([...groups.entries()].sort((a, b) => b[0].localeCompare(a[0])));
}
function getInvoiceEmailButtonLabel(invoice, overdue) {
if (overdue) {
return {
text: '⏰ Send Reminder',
title: 'Send overdue reminder with invoice PDF and optional Stripe payment link',
className: 'bg-red-100 text-red-700 hover:bg-red-200'
};
}
if (invoice.email_status === 'sent') {
return {
text: '🔁 Resend Invoice',
title: 'Resend invoice with PDF and optional Stripe payment link',
className: 'bg-purple-100 text-purple-700 hover:bg-purple-200'
};
}
return {
text: '📤 Send Invoice',
title: 'Send invoice with PDF and optional Stripe payment link',
className: 'bg-blue-100 text-blue-700 hover:bg-blue-200'
};
}
// ============================================================
// Render
// ============================================================
@@ -292,9 +316,15 @@ function renderInvoiceRow(invoice) {
const delBtn = `<button onclick="window.invoiceView.remove(${invoice.id})" class="text-red-600 hover:text-red-900">Del</button>`;
const stripeEmailBtn = (hasQbo && !paid && (invoice.email_status !== 'sent' || ((invoice.email_status === 'sent' && overdue))))
? `<button onclick="window.emailModal.open(${invoice.id})" title="Email with Stripe Payment Link" class="px-2 py-1 bg-purple-100 text-purple-700 rounded hover:bg-purple-200 text-xs font-semibold">💳 Pay Link</button>`
: '';
const emailAction = getInvoiceEmailButtonLabel(invoice, overdue);
const stripeEmailBtn = (hasQbo && !paid)
? `<button onclick="window.emailModal.open(${invoice.id})"
title="${emailAction.title}"
class="px-2 py-1 ${emailAction.className} rounded text-xs font-semibold">
${emailAction.text}
</button>`
: '';
const stripeCheckBtn = (invoice.stripe_payment_link_id && !paid)
? `<button onclick="window.invoiceView.checkStripePayment(${invoice.id})" title="Check Stripe Payment Status" class="px-2 py-1 bg-purple-50 text-purple-600 rounded hover:bg-purple-100 text-xs font-semibold">🔍 Check</button>`