feat: estimate tooltip.

This commit is contained in:
elforjani13
2022-04-09 00:42:34 +02:00
parent 2ced5dc013
commit cc457e1e43

View File

@@ -1,47 +1,74 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { FormatNumberCell } from '../../../components'; import { FormatNumberCell, TextOverviewTooltipCell } from '../../../components';
import { getColumnWidth } from 'utils';
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
/** /**
* Retrieve table columns of estimate readonly entries details. * Retrieve table columns of estimate readonly entries details.
*/ */
export const useEstimateReadonlyEntriesColumns = () => export const useEstimateReadonlyEntriesColumns = () => {
React.useMemo(() => [ // estimate details drawer context.
{ const {
Header: intl.get('product_and_service'), estimate: { entries },
accessor: 'item.name', } = useEstimateDetailDrawerContext();
width: 150,
className: 'name', return React.useMemo(
disableSortBy: true, () => [
}, {
{ Header: intl.get('product_and_service'),
Header: intl.get('description'), accessor: 'item.name',
accessor: 'description', Cell: TextOverviewTooltipCell,
className: 'description', width: 150,
disableSortBy: true, className: 'name',
}, disableSortBy: true,
{ textOverview: true,
Header: intl.get('quantity'), },
accessor: 'quantity', {
Cell: FormatNumberCell, Header: intl.get('description'),
width: 100, accessor: 'description',
align: 'right', Cell: TextOverviewTooltipCell,
disableSortBy: true, className: 'description',
}, disableSortBy: true,
{ textOverview: true,
Header: intl.get('rate'), },
accessor: 'rate', {
Cell: FormatNumberCell, Header: intl.get('quantity'),
width: 100, accessor: 'quantity',
align: 'right', Cell: FormatNumberCell,
disableSortBy: true, width: getColumnWidth(entries, 'quantity', {
}, minWidth: 60,
{ magicSpacing: 5,
Header: intl.get('amount'), }),
accessor: 'amount', align: 'right',
Cell: FormatNumberCell, disableSortBy: true,
width: 100, textOverview: true,
align: 'right', },
disableSortBy: true, {
}, Header: intl.get('rate'),
], []); accessor: 'rate',
Cell: FormatNumberCell,
width: getColumnWidth(entries, 'rate', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right',
disableSortBy: true,
textOverview: true,
},
{
Header: intl.get('amount'),
accessor: 'amount',
Cell: FormatNumberCell,
width: getColumnWidth(entries, 'amount', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right',
disableSortBy: true,
textOverview: true,
},
],
[],
);
};