re-structure to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 01:02:31 +02:00
parent 8242ec64ba
commit 7a0a13f9d5
10400 changed files with 46966 additions and 17223 deletions

View File

@@ -0,0 +1,77 @@
// @ts-nocheck
import React from 'react';
import moment from 'moment';
import * as R from 'ramda';
import ProfitLossSheetHeader from './ProfitLossSheetHeader';
import ProfitLossActionsBar from './ProfitLossActionsBar';
import { DashboardPageContent } from '@/components';
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
import withProfitLossActions from './withProfitLossActions';
import { useProfitLossSheetQuery } from './utils';
import { ProfitLossSheetProvider } from './ProfitLossProvider';
import { ProfitLossSheetLoadingBar } from './components';
import { ProfitLossBody } from './ProfitLossBody';
/**
* Profit/Loss financial statement sheet.
* @returns {React.JSX}
*/
function ProfitLossSheet({
// #withProfitLossActions
toggleProfitLossFilterDrawer: toggleDisplayFilterDrawer,
}) {
// Profit/loss sheet query.
const { query, setLocationQuery } = useProfitLossSheetQuery();
// Handle submit filter.
const handleSubmitFilter = (filter) => {
const newFilter = {
...filter,
fromDate: moment(filter.fromDate).format('YYYY-MM-DD'),
toDate: moment(filter.toDate).format('YYYY-MM-DD'),
};
setLocationQuery(newFilter);
};
// Handle number format submit.
const handleNumberFormatSubmit = (numberFormat) => {
setLocationQuery({
...query,
numberFormat,
});
};
// Hide the filter drawer once the page unmount.
React.useEffect(
() => () => {
toggleDisplayFilterDrawer(false);
},
[toggleDisplayFilterDrawer],
);
return (
<ProfitLossSheetProvider query={query}>
<ProfitLossActionsBar
numberFormat={query.numberFormat}
onNumberFormatSubmit={handleNumberFormatSubmit}
/>
<ProfitLossSheetLoadingBar />
{/* <ProfitLossSheetAlerts /> */}
<DashboardPageContent>
<ProfitLossSheetHeader
pageFilter={query}
onSubmitFilter={handleSubmitFilter}
/>
<ProfitLossBody />
</DashboardPageContent>
</ProfitLossSheetProvider>
);
}
export default R.compose(
withDashboardActions,
withProfitLossActions,
)(ProfitLossSheet);