mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
// @ts-nocheck
|
||||
import React, { useEffect } from 'react';
|
||||
import moment from 'moment';
|
||||
|
||||
import { FinancialStatement, DashboardPageContent } from '@/components';
|
||||
import { CashFlowStatementBody } from './CashFlowStatementBody';
|
||||
import { CashFlowStatementProvider } from './CashFlowStatementProvider';
|
||||
|
||||
import CashFlowStatementHeader from './CashFlowStatementHeader';
|
||||
import CashFlowStatementActionsBar from './CashFlowStatementActionsBar';
|
||||
|
||||
import withCashFlowStatementActions from './withCashFlowStatementActions';
|
||||
import {
|
||||
CashFlowStatementLoadingBar,
|
||||
CashFlowStatementAlerts,
|
||||
} from './components';
|
||||
|
||||
import { useCashflowStatementQuery } from './utils';
|
||||
import { compose } from '@/utils';
|
||||
|
||||
/**
|
||||
* Cash flow statement.
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
function CashFlowStatement({
|
||||
// # withCashStatementActions
|
||||
toggleCashFlowStatementFilterDrawer,
|
||||
}) {
|
||||
// Cashflow statement query.
|
||||
const { query, setLocationQuery } = useCashflowStatementQuery();
|
||||
|
||||
// Handle refetch cash flow after filter change.
|
||||
const handleFilterSubmit = (filter) => {
|
||||
const newFilter = {
|
||||
...filter,
|
||||
fromDate: moment(filter.fromDate).format('YYYY-MM-DD'),
|
||||
toDate: moment(filter.toDate).format('YYYY-MM-DD'),
|
||||
};
|
||||
setLocationQuery({ ...newFilter });
|
||||
};
|
||||
// Handle format number submit.
|
||||
const handleNumberFormatSubmit = (values) => {
|
||||
setLocationQuery({
|
||||
...query,
|
||||
numberFormat: values,
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(
|
||||
() => () => {
|
||||
toggleCashFlowStatementFilterDrawer(false);
|
||||
},
|
||||
[toggleCashFlowStatementFilterDrawer],
|
||||
);
|
||||
|
||||
return (
|
||||
<CashFlowStatementProvider filter={query}>
|
||||
<CashFlowStatementActionsBar
|
||||
numberFormat={query.numberFormat}
|
||||
onNumberFormatSubmit={handleNumberFormatSubmit}
|
||||
/>
|
||||
<CashFlowStatementLoadingBar />
|
||||
<CashFlowStatementAlerts />
|
||||
|
||||
<DashboardPageContent>
|
||||
<FinancialStatement>
|
||||
<CashFlowStatementHeader
|
||||
pageFilter={query}
|
||||
onSubmitFilter={handleFilterSubmit}
|
||||
/>
|
||||
<CashFlowStatementBody />
|
||||
</FinancialStatement>
|
||||
</DashboardPageContent>
|
||||
</CashFlowStatementProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withCashFlowStatementActions)(CashFlowStatement);
|
||||
Reference in New Issue
Block a user