WIP: customer/vendor balance summary.

This commit is contained in:
a.bouhuolia
2021-05-05 21:41:10 +02:00
parent 8ca3509f03
commit 97d12d4294
18 changed files with 674 additions and 176 deletions

View File

@@ -5,6 +5,8 @@ import accounting from 'accounting';
import Currencies from 'js-money/lib/currency';
import definedOptions from 'data/options';
export * from './table';
const hashPassword = (password) =>
new Promise((resolve) => {
bcrypt.genSalt(10, (error, salt) => {

26
server/src/utils/table.ts Normal file
View File

@@ -0,0 +1,26 @@
import { get } from 'lodash';
import { IColumnMapperMeta, ITableRow } from 'interfaces';
export function tableMapper(
data: Object[],
columns: IColumnMapperMeta[],
rowsMeta
): ITableRow[] {
return data.map((object) => tableRowMapper(object, columns, rowsMeta));
}
export function tableRowMapper(
object: Object,
columns: IColumnMapperMeta[],
rowMeta
): ITableRow {
const cells = columns.map((column) => ({
key: column.key,
value: column.value ? column.value : get(object, column.accessor),
}));
return {
cells,
...rowMeta,
};
}