mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
feat: sales by items dynamic columns
This commit is contained in:
@@ -44,10 +44,22 @@ const numericColumnAccessor = R.curry((data, column) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Item name column accessor.
|
||||||
|
*/
|
||||||
|
const itemNameColumnAccessor = R.curry((data, column) => {
|
||||||
|
return {
|
||||||
|
...column,
|
||||||
|
width: 180,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const dynamiColumnMapper = R.curry((data, column) => {
|
const dynamiColumnMapper = R.curry((data, column) => {
|
||||||
const _numericColumnAccessor = numericColumnAccessor(data);
|
const _numericColumnAccessor = numericColumnAccessor(data);
|
||||||
|
const _itemNameColumnAccessor = itemNameColumnAccessor(data);
|
||||||
|
|
||||||
return R.compose(
|
return R.compose(
|
||||||
|
R.when(R.pathEq(['key'], 'item_name'), _itemNameColumnAccessor),
|
||||||
R.when(R.pathEq(['key'], 'sold_quantity'), _numericColumnAccessor),
|
R.when(R.pathEq(['key'], 'sold_quantity'), _numericColumnAccessor),
|
||||||
R.when(R.pathEq(['key'], 'sold_amount'), _numericColumnAccessor),
|
R.when(R.pathEq(['key'], 'sold_amount'), _numericColumnAccessor),
|
||||||
R.when(R.pathEq(['key'], 'average_price'), _numericColumnAccessor),
|
R.when(R.pathEq(['key'], 'average_price'), _numericColumnAccessor),
|
||||||
|
|||||||
Reference in New Issue
Block a user