mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { isNull } from 'lodash';
|
|
import { Transformer } from '@/lib/Transformer/Transformer';
|
|
import { formatNumber } from 'utils';
|
|
import { IContact } from '@/interfaces';
|
|
|
|
export default class ContactTransfromer extends Transformer {
|
|
/**
|
|
* Retrieve formatted expense amount.
|
|
* @param {IExpense} expense
|
|
* @returns {string}
|
|
*/
|
|
protected formattedBalance = (contact: IContact): string => {
|
|
return formatNumber(contact.balance, {
|
|
currencyCode: contact.currencyCode,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Retrieve formatted expense landed cost amount.
|
|
* @param {IExpense} expense
|
|
* @returns {string}
|
|
*/
|
|
protected formattedOpeningBalance = (contact: IContact): string => {
|
|
return !isNull(contact.openingBalance)
|
|
? formatNumber(contact.openingBalance, {
|
|
currencyCode: contact.currencyCode,
|
|
})
|
|
: '';
|
|
};
|
|
|
|
/**
|
|
* Retriecve fromatted date.
|
|
* @param {IExpense} expense
|
|
* @returns {string}
|
|
*/
|
|
protected formattedOpeningBalanceAt = (contact: IContact): string => {
|
|
return !isNull(contact.openingBalanceAt)
|
|
? this.formatDate(contact.openingBalanceAt)
|
|
: '';
|
|
};
|
|
}
|