mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-24 16:49:48 +00:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import intl from 'react-intl-universal';
|
|
|
|
import { FormatNumberCell, TextOverviewTooltipCell } from '@/components';
|
|
import { useExpenseDrawerContext } from './ExpenseDrawerProvider';
|
|
import { getColumnWidth } from '@/utils';
|
|
|
|
/**
|
|
* Retrieve expense readonly details entries table columns.
|
|
*/
|
|
export const useExpenseReadEntriesColumns = () => {
|
|
// Expense drawer context.
|
|
const {
|
|
expense: { categories },
|
|
} = useExpenseDrawerContext();
|
|
|
|
return React.useMemo(
|
|
() => [
|
|
{
|
|
Header: intl.get('expense_account'),
|
|
accessor: 'expense_account.name',
|
|
Cell: TextOverviewTooltipCell,
|
|
width: 110,
|
|
disableSortBy: true,
|
|
textOverview: true,
|
|
className: 'account',
|
|
},
|
|
{
|
|
Header: intl.get('description'),
|
|
accessor: 'description',
|
|
Cell: TextOverviewTooltipCell,
|
|
className: 'description',
|
|
disableSortBy: true,
|
|
textOverview: true,
|
|
},
|
|
{
|
|
Header: intl.get('amount'),
|
|
accessor: 'amount',
|
|
Cell: FormatNumberCell,
|
|
width: getColumnWidth(categories, 'amount', {
|
|
minWidth: 60,
|
|
magicSpacing: 5,
|
|
}),
|
|
disableSortBy: true,
|
|
className: 'amount',
|
|
align: 'right',
|
|
},
|
|
],
|
|
[],
|
|
);
|
|
};
|