chrone: sperate client and server to different repos.

This commit is contained in:
a.bouhuolia
2021-09-21 17:13:53 +02:00
parent e011b2a82b
commit 18df5530c7
10015 changed files with 17686 additions and 97524 deletions

View File

@@ -0,0 +1,76 @@
import React, { useMemo } from 'react';
import intl from 'react-intl-universal';
import { getColumnWidth } from 'utils';
import { If } from 'components';
import { CellTextSpan } from 'components/Datatable/Cells';
import { useInventoryValuationContext } from './InventoryValuationProvider';
import FinancialLoadingBar from '../FinancialLoadingBar';
/**
* Retrieve inventory valuation table columns.
*/
export const useInventoryValuationTableColumns = () => {
// inventory valuation context
const {
inventoryValuation: { tableRows },
} = useInventoryValuationContext();
return useMemo(
() => [
{
Header: intl.get('item_name'),
accessor: (row) => (row.code ? `${row.name} - ${row.code}` : row.name),
className: 'name',
width: 240,
textOverview: true,
},
{
Header: intl.get('quantity'),
accessor: 'quantity_formatted',
Cell: CellTextSpan,
className: 'quantity_formatted',
width: getColumnWidth(tableRows, `quantity_formatted`, {
minWidth: 120,
}),
textOverview: true,
},
{
Header: intl.get('asset_value'),
accessor: 'valuation_formatted',
Cell: CellTextSpan,
className: 'valuation',
width: getColumnWidth(tableRows, `valuation_formatted`, {
minWidth: 120,
}),
textOverview: true,
},
{
Header: intl.get('average'),
accessor: 'average_formatted',
Cell: CellTextSpan,
className: 'average_formatted',
width: getColumnWidth(tableRows, `average_formatted`, {
minWidth: 120,
}),
textOverview: true,
},
],
[tableRows],
);
};
/**
* inventory valuation progress loading bar.
*/
export function InventoryValuationLoadingBar() {
const { isFetching } = useInventoryValuationContext();
return (
<If condition={isFetching}>
<FinancialLoadingBar />
</If>
);
}