feat(financial reports): add branch multi select.

This commit is contained in:
elforjani13
2022-02-16 20:43:00 +02:00
parent c01fa85198
commit cffcef6f43
18 changed files with 392 additions and 31 deletions

View File

@@ -0,0 +1,37 @@
import React from 'react';
import { useBranches } from 'hooks/query';
import { FinancialHeaderLoadingSkeleton } from '../FinancialHeaderLoadingSkeleton';
const CashFlowStatementDimensionsPanelContext = React.createContext();
/**
* cash flow statement dimensions panel provider.
* @returns
*/
function CashFlowStatementDimensionsPanelProvider({ ...props }) {
// Fetches the branches list.
const { isLoading: isBranchesLoading, data: branches } = useBranches();
// Provider
const provider = {
branches,
isBranchesLoading,
};
return isBranchesLoading ? (
<FinancialHeaderLoadingSkeleton />
) : (
<CashFlowStatementDimensionsPanelContext.Provider
value={provider}
{...props}
/>
);
}
const useCashFlowStatementDimensionsPanelContext = () =>
React.useContext(CashFlowStatementDimensionsPanelContext);
export {
CashFlowStatementDimensionsPanelProvider,
useCashFlowStatementDimensionsPanelContext,
};