fix: mail state

This commit is contained in:
Ahmed Bouhuolia
2025-06-09 15:37:20 +02:00
parent 4366bf478a
commit 90d6bea9b9
12 changed files with 285 additions and 64 deletions

View File

@@ -1,8 +1,5 @@
import { Transformer } from '@/modules/Transformer/Transformer';
import { Bill } from '../models/Bill';
import { AttachmentTransformer } from '@/modules/Attachments/Attachment.transformer';
import { ItemEntryTransformer } from '@/modules/TransactionItemEntry/ItemEntry.transformer';
import { SaleInvoiceTaxEntryTransformer } from '@/modules/SaleInvoices/queries/SaleInvoiceTaxEntry.transformer';
export class BillTransformer extends Transformer {
/**
@@ -23,6 +20,9 @@ export class BillTransformer extends Transformer {
'subtotalLocalFormatted',
'subtotalExcludingTaxFormatted',
'taxAmountWithheldLocalFormatted',
'discountAmountFormatted',
'discountPercentageFormatted',
'adjustmentFormatted',
'totalFormatted',
'totalLocalFormatted',
'taxes',
@@ -183,6 +183,37 @@ export class BillTransformer extends Transformer {
});
};
/**
* Retrieves the formatted discount amount.
* @param {IBill} bill
* @returns {string}
*/
protected discountAmountFormatted = (bill: Bill): string => {
return this.formatNumber(bill.discountAmount, {
currencyCode: bill.currencyCode,
});
};
/**
* Retrieves the formatted discount percentage.
* @param {IBill} bill
* @returns {string}
*/
protected discountPercentageFormatted = (bill: Bill): string => {
return bill.discountPercentage ? `${bill.discountPercentage}%` : '';
};
/**
* Retrieves the formatted adjustment amount.
* @param {IBill} bill
* @returns {string}
*/
protected adjustmentFormatted = (bill: Bill): string => {
return this.formatNumber(bill.adjustment, {
currencyCode: bill.currencyCode,
});
};
/**
* Retrieve the taxes lines of bill.
* @param {Bill} bill