mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
fix: transactions by customers/vendors report localization.
This commit is contained in:
@@ -38,22 +38,22 @@ export default class InventoryDetailsTable {
|
||||
* @param {IInventoryDetailsItem} item
|
||||
* @returns {ITableRow}
|
||||
*/
|
||||
private itemNodeMapper(item: IInventoryDetailsItem) {
|
||||
private itemNodeMapper = (item: IInventoryDetailsItem) => {
|
||||
const columns = [{ key: 'item_name', accessor: 'name' }];
|
||||
|
||||
return tableRowMapper(item, columns, {
|
||||
rowTypes: [IROW_TYPE.ITEM],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mappes the item inventory transaction to table row.
|
||||
* @param {IInventoryDetailsItemTransaction} transaction
|
||||
* @returns {ITableRow}
|
||||
*/
|
||||
private itemTransactionNodeMapper(
|
||||
private itemTransactionNodeMapper = (
|
||||
transaction: IInventoryDetailsItemTransaction
|
||||
) {
|
||||
) => {
|
||||
const columns = [
|
||||
{ key: 'date', accessor: 'date.formattedDate' },
|
||||
{ key: 'transaction_type', accessor: 'transactionType' },
|
||||
@@ -75,17 +75,19 @@ export default class InventoryDetailsTable {
|
||||
return tableRowMapper(transaction, columns, {
|
||||
rowTypes: [IROW_TYPE.TRANSACTION],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Opening balance transaction mapper to table row.
|
||||
* @param {IInventoryDetailsOpening} transaction
|
||||
* @returns {ITableRow}
|
||||
*/
|
||||
private openingNodeMapper(transaction: IInventoryDetailsOpening): ITableRow {
|
||||
private openingNodeMapper = (
|
||||
transaction: IInventoryDetailsOpening
|
||||
): ITableRow => {
|
||||
const columns = [
|
||||
{ key: 'date', accessor: 'date.formattedDate' },
|
||||
{ key: 'closing', value: 'Opening Balance' },
|
||||
{ key: 'closing', value: this.i18n.__('Opening balance') },
|
||||
{ key: 'empty' },
|
||||
{ key: 'quantity', accessor: 'quantity.formattedNumber' },
|
||||
{ key: 'empty' },
|
||||
@@ -95,17 +97,19 @@ export default class InventoryDetailsTable {
|
||||
return tableRowMapper(transaction, columns, {
|
||||
rowTypes: [IROW_TYPE.OPENING_ENTRY],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Closing balance transaction mapper to table raw.
|
||||
* @param {IInventoryDetailsClosing} transaction
|
||||
* @returns {ITableRow}
|
||||
*/
|
||||
private closingNodeMapper(transaction: IInventoryDetailsClosing): ITableRow {
|
||||
private closingNodeMapper = (
|
||||
transaction: IInventoryDetailsClosing
|
||||
): ITableRow => {
|
||||
const columns = [
|
||||
{ key: 'date', accessor: 'date.formattedDate' },
|
||||
{ key: 'closing', value: 'Closing Balance' },
|
||||
{ key: 'closing', value: this.i18n.__('Closing balance') },
|
||||
{ key: 'empty' },
|
||||
{ key: 'quantity', accessor: 'quantity.formattedNumber' },
|
||||
{ key: 'empty' },
|
||||
@@ -117,7 +121,7 @@ export default class InventoryDetailsTable {
|
||||
return tableRowMapper(transaction, columns, {
|
||||
rowTypes: [IROW_TYPE.CLOSING_ENTRY],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Detarmines the ginve inventory details node type.
|
||||
@@ -125,16 +129,19 @@ export default class InventoryDetailsTable {
|
||||
* @param {IInventoryDetailsNode} node
|
||||
* @returns {boolean}
|
||||
*/
|
||||
private isNodeTypeEquals(type: string, node: IInventoryDetailsNode): boolean {
|
||||
private isNodeTypeEquals = (
|
||||
type: string,
|
||||
node: IInventoryDetailsNode
|
||||
): boolean => {
|
||||
return node.nodeType === type;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mappes the given item or transactions node to table rows.
|
||||
* @param {IInventoryDetailsNode} node -
|
||||
* @return {ITableRow}
|
||||
*/
|
||||
private itemMapper(node: IInventoryDetailsNode): ITableRow {
|
||||
private itemMapper = (node: IInventoryDetailsNode): ITableRow => {
|
||||
return R.compose(
|
||||
R.when(
|
||||
R.curry(this.isNodeTypeEquals)('OPENING_ENTRY'),
|
||||
@@ -147,33 +154,33 @@ export default class InventoryDetailsTable {
|
||||
R.when(R.curry(this.isNodeTypeEquals)('item'), this.itemNodeMapper),
|
||||
R.when(
|
||||
R.curry(this.isNodeTypeEquals)('transaction'),
|
||||
this.itemTransactionNodeMapper.bind(this)
|
||||
this.itemTransactionNodeMapper
|
||||
)
|
||||
)(node);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mappes the items nodes to table rows.
|
||||
* @param {IInventoryDetailsItem[]} items
|
||||
* @returns {ITableRow[]}
|
||||
*/
|
||||
private itemsMapper(items: IInventoryDetailsItem[]): ITableRow[] {
|
||||
return mapValuesDeep(items, this.itemMapper.bind(this), MAP_CONFIG);
|
||||
}
|
||||
private itemsMapper = (items: IInventoryDetailsItem[]): ITableRow[] => {
|
||||
return mapValuesDeep(items, this.itemMapper, MAP_CONFIG);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve the table rows of the inventory item details.
|
||||
* @returns {ITableRow[]}
|
||||
*/
|
||||
public tableData(): ITableRow[] {
|
||||
public tableData = (): ITableRow[] => {
|
||||
return this.itemsMapper(this.report.data);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve the table columns of inventory details report.
|
||||
* @returns {ITableColumn[]}
|
||||
*/
|
||||
public tableColumns(): ITableColumn[] {
|
||||
public tableColumns = (): ITableColumn[] => {
|
||||
return [
|
||||
{ key: 'date', label: this.i18n.__('Date') },
|
||||
{ key: 'transaction_type', label: this.i18n.__('Transaction type') },
|
||||
@@ -186,5 +193,5 @@ export default class InventoryDetailsTable {
|
||||
{ key: 'running_quantity', label: this.i18n.__('Running quantity') },
|
||||
{ key: 'running_value', label: this.i18n.__('Running Value') },
|
||||
];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user