update it
This commit is contained in:
parent
3fb03e2a97
commit
b9192c4263
|
@ -191,9 +191,10 @@ class Form extends Component {
|
|||
const {
|
||||
visible,
|
||||
title,
|
||||
isLoading,
|
||||
isPending,
|
||||
schema,
|
||||
uiSchema,
|
||||
isLoading,
|
||||
formData,
|
||||
validate,
|
||||
onHide,
|
||||
|
@ -239,7 +240,7 @@ class Form extends Component {
|
|||
<Button clear onClick={onHide}>
|
||||
CANCEL
|
||||
</Button>
|
||||
<Button clear disabled={disableSubmitButton} onClick={handleSubmitButton}>
|
||||
<Button clear disabled={isPending || disableSubmitButton} onClick={handleSubmitButton}>
|
||||
SAVE
|
||||
</Button>
|
||||
</Footer>
|
||||
|
|
|
@ -270,6 +270,7 @@ class Edit extends Component {
|
|||
visible,
|
||||
action,
|
||||
isLoading,
|
||||
isPending,
|
||||
onHide,
|
||||
onSubmit
|
||||
} = this.props;
|
||||
|
@ -281,6 +282,7 @@ class Edit extends Component {
|
|||
schema={this.state.schema}
|
||||
uiSchema={this.state.uiSchema}
|
||||
isLoading={isLoading}
|
||||
isPending={isPending}
|
||||
formData={(action === 'update') ? this.props.formData : formData}
|
||||
validate={validate}
|
||||
onHide={onHide}
|
||||
|
|
|
@ -52,7 +52,7 @@ class Document extends Component {
|
|||
validate = (formData, errors) => {
|
||||
const { subscribers, action } = this.props;
|
||||
const { imsi } = formData;
|
||||
|
||||
|
||||
if (action === 'create' && subscribers && subscribers.data &&
|
||||
subscribers.data.filter(subscriber => subscriber.imsi === imsi).length > 0) {
|
||||
errors.imsi.addError(`'${imsi}' is duplicated`);
|
||||
|
@ -62,7 +62,7 @@ class Document extends Component {
|
|||
}
|
||||
|
||||
handleSubmit = (formData) => {
|
||||
const { dispatch, action } = this.props;
|
||||
const { dispatch, action, onHide } = this.props;
|
||||
if (action === 'create') {
|
||||
dispatch(createSubscriber({}, formData));
|
||||
} else if (action === 'update') {
|
||||
|
@ -79,8 +79,9 @@ class Document extends Component {
|
|||
} = this;
|
||||
|
||||
const {
|
||||
action,
|
||||
visible,
|
||||
action,
|
||||
status,
|
||||
subscriber,
|
||||
onHide
|
||||
} = this.props
|
||||
|
@ -95,6 +96,7 @@ class Document extends Component {
|
|||
visible={visible}
|
||||
action={action}
|
||||
isLoading={isLoading}
|
||||
isPending={status.pending}
|
||||
formData={data}
|
||||
validate={validate}
|
||||
onHide={onHide}
|
||||
|
|
Loading…
Reference in New Issue