Re_Backend/src/emailtemplates/creditNoteSent.template.ts

204 lines
13 KiB
TypeScript

/**
* Credit Note Sent Email Template
* Sent when credit note is sent to dealer (Step 8)
*/
import { CreditNoteSentData } from './types';
import { getEmailFooter, getEmailHeader, HeaderStyles, getResponsiveStyles, wrapRichText, getEmailContainerStyles } from './helpers';
import { getBrandedHeader } from './branding.config';
export function getCreditNoteSentEmail(data: CreditNoteSentData): string {
return `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="format-detection" content="telephone=no">
<title>Credit Note Sent</title>
${getResponsiveStyles()}
</head>
<body style="margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; background-color: #f4f4f4;">
<table role="presentation" style="width: 100%; border-collapse: collapse; background-color: #f4f4f4;" cellpadding="0" cellspacing="0">
<tr>
<td style="padding: 40px 0;">
<table role="presentation" class="email-container" style="${getEmailContainerStyles()}" cellpadding="0" cellspacing="0">
<!-- Header -->
${getEmailHeader(getBrandedHeader({
title: 'Credit Note Sent',
...HeaderStyles.success
}))}
<!-- Content -->
<tr>
<td class="email-content" style="padding: 40px 30px;">
<p style="margin: 0 0 20px; color: #333333; font-size: 16px; line-height: 1.6;">
Dear <strong style="color: #667eea;">${data.recipientName}</strong>,
</p>
<p style="margin: 0 0 30px; color: #666666; font-size: 16px; line-height: 1.6;">
A credit note has been generated and sent for the claim request <strong>${data.requestNumber}</strong> (${data.requestId}).
</p>
<!-- Credit Note Details Box -->
<table role="presentation" style="width: 100%; border-collapse: collapse; background-color: #f8f9fa; border-radius: 6px; margin-bottom: 30px;" cellpadding="0" cellspacing="0">
<tr>
<td style="padding: 25px;">
<h2 style="margin: 0 0 20px; color: #333333; font-size: 18px; font-weight: 600;">Credit Note Details</h2>
<table role="presentation" style="width: 100%; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px; width: 140px;">
<strong>Request ID:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.requestId}
</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Request Number:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.requestNumber}
</td>
</tr>
${data.requestTitle ? `
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Title:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.requestTitle}
</td>
</tr>
` : ''}
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Credit Note Number:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px; font-weight: 600;">
${data.creditNoteNumber}
</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Credit Note Date:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.creditNoteDate}
</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Credit Note Amount:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px; font-weight: 600; color: #28a745;">
${data.creditNoteAmount.toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
</td>
</tr>
${data.invoiceNumber ? `
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Related Invoice:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.invoiceNumber}
</td>
</tr>
` : ''}
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Activity Name:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.activityName}
</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Dealer:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.dealerName} ${data.dealerCode ? `(${data.dealerCode})` : ''}
</td>
</tr>
${data.reason ? `
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px; vertical-align: top;">
<strong>Reason:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.reason}
</td>
</tr>
` : ''}
<tr>
<td style="padding: 8px 0; color: #666666; font-size: 14px;">
<strong>Sent On:</strong>
</td>
<td style="padding: 8px 0; color: #333333; font-size: 14px;">
${data.sentDate} at ${data.sentTime}
</td>
</tr>
</table>
</td>
</tr>
</table>
${data.downloadLink ? `
<!-- Download Section -->
<div style="padding: 20px; background-color: #e7f3ff; border-left: 4px solid #0066cc; border-radius: 4px; margin-bottom: 30px;">
<h3 style="margin: 0 0 10px; color: #004085; font-size: 16px; font-weight: 600;">Download Credit Note</h3>
<p style="margin: 0 0 15px; color: #004085; font-size: 14px; line-height: 1.8;">
You can download the credit note using the link below.
</p>
<table role="presentation" style="width: 100%; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: center;">
<a href="${data.downloadLink}" class="cta-button" style="display: inline-block; padding: 12px 30px; background-color: #0066cc; color: #ffffff; text-decoration: none; text-align: center; border-radius: 6px; font-size: 14px; font-weight: 600;">
Download Credit Note
</a>
</td>
</tr>
</table>
</div>
` : ''}
<!-- Completion Message -->
<div style="padding: 20px; background-color: #d4edda; border-left: 4px solid #28a745; border-radius: 4px; margin-bottom: 30px;">
<h3 style="margin: 0 0 10px; color: #155724; font-size: 16px; font-weight: 600;">Claim Process Completed</h3>
<p style="margin: 0; color: #155724; font-size: 14px; line-height: 1.8;">
The credit note has been sent to <strong>${data.dealerEmail}</strong>. The claim management process for this request is now complete.
</p>
</div>
<!-- View Details Button -->
<table role="presentation" style="width: 100%; border-collapse: collapse; margin-bottom: 20px;" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: center;">
<a href="${data.viewDetailsLink}" class="cta-button" style="display: inline-block; padding: 15px 40px; background-color: #1a1a1a; color: #ffffff; text-decoration: none; text-align: center; border-radius: 6px; font-size: 16px; font-weight: 600; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); min-width: 200px;">
View Request Details
</a>
</td>
</tr>
</table>
<p style="margin: 0; color: #666666; font-size: 14px; line-height: 1.6; text-align: center;">
Thank you for using the ${data.companyName} Workflow System.
</p>
</td>
</tr>
${getEmailFooter(data.companyName)}
</table>
</td>
</tr>
</table>
</body>
</html>
`;
}