Fixes bug on not reseting "Grant" when changing "Funder" on "New DMP (Wizard)" view.

This commit is contained in:
gkolokythas 2020-01-15 17:45:23 +02:00
parent 0e8b905fab
commit e1af4eacbe
1 changed files with 16 additions and 13 deletions

View File

@ -79,25 +79,28 @@ export class GrantEditorWizardComponent extends BaseComponent implements OnInit,
this.grantformGroup.get('existGrant').disable(); this.grantformGroup.get('existGrant').disable();
} }
this.funderFormGroup.statusChanges.pipe(takeUntil(this._destroyed)).subscribe(x => { this.funderFormGroup.statusChanges
if (x == 'INVALID') { .pipe(takeUntil(this._destroyed))
this.grantformGroup.get('existGrant').reset(); .subscribe(x => {
this.grantformGroup.get('label').reset(); this.grantformGroup.reset();
this.grantformGroup.get('description').reset(); if (x == 'INVALID') {
this.grantformGroup.get('existGrant').disable(); this.grantformGroup.get('existGrant').reset();
this.grantformGroup.get('label').disable();
this.grantformGroup.get('description').disable();
} else if (x == 'VALID') {
if (!this.isNew) {
this.grantformGroup.get('label').reset(); this.grantformGroup.get('label').reset();
this.grantformGroup.get('description').reset(); this.grantformGroup.get('description').reset();
this.grantformGroup.get('existGrant').disable();
this.grantformGroup.get('label').disable(); this.grantformGroup.get('label').disable();
this.grantformGroup.get('description').disable(); this.grantformGroup.get('description').disable();
this.grantformGroup.get('existGrant').enable(); } else if (x == 'VALID') {
if (!this.isNew) {
this.grantformGroup.get('label').reset();
this.grantformGroup.get('description').reset();
this.grantformGroup.get('label').disable();
this.grantformGroup.get('description').disable();
this.grantformGroup.get('existGrant').enable();
}
} }
} })
})
} }
isFunderFormInvalid() { isFunderFormInvalid() {