2018-03-08 09:44:35 +01:00
|
|
|
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
2018-10-04 14:08:29 +02:00
|
|
|
import {Squad} from '../../../models/model-interfaces';
|
|
|
|
import {Fraction} from '../../../utils/fraction.enum';
|
2017-05-10 11:04:06 +02:00
|
|
|
|
|
|
|
@Component({
|
2018-10-20 22:50:46 +02:00
|
|
|
selector: 'cc-squad-item',
|
2017-05-10 11:04:06 +02:00
|
|
|
templateUrl: './squad-item.component.html',
|
2019-02-25 14:32:29 +01:00
|
|
|
styleUrls: ['./squad-item.component.scss'],
|
2018-03-08 09:44:35 +01:00
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
2017-05-10 11:04:06 +02:00
|
|
|
})
|
2018-03-08 09:44:35 +01:00
|
|
|
export class SquadItemComponent implements OnInit {
|
2017-05-10 11:04:06 +02:00
|
|
|
|
2018-03-08 09:44:35 +01:00
|
|
|
@Input() selected: boolean;
|
2017-05-10 11:04:06 +02:00
|
|
|
|
2018-03-08 09:44:35 +01:00
|
|
|
@Input() squad: Squad;
|
|
|
|
|
|
|
|
@Output() squadSelected = new EventEmitter();
|
|
|
|
|
|
|
|
@Output() squadDelete = new EventEmitter();
|
2017-05-10 11:04:06 +02:00
|
|
|
|
2017-05-16 20:06:00 +02:00
|
|
|
imageSrc;
|
|
|
|
|
2017-11-08 19:35:34 +01:00
|
|
|
readonly fraction = Fraction;
|
|
|
|
|
|
|
|
constructor() {
|
2017-05-16 20:06:00 +02:00
|
|
|
}
|
2017-05-10 11:04:06 +02:00
|
|
|
|
2017-05-16 20:06:00 +02:00
|
|
|
ngOnInit() {
|
|
|
|
this.imageSrc = 'resource/squad/' + this.squad._id + '.png?' + Date.now();
|
2017-05-10 11:04:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
select() {
|
2018-03-07 11:56:50 +01:00
|
|
|
this.squadSelected.emit(this.squad._id);
|
2017-05-10 11:04:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
delete() {
|
|
|
|
this.squadDelete.emit(this.squad);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|