Fix : Auto-Increment Dialog

This commit is contained in:
elforjani3
2020-11-08 21:19:54 +02:00
parent 3ab6c4da2a
commit 6c8ff20847
19 changed files with 194 additions and 83 deletions

View File

@@ -9,7 +9,7 @@ import {
import { DateInput } from '@blueprintjs/datetime';
import { FormattedMessage as T } from 'react-intl';
import moment from 'moment';
import { momentFormatter, compose, tansformDateValue } from 'utils';
import { momentFormatter, compose, tansformDateValue, saveInvoke } from 'utils';
import classNames from 'classnames';
import { CLASSES } from 'common/classes';
import {
@@ -32,6 +32,9 @@ function InvoiceFormHeader({
customers,
//#withDialogActions
openDialog,
// #ownProps
onInvoiceNumberChanged,
}) {
const handleDateChange = useCallback(
(date_filed) => (date) => {
@@ -41,17 +44,6 @@ function InvoiceFormHeader({
[setFieldValue],
);
const CustomerRenderer = useCallback(
(cutomer, { handleClick }) => (
<MenuItem
key={cutomer.id}
text={cutomer.display_name}
onClick={handleClick}
/>
),
[],
);
// handle change customer
const onChangeCustomer = useCallback(
(filedName) => {
@@ -66,6 +58,10 @@ function InvoiceFormHeader({
openDialog('invoice-number-form', {});
}, [openDialog]);
const handleInvoiceNumberChanged = (event) => {
saveInvoke(onInvoiceNumberChanged, event.currentTarget.value);
};
return (
<div className={classNames(CLASSES.PAGE_FORM_HEADER)}>
<div className={classNames(CLASSES.PAGE_FORM_HEADER_PRIMARY)}>
@@ -144,6 +140,7 @@ function InvoiceFormHeader({
</FormGroup>
</Col>
</Row>
{/* ----------- Invoice number ----------- */}
<FormGroup
label={<T id={'invoice_no'} />}
@@ -171,6 +168,7 @@ function InvoiceFormHeader({
/>
}
{...getFieldProps('invoice_no')}
onBlur={handleInvoiceNumberChanged}
/>
</FormGroup>