2019-07-23 14:23:12 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'claim-result-metadata',
|
2022-05-19 12:12:59 +02:00
|
|
|
template: `
|
|
|
|
<div *ngIf="entity.result" class="uk-text-small">
|
|
|
|
<div *ngIf="entity.result.authors && entity.result.authors.length >0 " class="uk-margin-small-bottom">
|
|
|
|
<span class="uk-text-meta">Authors: </span>{{sliceArray(entity.result.authors)}}
|
2019-07-23 14:23:12 +02:00
|
|
|
</div>
|
2022-05-19 12:12:59 +02:00
|
|
|
<div *ngIf="!shortVersion && entity.result.editors&& entity.result.editors.length > 0" class="uk-margin-small-bottom">
|
|
|
|
<span class="uk-text-meta">Editors: </span>{{sliceArray(entity.result.editors)}}
|
2019-07-23 14:23:12 +02:00
|
|
|
</div>
|
2022-05-19 12:12:59 +02:00
|
|
|
<div *ngIf="!shortVersion" class="uk-flex uk-flex-wrap" style="grid-gap: 20px;">
|
|
|
|
<span *ngIf="entity.result.publisher!=null">
|
|
|
|
<span class="uk-text-meta uk-margin-small-bottom">Publisher: </span>{{entity.result.publisher}}
|
|
|
|
</span>
|
|
|
|
<span *ngIf="entity.result.journal!=null">
|
|
|
|
<span class="uk-text-meta uk-margin-small-bottom">Journal: </span>{{entity.result.journal}}
|
|
|
|
</span>
|
|
|
|
<span *ngIf="entity.result.date">
|
|
|
|
<span class="uk-text-meta uk-margin-small-bottom">Published: </span>
|
|
|
|
<span [class]="(getProjectDurationMessage(entity)?'uk-text-warning':'')">{{entity.result.date}}</span>
|
|
|
|
</span>
|
|
|
|
<div [class]="(getProjectDurationMessage(entity)?'uk-text-warning':'')">{{getProjectDurationMessage(entity)}}
|
|
|
|
</div>
|
2019-07-23 14:23:12 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
export class ClaimEntityResultMetadataComponent {
|
|
|
|
@Input() entity: ClaimEntity;
|
|
|
|
@Input() slice: boolean = false;
|
|
|
|
@Input() sliceSize: number = 45;
|
|
|
|
@Input() shortVersion: boolean = false;
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
}
|
|
|
|
|
|
|
|
sliceArray(array): string {
|
|
|
|
if (this.slice) {
|
|
|
|
let sliced = array.slice(0, this.sliceSize);
|
|
|
|
return sliced.join("; ") + (array.length>this.sliceSize ? "...":"");
|
|
|
|
}
|
|
|
|
return array.join("; ");
|
|
|
|
}
|
|
|
|
|
|
|
|
getProjectDurationMessage(result: ClaimEntity) {
|
|
|
|
if(!result.warningMessages){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
for (let message of result.warningMessages) {
|
|
|
|
if (message.type == "projectDuration") {
|
|
|
|
return "Should be from " + message.projectInfo.startDate + ((message.projectInfo.endDate) ? (" to " + ((5 + +message.projectInfo.endDate))) : "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|