mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
fix: toggle display filter drawer of financial statements.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import moment from 'moment';
|
||||
import { compose } from 'utils';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
||||
import ProfitLossSheetHeader from './ProfitLossSheetHeader';
|
||||
import ProfitLossSheetTable from './ProfitLossSheetTable';
|
||||
@@ -20,13 +19,11 @@ import { ProfitLossSheetProvider } from './ProfitLossProvider';
|
||||
* Profit/Loss financial statement sheet.
|
||||
*/
|
||||
function ProfitLossSheet({
|
||||
// #withDashboardActions
|
||||
changePageTitle,
|
||||
setDashboardBackLink,
|
||||
setSidebarShrink,
|
||||
|
||||
// #withPreferences
|
||||
organizationName,
|
||||
|
||||
// #withProfitLossActions
|
||||
toggleProfitLossFilterDrawer: toggleDisplayFilterDrawer
|
||||
}) {
|
||||
const [filter, setFilter] = useState({
|
||||
basis: 'cash',
|
||||
@@ -35,24 +32,7 @@ function ProfitLossSheet({
|
||||
displayColumnsType: 'total',
|
||||
accountsFilter: 'all-accounts',
|
||||
});
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
// Change page title of the dashboard.
|
||||
useEffect(() => {
|
||||
changePageTitle(formatMessage({ id: 'profit_loss_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 submit filter.
|
||||
const handleSubmitFilter = (filter) => {
|
||||
const _filter = {
|
||||
@@ -71,6 +51,11 @@ function ProfitLossSheet({
|
||||
});
|
||||
};
|
||||
|
||||
// Hide the filter drawer once the page unmount.
|
||||
React.useEffect(() => () => {
|
||||
toggleDisplayFilterDrawer(false);
|
||||
}, [toggleDisplayFilterDrawer])
|
||||
|
||||
return (
|
||||
<ProfitLossSheetProvider query={filter}>
|
||||
<ProfitLossActionsBar
|
||||
|
||||
Reference in New Issue
Block a user