2018-07-28 19:13:30 +02:00
|
|
|
import {Component, OnInit} from '@angular/core';
|
2018-06-24 18:17:52 +02:00
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
|
|
|
|
2018-06-29 22:20:30 +02:00
|
|
|
import {Fraction} from '../../utils/fraction.enum';
|
|
|
|
import {Decoration} from '../../models/model-interfaces';
|
|
|
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
2018-07-25 21:01:58 +02:00
|
|
|
import {MatBottomSheet} from '@angular/material';
|
|
|
|
import {UserListSheetComponent} from '../user-list-sheet/user-list-sheet.component';
|
2018-06-24 18:17:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'cc-decoration-overview',
|
|
|
|
templateUrl: './decoration-overview.component.html',
|
|
|
|
styleUrls: ['./decoration-overview.component.css']
|
|
|
|
})
|
2018-07-28 19:13:30 +02:00
|
|
|
export class DecorationOverviewComponent implements OnInit {
|
2018-06-24 18:17:52 +02:00
|
|
|
|
2018-07-19 22:10:32 +02:00
|
|
|
decorationsBlufor: Decoration[];
|
2018-07-18 21:15:42 +02:00
|
|
|
|
2018-07-19 22:10:32 +02:00
|
|
|
decorationsGlobal: Decoration[];
|
2018-07-18 21:15:42 +02:00
|
|
|
|
2018-07-19 22:10:32 +02:00
|
|
|
decorationsOpfor: Decoration[];
|
2018-07-18 21:15:42 +02:00
|
|
|
|
|
|
|
hasFixedTableHeader = false;
|
2018-06-24 18:17:52 +02:00
|
|
|
|
|
|
|
readonly fraction = Fraction;
|
|
|
|
|
|
|
|
constructor(private router: Router,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private decorationService: DecorationService,
|
2018-07-28 19:13:30 +02:00
|
|
|
private bottomSheet: MatBottomSheet) {
|
2018-06-24 18:17:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2018-07-18 21:15:42 +02:00
|
|
|
// init decoration data
|
2018-06-24 18:17:52 +02:00
|
|
|
this.decorationService.findDecorations()
|
|
|
|
.subscribe(decorations => {
|
2018-07-19 22:10:32 +02:00
|
|
|
this.decorationsBlufor = decorations.filter(d => d.fraction === 'BLUFOR');
|
|
|
|
this.decorationsGlobal = decorations.filter(d => d.fraction === 'GLOBAL');
|
|
|
|
this.decorationsOpfor = decorations.filter(d => d.fraction === 'OPFOR');
|
2018-06-24 18:17:52 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2018-07-21 12:03:50 +02:00
|
|
|
select(decoration: Decoration) {
|
2018-07-28 19:13:30 +02:00
|
|
|
this.bottomSheet.open(UserListSheetComponent, {data: {decoration: decoration}});
|
2018-06-24 18:17:52 +02:00
|
|
|
}
|
|
|
|
}
|