99 lines
3.7 KiB
TypeScript
99 lines
3.7 KiB
TypeScript
import {Component, ViewChild} from '@angular/core';
|
|
import {Observable} from 'rxjs/Observable';
|
|
import {ActivatedRoute} from '@angular/router';
|
|
import {ProjectService} from '../../services/project.service';
|
|
import {ProjectInfo} from '../../utils/entities/projectInfo';
|
|
import {InlineClaimResultComponent} from '../../claimPages/inlineClaimResult/inlineClaimResult.component';
|
|
|
|
@Component({
|
|
selector: 'project',
|
|
templateUrl: 'project.component.html',
|
|
})
|
|
export class ProjectComponent {
|
|
constructor (private _projectService: ProjectService,
|
|
private route: ActivatedRoute) {
|
|
console.info('project constructor');
|
|
|
|
}
|
|
ngOnInit() {
|
|
// this.sub = this.route.params.subscribe(params => {
|
|
// this.projectId = params['projectId'];
|
|
// console.info('project init');
|
|
// this.getProjectInfo(this.projectId);
|
|
// });
|
|
this.sub = this.route.queryParams.subscribe(params => {
|
|
this.projectId = params['projectId'];
|
|
console.info("Id is :"+this.projectId);
|
|
if(this.projectId){
|
|
this.getProjectInfo(this.projectId);
|
|
}else{
|
|
this.warningMessage="No valid project id";
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
private projectId : string ;
|
|
private projectInfo: ProjectInfo;
|
|
|
|
private project ;
|
|
|
|
@ViewChild (InlineClaimResultComponent) inlineClaimResult : InlineClaimResultComponent ;
|
|
|
|
|
|
public warningMessage = "";
|
|
public errorMessage = "";
|
|
ngOnDestroy() {
|
|
this.sub.unsubscribe();
|
|
}
|
|
sub: any;
|
|
|
|
getProjectInfo (id:string) {
|
|
console.info("inside getProjectInfo of component");
|
|
this.warningMessage = '';
|
|
this.errorMessage=""
|
|
this._projectService.getProjectInfo(id).subscribe(
|
|
data => {
|
|
this.projectInfo = data;
|
|
/*
|
|
<dt *ngIf="projectInfo.title != undefined && projectInfo.title != ''">Title: </dt>
|
|
<dd *ngIf="projectInfo.title != undefined && projectInfo.title != ''">{{projectInfo.title}}</dd>
|
|
<dt *ngIf="projectInfo.funding != undefined && projectInfo.funding != ''">Funding: </dt>
|
|
<dd *ngIf="projectInfo.funding != undefined && projectInfo.funding != ''">{{projectInfo.funding}}</dd>
|
|
<dt *ngIf="projectInfo.callIdentifier != undefined && projectInfo.callIdentifier != ''">Call: </dt>
|
|
<dd *ngIf="projectInfo.callIdentifier != undefined && projectInfo.callIdentifier != ''">{{projectInfo.callIdentifier}}</dd>
|
|
<dt *ngIf="projectInfo.contractNum != undefined && projectInfo.contractNum != ''">Contract (GA) number: </dt>
|
|
<dd *ngIf="projectInfo.contractNum != undefined && projectInfo.contractNum != ''">{{projectInfo.contractNum}}</dd>
|
|
<dt *ngIf="projectInfo.startDate != undefined && projectInfo.startDate != ''">Start Date: </dt>
|
|
<dd *ngIf="projectInfo.startDate != undefined && projectInfo.startDate != ''">{{projectInfo.startDate}}</dd>
|
|
<dt *ngIf="projectInfo.endDate != undefined && projectInfo.endDate != ''">End Date: </dt>
|
|
<dd *ngIf="projectInfo.endDate != undefined && projectInfo.endDate != ''">{{projectInfo.endDate}}</dd>
|
|
*/
|
|
this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate };
|
|
},
|
|
err => {
|
|
console.error(err);
|
|
this.errorMessage = 'No project found';
|
|
}
|
|
);
|
|
}
|
|
|
|
/*
|
|
********* Methods for Inline Claim of results *****
|
|
*/
|
|
toggleClaimResult(){
|
|
this.inlineClaimResult.toggle();
|
|
}
|
|
publicationAdded($event){
|
|
//TODO
|
|
}
|
|
|
|
datasetAdded($event){
|
|
var contexts =$event.value;
|
|
|
|
//TODO
|
|
}
|
|
|
|
}
|