mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
fix(BS|PL): report query.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import { Formik, Form } from 'formik';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import * as Yup from 'yup';
|
||||
import * as R from 'ramda';
|
||||
import { Tabs, Tab, Button, Intent } from '@blueprintjs/core';
|
||||
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import FinancialStatementHeader from 'containers/FinancialStatements/FinancialStatementHeader';
|
||||
import ProfitLossSheetHeaderGeneralPane from './ProfitLossSheetHeaderGeneralPane';
|
||||
import ProfitLossSheetHeaderComparisonPanel from './ProfitLossSheetHeaderComparisonPanel';
|
||||
@@ -13,8 +12,12 @@ import ProfitLossSheetHeaderComparisonPanel from './ProfitLossSheetHeaderCompari
|
||||
import withProfitLoss from './withProfitLoss';
|
||||
import withProfitLossActions from './withProfitLossActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
import { useProfitLossHeaderValidationSchema } from './utils';
|
||||
|
||||
/**
|
||||
* Profit/loss header.
|
||||
* @returns {React.JSX}
|
||||
*/
|
||||
function ProfitLossHeader({
|
||||
// #ownProps
|
||||
pageFilter,
|
||||
@@ -27,15 +30,7 @@ function ProfitLossHeader({
|
||||
toggleProfitLossFilterDrawer: toggleFilterDrawer,
|
||||
}) {
|
||||
// Validation schema.
|
||||
const validationSchema = Yup.object().shape({
|
||||
fromDate: Yup.date().required().label(intl.get('from_date')),
|
||||
toDate: Yup.date()
|
||||
.min(Yup.ref('fromDate'))
|
||||
.required()
|
||||
.label(intl.get('to_date')),
|
||||
filterByOption: Yup.string(),
|
||||
displayColumnsType: Yup.string(),
|
||||
});
|
||||
const validationSchema = useProfitLossHeaderValidationSchema();
|
||||
|
||||
// Initial values.
|
||||
const initialValues = {
|
||||
@@ -43,13 +38,11 @@ function ProfitLossHeader({
|
||||
fromDate: moment(pageFilter.fromDate).toDate(),
|
||||
toDate: moment(pageFilter.toDate).toDate(),
|
||||
};
|
||||
|
||||
// Handle form submit.
|
||||
const handleSubmit = (values, actions) => {
|
||||
onSubmitFilter(values);
|
||||
toggleFilterDrawer(false);
|
||||
};
|
||||
|
||||
// Handles the cancel button click.
|
||||
const handleCancelClick = () => {
|
||||
toggleFilterDrawer(false);
|
||||
@@ -59,7 +52,7 @@ function ProfitLossHeader({
|
||||
toggleFilterDrawer(false);
|
||||
};
|
||||
|
||||
return (
|
||||
return (
|
||||
<FinancialStatementHeader
|
||||
isOpen={profitLossDrawerFilter}
|
||||
drawerProps={{ onClose: handleDrawerClose }}
|
||||
@@ -97,7 +90,7 @@ function ProfitLossHeader({
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
export default R.compose(
|
||||
withProfitLoss(({ profitLossDrawerFilter }) => ({
|
||||
profitLossDrawerFilter,
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user