feat: link discount to mail receipts

This commit is contained in:
Ahmed Bouhuolia
2024-12-02 18:45:16 +02:00
parent 05cf94940e
commit 5b75fa9286
14 changed files with 294 additions and 18 deletions

View File

@@ -20,6 +20,16 @@ export class GetSaleEstimateMailStateTransformer extends SaleEstimateTransfromer
'subtotal',
'subtotalFormatted',
'discountAmount',
'discountAmountFormatted',
'discountPercentage',
'discountPercentageFormatted',
'discountLabel',
'adjustment',
'adjustmentFormatted',
'adjustmentLabel',
'estimateNumber',
'entries',
@@ -97,6 +107,17 @@ export class GetSaleEstimateMailStateTransformer extends SaleEstimateTransfromer
return estimate.amount;
}
/**
* Retrieves the discount label of the estimate.
* @param estimate
* @returns {string}
*/
protected discountLabel(estimate) {
return estimate.discountType === 'percentage'
? `Discount [${estimate.discountPercentageFormatted}]`
: 'Discount';
}
/**
* Retrieves the formatted total of the estimate.
* @param estimate