diff --git a/dmp-frontend/src/app/add-researchers/add-researchers.component.html b/dmp-frontend/src/app/add-researchers/add-researchers.component.html new file mode 100644 index 000000000..9c13f0eea --- /dev/null +++ b/dmp-frontend/src/app/add-researchers/add-researchers.component.html @@ -0,0 +1,19 @@ +
+

{{'ADDRESEARCHERS-EDITOR.TITLE' | translate}}

+
+ + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+
+ + +
+
+
\ No newline at end of file diff --git a/dmp-frontend/src/app/add-researchers/add-researchers.component.ts b/dmp-frontend/src/app/add-researchers/add-researchers.component.ts new file mode 100644 index 000000000..78aadbc11 --- /dev/null +++ b/dmp-frontend/src/app/add-researchers/add-researchers.component.ts @@ -0,0 +1,39 @@ +import { JsonSerializer } from '../utilities/JsonSerializer'; +import { RequestItem } from '../models/criteria/RequestItem'; +import { Component, OnInit, Inject } from "@angular/core"; +import { FormGroup } from '@angular/forms'; +import { Params, ActivatedRoute, Router } from '@angular/router'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; +import { ResearcherModel } from '@app/models/researcher/ResearcherModel'; +import { ResearcherService } from '@app/services/researchers/researchers.service'; + +@Component({ + selector: 'add-researchers-component', + templateUrl: 'add-researchers.component.html', + providers: [ResearcherService] + +}) +export class AddResearchersComponent implements OnInit { + + private formGroup: FormGroup; + + constructor( + private researcherService: ResearcherService, + private route: ActivatedRoute, + public router: Router, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any + ) { } + + ngOnInit(): void { + let researcher = new ResearcherModel(); + this.formGroup = researcher.buildForm(); + } + + + send(value: any) { + this.researcherService.createResearcher(this.formGroup.value).subscribe( + null, null, () => this.dialogRef.close() + ); + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index 46d74de9d..0da556738 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -25,7 +25,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { FigurecardComponent } from './shared/components/figurecard/figurecard.component'; import { InvitationAcceptedComponent } from './invitation-accepted/invitation-accepted.component'; -import { InvitationComponent } from './invitation/invitation.component'; import { HomepageComponent } from './homepage/homepage.component'; import { PageNotFoundComponent } from './not-found.component'; import { AppComponent } from './app.component'; @@ -33,7 +32,6 @@ import { NgModule } from "@angular/core"; import { DatasetProfileModule } from './dataset-profile-form/dataset-profile.module'; import { WelcomepageComponent } from '@app/welcomepage/welcomepage.component'; - @NgModule({ declarations: [ AppComponent, diff --git a/dmp-frontend/src/app/dmps/dmps.module.ts b/dmp-frontend/src/app/dmps/dmps.module.ts index 598b96d85..e6f3385a8 100644 --- a/dmp-frontend/src/app/dmps/dmps.module.ts +++ b/dmp-frontend/src/app/dmps/dmps.module.ts @@ -13,6 +13,8 @@ import { CommonModule } from '@angular/common'; import { SharedModule } from '../shared/shared.module' import { NgModule } from '@angular/core'; +import { AddResearchersComponent } from '@app/add-researchers/add-researchers.component'; + @NgModule({ imports: [ CommonModule, @@ -35,6 +37,7 @@ import { NgModule } from '@angular/core'; DataManagementPlanEditorComponent, InvitationComponent, InvitationAcceptedComponent, + AddResearchersComponent ], exports: [ @@ -42,10 +45,12 @@ import { NgModule } from '@angular/core'; DataManagementPlanEditorComponent, InvitationComponent, InvitationAcceptedComponent, + AddResearchersComponent ], entryComponents: [ - InvitationComponent + InvitationComponent, + AddResearchersComponent ], providers: [ BaseHttpService diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html index 3768100f5..aa650f1c6 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html @@ -18,15 +18,12 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + + (inputChange)="filterProfiles($event)" requireMatch required>
{{chip.label.substring(0, 1).toUpperCase()}}
{{chip.label}} @@ -37,9 +34,11 @@
- {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} +
- + @@ -55,28 +54,35 @@ - - -
{{chip.name.substring(0, 1).toUpperCase()}}
- {{chip.name}} -
- -
- {{option.name}} -
-
- -
+
+ + +
{{chip.name.substring(0, 1).toUpperCase()}}
+ {{chip.name}} +
+ +
+ {{option.name}} +
+
+ +
+ + +
+ -

Associated Users

- +

Associated Users

+ person
{{user.name}}
-
- + +
diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts index 9fed22ddd..a27c74f0a 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts @@ -1,5 +1,5 @@ import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from "@angular/core"; -import { MatPaginator, MatSort, MatSnackBar } from "@angular/material"; +import { MatPaginator, MatSort, MatSnackBar, MatDialog } from "@angular/material"; import { Router, ActivatedRoute, Params } from "@angular/router"; import { TranslateService } from "@ngx-translate/core"; import { DataSource } from "@angular/cdk/table"; @@ -20,6 +20,7 @@ import { AutoCompleteConfiguration } from "../../shared/components/autocomplete/ import { ProjectCriteria } from "../../models/criteria/project/ProjectCriteria"; import { ProjectService } from "../../services/project/project.service"; import { DmpUsersModel } from "@app/models/dmpUsers/DmpUsersModel"; +import { AddResearchersComponent } from "@app/add-researchers/add-researchers.component"; @@ -56,7 +57,8 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { public snackBar: MatSnackBar, public router: Router, public language: TranslateService, - private _service: DataManagementPlanService + private _service: DataManagementPlanService, + public dialog: MatDialog ) { } @@ -209,4 +211,15 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { } } + addResearcher(rowId: any, rowName: any) { + let dialogRef = this.dialog.open(AddResearchersComponent, { + height: '255px', + width: '700px', + data: { + dmpId: rowId, + dmpName: rowName + } + }); + } + } \ No newline at end of file diff --git a/dmp-frontend/src/app/models/researcher/ResearcherModel.ts b/dmp-frontend/src/app/models/researcher/ResearcherModel.ts index 03cbace90..8ad928280 100644 --- a/dmp-frontend/src/app/models/researcher/ResearcherModel.ts +++ b/dmp-frontend/src/app/models/researcher/ResearcherModel.ts @@ -1,8 +1,10 @@ import { Serializable } from "../Serializable"; +import { FormGroup, FormBuilder } from '@angular/forms'; export class ResearcherModel implements Serializable { public id: String; public name: String; + public lastName: String; public uri: String; public email: String; @@ -14,4 +16,14 @@ export class ResearcherModel implements Serializable { return this; } + + buildForm(): FormGroup { + let formGroup = new FormBuilder().group({ + firstName:[this.name], + lastName:[this.lastName] + }) + + return formGroup; + } + } \ No newline at end of file diff --git a/dmp-frontend/src/app/services/researchers/researchers.service.ts b/dmp-frontend/src/app/services/researchers/researchers.service.ts new file mode 100644 index 000000000..07a0dbaaa --- /dev/null +++ b/dmp-frontend/src/app/services/researchers/researchers.service.ts @@ -0,0 +1,31 @@ +import { Invitation } from '../../models/invitation/Invitation'; +import { UserInvitationCriteria } from '../../models/criteria/invitation/UserInvitationCriteria'; +import { User } from '../../models/invitation/User'; +import { HostConfiguration } from '../../app.constants'; +import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service'; +import { Injectable } from "@angular/core"; +import { HttpHeaders } from '@angular/common/http'; +import { Observable } from 'rxjs/Observable'; +import { RequestItem } from '../../models/criteria/RequestItem'; +import { ResearcherModel } from '@app/models/researcher/ResearcherModel'; + +@Injectable() +export class ResearcherService { + + private actionUrl: string; + private headers: HttpHeaders; + + constructor(private http: BaseHttpService) { + + this.actionUrl = HostConfiguration.Server + 'researchers/'; + + this.headers = new HttpHeaders(); + this.headers = this.headers.set('Content-Type', 'application/json'); + this.headers = this.headers.set('Accept', 'application/json'); + } + + public createResearcher(researcher: ResearcherModel) { + return this.http.post(this.actionUrl + "create", researcher, { headers: this.headers }); + } + +} \ No newline at end of file diff --git a/dmp-frontend/src/assets/lang/en.json b/dmp-frontend/src/assets/lang/en.json index 4ec10f343..43cc7e433 100644 --- a/dmp-frontend/src/assets/lang/en.json +++ b/dmp-frontend/src/assets/lang/en.json @@ -199,5 +199,14 @@ "USER": "User", "MANAGER": "Manager" } - } + }, + "ADDRESEARCHERS-EDITOR": { + "TITLE": "Add a Researcher", + "FIRST_NAME": "First Name", + "LAST_NAME": "Last Name", + "ACTIONS": { + "SAVE": "Save", + "CANCEL": "Cancel" + } + } } \ No newline at end of file