2017-05-10 11:04:06 +02:00
|
|
|
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
|
|
|
|
import {Router} from "@angular/router";
|
2017-05-16 20:06:00 +02:00
|
|
|
import {Squad} from "../../models/model-interfaces";
|
2017-05-10 11:04:06 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'pjm-squad-item',
|
|
|
|
templateUrl: './squad-item.component.html',
|
|
|
|
styleUrls: ['./squad-item.component.css'],
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
|
|
inputs: ['squad', 'selected'],
|
|
|
|
outputs: ['squadSelected', 'squadDelete'],
|
|
|
|
})
|
|
|
|
export class SquadItemComponent {
|
|
|
|
|
|
|
|
selected: boolean;
|
|
|
|
squad: Squad;
|
|
|
|
|
|
|
|
squadSelected = new EventEmitter();
|
|
|
|
squadDelete = new EventEmitter();
|
|
|
|
|
2017-05-16 20:06:00 +02:00
|
|
|
imageSrc;
|
|
|
|
|
2017-05-10 11:04:06 +02:00
|
|
|
constructor(private router: Router) {
|
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() {
|
|
|
|
this.squadSelected.emit(this.squad._id)
|
|
|
|
}
|
|
|
|
|
|
|
|
delete() {
|
|
|
|
this.squadDelete.emit(this.squad);
|
|
|
|
}
|
|
|
|
|
|
|
|
ngAfterViewChecked() {
|
|
|
|
//var taskId = (this.task ? this.task.id : '');
|
|
|
|
// console.log(`Task ${taskId} checked ${++this.checkCounter} times`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|