mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
fix: wip filter uncategorized transactions by date
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
|
||||
import React from 'react';
|
||||
import { flatten, map } from 'lodash';
|
||||
import * as R from 'ramda';
|
||||
import { IntersectionObserver } from '@/components';
|
||||
import { useAccountUncategorizedTransactionsInfinity } from '@/hooks/query';
|
||||
import { useAccountTransactionsContext } from './AccountTransactionsProvider';
|
||||
import { withBanking } from '../withBanking';
|
||||
|
||||
const AccountUncategorizedTransactionsContext = React.createContext();
|
||||
|
||||
@@ -13,9 +15,15 @@ function flattenInfinityPagesData(data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Account uncategorized transctions provider.
|
||||
* Account un-categorized transactions provider.
|
||||
*/
|
||||
function AccountUncategorizedTransactionsBoot({ children }) {
|
||||
function AccountUncategorizedTransactionsBootRoot({
|
||||
// #withBanking
|
||||
uncategorizedTransactionsFilter,
|
||||
|
||||
// #ownProps
|
||||
children,
|
||||
}) {
|
||||
const { accountId } = useAccountTransactionsContext();
|
||||
|
||||
// Fetches the uncategorized transactions.
|
||||
@@ -29,6 +37,8 @@ function AccountUncategorizedTransactionsBoot({ children }) {
|
||||
hasNextPage: hasUncategorizedTransactionsNextPage,
|
||||
} = useAccountUncategorizedTransactionsInfinity(accountId, {
|
||||
page_size: 50,
|
||||
min_date: uncategorizedTransactionsFilter?.fromDate,
|
||||
max_date: uncategorizedTransactionsFilter?.toDate,
|
||||
});
|
||||
// Memorized the cashflow account transactions.
|
||||
const uncategorizedTransactions = React.useMemo(
|
||||
@@ -69,6 +79,12 @@ function AccountUncategorizedTransactionsBoot({ children }) {
|
||||
);
|
||||
}
|
||||
|
||||
const AccountUncategorizedTransactionsBoot = R.compose(
|
||||
withBanking(({ uncategorizedTransactionsFilter }) => ({
|
||||
uncategorizedTransactionsFilter,
|
||||
})),
|
||||
)(AccountUncategorizedTransactionsBootRoot);
|
||||
|
||||
const useAccountUncategorizedTransactionsContext = () =>
|
||||
React.useContext(AccountUncategorizedTransactionsContext);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user