feat: add email message field to invoices and update related components

This commit is contained in:
2026-04-28 01:06:45 -04:00
parent 4108019eab
commit 915ec103fc
16 changed files with 361 additions and 356 deletions
-34
View File
@@ -7,7 +7,6 @@ interface InvoiceEmailTemplateProps {
totalAmount: number;
taxRate: number;
currency?: string | null;
notes?: string | null;
client: {
name: string;
email: string | null;
@@ -62,18 +61,6 @@ export function generateInvoiceEmailTemplate({
}).format(amount);
};
const escapeHtml = (value: string) =>
value
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
const formattedNotes = invoice.notes?.trim()
? escapeHtml(invoice.notes).replace(/\n/g, "<br>")
: "";
const getTimeOfDayGreeting = () => {
const hour = new Date().getHours();
if (hour < 12) return "Good morning";
@@ -472,17 +459,6 @@ export function generateInvoiceEmailTemplate({
</div>
</div>
${
formattedNotes
? `<div class="invoice-card">
<div class="invoice-summary">
<div class="invoice-number" style="font-size: 18px;">Notes</div>
</div>
<div class="message" style="margin-bottom: 0;">${formattedNotes}</div>
</div>`
: ""
}
<div class="attachment-notice">
<div class="attachment-icon"></div>
<div class="attachment-text">
@@ -562,16 +538,6 @@ Subtotal: ${formatCurrency(subtotal)}${
}
Total: ${formatCurrency(total)}
${
invoice.notes?.trim()
? `
NOTES
═══════════════
${invoice.notes.trim()}
`
: ""
}
ATTACHMENT
═══════════════
PDF invoice attached: invoice-${invoice.invoiceNumber}.pdf