mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
feat: add inventory adjustment entries.
This commit is contained in:
@@ -1,26 +1,48 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { Tab } from '@blueprintjs/core';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Card } from 'components';
|
import { DrawerMainTabs } from 'components';
|
||||||
|
import InventoryAdjustmentDetailTab from './InventoryAdjustmentDetailTab';
|
||||||
import InventoryAdjustmentDetailActionsBar from './InventoryAdjustmentDetailActionsBar';
|
import InventoryAdjustmentDetailActionsBar from './InventoryAdjustmentDetailActionsBar';
|
||||||
import InventoryAdjustmentDetailHeader from './InventoryAdjustmentDetailHeader';
|
import InventoryAdjustmentDetailGLEntriesPanel from './InventoryAdjustmentDetailGLEntriesPanel';
|
||||||
import InventoryAdjustmentDetailTable from './InventoryAdjustmentDetailTable';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inventory adjustment detail
|
* Inventory adjustment detail
|
||||||
|
* @returns {React.JSX}
|
||||||
*/
|
*/
|
||||||
export default function InventoryAdjustmentDetail() {
|
export default function InventoryAdjustmentDetail() {
|
||||||
return (
|
return (
|
||||||
<InventoryAdjustmentDetailsRoot>
|
<InventoryAdjustmentDetailsRoot>
|
||||||
<InventoryAdjustmentDetailActionsBar />
|
<InventoryAdjustmentDetailActionsBar />
|
||||||
|
<InventoryAdjustmentDetailTabs />
|
||||||
<Card>
|
|
||||||
<InventoryAdjustmentDetailHeader />
|
|
||||||
<InventoryAdjustmentDetailTable />
|
|
||||||
</Card>
|
|
||||||
</InventoryAdjustmentDetailsRoot>
|
</InventoryAdjustmentDetailsRoot>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invenoty adjusment details tabs.
|
||||||
|
* @returns {React.JSX}
|
||||||
|
*/
|
||||||
|
function InventoryAdjustmentDetailTabs() {
|
||||||
|
return (
|
||||||
|
<DrawerMainTabs
|
||||||
|
renderActiveTabPanelOnly={true}
|
||||||
|
defaultSelectedTabId="details"
|
||||||
|
>
|
||||||
|
<Tab
|
||||||
|
title={intl.get('details')}
|
||||||
|
id={'details'}
|
||||||
|
panel={<InventoryAdjustmentDetailTab />}
|
||||||
|
/>
|
||||||
|
<Tab
|
||||||
|
title={intl.get('journal_entries')}
|
||||||
|
id={'journal_entries'}
|
||||||
|
panel={<InventoryAdjustmentDetailGLEntriesPanel />}
|
||||||
|
/>
|
||||||
|
</DrawerMainTabs>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const InventoryAdjustmentDetailsRoot = styled.div``;
|
const InventoryAdjustmentDetailsRoot = styled.div``;
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
import { Card } from 'components';
|
||||||
|
import { useTransactionsByReference } from 'hooks/query';
|
||||||
|
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
|
||||||
|
|
||||||
|
import JournalEntriesTable, {
|
||||||
|
AmountDisplayedBaseCurrencyMessage,
|
||||||
|
} from '../../JournalEntriesTable/JournalEntriesTable';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inentory adjustmet detail GL entries panel.
|
||||||
|
* @returns {React.JSX}
|
||||||
|
*/
|
||||||
|
export default function InventoryAdjustmentDetailGLEntriesPanel() {
|
||||||
|
const { inventoryId } = useInventoryAdjustmentDrawerContext();
|
||||||
|
|
||||||
|
// Handle fetch transaction by reference.
|
||||||
|
const {
|
||||||
|
data: { transactions },
|
||||||
|
isLoading: isTransactionLoading,
|
||||||
|
} = useTransactionsByReference(
|
||||||
|
{
|
||||||
|
reference_id: inventoryId,
|
||||||
|
reference_type: 'inventoryAdjustment',
|
||||||
|
},
|
||||||
|
{ enabled: !!inventoryId },
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<InventoryAdjustmentGLEntriesRoot>
|
||||||
|
<AmountDisplayedBaseCurrencyMessage />
|
||||||
|
<JournalEntriesTable
|
||||||
|
loading={isTransactionLoading}
|
||||||
|
transactions={transactions}
|
||||||
|
/>
|
||||||
|
</InventoryAdjustmentGLEntriesRoot>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const InventoryAdjustmentGLEntriesRoot = styled(Card)``;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
import { CommercialDocBox } from 'components';
|
||||||
|
|
||||||
|
import InventoryAdjustmentDetailHeader from './InventoryAdjustmentDetailHeader';
|
||||||
|
import InventoryAdjustmentDetailTable from './InventoryAdjustmentDetailTable';
|
||||||
|
|
||||||
|
export default function InventoryAdjustmentDetailTab() {
|
||||||
|
return (
|
||||||
|
<CommercialDocBox>
|
||||||
|
<InventoryAdjustmentDetailHeader />
|
||||||
|
<InventoryAdjustmentDetailTable />
|
||||||
|
</CommercialDocBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,7 +19,12 @@ function InventoryAdjustmentDetailDrawer({
|
|||||||
payload: { inventoryId },
|
payload: { inventoryId },
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Drawer isOpen={isOpen} name={name} size={'750px'}>
|
<Drawer
|
||||||
|
isOpen={isOpen}
|
||||||
|
name={name}
|
||||||
|
style={{ minWidth: '700px', maxWidth: '900px' }}
|
||||||
|
size={'65%'}
|
||||||
|
>
|
||||||
<DrawerSuspense>
|
<DrawerSuspense>
|
||||||
<InventoryAdjustmentDrawerContent inventoryId={inventoryId} />
|
<InventoryAdjustmentDrawerContent inventoryId={inventoryId} />
|
||||||
</DrawerSuspense>
|
</DrawerSuspense>
|
||||||
|
|||||||
Reference in New Issue
Block a user