feat: mail receipt preview

This commit is contained in:
Ahmed Bouhuolia
2024-11-23 20:36:46 +02:00
parent d5b0546301
commit da47418f17
17 changed files with 388 additions and 77 deletions

View File

@@ -32,6 +32,7 @@ export class GetPaymentReceivedMailState {
.findById(paymentId)
.withGraphFetched('customer')
.withGraphFetched('entries.invoice')
.withGraphFetched('pdfTemplate')
.throwIfNotFound();
const mailOptions =

View File

@@ -26,7 +26,10 @@ export class GetPaymentReceivedMailStateTransformer extends PaymentReceiveTransf
'total',
'totalFormatted',
'paymentNo',
'subtotal',
'subtotalFormatted',
'paymentNumber',
'entries',
@@ -87,6 +90,17 @@ export class GetPaymentReceivedMailStateTransformer extends PaymentReceiveTransf
return this.formatMoney(payment.paymentAmount);
};
/**
* Retrieves the payment amount.
* @param payment
* @returns {number}
*/
protected total = (payment) => {
return this.formatNumber(payment.amount, {
money: false,
});
};
/**
* Retrieves the formatted payment amount.
* @returns {string}
@@ -95,6 +109,34 @@ export class GetPaymentReceivedMailStateTransformer extends PaymentReceiveTransf
return this.formatMoney(payment.total);
};
/**
* Retrieves the payment amount.
* @param payment
* @returns {number}
*/
protected subtotal = (payment) => {
return this.formatNumber(payment.amount, {
money: false,
});
};
/**
* Retrieves the formatted payment amount.
* @returns {string}
*/
protected subtotalFormatted = (payment) => {
return this.formatMoney(payment.total);
};
/**
* Retrieves the payment number.
* @param payment
* @returns {string}
*/
protected paymentNumber = (payment) => {
return payment.paymentReceiveNo;
};
/**
* Retrieves the payment entries.
* @param {IPaymentReceived} payment