mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
feat: optimize the style of bank account transactions tables
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { camelCase} from 'lodash';
|
import { camelCase } from 'lodash';
|
||||||
|
|
||||||
import { If, Skeleton } from '@/components';
|
import { If, Skeleton } from '@/components';
|
||||||
import { useAppIntlContext } from '@/components/AppIntlProvider';
|
import { useAppIntlContext } from '@/components/AppIntlProvider';
|
||||||
import TableContext from './TableContext';
|
import TableContext from './TableContext';
|
||||||
import { saveInvoke, ignoreEventFromSelectors } from '@/utils';
|
import { saveInvoke, ignoreEventFromSelectors } from '@/utils';
|
||||||
import { isCellLoading } from './utils';
|
import { isCellLoading } from './utils';
|
||||||
|
import { MoneyDisplay } from '../Money/MoneyDisplay';
|
||||||
|
|
||||||
const ROW_CLICK_SELECTORS_INGORED = ['.expand-toggle', '.selection-checkbox'];
|
const ROW_CLICK_SELECTORS_INGORED = ['.expand-toggle', '.selection-checkbox'];
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ export default function TableCell({ cell, row, index }) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
saveInvoke(onCellClick, cell, event);
|
saveInvoke(onCellClick, cell, event);
|
||||||
};
|
};
|
||||||
const cellType = camelCase(cell.column.Cell.cellType) || 'text';
|
const cellType = camelCase(cell.column.Cell.cellType) || 'text';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -109,7 +110,11 @@ export default function TableCell({ cell, row, index }) {
|
|||||||
</span>
|
</span>
|
||||||
</If>
|
</If>
|
||||||
|
|
||||||
{cell.render('Cell')}
|
{cell.column?.money ? (
|
||||||
|
<MoneyDisplay>{cell.render('Cell')}</MoneyDisplay>
|
||||||
|
) : (
|
||||||
|
<>{cell.render('Cell')}</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
.root {
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
9
packages/webapp/src/components/Money/MoneyDisplay.tsx
Normal file
9
packages/webapp/src/components/Money/MoneyDisplay.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import styles from './MoneyDisplay.module.scss';
|
||||||
|
|
||||||
|
interface MoneyDisplayProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MoneyDisplay({ children }: MoneyDisplayProps) {
|
||||||
|
return <span className={styles.root}>{children}</span>;
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ export const useManualJournalsColumns = () => {
|
|||||||
accessor: 'formatted_amount',
|
accessor: 'formatted_amount',
|
||||||
width: 115,
|
width: 115,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
className: clsx(CLASSES.FONT_BOLD),
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ export const useAccountsTableColumns = () => {
|
|||||||
width: 150,
|
width: 150,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'balance',
|
id: 'balance',
|
||||||
@@ -112,6 +113,7 @@ export const useAccountsTableColumns = () => {
|
|||||||
Cell: BalanceCell,
|
Cell: BalanceCell,
|
||||||
width: 150,
|
width: 150,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
|
||||||
import { Intent } from '@blueprintjs/core';
|
import { Intent } from '@blueprintjs/core';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import {
|
import {
|
||||||
DataTable,
|
|
||||||
TableFastCell,
|
TableFastCell,
|
||||||
TableSkeletonRows,
|
TableSkeletonRows,
|
||||||
TableSkeletonHeader,
|
TableSkeletonHeader,
|
||||||
@@ -17,9 +15,10 @@ import { useMemorizedColumnsWidths } from '@/hooks';
|
|||||||
import { useExcludedTransactionsColumns } from './_utils';
|
import { useExcludedTransactionsColumns } from './_utils';
|
||||||
import { useExcludedTransactionsBoot } from './ExcludedTransactionsTableBoot';
|
import { useExcludedTransactionsBoot } from './ExcludedTransactionsTableBoot';
|
||||||
import { useAccountTransactionsContext } from '../AccountTransactionsProvider';
|
import { useAccountTransactionsContext } from '../AccountTransactionsProvider';
|
||||||
|
import { useUnexcludeUncategorizedTransaction } from '@/hooks/query/bank-rules';
|
||||||
|
|
||||||
import { ActionsMenu } from './_components';
|
import { ActionsMenu } from './_components';
|
||||||
import { useUnexcludeUncategorizedTransaction } from '@/hooks/query/bank-rules';
|
import { BankAccountDataTable } from '../components/BankAccountDataTable';
|
||||||
import {
|
import {
|
||||||
WithBankingActionsProps,
|
WithBankingActionsProps,
|
||||||
withBankingActions,
|
withBankingActions,
|
||||||
@@ -78,7 +77,7 @@ function ExcludedTransactionsTableRoot({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CashflowTransactionsTable
|
<BankAccountDataTable
|
||||||
noInitialFetch={true}
|
noInitialFetch={true}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={excludedBankTransactions}
|
data={excludedBankTransactions}
|
||||||
@@ -116,42 +115,3 @@ function ExcludedTransactionsTableRoot({
|
|||||||
export const ExcludedTransactionsTable = R.compose(withBankingActions)(
|
export const ExcludedTransactionsTable = R.compose(withBankingActions)(
|
||||||
ExcludedTransactionsTableRoot,
|
ExcludedTransactionsTableRoot,
|
||||||
);
|
);
|
||||||
|
|
||||||
const DashboardConstrantTable = styled(DataTable)`
|
|
||||||
.table {
|
|
||||||
.thead {
|
|
||||||
.th {
|
|
||||||
background: #fff;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tbody {
|
|
||||||
.tr:last-child .td {
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const CashflowTransactionsTable = styled(DashboardConstrantTable)`
|
|
||||||
.table .tbody {
|
|
||||||
.tbody-inner .tr.no-results {
|
|
||||||
.td {
|
|
||||||
padding: 2rem 0;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #888;
|
|
||||||
font-weight: 400;
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tbody-inner {
|
|
||||||
.tr .td {
|
|
||||||
border-bottom: 1px solid #e6e6e6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -54,12 +54,14 @@ export function useExcludedTransactionsColumns() {
|
|||||||
accessor: 'formatted_deposit_amount',
|
accessor: 'formatted_deposit_amount',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
width: depositWidth,
|
width: depositWidth,
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: 'Withdrawal',
|
Header: 'Withdrawal',
|
||||||
accessor: 'formatted_withdrawal_amount',
|
accessor: 'formatted_withdrawal_amount',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
width: withdrawalWidth,
|
width: withdrawalWidth,
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import clsx from 'classnames';
|
|
||||||
import styled from 'styled-components';
|
|
||||||
import {
|
import {
|
||||||
DataTable,
|
|
||||||
TableFastCell,
|
TableFastCell,
|
||||||
TableSkeletonRows,
|
TableSkeletonRows,
|
||||||
TableSkeletonHeader,
|
TableSkeletonHeader,
|
||||||
@@ -16,6 +13,7 @@ import { useAccountTransactionsContext } from '../AccountTransactionsProvider';
|
|||||||
import { usePendingTransactionsContext } from './PendingTransactionsTableBoot';
|
import { usePendingTransactionsContext } from './PendingTransactionsTableBoot';
|
||||||
import { usePendingTransactionsTableColumns } from './_hooks';
|
import { usePendingTransactionsTableColumns } from './_hooks';
|
||||||
|
|
||||||
|
import { BankAccountDataTable } from '../components/BankAccountDataTable';
|
||||||
import { compose } from '@/utils';
|
import { compose } from '@/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +35,7 @@ function PendingTransactionsDataTableRoot({
|
|||||||
} = usePendingTransactionsContext();
|
} = usePendingTransactionsContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CashflowTransactionsTable
|
<BankAccountDataTable
|
||||||
noInitialFetch={true}
|
noInitialFetch={true}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={pendingTransactions || []}
|
data={pendingTransactions || []}
|
||||||
@@ -54,7 +52,6 @@ function PendingTransactionsDataTableRoot({
|
|||||||
vListOverscanRowCount={0}
|
vListOverscanRowCount={0}
|
||||||
noResults={'There is no pending transactions in the current account.'}
|
noResults={'There is no pending transactions in the current account.'}
|
||||||
windowScrollerProps={{ scrollElement: scrollableRef }}
|
windowScrollerProps={{ scrollElement: scrollableRef }}
|
||||||
className={clsx('table-constrant')}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -65,47 +62,3 @@ export const PendingTransactionsDataTable = compose(
|
|||||||
})),
|
})),
|
||||||
withBankingActions,
|
withBankingActions,
|
||||||
)(PendingTransactionsDataTableRoot);
|
)(PendingTransactionsDataTableRoot);
|
||||||
|
|
||||||
const DashboardConstrantTable = styled(DataTable)`
|
|
||||||
.table {
|
|
||||||
.thead {
|
|
||||||
.th {
|
|
||||||
background: #fff;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
font-size: 13px;i
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tbody {
|
|
||||||
.tr:last-child .td {
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const CashflowTransactionsTable = styled(DashboardConstrantTable)`
|
|
||||||
.table .tbody {
|
|
||||||
.tbody-inner .tr.no-results {
|
|
||||||
.td {
|
|
||||||
padding: 2rem 0;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #888;
|
|
||||||
font-weight: 400;
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tbody-inner {
|
|
||||||
.tr .td:not(:first-child) {
|
|
||||||
border-left: 1px solid #e6e6e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.td-description {
|
|
||||||
color: #5f6b7c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export function usePendingTransactionsTableColumns() {
|
|||||||
textOverview: true,
|
textOverview: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'withdrawal',
|
id: 'withdrawal',
|
||||||
@@ -58,6 +59,7 @@ export function usePendingTransactionsTableColumns() {
|
|||||||
textOverview: true,
|
textOverview: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
withBankingActions,
|
withBankingActions,
|
||||||
} from '../../withBankingActions';
|
} from '../../withBankingActions';
|
||||||
import styles from './RecognizedTransactionsTable.module.scss';
|
import styles from './RecognizedTransactionsTable.module.scss';
|
||||||
|
import { BankAccountDataTable } from '../components/BankAccountDataTable';
|
||||||
|
|
||||||
interface RecognizedTransactionsTableProps extends WithBankingActionsProps {}
|
interface RecognizedTransactionsTableProps extends WithBankingActionsProps {}
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ function RecognizedTransactionsTableRoot({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CashflowTransactionsTable
|
<BankAccountDataTable
|
||||||
noInitialFetch={true}
|
noInitialFetch={true}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={recognizedTransactions}
|
data={recognizedTransactions}
|
||||||
@@ -100,14 +101,12 @@ function RecognizedTransactionsTableRoot({
|
|||||||
ContextMenu={ActionsMenu}
|
ContextMenu={ActionsMenu}
|
||||||
onCellClick={handleCellClick}
|
onCellClick={handleCellClick}
|
||||||
// #TableVirtualizedListRows props.
|
// #TableVirtualizedListRows props.
|
||||||
vListrowHeight={'small' == 'small' ? 32 : 40}
|
|
||||||
vListrowHeight={40}
|
vListrowHeight={40}
|
||||||
vListOverscanRowCount={0}
|
vListOverscanRowCount={0}
|
||||||
initialColumnsWidths={initialColumnsWidths}
|
initialColumnsWidths={initialColumnsWidths}
|
||||||
onColumnResizing={handleColumnResizing}
|
onColumnResizing={handleColumnResizing}
|
||||||
windowScrollerProps={{ scrollElement: scrollableRef }}
|
windowScrollerProps={{ scrollElement: scrollableRef }}
|
||||||
noResults={<RecognizedTransactionsTableNoResults />}
|
noResults={<RecognizedTransactionsTableNoResults />}
|
||||||
className="table-constrant"
|
|
||||||
payload={{
|
payload={{
|
||||||
onExclude: handleExcludeClick,
|
onExclude: handleExcludeClick,
|
||||||
onCategorize: handleCategorizeClick,
|
onCategorize: handleCategorizeClick,
|
||||||
@@ -120,45 +119,6 @@ export const RecognizedTransactionsTable = compose(withBankingActions)(
|
|||||||
RecognizedTransactionsTableRoot,
|
RecognizedTransactionsTableRoot,
|
||||||
);
|
);
|
||||||
|
|
||||||
const DashboardConstrantTable = styled(DataTable)`
|
|
||||||
.table {
|
|
||||||
.thead {
|
|
||||||
.th {
|
|
||||||
background: #fff;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tbody {
|
|
||||||
.tr:last-child .td {
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const CashflowTransactionsTable = styled(DashboardConstrantTable)`
|
|
||||||
.table .tbody {
|
|
||||||
.tbody-inner .tr.no-results {
|
|
||||||
.td {
|
|
||||||
padding: 2rem 0;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #888;
|
|
||||||
font-weight: 400;
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tbody-inner {
|
|
||||||
.tr .td {
|
|
||||||
border-bottom: 1px solid #e6e6e6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
function RecognizedTransactionsTableNoResults() {
|
function RecognizedTransactionsTableNoResults() {
|
||||||
return (
|
return (
|
||||||
<Stack spacing={12} className={styles.emptyState}>
|
<Stack spacing={12} className={styles.emptyState}>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
import React from 'react';
|
||||||
|
import clsx from 'classnames';
|
||||||
|
import { Classes } from '@blueprintjs/core';
|
||||||
import { Group, Icon } from '@/components';
|
import { Group, Icon } from '@/components';
|
||||||
import { getColumnWidth } from '@/utils';
|
import { getColumnWidth } from '@/utils';
|
||||||
import React from 'react';
|
|
||||||
import { useRecognizedTransactionsBoot } from './RecognizedTransactionsTableBoot';
|
import { useRecognizedTransactionsBoot } from './RecognizedTransactionsTableBoot';
|
||||||
|
|
||||||
const getReportColWidth = (data, accessor, headerText) => {
|
const getReportColWidth = (data, accessor, headerText) => {
|
||||||
@@ -28,10 +30,6 @@ const recognizeAccessor = (transaction) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const descriptionAccessor = (transaction) => {
|
|
||||||
return <span style={{ color: '#5F6B7C' }}>{transaction.description}</span>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve uncategorized transactions columns table.
|
* Retrieve uncategorized transactions columns table.
|
||||||
*/
|
*/
|
||||||
@@ -59,7 +57,8 @@ export function useUncategorizedTransactionsColumns() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: 'Description',
|
Header: 'Description',
|
||||||
accessor: descriptionAccessor,
|
accessor: 'description',
|
||||||
|
className: clsx(Classes.TEXT_MUTED),
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -82,12 +81,14 @@ export function useUncategorizedTransactionsColumns() {
|
|||||||
accessor: 'formatted_deposit_amount',
|
accessor: 'formatted_deposit_amount',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
width: depositWidth,
|
width: depositWidth,
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: 'Withdrawal',
|
Header: 'Withdrawal',
|
||||||
accessor: 'formatted_withdrawal_amount',
|
accessor: 'formatted_withdrawal_amount',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
width: withdrawalWidth,
|
width: withdrawalWidth,
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
import styled from 'styled-components';
|
|
||||||
import { Intent } from '@blueprintjs/core';
|
import { Intent } from '@blueprintjs/core';
|
||||||
import {
|
import {
|
||||||
DataTable,
|
|
||||||
TableFastCell,
|
TableFastCell,
|
||||||
TableSkeletonRows,
|
TableSkeletonRows,
|
||||||
TableSkeletonHeader,
|
TableSkeletonHeader,
|
||||||
TableVirtualizedListRows,
|
TableVirtualizedListRows,
|
||||||
FormattedMessage as T,
|
|
||||||
AppToaster,
|
AppToaster,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { TABLES } from '@/constants/tables';
|
import { TABLES } from '@/constants/tables';
|
||||||
import { ActionsMenu } from './components';
|
import { ActionsMenu } from './components';
|
||||||
|
import { BankAccountDataTable } from '../components/BankAccountDataTable';
|
||||||
|
|
||||||
import withSettings from '@/containers/Settings/withSettings';
|
import withSettings from '@/containers/Settings/withSettings';
|
||||||
import { withBankingActions } from '../../withBankingActions';
|
import { withBankingActions } from '../../withBankingActions';
|
||||||
|
import { withBanking } from '../../withBanking';
|
||||||
|
|
||||||
import { useMemorizedColumnsWidths } from '@/hooks';
|
import { useMemorizedColumnsWidths } from '@/hooks';
|
||||||
import { useAccountUncategorizedTransactionsContext } from '../AllTransactionsUncategorizedBoot';
|
import { useAccountUncategorizedTransactionsContext } from '../AllTransactionsUncategorizedBoot';
|
||||||
@@ -25,7 +24,6 @@ import { useAccountUncategorizedTransactionsColumns } from './hooks';
|
|||||||
import { useAccountTransactionsContext } from '../AccountTransactionsProvider';
|
import { useAccountTransactionsContext } from '../AccountTransactionsProvider';
|
||||||
|
|
||||||
import { compose } from '@/utils';
|
import { compose } from '@/utils';
|
||||||
import { withBanking } from '../../withBanking';
|
|
||||||
import styles from './AccountTransactionsUncategorizedTable.module.scss';
|
import styles from './AccountTransactionsUncategorizedTable.module.scss';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +46,6 @@ function AccountTransactionsDataTable({
|
|||||||
}) {
|
}) {
|
||||||
// Retrieve table columns.
|
// Retrieve table columns.
|
||||||
const columns = useAccountUncategorizedTransactionsColumns();
|
const columns = useAccountUncategorizedTransactionsColumns();
|
||||||
|
|
||||||
const { scrollableRef } = useAccountTransactionsContext();
|
const { scrollableRef } = useAccountTransactionsContext();
|
||||||
|
|
||||||
// Retrieve list context.
|
// Retrieve list context.
|
||||||
@@ -100,7 +97,7 @@ function AccountTransactionsDataTable({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CashflowTransactionsTable
|
<BankAccountDataTable
|
||||||
noInitialFetch={true}
|
noInitialFetch={true}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={uncategorizedTransactions || []}
|
data={uncategorizedTransactions || []}
|
||||||
@@ -119,7 +116,7 @@ function AccountTransactionsDataTable({
|
|||||||
ContextMenu={ActionsMenu}
|
ContextMenu={ActionsMenu}
|
||||||
onCellClick={handleCellClick}
|
onCellClick={handleCellClick}
|
||||||
// #TableVirtualizedListRows props.
|
// #TableVirtualizedListRows props.
|
||||||
vListrowHeight={cashflowTansactionsTableSize === 'small' ? 32 : 40}
|
vListrowHeight={cashflowTansactionsTableSize === 'small' ? 34 : 40}
|
||||||
vListOverscanRowCount={0}
|
vListOverscanRowCount={0}
|
||||||
initialColumnsWidths={initialColumnsWidths}
|
initialColumnsWidths={initialColumnsWidths}
|
||||||
onColumnResizing={handleColumnResizing}
|
onColumnResizing={handleColumnResizing}
|
||||||
@@ -132,7 +129,7 @@ function AccountTransactionsDataTable({
|
|||||||
}}
|
}}
|
||||||
onSelectedRowsChange={handleSelectedRowsChange}
|
onSelectedRowsChange={handleSelectedRowsChange}
|
||||||
windowScrollerProps={{ scrollElement: scrollableRef }}
|
windowScrollerProps={{ scrollElement: scrollableRef }}
|
||||||
className={clsx('table-constrant', styles.table, {
|
className={clsx(styles.table, {
|
||||||
[styles.showCategorizeColumn]: enableMultipleCategorization,
|
[styles.showCategorizeColumn]: enableMultipleCategorization,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
@@ -151,47 +148,3 @@ export default compose(
|
|||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
)(AccountTransactionsDataTable);
|
)(AccountTransactionsDataTable);
|
||||||
|
|
||||||
const DashboardConstrantTable = styled(DataTable)`
|
|
||||||
.table {
|
|
||||||
.thead {
|
|
||||||
.th {
|
|
||||||
background: #fff;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
font-size: 13px;i
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tbody {
|
|
||||||
.tr:last-child .td {
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const CashflowTransactionsTable = styled(DashboardConstrantTable)`
|
|
||||||
.table .tbody {
|
|
||||||
.tbody-inner .tr.no-results {
|
|
||||||
.td {
|
|
||||||
padding: 2rem 0;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #888;
|
|
||||||
font-weight: 400;
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tbody-inner {
|
|
||||||
.tr .td:not(:first-child) {
|
|
||||||
border-left: 1px solid #e6e6e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.td-description {
|
|
||||||
color: #5f6b7c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
import clsx from 'classnames';
|
||||||
import {
|
import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
Classes,
|
||||||
Intent,
|
Intent,
|
||||||
PopoverInteractionKind,
|
PopoverInteractionKind,
|
||||||
Position,
|
Position,
|
||||||
@@ -97,6 +99,7 @@ export function useAccountUncategorizedTransactionsColumns() {
|
|||||||
width: 160,
|
width: 160,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
className: clsx(Classes.TEXT_MUTED),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'payee',
|
id: 'payee',
|
||||||
@@ -123,21 +126,21 @@ export function useAccountUncategorizedTransactionsColumns() {
|
|||||||
id: 'deposit',
|
id: 'deposit',
|
||||||
Header: intl.get('banking.label.deposit'),
|
Header: intl.get('banking.label.deposit'),
|
||||||
accessor: 'formatted_deposit_amount',
|
accessor: 'formatted_deposit_amount',
|
||||||
width: 40,
|
|
||||||
className: 'deposit',
|
|
||||||
textOverview: true,
|
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
width: 40,
|
||||||
|
textOverview: true,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'withdrawal',
|
id: 'withdrawal',
|
||||||
Header: intl.get('banking.label.withdrawal'),
|
Header: intl.get('banking.label.withdrawal'),
|
||||||
accessor: 'formatted_withdrawal_amount',
|
accessor: 'formatted_withdrawal_amount',
|
||||||
className: 'withdrawal',
|
|
||||||
width: 40,
|
width: 40,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'categorize_include',
|
id: 'categorize_include',
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ export function useAccountTransactionsColumns() {
|
|||||||
textOverview: true,
|
textOverview: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'withdrawal',
|
id: 'withdrawal',
|
||||||
@@ -133,16 +134,18 @@ export function useAccountTransactionsColumns() {
|
|||||||
textOverview: true,
|
textOverview: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'running_balance',
|
id: 'running_balance',
|
||||||
Header: intl.get('banking.label.running_balance'),
|
Header: intl.get('banking.label.running_balance'),
|
||||||
accessor: 'formatted_running_balance',
|
accessor: 'formatted_running_balance',
|
||||||
className: 'running_balance',
|
className: 'running_balance',
|
||||||
|
align: 'right',
|
||||||
width: 150,
|
width: 150,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
align: 'right',
|
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
.root {
|
||||||
|
:global .table{
|
||||||
|
.thead {
|
||||||
|
.th {
|
||||||
|
background: #fff;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tbody-inner .tr.no-results {
|
||||||
|
.td {
|
||||||
|
padding: 2rem 0;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #888;
|
||||||
|
font-weight: 400;
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tbody-inner {
|
||||||
|
.tr .td{
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import clsx from 'classnames';
|
||||||
|
import { DataTable } from '@/components';
|
||||||
|
import styles from './BankAccountDataTable.module.scss';
|
||||||
|
|
||||||
|
interface BankAccountDataTableProps {
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function BankAccountDataTable({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: BankAccountDataTableProps) {
|
||||||
|
return (
|
||||||
|
<DataTable
|
||||||
|
{...props}
|
||||||
|
className={clsx('table-constrant', styles.root, className)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -170,6 +170,7 @@ export function useCustomersTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
width: 100,
|
width: 100,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ export function useExpensesTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
width: 150,
|
width: 150,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
className: clsx(CLASSES.FONT_BOLD),
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const numericColumnAccessor = R.curry((data, column) => {
|
|||||||
...column,
|
...column,
|
||||||
align: Align.Right,
|
align: Align.Right,
|
||||||
width,
|
width,
|
||||||
|
money: true,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const numericColumnAccessor = R.curry((data, column) => {
|
|||||||
return {
|
return {
|
||||||
...column,
|
...column,
|
||||||
align: Align.Right,
|
align: Align.Right,
|
||||||
|
money: true,
|
||||||
width,
|
width,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ const amountAccessor = R.curry((data, column) => {
|
|||||||
minWidth: AMOUNT_COLUMNS_MIN_WIDTH,
|
minWidth: AMOUNT_COLUMNS_MIN_WIDTH,
|
||||||
}),
|
}),
|
||||||
align: Align.Right,
|
align: Align.Right,
|
||||||
|
money: true,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ export const useItemsTableColumns = () => {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
width: 150,
|
width: 150,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'cost_price',
|
id: 'cost_price',
|
||||||
@@ -220,6 +221,7 @@ export const useItemsTableColumns = () => {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
width: 150,
|
width: 150,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'quantity_on_hand',
|
id: 'quantity_on_hand',
|
||||||
@@ -229,6 +231,7 @@ export const useItemsTableColumns = () => {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
width: 140,
|
width: 140,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ export function useBillsTableColumns() {
|
|||||||
width: 120,
|
width: 120,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
className: clsx(CLASSES.FONT_BOLD),
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ export function useEstiamtesTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
className: clsx(CLASSES.FONT_BOLD),
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
|
money: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ export function useInvoicesTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
|
money: true,
|
||||||
className: clsx(CLASSES.FONT_BOLD),
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ export function useVendorsTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
width: 100,
|
width: 100,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
money: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -378,6 +378,8 @@
|
|||||||
.table-constrant,
|
.table-constrant,
|
||||||
.table--constrant {
|
.table--constrant {
|
||||||
.table {
|
.table {
|
||||||
|
color: #000;
|
||||||
|
|
||||||
.thead {
|
.thead {
|
||||||
.tr:first-of-type .th {
|
.tr:first-of-type .th {
|
||||||
border-top: 1px solid #000000;
|
border-top: 1px solid #000000;
|
||||||
@@ -395,7 +397,6 @@
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 0.5rem 0.5rem;
|
padding: 0.5rem 0.5rem;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
color: #000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user