mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
feat: add tooltip cell to detail.
This commit is contained in:
@@ -1,33 +1,45 @@
|
||||
import React from 'react';
|
||||
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.
|
||||
*/
|
||||
export const useExpenseReadEntriesColumns = () =>
|
||||
React.useMemo(
|
||||
export const useExpenseReadEntriesColumns = () => {
|
||||
// Expense drawer context.
|
||||
const {
|
||||
expense: { categories },
|
||||
} = useExpenseDrawerContext();
|
||||
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: intl.get('expense_account'),
|
||||
accessor: 'expense_account.name',
|
||||
width: 110,
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
className: 'account',
|
||||
},
|
||||
{
|
||||
Header: intl.get('description'),
|
||||
accessor: 'description',
|
||||
width: 110,
|
||||
disableSortBy: true,
|
||||
Cell: TextOverviewTooltipCell,
|
||||
className: 'description',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('amount'),
|
||||
accessor: 'amount',
|
||||
Cell: FormatNumberCell,
|
||||
width: 100,
|
||||
width: getColumnWidth(categories, 'amount', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
disableSortBy: true,
|
||||
className: 'amount',
|
||||
align: 'right',
|
||||
@@ -35,3 +47,4 @@ export const useExpenseReadEntriesColumns = () =>
|
||||
],
|
||||
[],
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,37 +1,60 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { getColumnWidth } from 'utils';
|
||||
import { TextOverviewTooltipCell } from 'components';
|
||||
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
|
||||
|
||||
export const useInventoryAdjustmentEntriesColumns = () =>
|
||||
React.useMemo(
|
||||
export const useInventoryAdjustmentEntriesColumns = () => {
|
||||
// Inventory adjustment details drawer context.
|
||||
const {
|
||||
inventoryAdjustment: { entries },
|
||||
} = useInventoryAdjustmentDrawerContext();
|
||||
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: intl.get('inventory_adjustment.column.product'),
|
||||
accessor: 'item.name',
|
||||
width: 150,
|
||||
Cell: TextOverviewTooltipCell,
|
||||
width: 100,
|
||||
className: 'name',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('quantity'),
|
||||
accessor: 'quantity',
|
||||
width: 100,
|
||||
width: getColumnWidth(entries, 'quantity', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
align: 'right',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('cost'),
|
||||
accessor: 'cost',
|
||||
width: 100,
|
||||
width: getColumnWidth(entries, 'cost', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
align: 'right',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('value'),
|
||||
accessor: 'value',
|
||||
width: 100,
|
||||
width: getColumnWidth(entries, 'value', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
align: 'right',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
],
|
||||
[],
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,28 +1,17 @@
|
||||
import intl from 'react-intl-universal';
|
||||
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 { getColumnWidth } from 'utils';
|
||||
import { useFeatureCan } from 'hooks/state';
|
||||
|
||||
/**
|
||||
* 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>
|
||||
);
|
||||
}
|
||||
import { useManualJournalDrawerContext } from './ManualJournalDrawerProvider';
|
||||
|
||||
/**
|
||||
* Publish column accessor.
|
||||
@@ -50,6 +39,12 @@ export function ManualJournalDetailsStatus({ manualJournal }) {
|
||||
*/
|
||||
export const useManualJournalEntriesColumns = () => {
|
||||
const { featureCan } = useFeatureCan();
|
||||
|
||||
// manual journal details drawer context.
|
||||
const {
|
||||
manualJournal: { entries },
|
||||
} = useManualJournalDrawerContext();
|
||||
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
@@ -57,6 +52,7 @@ export const useManualJournalEntriesColumns = () => {
|
||||
accessor: 'account.name',
|
||||
width: 130,
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
className: 'account',
|
||||
},
|
||||
{
|
||||
@@ -64,13 +60,15 @@ export const useManualJournalEntriesColumns = () => {
|
||||
accessor: 'contact.display_name',
|
||||
width: 130,
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
className: 'contact',
|
||||
},
|
||||
{
|
||||
Header: intl.get('note'),
|
||||
accessor: NoteAccessor,
|
||||
width: 80,
|
||||
accessor: 'note',
|
||||
Cell: TextOverviewTooltipCell,
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
className: 'note',
|
||||
},
|
||||
...(featureCan(Features.Branches)
|
||||
@@ -88,9 +86,13 @@ export const useManualJournalEntriesColumns = () => {
|
||||
Header: intl.get('credit'),
|
||||
accessor: 'credit',
|
||||
Cell: FormatNumberCell,
|
||||
width: 100,
|
||||
width: getColumnWidth(entries, 'credit', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
disableResizable: true,
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
formatNumber: { noZero: true },
|
||||
className: 'credit',
|
||||
align: 'right',
|
||||
@@ -99,8 +101,12 @@ export const useManualJournalEntriesColumns = () => {
|
||||
Header: intl.get('debit'),
|
||||
accessor: 'debit',
|
||||
Cell: FormatNumberCell,
|
||||
width: 100,
|
||||
width: getColumnWidth(entries, 'debit', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
disableResizable: true,
|
||||
textOverview: true,
|
||||
disableSortBy: true,
|
||||
formatNumber: { noZero: true },
|
||||
className: 'debit',
|
||||
|
||||
@@ -1,41 +1,55 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Intent, Tag } from '@blueprintjs/core';
|
||||
import { getColumnWidth } from 'utils';
|
||||
import { useWarehouseDetailDrawerContext } from './WarehouseTransferDetailDrawerProvider';
|
||||
|
||||
import {
|
||||
FormattedMessage as T,
|
||||
FormatNumberCell,
|
||||
TextOverviewTooltipCell,
|
||||
Choose,
|
||||
} from '../../../components';
|
||||
|
||||
export const useWarehouseTransferReadOnlyEntriesColumns = () =>
|
||||
React.useMemo(
|
||||
export const useWarehouseTransferReadOnlyEntriesColumns = () => {
|
||||
const {
|
||||
warehouseTransfer: { entries },
|
||||
} = useWarehouseDetailDrawerContext();
|
||||
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: intl.get('warehouse_transfer.column.item_name'),
|
||||
accessor: 'item.name',
|
||||
width: 150,
|
||||
Cell: TextOverviewTooltipCell,
|
||||
width: 100,
|
||||
className: 'name',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('warehouse_transfer.column.description'),
|
||||
accessor: 'description',
|
||||
Cell: TextOverviewTooltipCell,
|
||||
className: 'description',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('warehouse_transfer.column.transfer_quantity'),
|
||||
accessor: 'quantity',
|
||||
Cell: FormatNumberCell,
|
||||
width: 100,
|
||||
width: getColumnWidth(entries, 'quantity', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
align: 'right',
|
||||
disableSortBy: true,
|
||||
},
|
||||
],
|
||||
[],
|
||||
);
|
||||
|
||||
};
|
||||
/**
|
||||
* Warehouses transfer details status.
|
||||
* @returns {React.JSX}
|
||||
|
||||
Reference in New Issue
Block a user