mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat: add View detail.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { useVendorCredit } from 'hooks/query';
|
||||
import { DrawerHeaderContent, DrawerLoading } from 'components';
|
||||
|
||||
const VendorCreditDetailDrawerContext = React.createContext();
|
||||
|
||||
/**
|
||||
* Vendor credit drawer provider.
|
||||
*/
|
||||
function VendorCreditDetailDrawerProvider({ vendorCreditId, ...props }) {
|
||||
// Handle fetch vendor credit details.
|
||||
const { data: vendorCredit, isLoading: isVendorCreditLoading } =
|
||||
useVendorCredit(vendorCreditId, {
|
||||
enabled: !!vendorCreditId,
|
||||
});
|
||||
|
||||
const provider = {
|
||||
vendorCredit,
|
||||
vendorCreditId,
|
||||
};
|
||||
|
||||
return (
|
||||
<DrawerLoading loading={isVendorCreditLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="vendor-credit-detail-drawer"
|
||||
title={intl.get('vendor_credit.drawer_vendor_credit_detail')}
|
||||
/>
|
||||
<VendorCreditDetailDrawerContext.Provider value={provider} {...props} />
|
||||
</DrawerLoading>
|
||||
);
|
||||
}
|
||||
|
||||
const useVendorCreditDetailDrawerContext = () =>
|
||||
React.useContext(VendorCreditDetailDrawerContext);
|
||||
|
||||
export { VendorCreditDetailDrawerProvider, useVendorCreditDetailDrawerContext };
|
||||
Reference in New Issue
Block a user