mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: add entries-columns.
This commit is contained in:
@@ -4,6 +4,7 @@ import styled from 'styled-components';
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Popover,
|
Popover,
|
||||||
|
Tooltip,
|
||||||
PopoverInteractionKind,
|
PopoverInteractionKind,
|
||||||
Position,
|
Position,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
@@ -11,12 +12,14 @@ import {
|
|||||||
Intent,
|
Intent,
|
||||||
Tag,
|
Tag,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
|
import { getColumnWidth } from 'utils';
|
||||||
import {
|
import {
|
||||||
FormatNumberCell,
|
FormatNumberCell,
|
||||||
Icon,
|
Icon,
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
Choose,
|
Choose,
|
||||||
Can,
|
Can,
|
||||||
|
MODIFIER,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import {
|
import {
|
||||||
SaleInvoiceAction,
|
SaleInvoiceAction,
|
||||||
@@ -24,24 +27,55 @@ import {
|
|||||||
} from '../../../common/abilityOption';
|
} from '../../../common/abilityOption';
|
||||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||||
|
|
||||||
|
export function TooltipAccessor({ cell: { value } }) {
|
||||||
|
return (
|
||||||
|
<Tooltip
|
||||||
|
content={value}
|
||||||
|
position={Position.BOTTOM_LEFT}
|
||||||
|
boundary={'viewport'}
|
||||||
|
className={MODIFIER.SELECT_LIST_TOOLTIP_ITEMS} // block
|
||||||
|
>
|
||||||
|
{value}
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve invoice readonly details table columns.
|
* Retrieve invoice readonly details table columns.
|
||||||
*/
|
*/
|
||||||
export const useInvoiceReadonlyEntriesColumns = () =>
|
export const useInvoiceReadonlyEntriesColumns = () => {
|
||||||
React.useMemo(
|
// Invoice details drawer context.
|
||||||
|
const {
|
||||||
|
invoice: { entries },
|
||||||
|
} = useInvoiceDetailDrawerContext();
|
||||||
|
|
||||||
|
return React.useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
Header: intl.get('product_and_service'),
|
Header: intl.get('product_and_service'),
|
||||||
accessor: 'item.name',
|
accessor: 'item.name',
|
||||||
width: 150,
|
Cell: TooltipAccessor,
|
||||||
|
width: getColumnWidth(entries, 'item.name', {
|
||||||
|
minWidth: 100,
|
||||||
|
maxWidth: 150,
|
||||||
|
magicSpacing: 5,
|
||||||
|
}),
|
||||||
className: 'name',
|
className: 'name',
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
|
textOverview: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('description'),
|
Header: intl.get('description'),
|
||||||
accessor: 'description',
|
accessor: 'description',
|
||||||
|
// Cell: TooltipAccessor,
|
||||||
className: 'description',
|
className: 'description',
|
||||||
|
width: getColumnWidth(entries, 'description', {
|
||||||
|
minWidth: 100,
|
||||||
|
maxWidth: 150,
|
||||||
|
magicSpacing: 5,
|
||||||
|
}),
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
|
textOverview: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('quantity'),
|
Header: intl.get('quantity'),
|
||||||
@@ -70,6 +104,7 @@ export const useInvoiceReadonlyEntriesColumns = () =>
|
|||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoice details more actions menu.
|
* Invoice details more actions menu.
|
||||||
|
|||||||
Reference in New Issue
Block a user