mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// @ts-nocheck
|
||||
import React, { useMemo, createContext, useContext } from 'react';
|
||||
|
||||
import FinancialReportPage from '../FinancialReportPage';
|
||||
import { useAPAgingSummaryReport } from '@/hooks/query';
|
||||
import { transformFilterFormToQuery } from '../common';
|
||||
|
||||
const APAgingSummaryContext = createContext();
|
||||
|
||||
/**
|
||||
* A/P aging summary provider.
|
||||
*/
|
||||
function APAgingSummaryProvider({ filter, ...props }) {
|
||||
// Transformers the filter from to the Url query.
|
||||
const query = useMemo(() => transformFilterFormToQuery(filter), [filter]);
|
||||
|
||||
const {
|
||||
data: APAgingSummary,
|
||||
isLoading: isAPAgingLoading,
|
||||
isFetching: isAPAgingFetching,
|
||||
refetch,
|
||||
} = useAPAgingSummaryReport(query, { keepPreviousData: true });
|
||||
|
||||
const provider = {
|
||||
APAgingSummary,
|
||||
|
||||
isAPAgingLoading,
|
||||
isAPAgingFetching,
|
||||
refetch,
|
||||
};
|
||||
|
||||
return (
|
||||
<FinancialReportPage name={'AP-Aging-Summary'}>
|
||||
<APAgingSummaryContext.Provider value={provider} {...props} />
|
||||
</FinancialReportPage>
|
||||
);
|
||||
}
|
||||
|
||||
const useAPAgingSummaryContext = () => useContext(APAgingSummaryContext);
|
||||
|
||||
export { APAgingSummaryProvider, useAPAgingSummaryContext };
|
||||
Reference in New Issue
Block a user