mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
fix: Bank rules conditions column
This commit is contained in:
@@ -2,17 +2,36 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Intent, Tag } from '@blueprintjs/core';
|
||||
|
||||
const applyToTypeAccessor = (rule) => {
|
||||
return rule.apply_if_transaction_type === 'deposit' ? (
|
||||
<Tag round intent={Intent.SUCCESS}>
|
||||
Deposits
|
||||
</Tag>
|
||||
) : (
|
||||
<Tag round intent={Intent.DANGER}>
|
||||
Withdrawals
|
||||
</Tag>
|
||||
);
|
||||
};
|
||||
|
||||
const conditionsAccessor = (rule) => (
|
||||
<span style={{ fontSize: 12, color: '#5F6B7C' }}>
|
||||
{rule.conditions_formatted}
|
||||
</span>
|
||||
);
|
||||
|
||||
const applyToAccessor = (rule) => (
|
||||
<Tag intent={Intent.NONE} minimal>
|
||||
{rule.assign_account_name}
|
||||
</Tag>
|
||||
);
|
||||
|
||||
export const useBankRulesTableColumns = () => {
|
||||
return useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: 'Apply to',
|
||||
accessor: (rule) =>
|
||||
rule.apply_if_transaction_type === 'deposit' ? (
|
||||
<Tag round intent={Intent.SUCCESS}>Deposits</Tag>
|
||||
) : (
|
||||
<Tag round intent={Intent.DANGER}>Withdrawals</Tag>
|
||||
),
|
||||
accessor: applyToTypeAccessor,
|
||||
},
|
||||
{
|
||||
Header: 'Rule Name',
|
||||
@@ -20,15 +39,15 @@ export const useBankRulesTableColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: 'Categorize As',
|
||||
accessor: () => 'Expense',
|
||||
accessor: 'assign_category_formatted',
|
||||
},
|
||||
{
|
||||
Header: 'Apply To',
|
||||
accessor: () => <Tag intent={Intent.NONE} minimal>All Accounts</Tag>,
|
||||
accessor: applyToAccessor,
|
||||
},
|
||||
{
|
||||
Header: 'Conditions',
|
||||
accessor: () => '',
|
||||
accessor: conditionsAccessor,
|
||||
},
|
||||
],
|
||||
[],
|
||||
|
||||
Reference in New Issue
Block a user