2018-06-18 20:44:18 +02:00
|
|
|
import {Component, OnInit} from '@angular/core';
|
2018-06-17 16:44:31 +02:00
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
2018-06-18 20:44:18 +02:00
|
|
|
import {Award, Promotion, Rank} from '../../models/model-interfaces';
|
2018-06-17 16:44:31 +02:00
|
|
|
import {RankService} from '../../services/army-management/rank.service';
|
|
|
|
import {PromotionService} from '../../services/army-management/promotion.service';
|
|
|
|
import {LoginService} from '../../services/app-user-service/login-service';
|
2018-06-17 16:45:44 +02:00
|
|
|
import {AwardingService} from '../../services/army-management/awarding.service';
|
2018-06-17 16:44:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
templateUrl: './sql-dashboard.component.html',
|
|
|
|
styleUrls: ['./sql-dashboard.component.css', '../../style/overview.css'],
|
|
|
|
})
|
|
|
|
export class SqlDashboardComponent implements OnInit {
|
|
|
|
|
|
|
|
ranks: Rank[];
|
|
|
|
|
2018-06-18 20:44:18 +02:00
|
|
|
promotions: Promotion[];
|
2018-06-17 16:44:31 +02:00
|
|
|
|
2018-06-18 20:44:18 +02:00
|
|
|
awards: Award[];
|
2018-06-17 16:44:31 +02:00
|
|
|
|
|
|
|
constructor(private router: Router,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private rankService: RankService,
|
|
|
|
private promotionService: PromotionService,
|
|
|
|
private awardingService: AwardingService,
|
|
|
|
private loginService: LoginService) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
const currentUser = this.loginService.getCurrentUser();
|
|
|
|
|
|
|
|
this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => {
|
|
|
|
this.promotions = promotions.filter(promotion => promotion.confirmed === 0);
|
|
|
|
});
|
|
|
|
|
2018-06-18 20:44:18 +02:00
|
|
|
this.awardingService.getUnprocessedSquadAwards(currentUser.squad._id).subscribe(awards => {
|
|
|
|
this.awards = awards;
|
2018-06-17 16:44:31 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
this.rankService.findRanks('', currentUser.squad.fraction).subscribe(ranks => {
|
|
|
|
this.ranks = ranks;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
cancel() {
|
|
|
|
this.router.navigate(['..'], {relativeTo: this.route});
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|