2018-10-01 07:53:38 +02:00
|
|
|
import {Component, OnDestroy, 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 {Rank} from '../../models/model-interfaces';
|
|
|
|
import {RankService} from '../../services/army-management/rank.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-rank-overview',
|
|
|
|
templateUrl: './rank-overview.component.html',
|
2019-02-25 14:32:29 +01:00
|
|
|
styleUrls: ['./rank-overview.component.scss']
|
2018-06-24 18:17:52 +02:00
|
|
|
})
|
2018-10-01 07:53:38 +02:00
|
|
|
export class RankOverviewComponent implements OnInit, OnDestroy {
|
2018-06-24 18:17:52 +02:00
|
|
|
|
2018-07-10 20:48:52 +02:00
|
|
|
ranksOpfor: Rank[];
|
|
|
|
|
|
|
|
ranksBlufor: Rank[];
|
|
|
|
|
|
|
|
displayedColumns: string[] = ['picture', 'name'];
|
2018-06-24 18:17:52 +02:00
|
|
|
|
|
|
|
readonly fraction = Fraction;
|
|
|
|
|
|
|
|
constructor(private router: Router,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private rankService: RankService,
|
2018-07-28 19:13:30 +02:00
|
|
|
private bottomSheet: MatBottomSheet) {
|
2018-06-24 18:17:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
// init rank data
|
|
|
|
this.rankService.findRanks()
|
|
|
|
.subscribe(ranks => {
|
2018-07-10 20:48:52 +02:00
|
|
|
this.ranksBlufor = ranks.filter(r => r.fraction === 'BLUFOR');
|
|
|
|
this.ranksOpfor = ranks.filter(r => r.fraction === 'OPFOR');
|
2018-06-24 18:17:52 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2018-10-01 07:53:38 +02:00
|
|
|
ngOnDestroy() {
|
|
|
|
this.bottomSheet.dismiss();
|
|
|
|
}
|
|
|
|
|
2018-07-22 13:09:51 +02:00
|
|
|
selectRow(rank: Rank) {
|
2018-08-04 16:53:58 +02:00
|
|
|
this.bottomSheet.open(UserListSheetComponent, {data: {rank: rank}});
|
2018-07-21 12:03:50 +02:00
|
|
|
}
|
2018-06-24 18:17:52 +02:00
|
|
|
}
|