mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-14 11:50:31 +00:00
84 lines
2.0 KiB
TypeScript
84 lines
2.0 KiB
TypeScript
import { get } from 'lodash';
|
|
import { TransactionsLockingGroup } from '@/interfaces';
|
|
import { Transformer } from '@/lib/Transformer/Transformer';
|
|
import { getTransactionsLockingSchemaMeta } from './constants';
|
|
|
|
export default class TransactionsLockingMetaTransformer extends Transformer {
|
|
/**
|
|
* Include these attributes to sale credit note object.
|
|
* @returns {Array}
|
|
*/
|
|
public includeAttributes = (): string[] => {
|
|
return [
|
|
'module',
|
|
'formattedModule',
|
|
'description',
|
|
'formattedLockToDate',
|
|
'formattedUnlockFromDate',
|
|
'formattedUnlockToDate',
|
|
];
|
|
};
|
|
|
|
/**
|
|
* Module slug.
|
|
* @returns {string}
|
|
*/
|
|
protected module = () => {
|
|
return this.options.module;
|
|
};
|
|
|
|
/**
|
|
* Formatted module name.
|
|
* @returns {string}
|
|
*/
|
|
protected formattedModule = () => {
|
|
return this.options.module === TransactionsLockingGroup.All
|
|
? this.context.i18n.__('transactions_locking.module.all_transactions')
|
|
: this.context.i18n.__(
|
|
get(
|
|
getTransactionsLockingSchemaMeta(this.options.module),
|
|
'formattedModule'
|
|
)
|
|
);
|
|
};
|
|
|
|
/**
|
|
* Module description.
|
|
* @returns {string}
|
|
*/
|
|
protected description = () => {
|
|
return this.options.module === TransactionsLockingGroup.All
|
|
? ''
|
|
: this.context.i18n.__(
|
|
get(
|
|
getTransactionsLockingSchemaMeta(this.options.module),
|
|
'description'
|
|
)
|
|
);
|
|
};
|
|
|
|
/**
|
|
* Formatted unlock to date.
|
|
* @returns {string}
|
|
*/
|
|
protected formattedUnlockToDate = (item) => {
|
|
return item.unlockToDate ? this.formatDate(item.unlockToDate) : '';
|
|
};
|
|
|
|
/**
|
|
* Formatted unlock from date.
|
|
* @returns {string}
|
|
*/
|
|
protected formattedUnlockFromDate = (item) => {
|
|
return item.unlockFromDate ? this.formatDate(item.unlockFromDate) : '';
|
|
};
|
|
|
|
/**
|
|
* Formatted lock to date.
|
|
* @returns {string}
|
|
*/
|
|
protected formattedLockToDate = (item) => {
|
|
return item.lockToDate ? this.formatDate(item.lockToDate) : '';
|
|
};
|
|
}
|