feat: get bank account meta summary

This commit is contained in:
Ahmed Bouhuolia
2024-07-02 19:21:26 +02:00
parent 8a09de9771
commit 91730d204e
22 changed files with 476 additions and 69 deletions

View File

@@ -4,6 +4,7 @@ import { useParams } from 'react-router-dom';
import { DashboardInsider } from '@/components';
import { useCashflowAccounts, useAccount } from '@/hooks/query';
import { useAppQueryString } from '@/hooks';
import { useGetBankAccountSummaryMeta } from '@/hooks/query/bank-rules';
const AccountTransactionsContext = React.createContext();
@@ -20,31 +21,38 @@ function AccountTransactionsProvider({ query, ...props }) {
const setFilterTab = (value: string) => {
setLocationQuery({ filter: value });
};
// Fetch cashflow accounts.
// Retrieves cashflow accounts.
const {
data: cashflowAccounts,
isFetching: isCashFlowAccountsFetching,
isLoading: isCashFlowAccountsLoading,
} = useCashflowAccounts(query, { keepPreviousData: true });
// Retrieve specific account details.
// Retrieves specific account details.
const {
data: currentAccount,
isFetching: isCurrentAccountFetching,
isLoading: isCurrentAccountLoading,
} = useAccount(accountId, { keepPreviousData: true });
// Retrieves the bank account meta summary.
const {
data: bankAccountMetaSummary,
isLoading: isBankAccountMetaSummaryLoading,
} = useGetBankAccountSummaryMeta(accountId);
// Provider payload.
const provider = {
accountId,
cashflowAccounts,
currentAccount,
bankAccountMetaSummary,
isCashFlowAccountsFetching,
isCashFlowAccountsLoading,
isCurrentAccountFetching,
isCurrentAccountLoading,
isBankAccountMetaSummaryLoading,
filterTab,
setFilterTab,