mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 16:19:49 +00:00
feat: add bank balance to accounts chart table
This commit is contained in:
@@ -116,3 +116,16 @@ export function BalanceCell({ cell }) {
|
|||||||
<span class="placeholder">—</span>
|
<span class="placeholder">—</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Balance cell.
|
||||||
|
*/
|
||||||
|
export function BankBalanceCell({ cell }) {
|
||||||
|
const account = cell.row.original;
|
||||||
|
|
||||||
|
return account.amount !== null ? (
|
||||||
|
<span>{account.bank_balance_formatted}</span>
|
||||||
|
) : (
|
||||||
|
<span class="placeholder">—</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import intl from 'react-intl-universal';
|
|||||||
import { Intent, Tag } from '@blueprintjs/core';
|
import { Intent, Tag } from '@blueprintjs/core';
|
||||||
|
|
||||||
import { If, AppToaster } from '@/components';
|
import { If, AppToaster } from '@/components';
|
||||||
import { NormalCell, BalanceCell } from './components';
|
import { NormalCell, BalanceCell, BankBalanceCell } from './components';
|
||||||
import { transformTableStateToQuery, isBlank } from '@/utils';
|
import { transformTableStateToQuery, isBlank } from '@/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,6 +94,15 @@ export const useAccountsTableColumns = () => {
|
|||||||
width: 75,
|
width: 75,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'bank_balance',
|
||||||
|
Header: 'Bank Balance',
|
||||||
|
accessor: 'bank_balance_formatted',
|
||||||
|
Cell: BankBalanceCell,
|
||||||
|
width: 150,
|
||||||
|
clickable: true,
|
||||||
|
align: 'right',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'balance',
|
id: 'balance',
|
||||||
Header: intl.get('balance'),
|
Header: intl.get('balance'),
|
||||||
@@ -119,5 +128,5 @@ export const transformAccountsStateToQuery = (tableState) => {
|
|||||||
return {
|
return {
|
||||||
...transformTableStateToQuery(tableState),
|
...transformTableStateToQuery(tableState),
|
||||||
inactive_mode: tableState.inactiveMode,
|
inactive_mode: tableState.inactiveMode,
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
PlaidLinkOnEventMetadata,
|
PlaidLinkOnEventMetadata,
|
||||||
PlaidLinkStableEvent,
|
PlaidLinkStableEvent,
|
||||||
} from 'react-plaid-link';
|
} from 'react-plaid-link';
|
||||||
import { logEvent } from './_utils';
|
import { logEvent, logExit, logSuccess } from './_utils';
|
||||||
import { usePlaidExchangeToken } from '@/hooks/query';
|
import { usePlaidExchangeToken } from '@/hooks/query';
|
||||||
import { useResetBankingPlaidToken } from '@/hooks/state/banking';
|
import { useResetBankingPlaidToken } from '@/hooks/state/banking';
|
||||||
|
|
||||||
|
|||||||
@@ -28,3 +28,19 @@ export const logSuccess = async ({
|
|||||||
link_session_id,
|
link_session_id,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const logExit = async (
|
||||||
|
error: PlaidLinkError | null,
|
||||||
|
{ institution, status, link_session_id, request_id }: PlaidLinkOnExitMetadata,
|
||||||
|
) => {
|
||||||
|
logEvent(
|
||||||
|
'onExit',
|
||||||
|
{
|
||||||
|
institution,
|
||||||
|
status,
|
||||||
|
link_session_id,
|
||||||
|
request_id,
|
||||||
|
},
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -71,6 +71,19 @@ function AccountBalanceItem() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function AccountBankBalanceItem() {
|
||||||
|
const { currentAccount } = useAccountTransactionsContext();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AccountBalanceItemWrap>
|
||||||
|
Balance in Bank Account
|
||||||
|
<AccountBalanceAmount>
|
||||||
|
{currentAccount.bank_balance_formatted}
|
||||||
|
</AccountBalanceAmount>
|
||||||
|
</AccountBalanceItemWrap>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function AccountTransactionsDetailsBarSkeleton() {
|
function AccountTransactionsDetailsBarSkeleton() {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
@@ -89,6 +102,7 @@ function AccountTransactionsDetailsContent() {
|
|||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<AccountSwitchItem />
|
<AccountSwitchItem />
|
||||||
<AccountBalanceItem />
|
<AccountBalanceItem />
|
||||||
|
<AccountBankBalanceItem />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,8 @@ import { useGetBankingPlaidToken } from '@/hooks/state/banking';
|
|||||||
export function CashflowAccountsPlaidLink() {
|
export function CashflowAccountsPlaidLink() {
|
||||||
const plaidToken = useGetBankingPlaidToken();
|
const plaidToken = useGetBankingPlaidToken();
|
||||||
|
|
||||||
|
if (!plaidToken) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return <LaunchLink token={plaidToken} />;
|
return <LaunchLink token={plaidToken} />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user