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 from 'react';
import intl from 'react-intl-universal';
import { Button } from '@blueprintjs/core';
import { getColumnWidth } from 'utils';
import { If, Icon } from 'components';
import { CellTextSpan } from 'components/Datatable/Cells';
import { usePurchaseByItemsContext } from './PurchasesByItemsProvider';
import FinancialLoadingBar from '../FinancialLoadingBar';
/**
* Retrieve purchases by items table columns.
*/
export const usePurchasesByItemsTableColumns = () => {
// purchases by items context.
const {
purchaseByItems: { tableRows },
} = usePurchaseByItemsContext();
return React.useMemo(
() => [
{
Header: intl.get('item_name'),
accessor: (row) => (row.code ? `${row.name} - ${row.code}` : row.name),
className: 'name',
width: 180,
textOverview: true,
},
{
Header: intl.get('quantity_purchased'),
accessor: 'quantity_purchased_formatted',
Cell: CellTextSpan,
className: 'quantity_purchased_formatted',
width: getColumnWidth(tableRows, `quantity_purchased_formatted`, {
minWidth: 150,
}),
textOverview: true,
},
{
Header: intl.get('purchase_amount'),
accessor: 'purchase_cost_formatted',
Cell: CellTextSpan,
className: 'purchase_cost_formatted',
width: getColumnWidth(tableRows, `purchase_cost_formatted`, {
minWidth: 150,
}),
textOverview: true,
},
{
Header: intl.get('average_price'),
accessor: 'average_cost_price_formatted',
Cell: CellTextSpan,
className: 'average_cost_price_formatted',
width: getColumnWidth(tableRows, `average_cost_price_formatted`, {
minWidth: 180,
}),
textOverview: true,
},
],
[tableRows],
);
};
/**
* Purchases by items progress loading bar.
*/
export function PurchasesByItemsLoadingBar() {
const { isFetching } = usePurchaseByItemsContext();
return (
<If condition={isFetching}>
<FinancialLoadingBar />
</If>
);
}