Use fraction enum in users module

pull/18/head
HardiReady 2017-11-08 19:40:51 +01:00
parent 5f6be06516
commit de9504a6f3
8 changed files with 20 additions and 8 deletions

View File

@ -13,7 +13,8 @@
style="min-width: 200px;"> style="min-width: 200px;">
<option [value]="0">Auswählen...</option> <option [value]="0">Auswählen...</option>
<option *ngFor="let deco of decorations" [value]="deco._id"> <option *ngFor="let deco of decorations" [value]="deco._id">
{{deco.fraction == 'BLUFOR'? 'NATO' : deco.fraction == 'OPFOR'? 'CSAT' : 'Global'}}: {{deco.name}} {{deco.fraction == 'BLUFOR'? fraction.BLUFOR : deco.fraction == 'OPFOR'? fraction.OPFOR : 'Global'}}:
{{deco.name}}
</option> </option>
</select> </select>

View File

@ -4,6 +4,7 @@ import {Award, Decoration} from "../../models/model-interfaces";
import {NgForm} from "@angular/forms"; import {NgForm} from "@angular/forms";
import {AwardingService} from "../../services/army-management/awarding.service"; import {AwardingService} from "../../services/army-management/awarding.service";
import {DecorationService} from "../../services/army-management/decoration.service"; import {DecorationService} from "../../services/army-management/decoration.service";
import {Fraction} from "../../utils/fraction.enum";
@Component({ @Component({
@ -24,6 +25,8 @@ export class AwardUserComponent {
decoPreviewDisplay = 'none'; decoPreviewDisplay = 'none';
readonly fraction = Fraction;
constructor(private router: Router, constructor(private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private awardingService: AwardingService, private awardingService: AwardingService,

View File

@ -24,7 +24,7 @@
(change)="toggleRanks()"> (change)="toggleRanks()">
<option [value]="0">Ohne Fraktion/ Squad</option> <option [value]="0">Ohne Fraktion/ Squad</option>
<option *ngFor="let squad of squads" [ngValue]="squad"> <option *ngFor="let squad of squads" [ngValue]="squad">
{{squad.fraction == 'BLUFOR'? 'NATO' : 'CSAT'}}: {{squad.name}} {{squad.fraction == 'BLUFOR'? fraction.BLUFOR : fraction.OPFOR}}: {{squad.name}}
</option> </option>
</select> </select>

View File

@ -6,6 +6,7 @@ import {SquadService} from "../../services/army-management/squad.service";
import {RankService} from "../../services/army-management/rank.service"; import {RankService} from "../../services/army-management/rank.service";
import {Subscription} from "rxjs"; import {Subscription} from "rxjs";
import {NgForm} from "@angular/forms"; import {NgForm} from "@angular/forms";
import {Fraction} from "../../utils/fraction.enum";
@Component({ @Component({
@ -32,6 +33,8 @@ export class EditUserComponent {
error: string; error: string;
readonly fraction = Fraction;
constructor(private router: Router, constructor(private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private userService: UserService, private userService: UserService,

View File

@ -6,8 +6,9 @@
<a>{{user.username}}</a> <a>{{user.username}}</a>
</span> </span>
<br> <br>
<small *ngIf="user.squadId && user.squadId.fraction == 'OPFOR'">CSAT - {{user.squadId.name}}</small> <small *ngIf="user.squadId && user.squadId.fraction == 'OPFOR'">{{fraction.OPFOR}} - {{user.squadId.name}}</small>
<small *ngIf="user.squadId && user.squadId.fraction == 'BLUFOR'">NATO - {{user.squadId.name}}</small> <small *ngIf="user.squadId && user.squadId.fraction == 'BLUFOR'">{{fraction.BLUFOR}} - {{user.squadId.name}}
</small>
<small *ngIf="!user.squadId">ohne Squad/Fraktion</small> <small *ngIf="!user.squadId">ohne Squad/Fraktion</small>
</div> </div>

View File

@ -1,6 +1,6 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core"; import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
import {Router} from "@angular/router";
import {User} from "../../models/model-interfaces"; import {User} from "../../models/model-interfaces";
import {Fraction} from "../../utils/fraction.enum";
@Component({ @Component({
selector: 'pjm-user-item', selector: 'pjm-user-item',
@ -19,8 +19,9 @@ export class UserItemComponent {
userAward = new EventEmitter(); userAward = new EventEmitter();
userDelete = new EventEmitter(); userDelete = new EventEmitter();
constructor(private router: Router) { readonly fraction = Fraction;
constructor() {
} }
select() { select() {

View File

@ -1,8 +1,8 @@
<div class="select-list"> <div class="select-list">
<div class="input-group list-header pull-left"> <div class="input-group list-header pull-left">
<div class="btn-group" (click)="filterUsers()"> <div class="btn-group" (click)="filterUsers()">
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="BLUFOR" uncheckable>NATO</label> <label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="BLUFOR" uncheckable>{{fraction.BLUFOR}}</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="OPFOR" uncheckable>CSAT</label> <label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="OPFOR" uncheckable>{{fraction.OPFOR}}</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="UNASSIGNED" uncheckable>Ohne Squad</label> <label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="UNASSIGNED" uncheckable>Ohne Squad</label>
</div> </div>
<a class="pull-right btn btn-success" (click)="openNewUserForm()">+</a> <a class="pull-right btn btn-success" (click)="openNewUserForm()">+</a>

View File

@ -7,6 +7,7 @@ import {Observable} from "rxjs/Observable";
import {UserService} from "../../services/army-management/user.service"; import {UserService} from "../../services/army-management/user.service";
import {User} from "../../models/model-interfaces"; import {User} from "../../models/model-interfaces";
import {ADD, LOAD} from "../../services/stores/user.store"; import {ADD, LOAD} from "../../services/stores/user.store";
import {Fraction} from "../../utils/fraction.enum";
@Component({ @Component({
selector: 'squad-list', selector: 'squad-list',
@ -31,6 +32,8 @@ export class UserListComponent implements OnInit {
limit = 20; limit = 20;
readonly fraction = Fraction;
constructor(private userService: UserService, constructor(private userService: UserService,
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,