2019-07-23 14:23:12 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Component({
|
2019-07-23 14:23:12 +02:00
|
|
|
selector: 'claim-selected-results',
|
|
|
|
templateUrl: 'selectedResults.component.html'
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
})
|
|
|
|
export class ClaimSelectedResultsComponent {
|
2019-07-23 14:23:12 +02:00
|
|
|
@Input() results: ClaimEntity[];
|
2019-08-27 15:19:58 +02:00
|
|
|
@Input() sectionTitle: string = "Research Results";
|
2019-07-23 14:23:12 +02:00
|
|
|
@Input() localStoragePrefix: string = "";
|
|
|
|
@Input() enableRemove:boolean = true;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
ngOnInit() {
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
remove(item: any) {
|
|
|
|
const index: number = this.results.indexOf(item);
|
2017-12-19 13:53:46 +01:00
|
|
|
if (index > -1) {
|
2019-07-23 14:23:12 +02:00
|
|
|
this.results.splice(index, 1);
|
|
|
|
if (this.results != null) {
|
|
|
|
localStorage.setItem(this.localStoragePrefix, JSON.stringify(this.results));
|
|
|
|
}
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
}
|