mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix: Filter financial reports by items, customers or vendors.
This commit is contained in:
@@ -2,7 +2,6 @@ import React from 'react';
|
||||
import * as Yup from 'yup';
|
||||
import moment from 'moment';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Formik, Form } from 'formik';
|
||||
import { Tabs, Tab, Button, Intent } from '@blueprintjs/core';
|
||||
|
||||
@@ -11,7 +10,7 @@ import InventoryValuationHeaderGeneralPanel from './InventoryValuationHeaderGene
|
||||
import withInventoryValuation from './withInventoryValuation';
|
||||
import withInventoryValuationActions from './withInventoryValuationActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
import { compose, transformToForm } from 'utils';
|
||||
|
||||
/**
|
||||
* inventory valuation header.
|
||||
@@ -27,18 +26,23 @@ function InventoryValuationHeader({
|
||||
// #withInventoryValuationActions
|
||||
toggleInventoryValuationFilterDrawer,
|
||||
}) {
|
||||
|
||||
|
||||
// Form validation schema.
|
||||
const validationSchema = Yup.object().shape({
|
||||
as_date: Yup.date().required().label('asDate'),
|
||||
asDate: Yup.date().required().label('asDate'),
|
||||
});
|
||||
|
||||
// Initial values.
|
||||
const initialValues = {
|
||||
as_date: moment(pageFilter.asDate).toDate(),
|
||||
// Default values.
|
||||
const defaultValues = {
|
||||
asDate: moment().toDate(),
|
||||
itemsIds: [],
|
||||
};
|
||||
// Initial values.
|
||||
const initialValues = transformToForm({
|
||||
...pageFilter,
|
||||
asDate: moment(pageFilter.asDate).toDate(),
|
||||
}, defaultValues);
|
||||
|
||||
// Handle the form of header submit.
|
||||
const handleSubmit = (values, { setSubmitting }) => {
|
||||
onSubmitFilter(values);
|
||||
toggleInventoryValuationFilterDrawer(false);
|
||||
|
||||
Reference in New Issue
Block a user