mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: add specific cashflow account transactions.
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
const AccountTransactionsContext = React.createContext();
|
||||
|
||||
function flattenInfinityPages(data) {
|
||||
return flatten(map(data.pages, (page) => page.cashflow_transactions));
|
||||
return flatten(map(data.pages, (page) => page.transactions));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,9 +30,10 @@ function AccountTransactionsProvider({ query, ...props }) {
|
||||
isSuccess: isCashflowTransactionsSuccess,
|
||||
fetchNextPage: fetchNextTransactionsPage,
|
||||
isFetchingNextPage,
|
||||
hasNextPage
|
||||
hasNextPage,
|
||||
} = useAccountTransactionsInfinity(accountId, {
|
||||
page_size: 50,
|
||||
account_id: accountId,
|
||||
});
|
||||
|
||||
// Memorized the cashflow account transactions.
|
||||
|
||||
@@ -49,7 +49,7 @@ export function useAccountTransactionsColumns() {
|
||||
{
|
||||
id: 'type',
|
||||
Header: intl.get('type'),
|
||||
accessor: 'reference_type_formatted',
|
||||
accessor: 'formatted_transaction_type',
|
||||
className: 'type',
|
||||
width: 140,
|
||||
textOverview: true,
|
||||
@@ -89,12 +89,21 @@ export function useAccountTransactionsColumns() {
|
||||
{
|
||||
id: 'running_balance',
|
||||
Header: intl.get('cash_flow.label.running_balance'),
|
||||
accessor: 'running_balance',
|
||||
accessor: 'formatted_running_balance',
|
||||
className: 'running_balance',
|
||||
width: 150,
|
||||
textOverview: true,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
id: 'balance',
|
||||
Header: intl.get('balance'),
|
||||
accessor: 'formatted_balance',
|
||||
className: 'balance',
|
||||
width: 150,
|
||||
textOverview: true,
|
||||
align: 'right',
|
||||
},
|
||||
],
|
||||
[],
|
||||
);
|
||||
|
||||
@@ -7,7 +7,7 @@ const commonInvalidateQueries = (queryClient) => {
|
||||
// Invalidate accounts.
|
||||
queryClient.invalidateQueries(t.ACCOUNTS);
|
||||
queryClient.invalidateQueries(t.ACCOUNT);
|
||||
|
||||
|
||||
// Invalidate account transactions.
|
||||
queryClient.invalidateQueries(t.ACCOUNT_TRANSACTION);
|
||||
|
||||
@@ -38,21 +38,6 @@ export function useCashflowAccounts(query, props) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve account transactions list.
|
||||
*/
|
||||
export function useCashflowTransactions(accountId, props) {
|
||||
return useRequestQuery(
|
||||
[t.CASH_FLOW_TRANSACTIONS, accountId],
|
||||
{ method: 'get', url: `cashflow/account/${accountId}/transactions` },
|
||||
{
|
||||
select: (res) => res.data.cashflow_transactions,
|
||||
defaultData: [],
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Money in owner contribution .
|
||||
*/
|
||||
@@ -123,7 +108,7 @@ export function useAccountTransactionsInfinity(
|
||||
const response = await apiRequest.http({
|
||||
...axios,
|
||||
method: 'get',
|
||||
url: `/api/cashflow/account/${accountId}/transactions`,
|
||||
url: `/api/financial_statements/cashflow-account-transactions`,
|
||||
params: { page: pageParam, ...query },
|
||||
});
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user