fix: toggle display filter drawer of financial statements.

This commit is contained in:
a.bouhuolia
2021-02-22 15:38:17 +02:00
parent 1e3b8df702
commit 2750d64fac
49 changed files with 716 additions and 1075 deletions

View File

@@ -13,9 +13,6 @@ import { JournalSheetProvider } from './JournalProvider';
import withSettings from 'containers/Settings/withSettings';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withJournalActions from './withJournalActions';
import withJournal from './withJournal';
import { transformFilterFormToQuery } from 'containers/FinancialStatements/common';
import 'style/pages/FinancialStatements/Journal.scss';
@@ -23,35 +20,17 @@ import 'style/pages/FinancialStatements/Journal.scss';
* Journal sheet.
*/
function Journal({
// #withDashboardActions
changePageTitle,
setDashboardBackLink,
setSidebarShrink,
// #withPreferences
organizationName,
// #withJournalActions
toggleJournalSheetFilter
}) {
const [filter, setFilter] = useState({
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
toDate: moment().endOf('year').format('YYYY-MM-DD'),
basis: 'accural',
});
const { formatMessage } = useIntl();
useEffect(() => {
changePageTitle(formatMessage({ id: 'journal_sheet' }));
}, [changePageTitle, formatMessage]);
useEffect(() => {
setSidebarShrink();
// Show the back link on dashboard topbar.
setDashboardBackLink(true);
return () => {
// Hide the back link on dashboard topbar.
setDashboardBackLink(false);
};
}, [setDashboardBackLink, setSidebarShrink]);
// Handle financial statement filter change.
const handleFilterSubmit = useCallback(
@@ -66,6 +45,11 @@ function Journal({
[setFilter],
);
// Hide the journal sheet filter drawer once the page unmount.
useEffect(() => () => {
toggleJournalSheetFilter(false);
}, [toggleJournalSheetFilter]);
return (
<JournalSheetProvider query={filter}>
<JournalActionsBar />
@@ -94,7 +78,4 @@ export default compose(
withSettings(({ organizationSettings }) => ({
organizationName: organizationSettings.name,
})),
withJournal(({ journalSheetRefresh }) => ({
journalSheetRefresh,
})),
)(Journal);