diff --git a/dmp-frontend/src/app/core/model/grant/grant-listing.ts b/dmp-frontend/src/app/core/model/grant/grant-listing.ts index df019fb46..9573ae4b6 100644 --- a/dmp-frontend/src/app/core/model/grant/grant-listing.ts +++ b/dmp-frontend/src/app/core/model/grant/grant-listing.ts @@ -1,7 +1,6 @@ import { UrlListingItem } from "../../../library/url-listing/url-listing-item"; import { GrantType } from '../../common/enum/grant-type'; import { Status } from '../../common/enum/Status'; -import { FunderModel } from "../funder/funder"; export interface GrantListingModel { id?: string; @@ -18,6 +17,7 @@ export interface GrantListingModel { funderId?: string; files?: ContentFile[]; dmps?: UrlListingItem[]; + source?: string; } export interface ContentFile { diff --git a/dmp-frontend/src/app/core/services/funder/funder.service.ts b/dmp-frontend/src/app/core/services/funder/funder.service.ts index aa5961fb8..9b19c05d0 100644 --- a/dmp-frontend/src/app/core/services/funder/funder.service.ts +++ b/dmp-frontend/src/app/core/services/funder/funder.service.ts @@ -2,10 +2,10 @@ import { Observable } from "rxjs"; import { Injectable } from "@angular/core"; import { HttpHeaders } from "@angular/common/http"; import { RequestItem } from "../../query/request-item"; -import { BaseCriteria } from "../../query/base-criteria"; import { BaseHttpService } from "../http/base-http.service"; import { environment } from '../../../../environments/environment'; import { FunderCriteria } from "../../query/funder/funder-criteria"; +import { FunderModel } from "../../model/funder/funder"; @Injectable() export class FunderService { @@ -16,8 +16,7 @@ export class FunderService { this.actionUrl = environment.Server + 'funders/'; } - getWithExternal(requestItem: RequestItem): Observable { - return this.http.post(this.actionUrl + 'external', requestItem, { headers: this.headers }); - // return this.http.post(this.actionUrl + 'external', requestItem, { headers: this.headers }); + getWithExternal(requestItem: RequestItem): Observable { + return this.http.post(this.actionUrl + 'external', requestItem, { headers: this.headers }); } } diff --git a/dmp-frontend/src/app/core/services/project/project.service.ts b/dmp-frontend/src/app/core/services/project/project.service.ts index 710b20efc..625be3581 100644 --- a/dmp-frontend/src/app/core/services/project/project.service.ts +++ b/dmp-frontend/src/app/core/services/project/project.service.ts @@ -6,6 +6,7 @@ import { BaseCriteria } from "../../query/base-criteria"; import { BaseHttpService } from "../http/base-http.service"; import { environment } from '../../../../environments/environment'; import { ProjectCriteria } from "../../query/project/project-criteria"; +import { ProjectModel } from "../../model/project/project"; @Injectable() export class ProjectService { @@ -16,8 +17,7 @@ export class ProjectService { this.actionUrl = environment.Server + 'projects/'; } - getWithExternal(requestItem: RequestItem): Observable { - return this.http.post(this.actionUrl + 'external', requestItem, { headers: this.headers }); - // return this.http.post(this.actionUrl + 'external', requestItem, { headers: this.headers }); + getWithExternal(requestItem: RequestItem): Observable { + return this.http.post(this.actionUrl + 'external', requestItem, { headers: this.headers }); } } diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html index 35cc45433..e44f6f5b6 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html @@ -49,7 +49,7 @@ work_outline {{ 'DMP-LISTING.COLUMNS.GRANT' | translate }} - + diff --git a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html index 2c11660f4..b39e900be 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html @@ -1,5 +1,5 @@
-
+
@@ -40,7 +40,7 @@
- +
@@ -48,17 +48,17 @@
- - - {{formGroup.get('label').getError('backendError').message}} - + + + {{grantformGroup.get('label').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - {{formGroup.get('description').getError('backendError').message}} - + + + {{grantformGroup.get('description').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
@@ -90,14 +90,14 @@ - {{formGroup.get('label').getError('backendError').message}} + {{projectFormGroup.get('label').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} - {{formGroup.get('description').getError('backendError').message}} + {{projectFormGroup.get('description').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts index cde93d987..2bb21c0e4 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts @@ -18,7 +18,7 @@ import { ProjectCriteria } from '../../../../core/query/project/project-criteria }) export class GrantTabComponent implements OnInit { - @Input() formGroup: FormGroup; + @Input() grantformGroup: FormGroup; @Input() projectFormGroup: FormGroup; @Input() funderFormGroup: FormGroup; @Input() isNew: boolean; @@ -48,7 +48,8 @@ export class GrantTabComponent implements OnInit { filterFn: this.searchGrant.bind(this), initialItems: (extraData) => this.searchGrant(''), displayFn: (item) => item['label'], - titleFn: (item) => item['label'] + titleFn: (item) => item['label'], + subtitleFn: (item) => item ? item['source'] : null }; this.projectAutoCompleteConfiguration = { @@ -65,7 +66,7 @@ export class GrantTabComponent implements OnInit { titleFn: (item) => item['label'] } - this.isCreateNew = (this.formGroup.get('label').value != null && this.formGroup.get('label').value.length > 0); + this.isCreateNew = (this.grantformGroup.get('label').value != null && this.grantformGroup.get('label').value.length > 0); this.isCreateNewProject = (this.projectFormGroup.get('label').value != null && this.projectFormGroup.get('label').value.length > 0); this.isCreateNewFunder = (this.funderFormGroup.get('label').value != null && this.funderFormGroup.get('label').value.length > 0); this.setValidators(); @@ -73,13 +74,13 @@ export class GrantTabComponent implements OnInit { this.setFunderValidators(); } - searchGrant(query: string) { + searchGrant(query: any) { const grantRequestItem: RequestItem = new RequestItem(); grantRequestItem.criteria = new GrantCriteria(); grantRequestItem.criteria.like = query; - if (this.funderFormGroup.value.existFunder.reference) { - grantRequestItem.criteria.funderReference = this.funderFormGroup.value.existFunder.reference; - } else { grantRequestItem.criteria.funderReference = ''} + if (this.funderFormGroup.get('existFunder').value) { + grantRequestItem.criteria.funderReference = this.funderFormGroup.controls['existFunder'].value.reference; + } return this.grantService.getWithExternal(grantRequestItem); } @@ -114,20 +115,20 @@ export class GrantTabComponent implements OnInit { setValidators() { if (this.isCreateNew) { - this.formGroup.get('existGrant').disable(); - this.formGroup.get('label').enable(); - this.formGroup.get('description').enable(); + this.grantformGroup.get('existGrant').disable(); + this.grantformGroup.get('label').enable(); + this.grantformGroup.get('description').enable(); } else if (this.isFinalized) { - this.formGroup.get('existGrant').disable(); - this.formGroup.get('label').disable(); - this.formGroup.get('description').disable(); + this.grantformGroup.get('existGrant').disable(); + this.grantformGroup.get('label').disable(); + this.grantformGroup.get('description').disable(); } else { - this.formGroup.get('existGrant').enable(); - this.formGroup.get('label').disable(); - this.formGroup.get('label').reset(); - this.formGroup.get('description').disable(); - this.formGroup.get('description').reset(); + this.grantformGroup.get('existGrant').enable(); + this.grantformGroup.get('label').disable(); + this.grantformGroup.get('label').reset(); + this.grantformGroup.get('description').disable(); + this.grantformGroup.get('description').reset(); } } diff --git a/dmp-frontend/src/app/ui/quick-wizard/grant-editor/grant-editor-wizard.component.html b/dmp-frontend/src/app/ui/quick-wizard/grant-editor/grant-editor-wizard.component.html index df848a508..3348b2e57 100644 --- a/dmp-frontend/src/app/ui/quick-wizard/grant-editor/grant-editor-wizard.component.html +++ b/dmp-frontend/src/app/ui/quick-wizard/grant-editor/grant-editor-wizard.component.html @@ -24,7 +24,7 @@

{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.ABOUT-NEW' | translate}}

{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.LABEL-HINT' | translate}}