Merge branch 'BIG-entries-columns' of https://github.com/bigcapitalhq/client into develop

This commit is contained in:
a.bouhuolia
2022-04-15 04:36:08 +02:00
17 changed files with 469 additions and 192 deletions

View File

@@ -11,7 +11,7 @@ export const CommercialDocHeader = styled.div`
`; `;
export const CommercialDocTopHeader = styled.div` export const CommercialDocTopHeader = styled.div`
margin-bottom: 25px; margin-bottom: 30px;
`; `;
export const CommercialDocEntriesTable = styled(DataTable)` export const CommercialDocEntriesTable = styled(DataTable)`

View File

@@ -0,0 +1,27 @@
import React from 'react';
import { Tooltip, Position } from '@blueprintjs/core';
/**
* Text overview tooltip cell.
* @returns {JSX.Element}
*/
export function TextOverviewTooltipCell({ cell: { value } }) {
const SUBMENU_POPOVER_MODIFIERS = {
flip: { boundariesElement: 'viewport', padding: 20 },
offset: { offset: '0, 10' },
preventOverflow: { boundariesElement: 'viewport', padding: 40 },
};
return (
<Tooltip
content={value}
position={Position.BOTTOM_LEFT}
boundary={'viewport'}
minimal={true}
modifiers={SUBMENU_POPOVER_MODIFIERS}
targetClassName={'table-tooltip-overview-target'}
>
{value}
</Tooltip>
);
}

View File

@@ -10,6 +10,7 @@ import CheckBoxFieldCell from './CheckBoxFieldCell';
import SwitchFieldCell from './SwitchFieldCell'; import SwitchFieldCell from './SwitchFieldCell';
import TextAreaCell from './TextAreaCell'; import TextAreaCell from './TextAreaCell';
import BranchesListFieldCell from './BranchesListFieldCell'; import BranchesListFieldCell from './BranchesListFieldCell';
import { TextOverviewTooltipCell } from './TextOverviewTooltipCell';
export { export {
AccountsListFieldCell, AccountsListFieldCell,
@@ -25,4 +26,5 @@ export {
SwitchFieldCell, SwitchFieldCell,
TextAreaCell, TextAreaCell,
BranchesListFieldCell, BranchesListFieldCell,
TextOverviewTooltipCell,
}; };

View File

@@ -49,7 +49,6 @@ import DrawerHeaderContent from './Drawer/DrawerHeaderContent';
import Postbox from './Postbox'; import Postbox from './Postbox';
import AccountsSuggestField from './AccountsSuggestField'; import AccountsSuggestField from './AccountsSuggestField';
import MaterialProgressBar from './MaterialProgressBar'; import MaterialProgressBar from './MaterialProgressBar';
import { MoneyFieldCell } from './DataTableCells';
import AvaterCell from './AvaterCell'; import AvaterCell from './AvaterCell';
import { ItemsMultiSelect } from './Items'; import { ItemsMultiSelect } from './Items';
@@ -105,6 +104,7 @@ export * from './Currencies';
export * from './FormTopbar' export * from './FormTopbar'
export * from './Paper'; export * from './Paper';
export * from './Accounts' export * from './Accounts'
export * from './DataTableCells';
const Hint = FieldHint; const Hint = FieldHint;
@@ -167,7 +167,6 @@ export {
Postbox, Postbox,
AccountsSuggestField, AccountsSuggestField,
MaterialProgressBar, MaterialProgressBar,
MoneyFieldCell,
ItemsMultiSelect, ItemsMultiSelect,
AvaterCell, AvaterCell,
MoreMenuItems, MoreMenuItems,

View File

@@ -13,57 +13,81 @@ import {
} from '@blueprintjs/core'; } from '@blueprintjs/core';
import { import {
FormatNumberCell, FormatNumberCell,
TextOverviewTooltipCell,
FormattedMessage as T, FormattedMessage as T,
Choose, Choose,
Icon, Icon,
} from '../../../components'; } from '../../../components';
import { getColumnWidth } from 'utils';
import { useBillDrawerContext } from './BillDrawerProvider';
/** /**
* Retrieve bill readonly details entries table columns. * Retrieve bill readonly details entries table columns.
*/ */
export const useBillReadonlyEntriesTableColumns = () => export const useBillReadonlyEntriesTableColumns = () => {
React.useMemo( const {
bill: { entries },
} = useBillDrawerContext();
return React.useMemo(
() => [ () => [
{ {
Header: intl.get('product_and_service'), Header: intl.get('product_and_service'),
accessor: 'item.name', accessor: 'item.name',
Cell: TextOverviewTooltipCell,
width: 150, width: 150,
className: 'item', className: 'item',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('description'), Header: intl.get('description'),
accessor: 'description', accessor: 'description',
Cell: TextOverviewTooltipCell,
className: 'description', className: 'description',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('quantity'), Header: intl.get('quantity'),
accessor: 'quantity', accessor: 'quantity',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'quantity', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('rate'), Header: intl.get('rate'),
accessor: 'rate', accessor: 'rate',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'rate', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('amount'), Header: intl.get('amount'),
accessor: 'amount', accessor: 'amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'amount', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
], ],
[], [],
); );
};
/** /**
* Bill details status. * Bill details status.

View File

@@ -10,56 +10,81 @@ import {
Tag, Tag,
Intent, Intent,
} from '@blueprintjs/core'; } from '@blueprintjs/core';
import { getColumnWidth } from 'utils';
import { import {
Icon, Icon,
FormattedMessage as T, FormattedMessage as T,
TextOverviewTooltipCell,
FormatNumberCell, FormatNumberCell,
Choose, Choose,
} from '../../../components'; } from '../../../components';
import { useCreditNoteDetailDrawerContext } from './CreditNoteDetailDrawerProvider';
export const useCreditNoteReadOnlyEntriesColumns = () => export const useCreditNoteReadOnlyEntriesColumns = () => {
React.useMemo( // credit note details drawer context.
const {
creditNote: { entries },
} = useCreditNoteDetailDrawerContext();
return React.useMemo(
() => [ () => [
{ {
Header: intl.get('product_and_service'), Header: intl.get('product_and_service'),
accessor: 'item.name', accessor: 'item.name',
Cell: TextOverviewTooltipCell,
width: 150, width: 150,
className: 'name', className: 'name',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('description'), Header: intl.get('description'),
accessor: 'description', accessor: 'description',
Cell: TextOverviewTooltipCell,
className: 'description', className: 'description',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('quantity'), Header: intl.get('quantity'),
accessor: 'quantity', accessor: 'quantity',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'quantity', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('rate'), Header: intl.get('rate'),
accessor: 'rate', accessor: 'rate',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'rate', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('amount'), Header: intl.get('amount'),
accessor: 'amount', accessor: 'amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'amount', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
], ],
[], [],
); );
};
/** /**
* Credit note more actions mneu. * Credit note more actions mneu.

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 {
estimate: { entries },
} = useEstimateDetailDrawerContext();
return React.useMemo(
() => [
{ {
Header: intl.get('product_and_service'), Header: intl.get('product_and_service'),
accessor: 'item.name', accessor: 'item.name',
Cell: TextOverviewTooltipCell,
width: 150, width: 150,
className: 'name', className: 'name',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('description'), Header: intl.get('description'),
accessor: 'description', accessor: 'description',
Cell: TextOverviewTooltipCell,
className: 'description', className: 'description',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('quantity'), Header: intl.get('quantity'),
accessor: 'quantity', accessor: 'quantity',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'quantity', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('rate'), Header: intl.get('rate'),
accessor: 'rate', accessor: 'rate',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'rate', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('amount'), Header: intl.get('amount'),
accessor: 'amount', accessor: 'amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'amount', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
], []); ],
[],
);
};

View File

@@ -1,33 +1,45 @@
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 { useExpenseDrawerContext } from './ExpenseDrawerProvider';
import { getColumnWidth } from 'utils';
/** /**
* Retrieve expense readonly details entries table columns. * Retrieve expense readonly details entries table columns.
*/ */
export const useExpenseReadEntriesColumns = () => export const useExpenseReadEntriesColumns = () => {
React.useMemo( // Expense drawer context.
const {
expense: { categories },
} = useExpenseDrawerContext();
return React.useMemo(
() => [ () => [
{ {
Header: intl.get('expense_account'), Header: intl.get('expense_account'),
accessor: 'expense_account.name', accessor: 'expense_account.name',
width: 110, width: 110,
disableSortBy: true, disableSortBy: true,
textOverview: true,
className: 'account', className: 'account',
}, },
{ {
Header: intl.get('description'), Header: intl.get('description'),
accessor: 'description', accessor: 'description',
width: 110, Cell: TextOverviewTooltipCell,
disableSortBy: true,
className: 'description', className: 'description',
disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('amount'), Header: intl.get('amount'),
accessor: 'amount', accessor: 'amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(categories, 'amount', {
minWidth: 60,
magicSpacing: 5,
}),
disableSortBy: true, disableSortBy: true,
className: 'amount', className: 'amount',
align: 'right', align: 'right',
@@ -35,3 +47,4 @@ export const useExpenseReadEntriesColumns = () =>
], ],
[], [],
); );
};

View File

@@ -1,37 +1,60 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { getColumnWidth } from 'utils';
import { TextOverviewTooltipCell } from 'components';
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
export const useInventoryAdjustmentEntriesColumns = () => export const useInventoryAdjustmentEntriesColumns = () => {
React.useMemo( // Inventory adjustment details drawer context.
const {
inventoryAdjustment: { entries },
} = useInventoryAdjustmentDrawerContext();
return React.useMemo(
() => [ () => [
{ {
Header: intl.get('inventory_adjustment.column.product'), Header: intl.get('inventory_adjustment.column.product'),
accessor: 'item.name', accessor: 'item.name',
width: 150, Cell: TextOverviewTooltipCell,
width: 100,
className: 'name', className: 'name',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('quantity'), Header: intl.get('quantity'),
accessor: 'quantity', accessor: 'quantity',
width: 100, width: getColumnWidth(entries, 'quantity', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('cost'), Header: intl.get('cost'),
accessor: 'cost', accessor: 'cost',
width: 100, width: getColumnWidth(entries, 'cost', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('value'), Header: intl.get('value'),
accessor: 'value', accessor: 'value',
width: 100, width: getColumnWidth(entries, 'value', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
], ],
[], [],
); );
};

View File

@@ -11,12 +11,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,
TextOverviewTooltipCell,
} from 'components'; } from 'components';
import { import {
SaleInvoiceAction, SaleInvoiceAction,
@@ -27,49 +29,69 @@ import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
/** /**
* 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: TextOverviewTooltipCell,
className: 'name',
disableSortBy: true, disableSortBy: true,
textOverview: true,
width: 150,
}, },
{ {
Header: intl.get('description'), Header: intl.get('description'),
accessor: 'description', accessor: 'description',
className: 'description', Cell: TextOverviewTooltipCell,
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('quantity'), Header: intl.get('quantity'),
accessor: 'quantity', accessor: 'quantity',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100,
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
width: getColumnWidth(entries, 'quantity', {
minWidth: 60,
magicSpacing: 5,
}),
}, },
{ {
Header: intl.get('rate'), Header: intl.get('rate'),
accessor: 'rate', accessor: 'rate',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100,
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
width: getColumnWidth(entries, 'rate', {
minWidth: 60,
magicSpacing: 5,
}),
}, },
{ {
Header: intl.get('amount'), Header: intl.get('amount'),
accessor: 'amount', accessor: 'amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100,
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
width: getColumnWidth(entries, 'amount', {
minWidth: 60,
magicSpacing: 5,
}),
}, },
], ],
[], [],
); );
};
/** /**
* Invoice details more actions menu. * Invoice details more actions menu.

View File

@@ -1,28 +1,17 @@
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import React from 'react'; import React from 'react';
import { Tag, Intent, Classes, Tooltip, Position } from '@blueprintjs/core'; import { Tag, Intent } from '@blueprintjs/core';
import { T, Choose, FormatNumberCell, If, Icon } from '../../../components'; import {
T,
Choose,
FormatNumberCell,
TextOverviewTooltipCell,
} from '../../../components';
import { Features } from 'common'; import { Features } from 'common';
import { getColumnWidth } from 'utils';
import { useFeatureCan } from 'hooks/state'; import { useFeatureCan } from 'hooks/state';
import { useManualJournalDrawerContext } from './ManualJournalDrawerProvider';
/**
* Note column accessor.
*/
export function NoteAccessor(row) {
return (
<If condition={row.note}>
<Tooltip
className={Classes.TOOLTIP_INDICATOR}
content={row.note}
position={Position.LEFT_TOP}
hoverOpenDelay={50}
>
<Icon icon={'file-alt'} iconSize={16} />
</Tooltip>
</If>
);
}
/** /**
* Publish column accessor. * Publish column accessor.
@@ -50,6 +39,12 @@ export function ManualJournalDetailsStatus({ manualJournal }) {
*/ */
export const useManualJournalEntriesColumns = () => { export const useManualJournalEntriesColumns = () => {
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
// manual journal details drawer context.
const {
manualJournal: { entries },
} = useManualJournalDrawerContext();
return React.useMemo( return React.useMemo(
() => [ () => [
{ {
@@ -57,6 +52,7 @@ export const useManualJournalEntriesColumns = () => {
accessor: 'account.name', accessor: 'account.name',
width: 130, width: 130,
disableSortBy: true, disableSortBy: true,
textOverview: true,
className: 'account', className: 'account',
}, },
{ {
@@ -64,13 +60,15 @@ export const useManualJournalEntriesColumns = () => {
accessor: 'contact.display_name', accessor: 'contact.display_name',
width: 130, width: 130,
disableSortBy: true, disableSortBy: true,
textOverview: true,
className: 'contact', className: 'contact',
}, },
{ {
Header: intl.get('note'), Header: intl.get('note'),
accessor: NoteAccessor, accessor: 'note',
width: 80, Cell: TextOverviewTooltipCell,
disableSortBy: true, disableSortBy: true,
textOverview: true,
className: 'note', className: 'note',
}, },
...(featureCan(Features.Branches) ...(featureCan(Features.Branches)
@@ -88,9 +86,13 @@ export const useManualJournalEntriesColumns = () => {
Header: intl.get('credit'), Header: intl.get('credit'),
accessor: 'credit', accessor: 'credit',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'credit', {
minWidth: 60,
magicSpacing: 5,
}),
disableResizable: true, disableResizable: true,
disableSortBy: true, disableSortBy: true,
textOverview: true,
formatNumber: { noZero: true }, formatNumber: { noZero: true },
className: 'credit', className: 'credit',
align: 'right', align: 'right',
@@ -99,8 +101,12 @@ export const useManualJournalEntriesColumns = () => {
Header: intl.get('debit'), Header: intl.get('debit'),
accessor: 'debit', accessor: 'debit',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'debit', {
minWidth: 60,
magicSpacing: 5,
}),
disableResizable: true, disableResizable: true,
textOverview: true,
disableSortBy: true, disableSortBy: true,
formatNumber: { noZero: true }, formatNumber: { noZero: true },
className: 'debit', className: 'debit',

View File

@@ -3,9 +3,17 @@ import intl from 'react-intl-universal';
import moment from 'moment'; import moment from 'moment';
import { FormatNumberCell } from '../../../components'; import { FormatNumberCell } from '../../../components';
import { getColumnWidth } from 'utils';
import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider';
export const usePaymentMadeEntriesColumns = () => export const usePaymentMadeEntriesColumns = () => {
React.useMemo(() => [ // Payment made details context.
const {
paymentMade: { entries },
} = usePaymentMadeDetailContext();
return React.useMemo(
() => [
{ {
Header: intl.get('date'), Header: intl.get('date'),
accessor: (row) => moment(row.date).format('YYYY MMM DD'), accessor: (row) => moment(row.date).format('YYYY MMM DD'),
@@ -24,13 +32,20 @@ export const usePaymentMadeEntriesColumns = () =>
Header: intl.get('bill_amount'), Header: intl.get('bill_amount'),
accessor: 'bill.amount', accessor: 'bill.amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: getColumnWidth(entries, 'bill.amount', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
}, },
{ {
Header: intl.get('due_amount'), Header: intl.get('due_amount'),
accessor: 'bill.due_amount', accessor: 'bill.due_amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'bill.due_amount', {
minWidth: 60,
magicSpacing: 5,
}),
disableSortBy: true, disableSortBy: true,
align: 'right', align: 'right',
}, },
@@ -38,8 +53,15 @@ export const usePaymentMadeEntriesColumns = () =>
Header: intl.get('payment_amount'), Header: intl.get('payment_amount'),
accessor: 'payment_amount', accessor: 'payment_amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'payment_amount', {
minWidth: 60,
magicSpacing: 5,
}),
disableSortBy: true, disableSortBy: true,
textOverview: true,
align: 'right', align: 'right',
}, },
], []); ],
[],
);
};

View File

@@ -2,12 +2,18 @@ import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import moment from 'moment'; import moment from 'moment';
import { FormatNumberCell } from '../../../components'; import { FormatNumberCell } from '../../../components';
import { getColumnWidth } from 'utils';
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
/** /**
* Retrieve payment entries table columns. * Retrieve payment entries table columns.
*/ */
export const usePaymentReceiveEntriesColumns = () => export const usePaymentReceiveEntriesColumns = () => {
React.useMemo( const {
paymentReceive: { entries },
} = usePaymentReceiveDetailContext();
return React.useMemo(
() => [ () => [
{ {
Header: intl.get('date'), Header: intl.get('date'),
@@ -27,24 +33,38 @@ export const usePaymentReceiveEntriesColumns = () =>
Header: intl.get('invoice_amount'), Header: intl.get('invoice_amount'),
accessor: 'invoice.balance', accessor: 'invoice.balance',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: getColumnWidth(entries, 'invoice.balance', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
textOverview: true,
}, },
{ {
Header: intl.get('amount_due'), Header: intl.get('amount_due'),
accessor: 'invoice.due_amount', accessor: 'invoice.due_amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
align: 'right', align: 'right',
width: 100, width: getColumnWidth(entries, 'invoice.due_amount', {
minWidth: 60,
magicSpacing: 5,
}),
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('payment_amount'), Header: intl.get('payment_amount'),
accessor: 'invoice.payment_amount', accessor: 'invoice.payment_amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
align: 'right', align: 'right',
width: 100, width: getColumnWidth(entries, 'invoice.payment_amount', {
minWidth: 60,
magicSpacing: 5,
}),
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
], ],
[], [],
); );
};

View File

@@ -1,44 +1,69 @@
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 { getColumnWidth } from 'utils';
import { FormatNumberCell, TextOverviewTooltipCell } from '../../../components';
import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider.js';
export const useReceiptReadonlyEntriesTableColumns = () => React.useMemo(() => [ export const useReceiptReadonlyEntriesTableColumns = () => {
// Receipt details drawer context.
const {
receipt: { entries },
} = useReceiptDetailDrawerContext();
return React.useMemo(
() => [
{ {
Header: intl.get('product_and_service'), Header: intl.get('product_and_service'),
accessor: 'item.name', accessor: 'item.name',
Cell: TextOverviewTooltipCell,
width: 150, width: 150,
className: 'name', className: 'name',
disableSortBy: true disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('description'), Header: intl.get('description'),
accessor: 'description', accessor: 'description',
Cell: TextOverviewTooltipCell,
className: 'description', className: 'description',
disableSortBy: true disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('quantity'), Header: intl.get('quantity'),
accessor: 'quantity', accessor: 'quantity',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'quantity', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true disableSortBy: true,
}, },
{ {
Header: intl.get('rate'), Header: intl.get('rate'),
accessor: 'rate', accessor: 'rate',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'rate', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('amount'), Header: intl.get('amount'),
accessor: 'amount', accessor: 'amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'amount', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true disableSortBy: true,
textOverview: true,
}, },
], []); ],
[],
);
};

View File

@@ -10,59 +10,82 @@ import {
Tag, Tag,
Intent, Intent,
} from '@blueprintjs/core'; } from '@blueprintjs/core';
import { getColumnWidth } from 'utils';
import { import {
Icon, Icon,
FormattedMessage as T, FormattedMessage as T,
TextOverviewTooltipCell,
FormatNumberCell, FormatNumberCell,
Choose, Choose,
} from '../../../components'; } from '../../../components';
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
/** /**
* Retrieve vendor credit readonly details entries table columns. * Retrieve vendor credit readonly details entries table columns.
*/ */
export const useVendorCreditReadonlyEntriesTableColumns = () => export const useVendorCreditReadonlyEntriesTableColumns = () => {
React.useMemo( const {
vendorCredit: { entries },
} = useVendorCreditDetailDrawerContext();
return React.useMemo(
() => [ () => [
{ {
Header: intl.get('product_and_service'), Header: intl.get('product_and_service'),
accessor: 'item.name', accessor: 'item.name',
Cell: TextOverviewTooltipCell,
width: 150, width: 150,
className: 'item', className: 'item',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('description'), Header: intl.get('description'),
accessor: 'description', accessor: 'description',
Cell: TextOverviewTooltipCell,
className: 'description', className: 'description',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('quantity'), Header: intl.get('quantity'),
accessor: 'quantity', accessor: 'quantity',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'quantity', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('rate'), Header: intl.get('rate'),
accessor: 'rate', accessor: 'rate',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'rate', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('amount'), Header: intl.get('amount'),
accessor: 'amount', accessor: 'amount',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'amount', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
], ],
[], [],
); );
};
/** /**
* Vendor note more actions menu. * Vendor note more actions menu.

View File

@@ -1,41 +1,55 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { Intent, Tag } from '@blueprintjs/core'; import { Intent, Tag } from '@blueprintjs/core';
import { getColumnWidth } from 'utils';
import { useWarehouseDetailDrawerContext } from './WarehouseTransferDetailDrawerProvider';
import { import {
FormattedMessage as T, FormattedMessage as T,
FormatNumberCell, FormatNumberCell,
TextOverviewTooltipCell,
Choose, Choose,
} from '../../../components'; } from '../../../components';
export const useWarehouseTransferReadOnlyEntriesColumns = () => export const useWarehouseTransferReadOnlyEntriesColumns = () => {
React.useMemo( const {
warehouseTransfer: { entries },
} = useWarehouseDetailDrawerContext();
return React.useMemo(
() => [ () => [
{ {
Header: intl.get('warehouse_transfer.column.item_name'), Header: intl.get('warehouse_transfer.column.item_name'),
accessor: 'item.name', accessor: 'item.name',
width: 150, Cell: TextOverviewTooltipCell,
width: 100,
className: 'name', className: 'name',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('warehouse_transfer.column.description'), Header: intl.get('warehouse_transfer.column.description'),
accessor: 'description', accessor: 'description',
Cell: TextOverviewTooltipCell,
className: 'description', className: 'description',
disableSortBy: true, disableSortBy: true,
textOverview: true,
}, },
{ {
Header: intl.get('warehouse_transfer.column.transfer_quantity'), Header: intl.get('warehouse_transfer.column.transfer_quantity'),
accessor: 'quantity', accessor: 'quantity',
Cell: FormatNumberCell, Cell: FormatNumberCell,
width: 100, width: getColumnWidth(entries, 'quantity', {
minWidth: 60,
magicSpacing: 5,
}),
align: 'right', align: 'right',
disableSortBy: true, disableSortBy: true,
}, },
], ],
[], [],
); );
};
/** /**
* Warehouses transfer details status. * Warehouses transfer details status.
* @returns {React.JSX} * @returns {React.JSX}

View File

@@ -290,3 +290,8 @@ html[lang^='ar'] {
.font-bold { .font-bold {
font-weight: 600; font-weight: 600;
} }
span.table-tooltip-overview-target{
display: inline;
}