import React, { useMemo, useCallback, useState } from 'react'; import { FormGroup, InputGroup, Intent, Position, ControlGroup, } from '@blueprintjs/core'; import { DateInput } from '@blueprintjs/datetime'; import { FormattedMessage as T } from 'react-intl'; import moment from 'moment'; import { momentFormatter, compose, tansformDateValue, saveInvoke } from 'utils'; import classNames from 'classnames'; import { CLASSES } from 'common/classes'; import { ContactSelecetList, ErrorMessage, FieldRequiredHint, Icon, InputPrependButton, Row, Col, } from 'components'; import withCustomers from 'containers/Customers/withCustomers'; import withDialogActions from 'containers/Dialog/withDialogActions'; function InvoiceFormHeader({ formik: { errors, touched, setFieldValue, getFieldProps, values }, //#withCustomers customers, //#withDialogActions openDialog, // #ownProps onInvoiceNumberChanged, }) { const handleDateChange = useCallback( (date_filed) => (date) => { const formatted = moment(date).format('YYYY-MM-DD'); setFieldValue(date_filed, formatted); }, [setFieldValue], ); // handle change customer const onChangeCustomer = useCallback( (filedName) => { return (customer) => { setFieldValue(filedName, customer.id); }; }, [setFieldValue], ); const handleInvoiceNumberChange = useCallback(() => { openDialog('invoice-number-form', {}); }, [openDialog]); const handleInvoiceNumberChanged = (event) => { saveInvoke(onInvoiceNumberChanged, event.currentTarget.value); }; return (