2018-03-08 09:44:35 +01:00
|
|
|
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
2018-04-29 10:07:20 +02:00
|
|
|
import {War} from '../../../models/model-interfaces';
|
|
|
|
import {LoginService} from '../../../services/app-user-service/login-service';
|
2017-08-06 10:42:37 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'pjm-war-item',
|
|
|
|
templateUrl: './war-item.component.html',
|
2018-04-29 10:07:20 +02:00
|
|
|
styleUrls: ['./war-item.component.css', '../../../style/list-entry.css'],
|
2018-03-08 09:44:35 +01:00
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
2017-08-06 10:42:37 +02:00
|
|
|
})
|
2018-03-08 09:44:35 +01:00
|
|
|
export class WarItemComponent implements OnInit {
|
2017-08-06 10:42:37 +02:00
|
|
|
|
2018-03-08 09:44:35 +01:00
|
|
|
@Input() selected: boolean;
|
2017-08-06 10:42:37 +02:00
|
|
|
|
2018-03-08 09:44:35 +01:00
|
|
|
@Input() war: War;
|
2017-08-06 10:42:37 +02:00
|
|
|
|
2018-03-08 09:44:35 +01:00
|
|
|
@Output() warSelected = new EventEmitter();
|
2017-08-06 10:42:37 +02:00
|
|
|
|
2018-04-29 11:12:09 +02:00
|
|
|
@Output() warEdit = new EventEmitter();
|
|
|
|
|
2018-03-08 09:44:35 +01:00
|
|
|
@Output() warDelete = new EventEmitter();
|
2017-08-06 10:42:37 +02:00
|
|
|
|
2017-10-08 12:17:21 +02:00
|
|
|
constructor(public loginService: LoginService) {
|
2017-08-06 10:42:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
}
|
|
|
|
|
|
|
|
select() {
|
2018-03-08 09:44:35 +01:00
|
|
|
this.warSelected.emit(this.war._id);
|
2017-08-06 10:42:37 +02:00
|
|
|
}
|
|
|
|
|
2018-04-29 11:12:09 +02:00
|
|
|
edit() {
|
|
|
|
this.warEdit.emit(this.war._id);
|
|
|
|
}
|
|
|
|
|
2017-08-06 10:42:37 +02:00
|
|
|
delete() {
|
|
|
|
this.warDelete.emit(this.war);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|