mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
// @ts-nocheck
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import moment from 'moment';
|
||||
|
||||
import { DashboardPageContent } from '@/components';
|
||||
import InventoryValuationActionsBar from './InventoryValuationActionsBar';
|
||||
import InventoryValuationHeader from './InventoryValuationHeader';
|
||||
|
||||
import { InventoryValuationProvider } from './InventoryValuationProvider';
|
||||
import { InventoryValuationBody } from './InventoryValuationBody';
|
||||
import { InventoryValuationLoadingBar } from './components';
|
||||
import { useInventoryValuationQuery } from './utils';
|
||||
import { compose } from '@/utils';
|
||||
|
||||
import withInventoryValuationActions from './withInventoryValuationActions';
|
||||
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
|
||||
|
||||
/**
|
||||
* Inventory valuation.
|
||||
*/
|
||||
function InventoryValuation({
|
||||
// #withInventoryValuationActions
|
||||
toggleInventoryValuationFilterDrawer,
|
||||
}) {
|
||||
const { query, setLocationQuery } = useInventoryValuationQuery();
|
||||
|
||||
// Handle filter form submit.
|
||||
const handleFilterSubmit = useCallback(
|
||||
(filter) => {
|
||||
const newFilter = {
|
||||
...filter,
|
||||
asDate: moment(filter.asDate).format('YYYY-MM-DD'),
|
||||
};
|
||||
setLocationQuery(newFilter);
|
||||
},
|
||||
[setLocationQuery],
|
||||
);
|
||||
// Handle number format form submit.
|
||||
const handleNumberFormatSubmit = (numberFormat) => {
|
||||
setLocationQuery({
|
||||
...query,
|
||||
numberFormat,
|
||||
});
|
||||
};
|
||||
// Hide the filter drawer once the page unmount.
|
||||
useEffect(
|
||||
() => () => {
|
||||
toggleInventoryValuationFilterDrawer(false);
|
||||
},
|
||||
[toggleInventoryValuationFilterDrawer],
|
||||
);
|
||||
|
||||
return (
|
||||
<InventoryValuationProvider query={query}>
|
||||
<InventoryValuationActionsBar
|
||||
numberFormat={query.numberFormat}
|
||||
onNumberFormatSubmit={handleNumberFormatSubmit}
|
||||
/>
|
||||
<InventoryValuationLoadingBar />
|
||||
|
||||
<DashboardPageContent>
|
||||
<InventoryValuationHeader
|
||||
pageFilter={query}
|
||||
onSubmitFilter={handleFilterSubmit}
|
||||
/>
|
||||
<InventoryValuationBody />
|
||||
</DashboardPageContent>
|
||||
</InventoryValuationProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withInventoryValuationActions,
|
||||
withCurrentOrganization(({ organization }) => ({
|
||||
organizationName: organization.name,
|
||||
})),
|
||||
)(InventoryValuation);
|
||||
Reference in New Issue
Block a user