import {Component, Input, Output, EventEmitter} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {ClaimResult} from '../claim-utils/claimEntities.class';
declare var UIkit:any;
@Component({
selector: 'claim-results',
template:`
0 " class="uk-list uk-list-divider">
-
Publisher: {{result.publisher}}
Journal: {{result.journal}} ({{result.date}})
0 " class="uk-article-meta">Authors: {{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}
0" class="uk-article-meta">Editors: {{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}
`,
})
export class ClaimResultsComponent {
@Input() results;
@Input() selectedResults;
private isSelected(id:string){
var found:boolean = false;
for (var _i = 0; _i < this.selectedResults.length; _i++) {
let item = this.selectedResults[_i];
if(item.id == id){
found=true;
}
}
return found;
}
add(item){
var found:boolean = this.isSelected( item.id);
if (!found) {
this.selectedResults.push(item);
UIkit.notification({
message : 'A new research result is selected.',
status : 'primary',
timeout : 1000,
pos : 'top-center'
});
}else{
UIkit.notification({
message : 'The research result is already on your list.',
status : 'warning',
timeout : 1000,
pos : 'top-center'
});
}
}
}