mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
34 lines
863 B
TypeScript
34 lines
863 B
TypeScript
import { Transformer } from '@/lib/Transformer/Transformer';
|
|
import { formatNumber } from 'utils';
|
|
|
|
export class CashflowTransactionTransformer extends Transformer {
|
|
/**
|
|
* Include these attributes to sale invoice object.
|
|
* @returns {string[]}
|
|
*/
|
|
public includeAttributes = (): string[] => {
|
|
return ['formattedAmount', 'transactionTypeFormatted'];
|
|
};
|
|
|
|
/**
|
|
* Formatted amount.
|
|
* @param {} transaction
|
|
* @returns {string}
|
|
*/
|
|
protected formattedAmount = (transaction) => {
|
|
return formatNumber(transaction.amount, {
|
|
currencyCode: transaction.currencyCode,
|
|
excerptZero: true,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Formatted transaction type.
|
|
* @param transaction
|
|
* @returns {string}
|
|
*/
|
|
protected transactionTypeFormatted = (transaction) => {
|
|
return this.context.i18n.__(transaction.transactionTypeFormatted);
|
|
}
|
|
}
|