feat: change default mail template messages

This commit is contained in:
Ahmed Bouhuolia
2024-11-26 13:15:15 +02:00
parent 7b5f0d3930
commit 4f57782be4
8 changed files with 81 additions and 61 deletions

View File

@@ -80,7 +80,13 @@ export class SendSaleEstimateMail {
tenantId,
estimateId
);
return transformEstimateToMailDataArgs(estimate);
const commonArgs = await this.contactMailNotification.getCommonFormatArgs(
tenantId
);
return {
...commonArgs,
...transformEstimateToMailDataArgs(estimate),
};
};
/**

View File

@@ -1,18 +1,17 @@
export const DEFAULT_ESTIMATE_REMINDER_MAIL_SUBJECT =
'Estimate {Estimate Number} is awaiting your approval';
export const DEFAULT_ESTIMATE_REMINDER_MAIL_CONTENT = `<p>Dear {Customer Name}</p>
<p>Thank you for your business, You can view or print your estimate from attachements.</p>
<p>
Estimate <strong>#{Estimate Number}</strong><br />
Expiration Date : <strong>{Estimate Expiration Date}</strong><br />
Amount : <strong>{Estimate Amount}</strong></br />
</p>
export const DEFAULT_ESTIMATE_REMINDER_MAIL_CONTENT = `Hi {Customer Name},
<p>
<i>Regards</i><br />
<i>{Company Name}</i>
</p>
`;
Here's estimate # {Estimate Number} for {Estimate Amount}
This estimate is valid until {Estimate Expiration Date}, and were happy to discuss any adjustments you or questions may have.
Please find your estimate attached to this email for your reference.
If you have any questions, please let us know.
Thanks,
{Company Name}`;
export const ERRORS = {
SALE_ESTIMATE_NOT_FOUND: 'SALE_ESTIMATE_NOT_FOUND',

View File

@@ -1,5 +1,4 @@
import { Transformer } from '@/lib/Transformer/Transformer';
import { PaymentReceivedEntryTransfromer } from './PaymentReceivedEntryTransformer';
export class GetPaymentReceivedMailTemplateAttrsTransformer extends Transformer {
/**
@@ -13,6 +12,8 @@ export class GetPaymentReceivedMailTemplateAttrsTransformer extends Transformer
'primaryColor',
'total',
'totalLabel',
'subtotal',
'subtotalLabel',
'paymentNumberLabel',
'paymentNumber',
'items',
@@ -75,6 +76,14 @@ export class GetPaymentReceivedMailTemplateAttrsTransformer extends Transformer
return this.options.paymentReceived.formattedAmount;
}
/**
* Subtotal label.
* @returns {string}
*/
public subtotalLabel(): string {
return 'Subtotal';
}
/**
* Payment number label.
* @returns {string}

View File

@@ -1,18 +1,15 @@
export const DEFAULT_PAYMENT_MAIL_SUBJECT =
'Payment Received for {Customer Name} from {Company Name}';
export const DEFAULT_PAYMENT_MAIL_CONTENT = `
<p>Dear {Customer Name}</p>
<p>Thank you for your payment. It was a pleasure doing business with you. We look forward to work together again!</p>
<p>
Payment Date : <strong>{Payment Date}</strong><br />
Amount : <strong>{Payment Amount}</strong></br />
</p>
' Payment Confirmation from {Company Name} Thank You!';
export const DEFAULT_PAYMENT_MAIL_CONTENT = `Dear {Customer Name}
<p>
<i>Regards</i><br />
<i>{Company Name}</i>
</p>
`;
Thank you for your payment. It was a pleasure doing business with you. We look forward to work together again!
Payment Transaction: {Payment Number}
Payment Date : {Payment Date}
Amount : {Payment Amount}
Regards,
{Company Name}`;
export const ERRORS = {
PAYMENT_RECEIVE_NO_EXISTS: 'PAYMENT_RECEIVE_NO_EXISTS',

View File

@@ -20,6 +20,9 @@ export class GetSaleReceiptMailTemplateAttributesTransformer extends Transformer
'total',
'totalLabel',
'subtotal',
'subtotalLabel',
'paidAmount',
'paidAmountLabel',
@@ -64,7 +67,7 @@ export class GetSaleReceiptMailTemplateAttributesTransformer extends Transformer
* @returns {string}
*/
public receiptNumber(): string {
return this.options.receipt.number;
return this.options.receipt.receiptNumber;
}
/**
@@ -72,7 +75,7 @@ export class GetSaleReceiptMailTemplateAttributesTransformer extends Transformer
* @returns {string}
*/
public receiptNumberLabel(): string {
return 'Receipt Number';
return 'Receipt # {receiptNumber}';
}
/**
@@ -95,7 +98,7 @@ export class GetSaleReceiptMailTemplateAttributesTransformer extends Transformer
* Receipt total.
*/
public total(): string {
return this.options.receipt.totalFormatted;
return this.options.receipt.formattedAmount;
}
/**
@@ -106,6 +109,22 @@ export class GetSaleReceiptMailTemplateAttributesTransformer extends Transformer
return 'Total';
}
/**
* Receipt subtotal.
* @returns {string}
*/
public subtotal(): string {
return this.options.receipt.formattedSubtotal;
}
/**
* Receipt subtotal label.
* @returns {string}
*/
public subtotalLabel(): string {
return 'Subtotal';
}
/**
* Receipt mail items attributes.
*/

View File

@@ -115,7 +115,13 @@ export class SaleReceiptMailNotification {
tenantId,
receiptId
);
return transformReceiptToMailDataArgs(receipt);
const commonArgs = await this.contactMailNotification.getCommonFormatArgs(
tenantId
);
return {
...commonArgs,
...transformReceiptToMailDataArgs(receipt),
};
};
/**

View File

@@ -1,18 +1,17 @@
export const DEFAULT_RECEIPT_MAIL_SUBJECT =
'Receipt {Receipt Number} from {Company Name}';
export const DEFAULT_RECEIPT_MAIL_CONTENT = `
<p>Dear {Customer Name}</p>
<p>Thank you for your business, You can view or print your receipt from attachements.</p>
<p>
Receipt <strong>#{Receipt Number}</strong><br />
Amount : <strong>{Receipt Amount}</strong></br />
</p>
export const DEFAULT_RECEIPT_MAIL_CONTENT = `Hi {Customer Name},
<p>
<i>Regards</i><br />
<i>{Company Name}</i>
</p>
`;
Here's receipt # {Receipt Number} for Receipt {Receipt Amount}
The receipt paid on {Receipt Date}, and the total amount paid is {Receipt Amount}.
Please find your sale receipt attached to this email for your reference
If you have any questions, please let us know.
Thanks,
{Company Name}`;
export const ERRORS = {
SALE_RECEIPT_NOT_FOUND: 'SALE_RECEIPT_NOT_FOUND',