opt-cc/static/src/app/manage/squads/squad-list/squad-item.component.ts

42 lines
899 B
TypeScript
Raw Normal View History

2018-03-08 09:44:35 +01:00
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Squad} from '../../../models/model-interfaces';
import {Fraction} from '../../../utils/fraction.enum';
2017-05-10 11:04:06 +02:00
@Component({
selector: 'cc-squad-item',
2017-05-10 11:04:06 +02:00
templateUrl: './squad-item.component.html',
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
imageSrc;
2017-11-08 19:35:34 +01:00
readonly fraction = Fraction;
constructor() {
}
2017-05-10 11:04:06 +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);
}
}