mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
feat: add specific cashflow account transactions.
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
|||||||
const AccountTransactionsContext = React.createContext();
|
const AccountTransactionsContext = React.createContext();
|
||||||
|
|
||||||
function flattenInfinityPages(data) {
|
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,
|
isSuccess: isCashflowTransactionsSuccess,
|
||||||
fetchNextPage: fetchNextTransactionsPage,
|
fetchNextPage: fetchNextTransactionsPage,
|
||||||
isFetchingNextPage,
|
isFetchingNextPage,
|
||||||
hasNextPage
|
hasNextPage,
|
||||||
} = useAccountTransactionsInfinity(accountId, {
|
} = useAccountTransactionsInfinity(accountId, {
|
||||||
page_size: 50,
|
page_size: 50,
|
||||||
|
account_id: accountId,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Memorized the cashflow account transactions.
|
// Memorized the cashflow account transactions.
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export function useAccountTransactionsColumns() {
|
|||||||
{
|
{
|
||||||
id: 'type',
|
id: 'type',
|
||||||
Header: intl.get('type'),
|
Header: intl.get('type'),
|
||||||
accessor: 'reference_type_formatted',
|
accessor: 'formatted_transaction_type',
|
||||||
className: 'type',
|
className: 'type',
|
||||||
width: 140,
|
width: 140,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
@@ -89,12 +89,21 @@ export function useAccountTransactionsColumns() {
|
|||||||
{
|
{
|
||||||
id: 'running_balance',
|
id: 'running_balance',
|
||||||
Header: intl.get('cash_flow.label.running_balance'),
|
Header: intl.get('cash_flow.label.running_balance'),
|
||||||
accessor: 'running_balance',
|
accessor: 'formatted_running_balance',
|
||||||
className: 'running_balance',
|
className: 'running_balance',
|
||||||
width: 150,
|
width: 150,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'balance',
|
||||||
|
Header: intl.get('balance'),
|
||||||
|
accessor: 'formatted_balance',
|
||||||
|
className: 'balance',
|
||||||
|
width: 150,
|
||||||
|
textOverview: true,
|
||||||
|
align: 'right',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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 .
|
* Create Money in owner contribution .
|
||||||
*/
|
*/
|
||||||
@@ -123,7 +108,7 @@ export function useAccountTransactionsInfinity(
|
|||||||
const response = await apiRequest.http({
|
const response = await apiRequest.http({
|
||||||
...axios,
|
...axios,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `/api/cashflow/account/${accountId}/transactions`,
|
url: `/api/financial_statements/cashflow-account-transactions`,
|
||||||
params: { page: pageParam, ...query },
|
params: { page: pageParam, ...query },
|
||||||
});
|
});
|
||||||
return response.data;
|
return response.data;
|
||||||
|
|||||||
Reference in New Issue
Block a user