42 lines
899 B
TypeScript
42 lines
899 B
TypeScript
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
|
import {Squad} from '../../../models/model-interfaces';
|
|
import {Fraction} from '../../../utils/fraction.enum';
|
|
|
|
@Component({
|
|
selector: 'cc-squad-item',
|
|
templateUrl: './squad-item.component.html',
|
|
styleUrls: ['./squad-item.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class SquadItemComponent implements OnInit {
|
|
|
|
@Input() selected: boolean;
|
|
|
|
@Input() squad: Squad;
|
|
|
|
@Output() squadSelected = new EventEmitter();
|
|
|
|
@Output() squadDelete = new EventEmitter();
|
|
|
|
imageSrc;
|
|
|
|
readonly fraction = Fraction;
|
|
|
|
constructor() {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.imageSrc = 'resource/squad/' + this.squad._id + '.png?' + Date.now();
|
|
}
|
|
|
|
select() {
|
|
this.squadSelected.emit(this.squad._id);
|
|
}
|
|
|
|
delete() {
|
|
this.squadDelete.emit(this.squad);
|
|
}
|
|
|
|
}
|
|
|