feat(webapp): wip tax rates management

This commit is contained in:
Ahmed Bouhuolia
2023-09-14 23:35:54 +02:00
parent b98b73ad98
commit 8a64198433
34 changed files with 1205 additions and 14 deletions

View File

@@ -0,0 +1,40 @@
// @ts-nocheck
import React, { createContext, useContext } from 'react';
import { DrawerLoading } from '@/components';
import { useTaxRate } from '@/hooks/query/taxRates';
const TaxRateDetailsContext = createContext();
interface TaxRateDetailsContentBootProps {
taxRateId: number;
}
/**
* Tax rate details content boot.
* @returns {JSX}
*/
export function TaxRateDetailsContentBoot({
taxRateId,
...props
}: TaxRateDetailsContentBootProps) {
const {
data: taxRate,
isFetching: isTaxRateFetching,
isLoading: isTaxRateLoading,
} = useTaxRate(taxRateId, { keepPreviousData: true });
const provider = {
isTaxRateLoading,
isTaxRateFetching,
taxRate,
taxRateId,
};
return (
<DrawerLoading loading={isTaxRateLoading}>
<TaxRateDetailsContext.Provider value={provider} {...props} />
</DrawerLoading>
);
}
export const useTaxRateDetailsContext = () => useContext(TaxRateDetailsContext);