mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat: Ability to hide/show financial statement header.
This commit is contained in:
@@ -80,7 +80,7 @@ function GeneralLedger({
|
||||
pageFilter={filter}
|
||||
onSubmitFilter={handleFilterSubmit} />
|
||||
|
||||
<div class="financial-statement__table">
|
||||
<div class="financial-statement__body">
|
||||
<GeneralLedgerTable
|
||||
companyName={organizationSettings.name}
|
||||
generalLedgerQuery={filter}
|
||||
|
||||
@@ -11,13 +11,25 @@ import {
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import Icon from 'components/Icon';
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'
|
||||
import { If } from 'components';
|
||||
import classNames from 'classnames';
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
|
||||
import withGeneralLedger from './withGeneralLedger';
|
||||
import withGeneralLedgerActions from './withGeneralLedgerActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
/**
|
||||
* General ledger actions bar.
|
||||
*/
|
||||
export default function GeneralLedgerActionsBar() {
|
||||
function GeneralLedgerActionsBar({
|
||||
// #withGeneralLedger
|
||||
generalLedgerSheetFilter,
|
||||
|
||||
// #withGeneralLedgerActions
|
||||
toggleGeneralLedgerSheetFilter,
|
||||
}) {
|
||||
const filterDropdown = FilterDropdown({
|
||||
fields: [],
|
||||
onFilterChange: (filterConditions) => {
|
||||
@@ -25,6 +37,10 @@ export default function GeneralLedgerActionsBar() {
|
||||
},
|
||||
});
|
||||
|
||||
const handleFilterClick = () => {
|
||||
toggleGeneralLedgerSheetFilter();
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
@@ -33,6 +49,27 @@ export default function GeneralLedgerActionsBar() {
|
||||
icon={<Icon icon='cog' />}
|
||||
text={<T id={'customize_report'}/>}
|
||||
/>
|
||||
|
||||
<NavbarDivider />
|
||||
|
||||
<If condition={generalLedgerSheetFilter}>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
text={<T id={'hide_filter'} />}
|
||||
icon={<Icon icon="arrow-to-top" />}
|
||||
onClick={handleFilterClick}
|
||||
/>
|
||||
</If>
|
||||
|
||||
<If condition={!generalLedgerSheetFilter}>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
text={<T id={'show_filter'} />}
|
||||
icon={<Icon icon="arrow-to-bottom" />}
|
||||
onClick={handleFilterClick}
|
||||
/>
|
||||
</If>
|
||||
|
||||
<NavbarDivider />
|
||||
|
||||
<Popover
|
||||
@@ -59,4 +96,9 @@ export default function GeneralLedgerActionsBar() {
|
||||
</NavbarGroup>
|
||||
</DashboardActionsBar>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withGeneralLedger(({ generalLedgerSheetFilter }) => ({ generalLedgerSheetFilter })),
|
||||
withGeneralLedgerActions,
|
||||
)(GeneralLedgerActionsBar);
|
||||
@@ -18,13 +18,19 @@ import FinancialStatementDateRange from 'containers/FinancialStatements/Financia
|
||||
import RadiosAccountingBasis from '../RadiosAccountingBasis';
|
||||
import {compose} from 'utils';
|
||||
|
||||
import withGeneralLedger from './withGeneralLedger';
|
||||
|
||||
|
||||
function GeneralLedgerHeader({
|
||||
onSubmitFilter,
|
||||
pageFilter,
|
||||
accounts,
|
||||
}) {
|
||||
|
||||
// #withAccounts
|
||||
accounts,
|
||||
|
||||
// #withGeneralLedger
|
||||
generalLedgerSheetFilter,
|
||||
}) {
|
||||
const formik = useFormik({
|
||||
enableReinitialize: true,
|
||||
initialValues: {
|
||||
@@ -56,7 +62,7 @@ function GeneralLedgerHeader({
|
||||
}, [formik]);
|
||||
|
||||
return (
|
||||
<FinancialStatementHeader>
|
||||
<FinancialStatementHeader show={generalLedgerSheetFilter}>
|
||||
<FinancialStatementDateRange formik={formik} />
|
||||
|
||||
<Row>
|
||||
@@ -91,5 +97,6 @@ function GeneralLedgerHeader({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
AccountsConnect
|
||||
AccountsConnect,
|
||||
withGeneralLedger(({ generalLedgerSheetFilter }) => ({ generalLedgerSheetFilter })),
|
||||
)(GeneralLedgerHeader);
|
||||
@@ -24,6 +24,7 @@ export default (mapState) => {
|
||||
generalLedgerIndex,
|
||||
),
|
||||
generalLedgerSheetLoading: state.financialStatements.generalLedger.loading,
|
||||
generalLedgerSheetFilter: state.financialStatements.generalLedger.filter,
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
fetchGeneralLedger: (query = {}) => dispatch(fetchGeneralLedger({ query })),
|
||||
toggleGeneralLedgerSheetFilter: () => dispatch({ type: 'GENERAL_LEDGER_FILTER_TOGGLE' }),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps);
|
||||
Reference in New Issue
Block a user