import React, { useEffect } from 'react'; import moment from 'moment'; import { Formik, Form } from 'formik'; import { FormattedMessage as T, useIntl } from 'react-intl'; import * as Yup from 'yup'; import { Tabs, Tab, Button, Intent } from '@blueprintjs/core'; import FinancialStatementHeader from 'containers/FinancialStatements/FinancialStatementHeader'; import ProfitLossSheetHeaderGeneralPane from './ProfitLossSheetHeaderGeneralPane'; import withProfitLoss from './withProfitLoss'; import withProfitLossActions from './withProfitLossActions'; import { compose } from 'utils'; function ProfitLossHeader({ // #ownProps pageFilter, onSubmitFilter, // #withProfitLoss profitLossDrawerFilter, // #withProfitLossActions toggleProfitLossFilterDrawer: toggleFilterDrawer, }) { const { formatMessage } = useIntl(); // Validation schema. const validationSchema = Yup.object().shape({ fromDate: Yup.date() .required() .label(formatMessage({ id: 'from_date' })), toDate: Yup.date() .min(Yup.ref('fromDate')) .required() .label(formatMessage({ id: 'to_date' })), accountsFilter: Yup.string(), displayColumnsType: Yup.string(), }); // Initial values. const initialValues = { ...pageFilter, 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); }; // Handles the drawer close action. const handleDrawerClose = () => { toggleFilterDrawer(false); }; return (
} panel={} />
); } export default compose( withProfitLoss(({ profitLossDrawerFilter }) => ({ profitLossDrawerFilter, })), withProfitLossActions, )(ProfitLossHeader);