2018-03-07 11:56:50 +01:00
|
|
|
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
|
|
|
|
import {Rank} from '../../models/model-interfaces';
|
|
|
|
import {Fraction} from '../../utils/fraction.enum';
|
2017-05-10 11:04:06 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'pjm-rank-item',
|
|
|
|
templateUrl: './rank-item.component.html',
|
2017-05-17 15:55:22 +02:00
|
|
|
styleUrls: ['./rank-item.component.css', '../../style/list-entry.css'],
|
2017-05-10 11:04:06 +02:00
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
|
|
inputs: ['rank', 'selected'],
|
|
|
|
outputs: ['rankSelected', 'rankDelete'],
|
|
|
|
})
|
|
|
|
export class RankItemComponent {
|
|
|
|
|
|
|
|
selected: boolean;
|
|
|
|
rank: Rank;
|
2017-05-15 15:32:36 +02:00
|
|
|
imageSrc;
|
2017-05-10 11:04:06 +02:00
|
|
|
|
|
|
|
rankSelected = new EventEmitter();
|
|
|
|
rankDelete = new EventEmitter();
|
|
|
|
|
2017-11-08 19:27:24 +01:00
|
|
|
readonly fraction = Fraction;
|
2017-05-10 11:04:06 +02:00
|
|
|
|
2017-11-08 19:27:24 +01:00
|
|
|
constructor() {
|
2017-05-10 11:04:06 +02:00
|
|
|
}
|
|
|
|
|
2017-05-15 15:32:36 +02:00
|
|
|
ngOnInit() {
|
|
|
|
this.imageSrc = 'resource/rank/' + this.rank._id + '.png?' + Date.now();
|
|
|
|
}
|
|
|
|
|
2017-05-10 11:04:06 +02:00
|
|
|
select() {
|
2018-03-07 11:56:50 +01:00
|
|
|
this.rankSelected.emit(this.rank._id);
|
2017-05-10 11:04:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
delete() {
|
2017-05-15 13:44:37 +02:00
|
|
|
this.rankDelete.emit(this.rank);
|
2017-05-10 11:04:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|