BIG-3: add filtering non-zero items.

This commit is contained in:
elforjani13
2021-09-24 19:41:23 +02:00
parent a3f1857e91
commit 4e99607b06
25 changed files with 273 additions and 73 deletions

View File

@@ -30,22 +30,25 @@ function CustomersTransactionsHeader({
}) {
// Default form values.
const defaultValues = {
...pageFilter,
fromDate: moment().toDate(),
toDate: moment().toDate(),
customersIds: [],
};
// Initial form values.
const initialValues = transformToForm({
...pageFilter,
fromDate: moment(pageFilter.fromDate).toDate(),
toDate: moment(pageFilter.toDate).toDate(),
}, defaultValues);
const initialValues = transformToForm(
{
...defaultValues,
...pageFilter,
fromDate: moment(pageFilter.fromDate).toDate(),
toDate: moment(pageFilter.toDate).toDate(),
},
defaultValues,
);
// Validation schema.
const validationSchema = Yup.object().shape({
fromDate: Yup.date()
.required()
.label(intl.get('fromDate')),
fromDate: Yup.date().required().label(intl.get('fromDate')),
toDate: Yup.date()
.min(Yup.ref('fromDate'))
.required()
@@ -59,7 +62,9 @@ function CustomersTransactionsHeader({
setSubmitting(false);
};
// Handle drawer close action.
const handleDrawerClose = () => { toggleFilterDrawer(false); };
const handleDrawerClose = () => {
toggleFilterDrawer(false);
};
return (
<FinancialStatementHeader

View File

@@ -3,12 +3,15 @@ import classNames from 'classnames';
import { Field } from 'formik';
import { Classes, FormGroup } from '@blueprintjs/core';
import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange';
import FinancialStatementsFilter from '../FinancialStatementsFilter';
import {
Row,
Col,
ContactsMultiSelect,
FormattedMessage as T,
} from '../../../components';
import { filterCustomersOptions } from '../common';
import {
CustomersTransactionsGeneralPanelProvider,
useCustomersTransactionsGeneralPanelContext,
@@ -34,7 +37,11 @@ function CustomersTransactionsHeaderGeneralPanelContent() {
return (
<div>
<FinancialStatementDateRange />
<FinancialStatementsFilter
items={filterCustomersOptions}
label={<T id={'customers.label_filter_customers'} />}
initialSelectedItem={'all-customers'}
/>
<Row>
<Col xs={5}>
<Field name={'customersIds'}>