mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
Merge branch 'master' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { DrawerHeaderContent, DashboardInsider } from 'components';
|
||||
import { useInventoryAdjustment } from 'hooks/query';
|
||||
|
||||
const InventoryAdjustmentDrawerContext = React.createContext();
|
||||
|
||||
/**
|
||||
* Inventory adjustment drawer provider.
|
||||
*/
|
||||
function InventoryAdjustmentDrawerProvider({ inventoryId, ...props }) {
|
||||
// Handle fetch inventory adjustment .
|
||||
const { data: inventoryAdjustment, isLoading: isAdjustmentsLoading } =
|
||||
useInventoryAdjustment(inventoryId, {
|
||||
enabled: !!inventoryId,
|
||||
});
|
||||
|
||||
//provider.
|
||||
const provider = {
|
||||
inventoryAdjustment,
|
||||
inventoryId,
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardInsider loading={isAdjustmentsLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="inventory-adjustment-drawer"
|
||||
title={intl.get('inventory_adjustment.details_drawer.title')}
|
||||
/>
|
||||
|
||||
<InventoryAdjustmentDrawerContext.Provider value={provider} {...props} />
|
||||
</DashboardInsider>
|
||||
);
|
||||
}
|
||||
|
||||
const useInventoryAdjustmentDrawerContext = () =>
|
||||
React.useContext(InventoryAdjustmentDrawerContext);
|
||||
|
||||
export {
|
||||
InventoryAdjustmentDrawerProvider,
|
||||
useInventoryAdjustmentDrawerContext,
|
||||
};
|
||||
Reference in New Issue
Block a user