2019-07-23 14:23:12 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
2022-05-11 17:46:51 +02:00
|
|
|
declare var UIkit: any;
|
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;
|
2022-04-05 17:36:08 +02:00
|
|
|
@Input() type: "source" | "target";
|
|
|
|
@Input() shortVersion:boolean = true;
|
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));
|
|
|
|
}
|
2022-05-11 17:46:51 +02:00
|
|
|
UIkit.notification(item.type + ' removed from your basket!', {
|
|
|
|
status: 'warning',
|
|
|
|
timeout: 4000,
|
|
|
|
pos: 'bottom-right'
|
|
|
|
});
|
2019-07-23 14:23:12 +02:00
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
}
|