mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
WIP: customer/vendor balance summary.
This commit is contained in:
@@ -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
26
server/src/utils/table.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user