diff --git a/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.html b/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.html index 2218f483a..61104beb1 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.html @@ -16,7 +16,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts b/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts index c77062efc..5557e9f77 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts @@ -12,6 +12,7 @@ import { GrantCriteria } from '@app/core/query/grant/grant-criteria'; import { ProjectCriteria } from '@app/core/query/project/project-criteria'; import { FunderCriteria } from '@app/core/query/funder/funder-criteria'; import { takeUntil } from 'rxjs/operators'; +import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model'; @Component({ selector: 'funding-info', @@ -81,35 +82,9 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { .subscribe(x => { this.configureAutoCompletes(); }); - - // this.funderFormGroup.statusChanges - // .pipe(takeUntil(this._destroyed)) - // .subscribe(x => { - // console.log("FUNDER CHANGE: INIT"); - // this.grantformGroup.reset(); - // if (x == 'INVALID') { - // this.grantformGroup.get('existGrant').reset(); - // this.grantformGroup.get('label').reset(); - // this.grantformGroup.get('description').reset(); - // this.grantformGroup.get('existGrant').disable(); - // 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('description').reset(); - // this.grantformGroup.get('label').disable(); - // this.grantformGroup.get('description').disable(); - // this.grantformGroup.get('existGrant').enable(); - - // } - // } - // this.configureAutoCompletes(); - // }) } configureAutoCompletes(): void { - console.log("before Search") this.funderAutoCompleteConfiguration = { filterFn: this.searchFunder.bind(this), initialItems: () => this.searchFunder(''), @@ -136,13 +111,12 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { } searchGrant(query: any) { - // console.log("Search GRANTS"); const grantRequestItem: RequestItem = new RequestItem(); grantRequestItem.criteria = new GrantCriteria(); grantRequestItem.criteria.like = query; if (this.funderFormGroup.get('existFunder').value) { grantRequestItem.criteria.funderReference = this.funderFormGroup.controls['existFunder'].value.reference; - // console.log(grantRequestItem); + console.log(grantRequestItem); } return this.grantService.getWithExternal(grantRequestItem); } @@ -196,7 +170,6 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { this.grantformGroup.get('label').disable(); this.grantformGroup.get('description').disable(); } else { - // console.log("SET VALIDATORS") this.grantformGroup.get('existGrant').enable(); this.grantformGroup.get('label').disable(); this.grantformGroup.get('label').reset(); @@ -260,15 +233,12 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { } funderValueChanged(funder: any) { - // console.log("Funder ", funder); - // console.log(this.funderFormGroup.get('existFunder').value); - - if ((funder.label !== "" && funder.label != null && funder.label !== undefined) + if ((funder.label !== "" && funder.label !== null && funder.label !== undefined) || (funder.existFunder !== null && funder.existFunder !== undefined && funder.existFunder.id !== undefined)) { - // console.log('Funder Value Changed') this.grantformGroup.reset(); this.grantformGroup.enable(); this.setGrantValidators(); + // this.grantformGroup.updateValueAndValidity(); } else { this.grantformGroup.reset(); this.grantformGroup.disable(); @@ -276,19 +246,6 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { } } - funderSelectionChanged() { - // console.log("onFunderSelectionChanged") - // console.log(this.funderFormGroup.get('existFunder').value); - // this.grantAutoCompleteConfiguration = null; - // this.grantAutoCompleteConfiguration = { - // filterFn: this.searchGrant.bind(this), - // initialItems: () => this.searchGrant(''), - // displayFn: (item) => item['label'] + this.getGrantIdText(item), - // titleFn: (item) => item['label'] + this.getGrantIdText(item), - // subtitleFn: (item) => item['source'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')) - // }; - } - isGrantDisabled() { return this.grantformGroup.disabled; }