138 lines
5.5 KiB
TypeScript
138 lines
5.5 KiB
TypeScript
import {Component} from '@angular/core';
|
|
import {JSONP_PROVIDERS} from '@angular/http';
|
|
import {Observable} from 'rxjs/Observable';
|
|
import { RouteParams } from '@angular/router-deprecated';
|
|
import {PersonService} from '../../services/person.service';
|
|
import {PersonInfo} from '../../entities/personInfo';
|
|
|
|
@Component({
|
|
selector: 'person',
|
|
template: `
|
|
|
|
<div>
|
|
<div class="container person">
|
|
<div class="container-header" >
|
|
<div *ngIf="personInfo != null">
|
|
<h3>{{personInfo.fullname}}</h3>
|
|
</div>
|
|
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
|
|
<div *ngIf="errorMessage.length > 0" class="alert alert-danger" role="alert">{{errorMessage}}</div>
|
|
</div>
|
|
|
|
<div class="row row-offcanvas row-offcanvas-right" >
|
|
|
|
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" *ngIf="personInfo != null">
|
|
<dl class="dl-horizontal">
|
|
<dt *ngIf="personInfo.secondnames != undefined && personInfo.secondnames != ''">Last name: </dt>
|
|
<dd *ngIf="personInfo.secondnames != undefined && personInfo.secondnames != ''">{{personInfo.secondnames}}</dd>
|
|
<dt *ngIf="personInfo.firstname != undefined && personInfo.firstname != ''">First name: </dt>
|
|
<dd *ngIf="personInfo.firstname != undefined && personInfo.firstname != ''">{{personInfo.firstname}}</dd>
|
|
<dt *ngIf="personInfo.country != undefined && personInfo.country != ''">Country: </dt>
|
|
<dd *ngIf="personInfo.country != undefined && personInfo.country != ''">{{personInfo.country}}</dd>
|
|
</dl>
|
|
|
|
<ul class="nav nav-tabs">
|
|
<li class="active">
|
|
<a data-toggle="tab" href="#publicationsTab">
|
|
Publications
|
|
</a>
|
|
</li>
|
|
<li role="presentation">
|
|
<a data-toggle="tab" href="#researchDataTab">
|
|
Research Data
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<div class="tab-content">
|
|
<div id="publicationsTab" class="tab-pane fade in active panel-body">
|
|
|
|
<div *ngIf="personInfo.publications == undefined" class = "alert alert-info " >
|
|
There are no publications
|
|
</div>
|
|
|
|
<div *ngIf="personInfo.publications != undefined">
|
|
<p>
|
|
The results below are discovered through our pilot algorithms.
|
|
<a href="mailto:">Let us know how we are doing!</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="researchDataTab" class="tab-pane fade panel-body">
|
|
<div *ngIf="personInfo.researchData == undefined" class = "alert alert-info ">
|
|
There are no research data
|
|
</div>
|
|
<div *ngIf="personInfo.researchData != undefined">
|
|
<p>
|
|
The results below are discovered through our pilot algorithms.
|
|
<a href="mailto:">Let us know how we are doing!</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-xs-12 col-sm-3" *ngIf="personInfo != null">
|
|
<ul class="list-group mainFunctionsBlock">
|
|
<li class="list-group-item">
|
|
<dl class="functionsSection">
|
|
<dt >Share - Bookmark</dt>
|
|
<dd>
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
`,
|
|
providers:[JSONP_PROVIDERS, PersonService]
|
|
})
|
|
|
|
export class PersonComponent {
|
|
constructor (private _personService: PersonService,
|
|
private _routeParams: RouteParams) {
|
|
console.info('person constructor');
|
|
this.params = _routeParams;
|
|
}
|
|
|
|
ngOnInit() {
|
|
console.info('person init');
|
|
this.getPersonInfo();
|
|
}
|
|
|
|
personInfo: PersonInfo;
|
|
params: RouteParams;
|
|
|
|
public warningMessage = "";
|
|
public errorMessage = "";
|
|
|
|
getPersonInfo () {
|
|
console.info("inside getProjectInfo of component");
|
|
|
|
this.warningMessage = '';
|
|
this.errorMessage=""
|
|
if(this.params.get("personId")==null || this.params.get("personId")==''){
|
|
this.warningMessage="No valid person id";
|
|
console.info("novalid");
|
|
} else {
|
|
console.info("do request");
|
|
|
|
this._personService.getPersonInfo(this.params.get('personId')).subscribe(
|
|
data => {
|
|
this.personInfo = data;
|
|
},
|
|
err => {
|
|
console.error(err)
|
|
console.info("error");
|
|
|
|
this.errorMessage = 'No person found';
|
|
}
|
|
);
|
|
}
|
|
}
|
|
}
|