2018-07-28 19:13:30 +02:00
|
|
|
import {Component, OnInit} from '@angular/core';
|
2018-03-07 11:56:50 +01:00
|
|
|
import {Army} from '../models/model-interfaces';
|
|
|
|
import {ArmyService} from '../services/army-service/army.service';
|
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
|
|
|
import {Fraction} from '../utils/fraction.enum';
|
2019-02-27 23:13:23 +01:00
|
|
|
import {BaseConfig} from '../app.config';
|
|
|
|
import {Observable} from 'rxjs';
|
2017-05-11 21:46:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
2018-03-08 10:17:10 +01:00
|
|
|
selector: 'cc-army',
|
2017-05-11 21:46:28 +02:00
|
|
|
templateUrl: './army.component.html',
|
2019-02-25 14:32:29 +01:00
|
|
|
styleUrls: ['./army.component.scss']
|
2017-05-11 21:46:28 +02:00
|
|
|
})
|
2018-07-28 19:13:30 +02:00
|
|
|
export class ArmyComponent implements OnInit {
|
2017-05-11 21:46:28 +02:00
|
|
|
|
2019-02-27 23:13:23 +01:00
|
|
|
readonly fraction = Fraction;
|
|
|
|
|
2018-04-02 13:20:44 +02:00
|
|
|
army: Army[] = [{}, {}];
|
2017-11-07 14:02:49 +01:00
|
|
|
|
2019-02-27 23:13:23 +01:00
|
|
|
singleViewSelected = this.fraction.BLUFOR;
|
|
|
|
|
|
|
|
isSmallLayout;
|
2017-05-11 21:46:28 +02:00
|
|
|
|
2017-05-18 14:32:51 +02:00
|
|
|
constructor(private router: Router,
|
|
|
|
private route: ActivatedRoute,
|
2018-07-28 19:13:30 +02:00
|
|
|
private armyService: ArmyService) {
|
2017-05-11 21:46:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2018-10-13 09:07:36 +02:00
|
|
|
this.armyService.getArmies().subscribe(army => {
|
|
|
|
this.army = army;
|
|
|
|
});
|
2019-02-27 23:13:23 +01:00
|
|
|
|
|
|
|
this.isSmallLayout = (window.innerWidth <= BaseConfig.responsive.breakpointSmallPx);
|
|
|
|
Observable.fromEvent(window, 'resize').subscribe(event => {
|
|
|
|
this.isSmallLayout = event.target['innerWidth'] <= BaseConfig.responsive.breakpointSmallPx;
|
|
|
|
});
|
2017-05-11 21:46:28 +02:00
|
|
|
};
|
2017-05-18 14:32:51 +02:00
|
|
|
|
|
|
|
select(memberId) {
|
2018-07-28 19:13:30 +02:00
|
|
|
this.router.navigate(['member', memberId], {relativeTo: this.route});
|
2017-05-18 14:32:51 +02:00
|
|
|
}
|
2019-02-27 23:13:23 +01:00
|
|
|
|
|
|
|
singleViewSwitch(switchFraction: Fraction) {
|
|
|
|
this.singleViewSelected = switchFraction;
|
|
|
|
}
|
2017-05-11 21:46:28 +02:00
|
|
|
}
|