;
@@ -33,31 +33,31 @@ export class AdminComponent {
}
updateAppUser(user) {
- let updateObject = {
+ const updateObject = {
_id: user._id,
squad: user.squad,
activated: user.activated,
permission: user.permission
};
- if (updateObject.squad === "0") {
+ if (updateObject.squad === '0') {
updateObject.squad = null;
}
this.appUserService.updateUser(updateObject)
- .subscribe(user => {
+ .subscribe(resUser => {
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;
- }, 2000)
- })
+ }, 2000);
+ });
}
deleteUser(user) {
if (confirm('Soll der Nutzer "' + user.username + '" wirklich gelöscht werden?')) {
this.appUserService.deleteUser(user)
.subscribe((res) => {
- })
+ });
}
}
diff --git a/static/src/app/admin/admin.module.ts b/static/src/app/admin/admin.module.ts
index d8b597f..94fbef5 100644
--- a/static/src/app/admin/admin.module.ts
+++ b/static/src/app/admin/admin.module.ts
@@ -1,10 +1,10 @@
-import {NgModule} from "@angular/core";
-import {AdminComponent} from "./admin.component";
-import {SharedModule} from "../shared.module";
-import {AppUserStore} from "../services/stores/app-user.store";
-import {AppUserService} from "../services/app-user-service/app-user.service";
-import {CommonModule} from "@angular/common";
-import {RouterModule} from "@angular/router";
+import {NgModule} from '@angular/core';
+import {AdminComponent} from './admin.component';
+import {SharedModule} from '../shared.module';
+import {AppUserStore} from '../services/stores/app-user.store';
+import {AppUserService} from '../services/app-user-service/app-user.service';
+import {CommonModule} from '@angular/common';
+import {RouterModule} from '@angular/router';
@NgModule({
declarations: [AdminComponent],
diff --git a/static/src/app/app.component.ts b/static/src/app/app.component.ts
index 7d4cd99..4e520f0 100644
--- a/static/src/app/app.component.ts
+++ b/static/src/app/app.component.ts
@@ -1,9 +1,9 @@
-import {Component} from '@angular/core';
+import {Component, OnInit} from '@angular/core';
import {NavigationEnd, NavigationStart, Router} from '@angular/router';
import {LoginService} from './services/app-user-service/login-service';
-import {PromotionService} from "./services/army-management/promotion.service";
-import {AwardingService} from "./services/army-management/awarding.service";
-import {RouteConfig} from "./app.config";
+import {PromotionService} from './services/army-management/promotion.service';
+import {AwardingService} from './services/army-management/awarding.service';
+import {RouteConfig} from './app.config';
declare function require(url: string);
@@ -12,11 +12,11 @@ declare function require(url: string);
templateUrl: 'app.component.html',
styleUrls: ['app.component.css', 'style/load-indicator.css']
})
-export class AppComponent {
+export class AppComponent implements OnInit {
config = RouteConfig;
- loading: boolean = false;
+ loading = false;
version = 'v' + require('./../../../package.json').version;
diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts
index 936c413..e8cfb5d 100644
--- a/static/src/app/app.module.ts
+++ b/static/src/app/app.module.ts
@@ -1,27 +1,27 @@
import {NgModule} from '@angular/core';
-import {BrowserModule} from "@angular/platform-browser";
+import {BrowserModule} from '@angular/platform-browser';
import {HttpModule} from '@angular/http';
import {AppComponent} from './app.component';
-import {LoginService} from "./services/app-user-service/login-service";
+import {LoginService} from './services/app-user-service/login-service';
import {appRouting, routingComponents, routingProviders} from './app.routing';
-import {SquadService} from "./services/army-management/squad.service";
-import {SquadStore} from "./services/stores/squad.store";
-import {DecorationStore} from "./services/stores/decoration.store";
-import {DecorationService} from "./services/army-management/decoration.service";
-import {RankStore} from "./services/stores/rank.store";
-import {RankService} from "./services/army-management/rank.service";
-import {AppConfig} from "./app.config";
-import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from "./login/login.guard";
-import {AwardingService} from "./services/army-management/awarding.service";
-import {HttpClient} from "./services/http-client";
-import {ArmyService} from "./services/army-service/army.service";
+import {SquadService} from './services/army-management/squad.service';
+import {SquadStore} from './services/stores/squad.store';
+import {DecorationStore} from './services/stores/decoration.store';
+import {DecorationService} from './services/army-management/decoration.service';
+import {RankStore} from './services/stores/rank.store';
+import {RankService} from './services/army-management/rank.service';
+import {AppConfig} from './app.config';
+import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from './login/login.guard';
+import {AwardingService} from './services/army-management/awarding.service';
+import {HttpClient} from './services/http-client';
+import {ArmyService} from './services/army-service/army.service';
import {ClipboardModule} from 'ngx-clipboard';
-import {PromotionService} from "./services/army-management/promotion.service";
-import {SharedModule} from "./shared.module";
-import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
-import {UserService} from "./services/army-management/user.service";
-import {UserStore} from "./services/stores/user.store";
-import {CookieService} from "ngx-cookie-service";
+import {PromotionService} from './services/army-management/promotion.service';
+import {SharedModule} from './shared.module';
+import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
+import {UserService} from './services/army-management/user.service';
+import {UserStore} from './services/stores/user.store';
+import {CookieService} from 'ngx-cookie-service';
@NgModule({
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule],
diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts
index c9ed43c..1f7ac03 100644
--- a/static/src/app/app.routing.ts
+++ b/static/src/app/app.routing.ts
@@ -1,10 +1,10 @@
-import {RouterModule, Routes} from "@angular/router";
-import {LoginComponent} from "./login/index";
-import {NotFoundComponent} from "./common/not-found/not-found.component";
-import {LoginGuardAdmin, LoginGuardHL} from "./login/login.guard";
-import {armyRoutes, armyRoutingComponents} from "./army/army.routing";
-import {SignupComponent} from "./login/signup.component";
-import {RouteConfig} from "./app.config";
+import {RouterModule, Routes} from '@angular/router';
+import {LoginComponent} from './login/index';
+import {NotFoundComponent} from './common/not-found/not-found.component';
+import {LoginGuardAdmin, LoginGuardHL} from './login/login.guard';
+import {armyRoutes, armyRoutingComponents} from './army/army.routing';
+import {SignupComponent} from './login/signup.component';
+import {RouteConfig} from './app.config';
export const appRoutes: Routes = [
{
diff --git a/static/src/app/army/army-member.component.ts b/static/src/app/army/army-member.component.ts
index 98f62de..46fa54f 100644
--- a/static/src/app/army/army-member.component.ts
+++ b/static/src/app/army/army-member.component.ts
@@ -1,13 +1,13 @@
-import {Component, Inject} from "@angular/core";
-import {Award, User} from "../models/model-interfaces";
-import {ActivatedRoute, Router} from "@angular/router";
-import {UserService} from "../services/army-management/user.service";
-import {Subscription} from "rxjs/Subscription";
-import {RouteConfig} from "../app.config";
-import {AwardingService} from "../services/army-management/awarding.service";
-import {Fraction} from "../utils/fraction.enum";
-import {DOCUMENT} from "@angular/common";
-import {CSSHelpers} from "../global.helpers";
+import {Component, Inject, OnDestroy, OnInit} from '@angular/core';
+import {Award, User} from '../models/model-interfaces';
+import {ActivatedRoute, Router} from '@angular/router';
+import {UserService} from '../services/army-management/user.service';
+import {Subscription} from 'rxjs/Subscription';
+import {RouteConfig} from '../app.config';
+import {AwardingService} from '../services/army-management/awarding.service';
+import {Fraction} from '../utils/fraction.enum';
+import {DOCUMENT} from '@angular/common';
+import {CSSHelpers} from '../global.helpers';
@Component({
@@ -15,7 +15,7 @@ import {CSSHelpers} from "../global.helpers";
templateUrl: './army-member.component.html',
styleUrls: ['./army-member.component.css']
})
-export class ArmyMemberComponent {
+export class ArmyMemberComponent implements OnInit, OnDestroy {
subscription: Subscription;
@@ -42,7 +42,7 @@ export class ArmyMemberComponent {
this.subscription = this.route.params
.map(params => params['id'])
- .filter(id => id != undefined)
+ .filter(id => id !== undefined)
.flatMap(id => this.userService.getUser(id))
.subscribe(user => {
this.user = user;
diff --git a/static/src/app/army/army.component.ts b/static/src/app/army/army.component.ts
index 252f688..e22ef7d 100644
--- a/static/src/app/army/army.component.ts
+++ b/static/src/app/army/army.component.ts
@@ -1,19 +1,19 @@
-import {Component, Inject} from "@angular/core";
-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";
-import {DOCUMENT} from "@angular/common";
-import {RouteConfig} from "../app.config";
-import {CSSHelpers} from "../global.helpers";
+import {Component, Inject, OnDestroy, OnInit} from '@angular/core';
+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';
+import {DOCUMENT} from '@angular/common';
+import {RouteConfig} from '../app.config';
+import {CSSHelpers} from '../global.helpers';
@Component({
- selector: 'army',
+ selector: 'cc-army',
templateUrl: './army.component.html',
styleUrls: ['./army.component.css']
})
-export class ArmyComponent {
+export class ArmyComponent implements OnInit, OnDestroy {
army: Army = {BLUFOR: {squads: [], memberCount: 0}, OPFOR: {squads: [], memberCount: 0}};
diff --git a/static/src/app/army/army.routing.ts b/static/src/app/army/army.routing.ts
index d530b6b..58d9876 100644
--- a/static/src/app/army/army.routing.ts
+++ b/static/src/app/army/army.routing.ts
@@ -1,6 +1,6 @@
-import {Routes} from "@angular/router";
-import {ArmyComponent} from "./army.component";
-import {ArmyMemberComponent} from "./army-member.component";
+import {Routes} from '@angular/router';
+import {ArmyComponent} from './army.component';
+import {ArmyMemberComponent} from './army-member.component';
export const armyRoutes: Routes = [
diff --git a/static/src/app/common/show-error/show-error.component.ts b/static/src/app/common/show-error/show-error.component.ts
index 31f08a5..9e4a6f5 100644
--- a/static/src/app/common/show-error/show-error.component.ts
+++ b/static/src/app/common/show-error/show-error.component.ts
@@ -12,8 +12,9 @@ import {FormGroup, NgForm} from '@angular/forms';
})
export class ShowErrorComponent {
- @Input('path') controlPath;
- @Input('text') displayName = '';
+ @Input('controlPath') controlPath;
+
+ @Input('displayName') displayName = '';
private form: FormGroup;
diff --git a/static/src/app/decorations/decoration-list/decoration-item.component.ts b/static/src/app/decorations/decoration-list/decoration-item.component.ts
index 810fda1..edaf472 100644
--- a/static/src/app/decorations/decoration-list/decoration-item.component.ts
+++ b/static/src/app/decorations/decoration-list/decoration-item.component.ts
@@ -1,24 +1,26 @@
-import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
-import {Decoration} from "../../models/model-interfaces";
-import {Fraction} from "../../utils/fraction.enum";
+import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
+import {Decoration} from '../../models/model-interfaces';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
selector: 'decoration-item',
templateUrl: './decoration-item.component.html',
styleUrls: ['./decoration-item.component.css', '../../style/list-entry.css'],
- changeDetection: ChangeDetectionStrategy.OnPush,
- inputs: ['decoration', 'selected'],
- outputs: ['decorationDelete', 'decorationSelected'],
+ changeDetection: ChangeDetectionStrategy.OnPush
})
-export class DecorationItemComponent {
+export class DecorationItemComponent implements OnInit {
+
+ @Input() selected: boolean;
+
+ @Input() decoration: Decoration;
+
+ @Output() decorationSelected = new EventEmitter();
+
+ @Output() decorationDelete = new EventEmitter();
- selected: boolean;
- decoration: Decoration;
imageSrc;
- imgStyle = {width: '', height: '', marginTop: ''};
- decorationSelected = new EventEmitter();
- decorationDelete = new EventEmitter();
+ imgStyle = {width: '', height: '', marginTop: ''};
readonly fraction = Fraction;
@@ -29,15 +31,15 @@ export class DecorationItemComponent {
this.imageSrc = 'resource/decoration/' + this.decoration._id + '.png?' + Date.now();
if (!this.decoration.isMedal) {
this.imgStyle.width = '62px';
- this.imgStyle.marginTop = '17px'
+ this.imgStyle.marginTop = '17px';
} else {
this.imgStyle.height = '50px';
- this.imgStyle.marginTop = '3px'
+ this.imgStyle.marginTop = '3px';
}
}
select() {
- this.decorationSelected.emit(this.decoration._id)
+ this.decorationSelected.emit(this.decoration._id);
}
delete() {
diff --git a/static/src/app/decorations/decoration-list/decoration-list.component.ts b/static/src/app/decorations/decoration-list/decoration-list.component.ts
index e1d0e0f..195a9fc 100644
--- a/static/src/app/decorations/decoration-list/decoration-list.component.ts
+++ b/static/src/app/decorations/decoration-list/decoration-list.component.ts
@@ -1,12 +1,12 @@
-import {Component, OnInit} from "@angular/core";
-import {Location} from "@angular/common";
+import {Component, OnInit} from '@angular/core';
+import {Location} from '@angular/common';
-import {FormControl} from "@angular/forms";
-import {ActivatedRoute, Router} from "@angular/router";
-import {Observable} from "rxjs/Observable";
-import {Decoration} from "../../models/model-interfaces";
-import {DecorationService} from "../../services/army-management/decoration.service";
-import {Fraction} from "../../utils/fraction.enum";
+import {FormControl} from '@angular/forms';
+import {ActivatedRoute, Router} from '@angular/router';
+import {Observable} from 'rxjs/Observable';
+import {Decoration} from '../../models/model-interfaces';
+import {DecorationService} from '../../services/army-management/decoration.service';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
selector: 'decoration-list',
@@ -60,13 +60,16 @@ export class DecorationListComponent implements OnInit {
deleteDecoration(decoration) {
let fraction = 'Global';
- if (decoration.fraction === 'BLUFOR') fraction = Fraction.BLUFOR;
- else if (decoration.fraction === 'OPFOR') fraction = Fraction.OPFOR;
+ if (decoration.fraction === 'BLUFOR') {
+ fraction = Fraction.BLUFOR;
+ } else if (decoration.fraction === 'OPFOR') {
+ fraction = Fraction.OPFOR;
+ }
if (confirm('Soll die Auszeichnung "' + decoration.name + '" (' + fraction + ') wirklich gelöscht werden?')) {
this.decorationService.deleteDecoration(decoration)
.subscribe((res) => {
- })
+ });
}
}
diff --git a/static/src/app/decorations/decoration.component.ts b/static/src/app/decorations/decoration.component.ts
index 6a412e5..4583001 100644
--- a/static/src/app/decorations/decoration.component.ts
+++ b/static/src/app/decorations/decoration.component.ts
@@ -1,7 +1,7 @@
-import {Component} from "@angular/core";
+import {Component} from '@angular/core';
@Component({
- selector: 'decorations',
+ selector: 'cc-decorations',
templateUrl: './decoration.component.html',
styleUrls: ['./decoration.component.css']
})
diff --git a/static/src/app/decorations/decoration.module.ts b/static/src/app/decorations/decoration.module.ts
index 91f2c58..a4d791d 100644
--- a/static/src/app/decorations/decoration.module.ts
+++ b/static/src/app/decorations/decoration.module.ts
@@ -1,10 +1,10 @@
-import {decorationRoutesModule, decorationsRoutingComponents} from "./decoration.routing";
-import {SharedModule} from "../shared.module";
-import {CommonModule} from "@angular/common";
-import {DecorationStore} from "../services/stores/decoration.store";
-import {DecorationService} from "../services/army-management/decoration.service";
-import {NgModule} from "@angular/core";
-import {ButtonsModule} from "ngx-bootstrap";
+import {decorationRoutesModule, decorationsRoutingComponents} from './decoration.routing';
+import {SharedModule} from '../shared.module';
+import {CommonModule} from '@angular/common';
+import {DecorationStore} from '../services/stores/decoration.store';
+import {DecorationService} from '../services/army-management/decoration.service';
+import {NgModule} from '@angular/core';
+import {ButtonsModule} from 'ngx-bootstrap';
@NgModule({
declarations: decorationsRoutingComponents,
diff --git a/static/src/app/decorations/decoration.routing.ts b/static/src/app/decorations/decoration.routing.ts
index 8f5cb04..ad7ea52 100644
--- a/static/src/app/decorations/decoration.routing.ts
+++ b/static/src/app/decorations/decoration.routing.ts
@@ -1,9 +1,9 @@
-import {RouterModule, Routes} from "@angular/router";
-import {DecorationComponent} from "./decoration.component";
-import {DecorationListComponent} from "./decoration-list/decoration-list.component";
-import {EditDecorationComponent} from "./edit-decoration/edit-decoration.component";
-import {ModuleWithProviders} from "@angular/core";
-import {DecorationItemComponent} from "./decoration-list/decoration-item.component";
+import {RouterModule, Routes} from '@angular/router';
+import {DecorationComponent} from './decoration.component';
+import {DecorationListComponent} from './decoration-list/decoration-list.component';
+import {EditDecorationComponent} from './edit-decoration/edit-decoration.component';
+import {ModuleWithProviders} from '@angular/core';
+import {DecorationItemComponent} from './decoration-list/decoration-item.component';
export const decorationsRoutes: Routes = [{
path: '', component: DecorationComponent,
@@ -27,5 +27,6 @@ export const decorationsRoutes: Routes = [{
export const decorationRoutesModule: ModuleWithProviders = RouterModule.forChild(decorationsRoutes);
-export const decorationsRoutingComponents = [DecorationItemComponent, DecorationComponent, DecorationListComponent, EditDecorationComponent];
+export const decorationsRoutingComponents = [DecorationItemComponent, DecorationComponent, DecorationListComponent,
+ EditDecorationComponent];
diff --git a/static/src/app/decorations/edit-decoration/edit-decoration.component.html b/static/src/app/decorations/edit-decoration/edit-decoration.component.html
index c97369b..3852ca3 100644
--- a/static/src/app/decorations/edit-decoration/edit-decoration.component.html
+++ b/static/src/app/decorations/edit-decoration/edit-decoration.component.html
@@ -9,7 +9,7 @@
name="title"
id="title"
required maxlength="50"/>
-
+
@@ -21,7 +21,7 @@
-
+
@@ -32,14 +32,14 @@
-
+
-
+
@@ -47,7 +47,7 @@
-
+
diff --git a/static/src/app/decorations/edit-decoration/edit-decoration.component.ts b/static/src/app/decorations/edit-decoration/edit-decoration.component.ts
index 69ea836..acca0de 100644
--- a/static/src/app/decorations/edit-decoration/edit-decoration.component.ts
+++ b/static/src/app/decorations/edit-decoration/edit-decoration.component.ts
@@ -1,16 +1,16 @@
-import {Component, ViewChild} from "@angular/core";
-import {ActivatedRoute, Router} from "@angular/router";
-import {NgForm} from "@angular/forms";
-import {Decoration} from "../../models/model-interfaces";
-import {DecorationService} from "../../services/army-management/decoration.service";
-import {Subscription} from "rxjs/Subscription";
-import {Fraction} from "../../utils/fraction.enum";
+import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
+import {ActivatedRoute, Router} from '@angular/router';
+import {NgForm} from '@angular/forms';
+import {Decoration} from '../../models/model-interfaces';
+import {DecorationService} from '../../services/army-management/decoration.service';
+import {Subscription} from 'rxjs/Subscription';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
templateUrl: './edit-decoration.component.html',
styleUrls: ['./edit-decoration.component.css', '../../style/entry-form.css', '../../style/overview.css']
})
-export class EditDecorationComponent {
+export class EditDecorationComponent implements OnInit, OnDestroy {
subscription: Subscription;
@@ -36,7 +36,7 @@ export class EditDecorationComponent {
ngOnInit() {
this.subscription = this.route.params
.map(params => params['id'])
- .filter(id => id != undefined)
+ .filter(id => id !== undefined)
.flatMap(id => this.decorationService.getDecoration(id))
.subscribe(decoration => {
this.decoration = decoration;
@@ -66,7 +66,7 @@ export class EditDecorationComponent {
this.decorationService.submitDecoration(this.decoration, file)
.subscribe(rank => {
this.router.navigate(['..'], {relativeTo: this.route});
- })
+ });
} else {
return window.alert(`Bild ist ein Pflichtfeld`);
}
@@ -84,8 +84,8 @@ export class EditDecorationComponent {
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;
- }, 2000)
- })
+ }, 2000);
+ });
}
}
diff --git a/static/src/app/filter/filter.pipe.ts b/static/src/app/filter/filter.pipe.ts
index 1df80f1..1f46d4b 100644
--- a/static/src/app/filter/filter.pipe.ts
+++ b/static/src/app/filter/filter.pipe.ts
@@ -1,4 +1,4 @@
-import {Pipe, PipeTransform} from "@angular/core";
+import {Pipe, PipeTransform} from '@angular/core';
/**
* Filter Pipe to filter specific rank by level number in template
@@ -11,12 +11,11 @@ export class FilterRankPipe implements PipeTransform {
transform(items: any[], filter: any): any {
// filter items array, items which match and return true will be kept, false will be filtered out
- let res = items.filter(item => item.level === filter);
+ const res = items.filter(item => item.level === filter);
if (res.length === 0) {
return [{name: '-'}];
- }
- else {
- return res
+ } else {
+ return res;
}
}
diff --git a/static/src/app/login/index.ts b/static/src/app/login/index.ts
index dce4d0a..0557c8b 100644
--- a/static/src/app/login/index.ts
+++ b/static/src/app/login/index.ts
@@ -1,2 +1,2 @@
export * from './login.component';
-export * from './login.guard';
\ No newline at end of file
+export * from './login.guard';
diff --git a/static/src/app/login/login.component.ts b/static/src/app/login/login.component.ts
index 8164280..c801702 100644
--- a/static/src/app/login/login.component.ts
+++ b/static/src/app/login/login.component.ts
@@ -1,7 +1,7 @@
-import {Component, OnInit} from "@angular/core";
-import {Router} from "@angular/router";
-import {LoginService} from "../services/app-user-service/login-service";
-import {RouteConfig} from "../app.config";
+import {Component, OnInit} from '@angular/core';
+import {Router} from '@angular/router';
+import {LoginService} from '../services/app-user-service/login-service';
+import {RouteConfig} from '../app.config';
@Component({
diff --git a/static/src/app/login/login.guard.ts b/static/src/app/login/login.guard.ts
index 95a5b25..00caa99 100644
--- a/static/src/app/login/login.guard.ts
+++ b/static/src/app/login/login.guard.ts
@@ -1,6 +1,6 @@
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';
-import {LoginService} from "../services/app-user-service/login-service";
+import {LoginService} from '../services/app-user-service/login-service';
@Injectable()
export class LoginGuardSQL implements CanActivate {
diff --git a/static/src/app/login/signup.component.ts b/static/src/app/login/signup.component.ts
index 52df89b..a20008e 100644
--- a/static/src/app/login/signup.component.ts
+++ b/static/src/app/login/signup.component.ts
@@ -1,7 +1,7 @@
-import {Component, OnInit} from "@angular/core";
-import {ActivatedRoute, Router} from "@angular/router";
-import {LoginService} from "../services/app-user-service/login-service";
-import {RouteConfig} from "../app.config";
+import {Component, OnInit} from '@angular/core';
+import {ActivatedRoute, Router} from '@angular/router';
+import {LoginService} from '../services/app-user-service/login-service';
+import {RouteConfig} from '../app.config';
@Component({
diff --git a/static/src/app/models/model-interfaces.ts b/static/src/app/models/model-interfaces.ts
index 58b91e8..1a52f36 100644
--- a/static/src/app/models/model-interfaces.ts
+++ b/static/src/app/models/model-interfaces.ts
@@ -11,7 +11,7 @@ export interface User {
_id?: string;
boardUserId?: number;
username?: string;
- squadId?: any; //Squad or id-string
+ squadId?: any; // Squad or id-string
rankLvl?: number;
rank?: Rank;
awards?: Award[];
@@ -76,20 +76,22 @@ export interface Rank {
}
export interface Award {
- _id?: string,
- userId: string,
- decorationId?: any; //Decoration or string
+ _id?: string;
+ userId: string;
+ decorationId?: any; // Decoration or string
reason?: string;
proposer?: AppUser;
date?: number; // since Date.now() returns a number
confirmed?: number;
+ rejectReason?: string;
}
export interface Promotion {
_id?: string;
- userId?: string
- oldRankLvl: number,
- newRankLvl: number
+ userId?: string;
+ oldRankLvl: number;
+ newRankLvl: number;
+ rejectReason?: string;
}
export interface Decoration {
@@ -114,7 +116,7 @@ export interface Army {
}[],
}[],
memberCount
- },
+ };
OPFOR: {
squads: {
_id,
@@ -127,6 +129,6 @@ export interface Army {
}[],
}[],
memberCount
- },
+ };
}
diff --git a/static/src/app/ranks/edit-rank/edit-rank.component.html b/static/src/app/ranks/edit-rank/edit-rank.component.html
index 2b8884e..eee7a19 100644
--- a/static/src/app/ranks/edit-rank/edit-rank.component.html
+++ b/static/src/app/ranks/edit-rank/edit-rank.component.html
@@ -10,7 +10,7 @@
id="title"
required maxlength="50"/>
-
+
@@ -21,14 +21,14 @@
-
+
-
+
diff --git a/static/src/app/ranks/edit-rank/edit-rank.component.ts b/static/src/app/ranks/edit-rank/edit-rank.component.ts
index 96d0ac8..5be2bbb 100644
--- a/static/src/app/ranks/edit-rank/edit-rank.component.ts
+++ b/static/src/app/ranks/edit-rank/edit-rank.component.ts
@@ -1,17 +1,17 @@
-import {Component, ViewChild} from "@angular/core";
-import {ActivatedRoute, Router} from "@angular/router";
-import {NgForm} from "@angular/forms";
-import {Rank} from "../../models/model-interfaces";
-import {RankService} from "../../services/army-management/rank.service";
-import {Subscription} from "rxjs/Subscription";
-import {Fraction} from "../../utils/fraction.enum";
+import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
+import {ActivatedRoute, Router} from '@angular/router';
+import {NgForm} from '@angular/forms';
+import {Rank} from '../../models/model-interfaces';
+import {RankService} from '../../services/army-management/rank.service';
+import {Subscription} from 'rxjs/Subscription';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
templateUrl: './edit-rank.component.html',
styleUrls: ['./edit-rank.component.css', '../../style/entry-form.css', '../../style/overview.css']
})
-export class EditRankComponent {
+export class EditRankComponent implements OnInit, OnDestroy {
subscription: Subscription;
@@ -39,7 +39,7 @@ export class EditRankComponent {
ngOnInit() {
this.subscription = this.route.params
.map(params => params['id'])
- .filter(id => id != undefined)
+ .filter(id => id !== undefined)
.flatMap(id => this.rankService.getRank(id))
.subscribe(rank => {
this.rank = rank;
@@ -70,7 +70,7 @@ export class EditRankComponent {
.subscribe(rank => {
this.saved = true;
this.router.navigate(['..'], {relativeTo: this.route});
- })
+ });
} else {
return window.alert(`Bild ist ein Pflichtfeld`);
}
@@ -88,8 +88,8 @@ export class EditRankComponent {
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;
- }, 2000)
- })
+ }, 2000);
+ });
}
}
diff --git a/static/src/app/ranks/rank-list/rank-item.component.ts b/static/src/app/ranks/rank-list/rank-item.component.ts
index d28eee0..80fb37a 100644
--- a/static/src/app/ranks/rank-list/rank-item.component.ts
+++ b/static/src/app/ranks/rank-list/rank-item.component.ts
@@ -1,24 +1,25 @@
-import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
-import {Rank} from "../../models/model-interfaces";
-import {Fraction} from "../../utils/fraction.enum";
+import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
+import {Rank} from '../../models/model-interfaces';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
selector: 'pjm-rank-item',
templateUrl: './rank-item.component.html',
styleUrls: ['./rank-item.component.css', '../../style/list-entry.css'],
- changeDetection: ChangeDetectionStrategy.OnPush,
- inputs: ['rank', 'selected'],
- outputs: ['rankSelected', 'rankDelete'],
+ changeDetection: ChangeDetectionStrategy.OnPush
})
-export class RankItemComponent {
+export class RankItemComponent implements OnInit {
+
+ @Input() selected: boolean;
+
+ @Input() rank: Rank;
+
+ @Output() rankSelected = new EventEmitter();
+
+ @Output() rankDelete = new EventEmitter();
- selected: boolean;
- rank: Rank;
imageSrc;
- rankSelected = new EventEmitter();
- rankDelete = new EventEmitter();
-
readonly fraction = Fraction;
constructor() {
@@ -29,7 +30,7 @@ export class RankItemComponent {
}
select() {
- this.rankSelected.emit(this.rank._id)
+ this.rankSelected.emit(this.rank._id);
}
delete() {
diff --git a/static/src/app/ranks/rank-list/rank-list.component.ts b/static/src/app/ranks/rank-list/rank-list.component.ts
index 1d2c9ca..3bb2c1c 100644
--- a/static/src/app/ranks/rank-list/rank-list.component.ts
+++ b/static/src/app/ranks/rank-list/rank-list.component.ts
@@ -1,12 +1,12 @@
-import {Component, OnInit} from "@angular/core";
-import {Location} from "@angular/common";
+import {Component, OnInit} from '@angular/core';
+import {Location} from '@angular/common';
-import {FormControl} from "@angular/forms";
-import {ActivatedRoute, Router} from "@angular/router";
-import {Observable} from "rxjs/Observable";
-import {Rank} from "../../models/model-interfaces";
-import {RankService} from "../../services/army-management/rank.service";
-import {Fraction} from "../../utils/fraction.enum";
+import {FormControl} from '@angular/forms';
+import {ActivatedRoute, Router} from '@angular/router';
+import {Observable} from 'rxjs/Observable';
+import {Rank} from '../../models/model-interfaces';
+import {RankService} from '../../services/army-management/rank.service';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
selector: 'rank-list',
@@ -69,7 +69,7 @@ export class RankListComponent implements OnInit {
if (confirm('Soll der Rang ' + rank.name + ' (' + fraction + ') wirklich gelöscht werden?')) {
this.rankService.deleteRank(rank)
.subscribe((res) => {
- })
+ });
}
}
diff --git a/static/src/app/ranks/ranks.component.ts b/static/src/app/ranks/ranks.component.ts
index b199411..33d3b23 100644
--- a/static/src/app/ranks/ranks.component.ts
+++ b/static/src/app/ranks/ranks.component.ts
@@ -1,7 +1,7 @@
-import {Component} from "@angular/core";
+import {Component} from '@angular/core';
@Component({
- selector: 'ranks',
+ selector: 'cc-ranks',
templateUrl: './ranks.component.html',
styleUrls: ['./ranks.component.css']
})
diff --git a/static/src/app/ranks/ranks.module.ts b/static/src/app/ranks/ranks.module.ts
index ef23247..9bdba31 100644
--- a/static/src/app/ranks/ranks.module.ts
+++ b/static/src/app/ranks/ranks.module.ts
@@ -1,10 +1,10 @@
-import {NgModule} from "@angular/core";
-import {rankRouterModule, ranksRoutingComponents} from "./ranks.routing";
-import {SharedModule} from "../shared.module";
-import {CommonModule} from "@angular/common";
-import {RankService} from "../services/army-management/rank.service";
-import {RankStore} from "../services/stores/rank.store";
-import {ButtonsModule} from "ngx-bootstrap";
+import {NgModule} from '@angular/core';
+import {rankRouterModule, ranksRoutingComponents} from './ranks.routing';
+import {SharedModule} from '../shared.module';
+import {CommonModule} from '@angular/common';
+import {RankService} from '../services/army-management/rank.service';
+import {RankStore} from '../services/stores/rank.store';
+import {ButtonsModule} from 'ngx-bootstrap';
@NgModule({
declarations: ranksRoutingComponents,
diff --git a/static/src/app/ranks/ranks.routing.ts b/static/src/app/ranks/ranks.routing.ts
index fc0a6c9..a052a69 100644
--- a/static/src/app/ranks/ranks.routing.ts
+++ b/static/src/app/ranks/ranks.routing.ts
@@ -1,9 +1,9 @@
-import {RouterModule, Routes} from "@angular/router";
-import {RankComponent} from "./ranks.component";
-import {RankListComponent} from "./rank-list/rank-list.component";
-import {EditRankComponent} from "./edit-rank/edit-rank.component";
-import {RankItemComponent} from "./rank-list/rank-item.component";
-import {ModuleWithProviders} from "@angular/core";
+import {RouterModule, Routes} from '@angular/router';
+import {RankComponent} from './ranks.component';
+import {RankListComponent} from './rank-list/rank-list.component';
+import {EditRankComponent} from './edit-rank/edit-rank.component';
+import {RankItemComponent} from './rank-list/rank-item.component';
+import {ModuleWithProviders} from '@angular/core';
export const ranksRoutes: Routes = [{
diff --git a/static/src/app/request/award/req-award.component.css b/static/src/app/request/award/req-award.component.css
index afba97b..dd5deea 100644
--- a/static/src/app/request/award/req-award.component.css
+++ b/static/src/app/request/award/req-award.component.css
@@ -19,7 +19,7 @@
.table-container {
margin-top: 40px;
overflow-x: auto;
- width: 75%;
+ width: 90%;
min-width: 800px;
padding: 5px;
}
diff --git a/static/src/app/request/award/req-award.component.html b/static/src/app/request/award/req-award.component.html
index 8d4f33f..c9cbc66 100644
--- a/static/src/app/request/award/req-award.component.html
+++ b/static/src/app/request/award/req-award.component.html
@@ -77,6 +77,7 @@
Antragsteller |
Datum |
Status |
+
Grund für Ablehnung |
@@ -102,6 +103,9 @@
{{award.confirmed === 0? 'In Bearbeitung' : (award.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
|
+
+ {{award.rejectReason ? award.rejectReason : ''}}
+ |
diff --git a/static/src/app/request/award/req-award.component.ts b/static/src/app/request/award/req-award.component.ts
index 8db50a4..efab43d 100644
--- a/static/src/app/request/award/req-award.component.ts
+++ b/static/src/app/request/award/req-award.component.ts
@@ -1,18 +1,18 @@
-import {Component, ViewChild} from "@angular/core";
-import {ActivatedRoute, Router} from "@angular/router";
-import {Award, Decoration, User} from "../../models/model-interfaces";
-import {NgForm} from "@angular/forms";
-import {AwardingService} from "../../services/army-management/awarding.service";
-import {DecorationService} from "../../services/army-management/decoration.service";
-import {UserService} from "../../services/army-management/user.service";
-import {LoginService} from "../../services/app-user-service/login-service";
+import {Component, OnInit, ViewChild} from '@angular/core';
+import {ActivatedRoute, Router} from '@angular/router';
+import {Award, Decoration, User} from '../../models/model-interfaces';
+import {NgForm} from '@angular/forms';
+import {AwardingService} from '../../services/army-management/awarding.service';
+import {DecorationService} from '../../services/army-management/decoration.service';
+import {UserService} from '../../services/army-management/user.service';
+import {LoginService} from '../../services/app-user-service/login-service';
@Component({
templateUrl: './req-award.component.html',
styleUrls: ['./req-award.component.css', '../../style/overview.css'],
})
-export class RequestAwardComponent {
+export class RequestAwardComponent implements OnInit {
@ViewChild(NgForm) form: NgForm;
@@ -24,7 +24,7 @@ export class RequestAwardComponent {
decoration: Decoration = {_id: '0'};
- reason: string = '';
+ reason = '';
decorations: Decoration[];
@@ -81,10 +81,10 @@ export class RequestAwardComponent {
addAwarding(previewImage, descriptionField) {
if (this.decoration._id && this.reason.length > 0) {
const award: Award = {
- "userId": this.user._id,
- "decorationId": this.decoration._id,
- "reason": this.reason,
- "date": Date.now()
+ 'userId': this.user._id,
+ 'decorationId': this.decoration._id,
+ 'reason': this.reason,
+ 'date': Date.now()
};
this.awardingService.requestAwarding(award).subscribe(() => {
this.awardingService.getUserAwardings(this.user._id)
@@ -96,9 +96,9 @@ export class RequestAwardComponent {
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;
- }, 2000)
- })
- })
+ }, 2000);
+ });
+ });
}
}
diff --git a/static/src/app/request/confirm-award/confirm-award.component.css b/static/src/app/request/confirm-award/confirm-award.component.css
index df217b2..2d7ee71 100644
--- a/static/src/app/request/confirm-award/confirm-award.component.css
+++ b/static/src/app/request/confirm-award/confirm-award.component.css
@@ -18,7 +18,7 @@
.table-container {
margin-top: 40px;
overflow-x: auto;
- width: 75%;
+ width: 90%;
padding: 5px;
}
diff --git a/static/src/app/request/confirm-award/confirm-award.component.html b/static/src/app/request/confirm-award/confirm-award.component.html
index 6361bfb..a35c79b 100644
--- a/static/src/app/request/confirm-award/confirm-award.component.html
+++ b/static/src/app/request/confirm-award/confirm-award.component.html
@@ -16,6 +16,7 @@
Begründung |
Antragsteller |
Datum |
+
|
Aktion |
@@ -34,7 +35,10 @@
{{award.decorationId.name}}
- {{award.reason}}
+
|
{{award.proposer?.username}}
@@ -42,9 +46,16 @@
|
{{award.date | date: 'dd.MM.yyyy'}}
|
+
+
+ |
- Bestätigen
- Ablehnen
+ Bestätigen
+ Ablehnen
|
diff --git a/static/src/app/request/confirm-award/confirm-award.component.ts b/static/src/app/request/confirm-award/confirm-award.component.ts
index 751f6ab..59238cc 100644
--- a/static/src/app/request/confirm-award/confirm-award.component.ts
+++ b/static/src/app/request/confirm-award/confirm-award.component.ts
@@ -1,14 +1,14 @@
-import {Component} from "@angular/core";
-import {Award} from "../../models/model-interfaces";
-import {AwardingService} from "../../services/army-management/awarding.service";
-import {LoginService} from "../../services/app-user-service/login-service";
+import {Component, OnInit} from '@angular/core';
+import {Award} from '../../models/model-interfaces';
+import {AwardingService} from '../../services/army-management/awarding.service';
+import {LoginService} from '../../services/app-user-service/login-service';
@Component({
templateUrl: './confirm-award.component.html',
styleUrls: ['./confirm-award.component.css', '../../style/overview.css'],
})
-export class ConfirmAwardComponent {
+export class ConfirmAwardComponent implements OnInit {
awards: Award[];
@@ -19,20 +19,28 @@ export class ConfirmAwardComponent {
}
ngOnInit() {
- let currentUser = this.loginService.getCurrentUser();
+ const currentUser = this.loginService.getCurrentUser();
this.awardingService.getUnconfirmedAwards(currentUser.squad.fraction).subscribe(awards => {
this.awards = awards;
});
}
- confirm(award: Award, decision: boolean) {
+ confirm(award: Award, decision: boolean, reason: string, rejectReason: string) {
const updateObject = {
_id: award._id,
confirmed: decision ? 1 : 2
};
+ if (rejectReason) {
+ updateObject['rejectReason'] = rejectReason;
+ }
+
+ if (reason && reason !== award.reason) {
+ updateObject['reason'] = reason;
+ }
+
this.awardingService.updateAward(updateObject).subscribe(res => {
- let currentUser = this.loginService.getCurrentUser();
+ const currentUser = this.loginService.getCurrentUser();
this.awardingService.getUnconfirmedAwards(currentUser.squad.fraction).subscribe(awards => {
this.awards = awards;
if (awards.length < 1) {
diff --git a/static/src/app/request/confirm-promotion/confirm-promotion.component.css b/static/src/app/request/confirm-promotion/confirm-promotion.component.css
index 2ea383a..2d7ee71 100644
--- a/static/src/app/request/confirm-promotion/confirm-promotion.component.css
+++ b/static/src/app/request/confirm-promotion/confirm-promotion.component.css
@@ -18,7 +18,7 @@
.table-container {
margin-top: 40px;
overflow-x: auto;
- width: 65%;
+ width: 90%;
padding: 5px;
}
diff --git a/static/src/app/request/confirm-promotion/confirm-promotion.component.html b/static/src/app/request/confirm-promotion/confirm-promotion.component.html
index dad3f1d..d9db874 100644
--- a/static/src/app/request/confirm-promotion/confirm-promotion.component.html
+++ b/static/src/app/request/confirm-promotion/confirm-promotion.component.html
@@ -16,7 +16,8 @@
Antragsteller |
Datum |
Status |
-
Aktion |
+
|
+
Aktion |
@@ -39,9 +40,16 @@
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
|
+
+
+ |
Bestätigen
- Ablehnen
+ Ablehnen
|
diff --git a/static/src/app/request/confirm-promotion/confirm-promotion.component.ts b/static/src/app/request/confirm-promotion/confirm-promotion.component.ts
index 8612ced..c3c5458 100644
--- a/static/src/app/request/confirm-promotion/confirm-promotion.component.ts
+++ b/static/src/app/request/confirm-promotion/confirm-promotion.component.ts
@@ -1,15 +1,15 @@
-import {Component} from "@angular/core";
-import {Promotion, Rank} from "../../models/model-interfaces";
-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";
+import {Component, OnInit} from '@angular/core';
+import {Promotion, Rank} from '../../models/model-interfaces';
+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';
@Component({
templateUrl: './confirm-promotion.component.html',
styleUrls: ['./confirm-promotion.component.css', '../../style/overview.css'],
})
-export class ConfirmPromotionComponent {
+export class ConfirmPromotionComponent implements OnInit {
showSuccessLabel = false;
@@ -23,25 +23,28 @@ export class ConfirmPromotionComponent {
}
ngOnInit() {
- let currentUser = this.loginService.getCurrentUser();
+ const currentUser = this.loginService.getCurrentUser();
// show only current users fraction promotions
this.rankService.findRanks('', currentUser.squad.fraction).subscribe(ranks => {
this.ranks = ranks;
});
this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => {
this.promotions = promotions;
- })
-
+ });
}
- confirm(promotion: Promotion, decision: boolean) {
+ confirm(promotion: Promotion, decision: boolean, rejectReason: string) {
const updateObject = {
_id: promotion._id,
confirmed: decision ? 1 : 2
};
+ if (rejectReason) {
+ updateObject['rejectReason'] = rejectReason;
+ }
+
this.promotionService.updatePromotion(updateObject).subscribe(res => {
- let currentUser = this.loginService.getCurrentUser();
+ const currentUser = this.loginService.getCurrentUser();
this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => {
this.promotions = promotions;
if (promotions.length < 1) {
diff --git a/static/src/app/request/promotion/req-promotion.component.css b/static/src/app/request/promotion/req-promotion.component.css
index 58d23c6..e799ab8 100644
--- a/static/src/app/request/promotion/req-promotion.component.css
+++ b/static/src/app/request/promotion/req-promotion.component.css
@@ -18,7 +18,7 @@
.table-container {
margin-top: 40px;
overflow-x: auto;
- width: 65%;
+ width: 90%;
min-width: 800px;
padding: 5px;
}
diff --git a/static/src/app/request/promotion/req-promotion.component.html b/static/src/app/request/promotion/req-promotion.component.html
index 9e7307f..33be9d0 100644
--- a/static/src/app/request/promotion/req-promotion.component.html
+++ b/static/src/app/request/promotion/req-promotion.component.html
@@ -74,6 +74,7 @@
Antragsteller |
Datum |
Status |
+
Grund für Ablehnung |
@@ -96,6 +97,9 @@
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
|
+
+ {{promotion.rejectReason ? promotion.rejectReason : ''}}
+ |
diff --git a/static/src/app/request/promotion/req-promotion.component.ts b/static/src/app/request/promotion/req-promotion.component.ts
index bdd4a06..963fcb0 100644
--- a/static/src/app/request/promotion/req-promotion.component.ts
+++ b/static/src/app/request/promotion/req-promotion.component.ts
@@ -1,18 +1,18 @@
-import {Component, ViewChild} from "@angular/core";
-import {ActivatedRoute, Router} from "@angular/router";
-import {Rank, User} from "../../models/model-interfaces";
-import {NgForm} from "@angular/forms";
-import {UserService} from "../../services/army-management/user.service";
-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";
+import {Component, OnInit, ViewChild} from '@angular/core';
+import {ActivatedRoute, Router} from '@angular/router';
+import {Rank, User} from '../../models/model-interfaces';
+import {NgForm} from '@angular/forms';
+import {UserService} from '../../services/army-management/user.service';
+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';
@Component({
templateUrl: './req-promotion.component.html',
styleUrls: ['./req-promotion.component.css', '../../style/overview.css'],
})
-export class RequestPromotionComponent {
+export class RequestPromotionComponent implements OnInit {
@ViewChild(NgForm) form: NgForm;
@@ -41,7 +41,7 @@ export class RequestPromotionComponent {
}
ngOnInit() {
- let currentUser = this.loginService.getCurrentUser()
+ const currentUser = this.loginService.getCurrentUser();
// show only current users squad members
this.userService.findUsers('', undefined, currentUser.squad._id).subscribe(users => {
this.users = users;
@@ -51,12 +51,12 @@ export class RequestPromotionComponent {
});
this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => {
this.uncheckedPromotions = promotions;
- })
+ });
}
toggleUser() {
- if (this.user._id != '0') {
+ if (this.user._id !== '0') {
this.showForm = true;
this.newLevel = this.user.rankLvl;
this.selectedUserRank = this.ranks.filter(rank => rank.level === this.user.rankLvl).map(rank => rank.name);
@@ -68,13 +68,13 @@ export class RequestPromotionComponent {
addPromotion() {
const promotion = {
- "userId": this.user._id,
- "oldRankLvl": this.user.rankLvl,
- "newRankLvl": this.newLevel
+ 'userId': this.user._id,
+ 'oldRankLvl': this.user.rankLvl,
+ 'newRankLvl': this.newLevel
};
this.promotionService.requestPromotion(promotion).subscribe(() => {
- let currentUser = this.loginService.getCurrentUser();
+ const currentUser = this.loginService.getCurrentUser();
this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => {
this.uncheckedPromotions = promotions;
this.showForm = false;
@@ -83,7 +83,7 @@ export class RequestPromotionComponent {
setTimeout(() => {
this.showSuccessLabel = false;
}, 2000);
- })
+ });
});
}
diff --git a/static/src/app/request/request.component.ts b/static/src/app/request/request.component.ts
index eab67db..162bce1 100644
--- a/static/src/app/request/request.component.ts
+++ b/static/src/app/request/request.component.ts
@@ -1,7 +1,7 @@
-import {Component} from "@angular/core";
+import {Component} from '@angular/core';
@Component({
- selector: 'request',
+ selector: 'cc-request',
templateUrl: 'request.component.html',
styleUrls: ['request.component.css']
})
diff --git a/static/src/app/request/request.module.ts b/static/src/app/request/request.module.ts
index ef3e0c6..1173550 100644
--- a/static/src/app/request/request.module.ts
+++ b/static/src/app/request/request.module.ts
@@ -1,13 +1,13 @@
-import {CommonModule} from "@angular/common";
-import {SharedModule} from "../shared.module";
-import {requestRouterModule} from "./request.routing";
-import {NgModule} from "@angular/core";
-import {FilterRankPipe} from "../filter/filter.pipe";
-import {RequestComponent} from "./request.component";
-import {ConfirmAwardComponent} from "./confirm-award/confirm-award.component";
-import {ConfirmPromotionComponent} from "./confirm-promotion/confirm-promotion.component";
-import {RequestAwardComponent} from "./award/req-award.component";
-import {RequestPromotionComponent} from "./promotion/req-promotion.component";
+import {CommonModule} from '@angular/common';
+import {SharedModule} from '../shared.module';
+import {requestRouterModule} from './request.routing';
+import {NgModule} from '@angular/core';
+import {FilterRankPipe} from '../filter/filter.pipe';
+import {RequestComponent} from './request.component';
+import {ConfirmAwardComponent} from './confirm-award/confirm-award.component';
+import {ConfirmPromotionComponent} from './confirm-promotion/confirm-promotion.component';
+import {RequestAwardComponent} from './award/req-award.component';
+import {RequestPromotionComponent} from './promotion/req-promotion.component';
@NgModule({
declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent,
diff --git a/static/src/app/request/request.routing.ts b/static/src/app/request/request.routing.ts
index 33d0137..28ce09b 100644
--- a/static/src/app/request/request.routing.ts
+++ b/static/src/app/request/request.routing.ts
@@ -1,13 +1,13 @@
-import {RouterModule, Routes} from "@angular/router";
-import {ModuleWithProviders} from "@angular/core";
-import {ConfirmAwardComponent} from "./confirm-award/confirm-award.component";
-import {ConfirmPromotionComponent} from "./confirm-promotion/confirm-promotion.component";
-import {RequestAwardComponent} from "./award/req-award.component";
-import {RequestPromotionComponent} from "./promotion/req-promotion.component";
+import {RouterModule, Routes} from '@angular/router';
+import {ModuleWithProviders} from '@angular/core';
+import {ConfirmAwardComponent} from './confirm-award/confirm-award.component';
+import {ConfirmPromotionComponent} from './confirm-promotion/confirm-promotion.component';
+import {RequestAwardComponent} from './award/req-award.component';
+import {RequestPromotionComponent} from './promotion/req-promotion.component';
-import {RequestComponent} from "./request.component";
-import {RouteConfig} from "../app.config";
-import {LoginGuardHL, LoginGuardSQL} from "../login/login.guard";
+import {RequestComponent} from './request.component';
+import {RouteConfig} from '../app.config';
+import {LoginGuardHL, LoginGuardSQL} from '../login';
export const requestRoutes: Routes = [{
diff --git a/static/src/app/services/app-user-service/app-user.service.ts b/static/src/app/services/app-user-service/app-user.service.ts
index 7817ef7..3b41aac 100644
--- a/static/src/app/services/app-user-service/app-user.service.ts
+++ b/static/src/app/services/app-user-service/app-user.service.ts
@@ -1,10 +1,10 @@
-import {Injectable} from "@angular/core";
-import {AppUser} from "../../models/model-interfaces";
-import {Observable} from "rxjs/Observable";
-import {EDIT, LOAD, REMOVE} from "../stores/user.store";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
-import {AppUserStore} from "../stores/app-user.store";
+import {Injectable} from '@angular/core';
+import {AppUser} from '../../models/model-interfaces';
+import {Observable} from 'rxjs/Observable';
+import {EDIT, LOAD, REMOVE} from '../stores/user.store';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
+import {AppUserStore} from '../stores/app-user.store';
@Injectable()
export class AppUserService {
diff --git a/static/src/app/services/app-user-service/login-service.ts b/static/src/app/services/app-user-service/login-service.ts
index 1cfc12c..c35eb12 100644
--- a/static/src/app/services/app-user-service/login-service.ts
+++ b/static/src/app/services/app-user-service/login-service.ts
@@ -1,11 +1,11 @@
-import {Injectable} from "@angular/core";
-import {Http, Response} from "@angular/http";
-import "rxjs/add/operator/map";
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import 'rxjs/add/operator/map';
-import {AppConfig} from "../../app.config";
-import {AwardingService} from "../army-management/awarding.service";
-import {PromotionService} from "../army-management/promotion.service";
-import {CookieService} from "ngx-cookie-service";
+import {AppConfig} from '../../app.config';
+import {AwardingService} from '../army-management/awarding.service';
+import {PromotionService} from '../army-management/promotion.service';
+import {CookieService} from 'ngx-cookie-service';
@Injectable()
export class LoginService {
@@ -20,7 +20,7 @@ export class LoginService {
return this.http.post(this.config.apiAuthenticationPath, {username: username, password: password})
.map((response: Response) => {
// login successful if there's a jwt token in the response
- let user = response.json();
+ const user = response.json();
if (user && user.token) {
// store user details and jwt token in cookie
this.cookieService.set('currentUser', JSON.stringify(user));
diff --git a/static/src/app/services/army-management/awarding.service.ts b/static/src/app/services/army-management/awarding.service.ts
index aa2d6a8..316f141 100644
--- a/static/src/app/services/army-management/awarding.service.ts
+++ b/static/src/app/services/army-management/awarding.service.ts
@@ -1,7 +1,7 @@
-import {Injectable} from "@angular/core";
-import {Award} from "../../models/model-interfaces";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
+import {Injectable} from '@angular/core';
+import {Award} from '../../models/model-interfaces';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
@Injectable()
export class AwardingService {
@@ -14,15 +14,15 @@ export class AwardingService {
getUnconfirmedAwards(fraction?: string) {
return this.http.get(this.config.apiAwardPath + '?inProgress=true&fractFilter=' + fraction)
- .map(res => res.json())
+ .map(res => res.json());
}
checkUnprocessedAwards(fraction?: string) {
this.getUnconfirmedAwards(fraction).subscribe((items) => {
if (items.length > 0) {
- this.hasUnprocessedAwards = true
+ this.hasUnprocessedAwards = true;
}
- })
+ });
}
/**
@@ -30,24 +30,24 @@ export class AwardingService {
*/
getUserAwardings(userId: string) {
return this.http.get(this.config.apiAwardPath + '?userId=' + userId)
- .map(res => res.json())
+ .map(res => res.json());
}
addAwarding(award: Award) {
- return this.http.post(this.config.apiAwardPath, award)
+ return this.http.post(this.config.apiAwardPath, award);
}
updateAward(award) {
return this.http.patch(this.config.apiAwardPath + '/' + award._id, award)
- .map(res => res.json())
+ .map(res => res.json());
}
requestAwarding(award: Award) {
- return this.http.post(this.config.apiRequestAwardPath, award)
+ return this.http.post(this.config.apiRequestAwardPath, award);
}
deleteAwarding(awardingId) {
- return this.http.delete(this.config.apiAwardPath + '/' + awardingId)
+ return this.http.delete(this.config.apiAwardPath + '/' + awardingId);
}
}
diff --git a/static/src/app/services/army-management/decoration.service.ts b/static/src/app/services/army-management/decoration.service.ts
index f7dae4a..2ee21d4 100644
--- a/static/src/app/services/army-management/decoration.service.ts
+++ b/static/src/app/services/army-management/decoration.service.ts
@@ -1,10 +1,10 @@
-import {Injectable} from "@angular/core";
-import {Decoration} from "../../models/model-interfaces";
-import {RequestMethod, RequestOptions, URLSearchParams} from "@angular/http";
-import {Observable} from "rxjs/Observable";
-import {ADD, DecorationStore, EDIT, LOAD, REMOVE} from "../stores/decoration.store";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
+import {Injectable} from '@angular/core';
+import {Decoration} from '../../models/model-interfaces';
+import {RequestMethod, RequestOptions, URLSearchParams} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {ADD, DecorationStore, EDIT, LOAD, REMOVE} from '../stores/decoration.store';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
@Injectable()
diff --git a/static/src/app/services/army-management/promotion.service.ts b/static/src/app/services/army-management/promotion.service.ts
index 0fd9a23..82f7206 100644
--- a/static/src/app/services/army-management/promotion.service.ts
+++ b/static/src/app/services/army-management/promotion.service.ts
@@ -1,7 +1,7 @@
-import {Injectable} from "@angular/core";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
-import {Promotion} from "../../models/model-interfaces";
+import {Injectable} from '@angular/core';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
+import {Promotion} from '../../models/model-interfaces';
@Injectable()
export class PromotionService {
@@ -14,33 +14,33 @@ export class PromotionService {
getUnconfirmedPromotions(fraction?: string) {
return this.http.get(this.config.apiPromotionPath + '?inProgress=true&fractFilter=' + fraction)
- .map(res => res.json())
+ .map(res => res.json());
}
checkUnconfirmedPromotions(fraction?: string) {
this.getUnconfirmedPromotions(fraction).subscribe((items) => {
if (items.length > 0) {
- this.hasUnprocessedPromotion = true
+ this.hasUnprocessedPromotion = true;
}
- })
+ });
}
getSquadPromotions(squadId: string) {
return this.http.get(this.config.apiPromotionPath + '?squadId=' + squadId)
- .map(res => res.json())
+ .map(res => res.json());
}
requestPromotion(promotion: Promotion) {
- return this.http.post(this.config.apiPromotionPath, promotion)
+ return this.http.post(this.config.apiPromotionPath, promotion);
}
updatePromotion(promotion) {
return this.http.patch(this.config.apiPromotionPath + '/' + promotion._id, promotion)
- .map(res => res.json())
+ .map(res => res.json());
}
deletePromotion(promotionId) {
- return this.http.delete(this.config.apiPromotionPath + promotionId)
+ return this.http.delete(this.config.apiPromotionPath + promotionId);
}
}
diff --git a/static/src/app/services/army-management/rank.service.ts b/static/src/app/services/army-management/rank.service.ts
index 05994f2..595f7f1 100644
--- a/static/src/app/services/army-management/rank.service.ts
+++ b/static/src/app/services/army-management/rank.service.ts
@@ -1,11 +1,11 @@
-import {Injectable} from "@angular/core";
-import {Decoration, Rank} from "../../models/model-interfaces";
-import {RequestMethod, RequestOptions, URLSearchParams} from "@angular/http";
-import {Observable} from "rxjs/Observable";
-import {LOAD} from "../stores/decoration.store";
-import {ADD, EDIT, RankStore, REMOVE} from "../stores/rank.store";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
+import {Injectable} from '@angular/core';
+import {Decoration, Rank} from '../../models/model-interfaces';
+import {RequestMethod, RequestOptions, URLSearchParams} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {LOAD} from '../stores/decoration.store';
+import {ADD, EDIT, RankStore, REMOVE} from '../stores/rank.store';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
@Injectable()
@@ -118,7 +118,7 @@ export class RankService {
* @param imageFile - new image file to upload
*/
updateRankGraphic(rankId: string, imageFile: File) {
- let formData: FormData = new FormData();
+ const formData: FormData = new FormData();
formData.append('_id', rankId);
formData.append('image', imageFile, imageFile.name);
diff --git a/static/src/app/services/army-management/squad.service.ts b/static/src/app/services/army-management/squad.service.ts
index f1d20aa..75a7ae6 100644
--- a/static/src/app/services/army-management/squad.service.ts
+++ b/static/src/app/services/army-management/squad.service.ts
@@ -1,11 +1,11 @@
-import {Injectable} from "@angular/core";
-import {Squad} from "../../models/model-interfaces";
-import {RequestMethod, RequestOptions, URLSearchParams} from "@angular/http";
-import {Observable} from "rxjs/Observable";
+import {Injectable} from '@angular/core';
+import {Squad} from '../../models/model-interfaces';
+import {RequestMethod, RequestOptions, URLSearchParams} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
-import {ADD, EDIT, LOAD, REMOVE, SquadStore} from "../stores/squad.store";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
+import {ADD, EDIT, LOAD, REMOVE, SquadStore} from '../stores/squad.store';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
@Injectable()
export class SquadService {
diff --git a/static/src/app/services/army-management/user.service.ts b/static/src/app/services/army-management/user.service.ts
index af907b3..71cd488 100644
--- a/static/src/app/services/army-management/user.service.ts
+++ b/static/src/app/services/army-management/user.service.ts
@@ -1,10 +1,10 @@
-import {Injectable} from "@angular/core";
-import {User} from "../../models/model-interfaces";
-import {URLSearchParams} from "@angular/http";
-import {Observable} from "rxjs/Observable";
-import {ADD, EDIT, LOAD, REMOVE, UserStore} from "../stores/user.store";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
+import {Injectable} from '@angular/core';
+import {User} from '../../models/model-interfaces';
+import {URLSearchParams} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {ADD, EDIT, LOAD, REMOVE, UserStore} from '../stores/user.store';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
@Injectable()
export class UserService {
@@ -32,7 +32,7 @@ export class UserService {
searchParams.append('offset', offset);
this.http.get(this.config.apiUserPath, searchParams)
.do((res) => {
- let headerCount = parseInt(res.headers.get('x-total-count'));
+ const headerCount = parseInt(res.headers.get('x-total-count'), 10);
if (headerCount) {
this.totalCount = headerCount;
}
diff --git a/static/src/app/services/army-service/army.service.ts b/static/src/app/services/army-service/army.service.ts
index 5cb0c3a..cba89a5 100644
--- a/static/src/app/services/army-service/army.service.ts
+++ b/static/src/app/services/army-service/army.service.ts
@@ -1,6 +1,6 @@
-import {Injectable} from "@angular/core";
-import {AppConfig} from "../../app.config";
-import {Http} from "@angular/http";
+import {Injectable} from '@angular/core';
+import {AppConfig} from '../../app.config';
+import {Http} from '@angular/http';
@Injectable()
diff --git a/static/src/app/services/http-client.ts b/static/src/app/services/http-client.ts
index 91a68fe..ad77701 100644
--- a/static/src/app/services/http-client.ts
+++ b/static/src/app/services/http-client.ts
@@ -1,7 +1,7 @@
-import {Injectable} from "@angular/core";
-import {Headers, Http, RequestMethod} from "@angular/http";
-import {Router} from "@angular/router";
-import {CookieService} from "ngx-cookie-service";
+import {Injectable} from '@angular/core';
+import {Headers, Http, RequestMethod} from '@angular/http';
+import {Router} from '@angular/router';
+import {CookieService} from 'ngx-cookie-service';
@Injectable()
export class HttpClient {
@@ -16,21 +16,21 @@ export class HttpClient {
if (cookieField) {
const currentUser = JSON.parse(cookieField);
if (new Date().getTime() <= Date.parse(currentUser.tokenExpireDate)) {
- let headers = new Headers();
+ const headers = new Headers();
headers.append('x-access-token', currentUser.token);
return headers;
} else {
- //logout
+ // logout
localStorage.removeItem('currentUser');
- this.router.navigate(['/login'])
+ this.router.navigate(['/login']);
}
}
}
get(url, searchParams?) {
- let headers = this.createAuthorizationHeader();
- let options: any = {headers: headers};
+ const headers = this.createAuthorizationHeader();
+ const options: any = {headers: headers};
if (searchParams) {
options.search = searchParams;
}
@@ -38,28 +38,28 @@ export class HttpClient {
}
post(url, data) {
- let headers = this.createAuthorizationHeader();
+ const headers = this.createAuthorizationHeader();
return this.http.post(url, data, {
headers: headers
});
}
put(url, data) {
- let headers = this.createAuthorizationHeader();
+ const headers = this.createAuthorizationHeader();
return this.http.put(url, data, {
headers: headers
});
}
patch(url, data) {
- let headers = this.createAuthorizationHeader();
+ const headers = this.createAuthorizationHeader();
return this.http.patch(url, data, {
headers: headers
});
}
delete(url) {
- let headers = this.createAuthorizationHeader();
+ const headers = this.createAuthorizationHeader();
return this.http.delete(url, {
headers: headers
});
diff --git a/static/src/app/services/logs/campaign.service.ts b/static/src/app/services/logs/campaign.service.ts
index 151dbaf..0b5ae55 100644
--- a/static/src/app/services/logs/campaign.service.ts
+++ b/static/src/app/services/logs/campaign.service.ts
@@ -1,7 +1,7 @@
-import {Injectable} from "@angular/core";
-import {Campaign} from "../../models/model-interfaces";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
+import {Injectable} from '@angular/core';
+import {Campaign} from '../../models/model-interfaces';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
@Injectable()
export class CampaignService {
@@ -14,17 +14,17 @@ export class CampaignService {
getAllCampaigns() {
return this.http.get(this.config.apiWarPath)
- .map(res => res.json())
+ .map(res => res.json());
}
submitCampaign(campaign: Campaign) {
return this.http.post(this.config.apiCampaignPath, campaign)
- .map(res => res.json())
+ .map(res => res.json());
}
deleteCampaign(id: string) {
return this.http.delete(this.config.apiCampaignPath + '/' + id)
- .map(res => res.json())
+ .map(res => res.json());
}
}
diff --git a/static/src/app/services/logs/logs.service.ts b/static/src/app/services/logs/logs.service.ts
index 92ea958..0a7c431 100644
--- a/static/src/app/services/logs/logs.service.ts
+++ b/static/src/app/services/logs/logs.service.ts
@@ -1,7 +1,7 @@
-import {Injectable} from "@angular/core";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
-import {URLSearchParams} from "@angular/http";
+import {Injectable} from '@angular/core';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
+import {URLSearchParams} from '@angular/http';
@Injectable()
export class LogsService {
@@ -12,28 +12,28 @@ export class LogsService {
getFullLog(warId: string) {
return this.http.get(this.config.apiLogsPath + '/' + warId)
- .map(res => res.json())
+ .map(res => res.json());
}
getBudgetLogs(warId: string, fraction = '') {
const params = new URLSearchParams();
params.append('fraction', fraction);
return this.http.get(this.config.apiLogsPath + '/' + warId + '/budget', params)
- .map(res => res.json())
+ .map(res => res.json());
}
getRespawnLogs(warId: string, playerName = '') {
const params = new URLSearchParams();
params.append('player', playerName);
return this.http.get(this.config.apiLogsPath + '/' + warId + '/respawn', params)
- .map(res => res.json())
+ .map(res => res.json());
}
getPointsLogs(warId: string, fraction = '') {
const params = new URLSearchParams();
params.append('fraction', fraction);
return this.http.get(this.config.apiLogsPath + '/' + warId + '/points', params)
- .map(res => res.json())
+ .map(res => res.json());
}
getReviveLogs(warId: string, medicName = '', patientName = '', fraction = '', stabilizedOnly = false, reviveOnly = false) {
@@ -44,7 +44,7 @@ export class LogsService {
params.append('stabilized', stabilizedOnly ? 'true' : '');
params.append('revive', reviveOnly ? 'true' : '');
return this.http.get(this.config.apiLogsPath + '/' + warId + '/revive', params)
- .map(res => res.json())
+ .map(res => res.json());
}
getKillLogs(warId: string, shooterName = '', targetName = '', fraction = '', friendlyFireOnly = false, notFriendlyFireOnly = false) {
@@ -55,7 +55,7 @@ export class LogsService {
params.append('friendlyFire', friendlyFireOnly ? 'true' : '');
params.append('noFriendlyFire', notFriendlyFireOnly ? 'true' : '');
return this.http.get(this.config.apiLogsPath + '/' + warId + '/kills', params)
- .map(res => res.json())
+ .map(res => res.json());
}
getTransportLogs(warId: string, driverName = '', passengerName = '', fraction = '') {
@@ -64,7 +64,7 @@ export class LogsService {
params.append('passenger', passengerName);
params.append('fraction', fraction);
return this.http.get(this.config.apiLogsPath + '/' + warId + '/transport', params)
- .map(res => res.json())
+ .map(res => res.json());
}
getFlagLogs(warId: string, playerName = '', fraction = '', captureOnly = false, defendOnly = false) {
@@ -74,7 +74,7 @@ export class LogsService {
params.append('capture', captureOnly ? 'true' : '');
params.append('defend', defendOnly ? 'true' : '');
return this.http.get(this.config.apiLogsPath + '/' + warId + '/flag', params)
- .map(res => res.json())
+ .map(res => res.json());
}
}
diff --git a/static/src/app/services/logs/player.service.ts b/static/src/app/services/logs/player.service.ts
index a7dbf91..1540dd7 100644
--- a/static/src/app/services/logs/player.service.ts
+++ b/static/src/app/services/logs/player.service.ts
@@ -1,6 +1,6 @@
-import {Injectable} from "@angular/core";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
+import {Injectable} from '@angular/core';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
@Injectable()
export class PlayerService {
@@ -11,12 +11,12 @@ export class PlayerService {
getCampaignPlayer(campaignId: string, playerName: string) {
return this.http.get(this.config.apiPlayersPath + '/single/' + campaignId + '/' + playerName)
- .map(res => res.json())
+ .map(res => res.json());
}
getCampaignHighscore(campaignId: string) {
return this.http.get(this.config.apiPlayersPath + '/ranking/' + campaignId)
- .map(res => res.json())
+ .map(res => res.json());
}
}
diff --git a/static/src/app/services/logs/war.service.ts b/static/src/app/services/logs/war.service.ts
index e3e9696..fb6d5d6 100644
--- a/static/src/app/services/logs/war.service.ts
+++ b/static/src/app/services/logs/war.service.ts
@@ -1,7 +1,7 @@
-import {Injectable} from "@angular/core";
-import {War} from "../../models/model-interfaces";
-import {AppConfig} from "../../app.config";
-import {HttpClient} from "../http-client";
+import {Injectable} from '@angular/core';
+import {War} from '../../models/model-interfaces';
+import {AppConfig} from '../../app.config';
+import {HttpClient} from '../http-client';
@Injectable()
export class WarService {
@@ -12,7 +12,7 @@ export class WarService {
getWar(warId: string) {
return this.http.get(this.config.apiWarPath + '/' + warId)
- .map(res => res.json())
+ .map(res => res.json());
}
@@ -30,12 +30,12 @@ export class WarService {
}
return this.http.post(this.config.apiWarPath, body)
- .map(res => res.json())
+ .map(res => res.json());
}
deleteWar(id: string) {
return this.http.delete(this.config.apiWarPath + '/' + id)
- .map(res => res.json())
+ .map(res => res.json());
}
}
diff --git a/static/src/app/services/stores/app-user.store.ts b/static/src/app/services/stores/app-user.store.ts
index 0045bd9..54a4638 100644
--- a/static/src/app/services/stores/app-user.store.ts
+++ b/static/src/app/services/stores/app-user.store.ts
@@ -1,5 +1,5 @@
-import {BehaviorSubject} from "rxjs/BehaviorSubject";
-import {AppUser} from "../../models/model-interfaces";
+import {BehaviorSubject} from 'rxjs/BehaviorSubject';
+import {AppUser} from '../../models/model-interfaces';
export const LOAD = 'LOAD';
export const ADD = 'ADD';
diff --git a/static/src/app/services/stores/decoration.store.ts b/static/src/app/services/stores/decoration.store.ts
index ad70e43..3bdde1d 100644
--- a/static/src/app/services/stores/decoration.store.ts
+++ b/static/src/app/services/stores/decoration.store.ts
@@ -1,5 +1,5 @@
-import {BehaviorSubject} from "rxjs/BehaviorSubject";
-import {Decoration} from "../../models/model-interfaces";
+import {BehaviorSubject} from 'rxjs/BehaviorSubject';
+import {Decoration} from '../../models/model-interfaces';
export const LOAD = 'LOAD';
export const ADD = 'ADD';
diff --git a/static/src/app/services/stores/generic-store.ts b/static/src/app/services/stores/generic-store.ts
index 1f6dce5..6271879 100644
--- a/static/src/app/services/stores/generic-store.ts
+++ b/static/src/app/services/stores/generic-store.ts
@@ -1,4 +1,4 @@
-import {BehaviorSubject} from "rxjs/BehaviorSubject";
+import {BehaviorSubject} from 'rxjs/BehaviorSubject';
export const LOAD = 'LOAD';
export const ADD = 'ADD';
@@ -29,7 +29,7 @@ export class Store
{
return [...items, action.data];
case EDIT:
return items.map(task => {
- var editedTask = action.data;
+ const editedTask = action.data;
if (task.id !== editedTask.id) {
return task;
}
diff --git a/static/src/app/services/stores/rank.store.ts b/static/src/app/services/stores/rank.store.ts
index d78b8aa..bcca9b5 100644
--- a/static/src/app/services/stores/rank.store.ts
+++ b/static/src/app/services/stores/rank.store.ts
@@ -1,5 +1,5 @@
-import {BehaviorSubject} from "rxjs/BehaviorSubject";
-import {Rank} from "../../models/model-interfaces";
+import {BehaviorSubject} from 'rxjs/BehaviorSubject';
+import {Rank} from '../../models/model-interfaces';
export const LOAD = 'LOAD';
export const ADD = 'ADD';
diff --git a/static/src/app/services/stores/squad.store.ts b/static/src/app/services/stores/squad.store.ts
index 6ba7180..558beee 100644
--- a/static/src/app/services/stores/squad.store.ts
+++ b/static/src/app/services/stores/squad.store.ts
@@ -1,5 +1,5 @@
-import {BehaviorSubject} from "rxjs/BehaviorSubject";
-import {Squad} from "../../models/model-interfaces";
+import {BehaviorSubject} from 'rxjs/BehaviorSubject';
+import {Squad} from '../../models/model-interfaces';
export const LOAD = 'LOAD';
export const ADD = 'ADD';
diff --git a/static/src/app/services/stores/user.store.ts b/static/src/app/services/stores/user.store.ts
index ce8ac10..7af7a94 100644
--- a/static/src/app/services/stores/user.store.ts
+++ b/static/src/app/services/stores/user.store.ts
@@ -1,5 +1,5 @@
-import {BehaviorSubject} from "rxjs/BehaviorSubject";
-import {User} from "../../models/model-interfaces";
+import {BehaviorSubject} from 'rxjs/BehaviorSubject';
+import {User} from '../../models/model-interfaces';
export const LOAD = 'LOAD';
export const ADD = 'ADD';
diff --git a/static/src/app/shared.module.ts b/static/src/app/shared.module.ts
index 8fa9bba..81f00d7 100644
--- a/static/src/app/shared.module.ts
+++ b/static/src/app/shared.module.ts
@@ -1,7 +1,7 @@
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
-import {ShowErrorComponent} from "./common/show-error/show-error.component";
-import {CommonModule} from "@angular/common";
+import {ShowErrorComponent} from './common/show-error/show-error.component';
+import {CommonModule} from '@angular/common';
@NgModule({
declarations: [ShowErrorComponent],
diff --git a/static/src/app/squads/edit-squad/edit-squad.component.html b/static/src/app/squads/edit-squad/edit-squad.component.html
index c230836..964cb42 100644
--- a/static/src/app/squads/edit-squad/edit-squad.component.html
+++ b/static/src/app/squads/edit-squad/edit-squad.component.html
@@ -10,7 +10,7 @@
id="title"
required maxlength="50"/>
-
+
@@ -21,14 +21,14 @@
-
+
-
+
diff --git a/static/src/app/squads/edit-squad/edit-squad.component.ts b/static/src/app/squads/edit-squad/edit-squad.component.ts
index 89e792a..8189c39 100644
--- a/static/src/app/squads/edit-squad/edit-squad.component.ts
+++ b/static/src/app/squads/edit-squad/edit-squad.component.ts
@@ -1,17 +1,17 @@
-import {Component, ViewChild} from "@angular/core";
-import {ActivatedRoute, Router} from "@angular/router";
-import {NgForm} from "@angular/forms";
-import {Squad} from "../../models/model-interfaces";
-import {SquadService} from "../../services/army-management/squad.service";
-import {Subscription} from "rxjs/Subscription";
-import {Fraction} from "../../utils/fraction.enum";
+import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
+import {ActivatedRoute, Router} from '@angular/router';
+import {NgForm} from '@angular/forms';
+import {Squad} from '../../models/model-interfaces';
+import {SquadService} from '../../services/army-management/squad.service';
+import {Subscription} from 'rxjs/Subscription';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
templateUrl: './edit-squad.component.html',
styleUrls: ['./edit-squad.component.css', '../../style/entry-form.css', '../../style/overview.css']
})
-export class EditSquadComponent {
+export class EditSquadComponent implements OnInit, OnDestroy {
subscription: Subscription;
@@ -39,7 +39,7 @@ export class EditSquadComponent {
ngOnInit() {
this.subscription = this.route.params
.map(params => params['id'])
- .filter(id => id != undefined)
+ .filter(id => id !== undefined)
.flatMap(id => this.squadService.getSquad(id))
.subscribe(squad => {
this.squad = squad;
@@ -70,7 +70,7 @@ export class EditSquadComponent {
.subscribe(rank => {
this.saved = true;
this.router.navigate(['..'], {relativeTo: this.route});
- })
+ });
} else {
return window.alert(`Bild ist ein Pflichtfeld`);
}
@@ -88,8 +88,8 @@ export class EditSquadComponent {
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;
- }, 2000)
- })
+ }, 2000);
+ });
}
}
diff --git a/static/src/app/squads/squad-list/squad-item.component.ts b/static/src/app/squads/squad-list/squad-item.component.ts
index b44ffa7..02851a6 100644
--- a/static/src/app/squads/squad-list/squad-item.component.ts
+++ b/static/src/app/squads/squad-list/squad-item.component.ts
@@ -1,22 +1,22 @@
-import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
-import {Squad} from "../../models/model-interfaces";
-import {Fraction} from "../../utils/fraction.enum";
+import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
+import {Squad} from '../../models/model-interfaces';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
selector: 'pjm-squad-item',
templateUrl: './squad-item.component.html',
styleUrls: ['./squad-item.component.css', '../../style/list-entry.css'],
- changeDetection: ChangeDetectionStrategy.OnPush,
- inputs: ['squad', 'selected'],
- outputs: ['squadSelected', 'squadDelete'],
+ changeDetection: ChangeDetectionStrategy.OnPush
})
-export class SquadItemComponent {
+export class SquadItemComponent implements OnInit {
- selected: boolean;
- squad: Squad;
+ @Input() selected: boolean;
- squadSelected = new EventEmitter();
- squadDelete = new EventEmitter();
+ @Input() squad: Squad;
+
+ @Output() squadSelected = new EventEmitter();
+
+ @Output() squadDelete = new EventEmitter();
imageSrc;
@@ -30,7 +30,7 @@ export class SquadItemComponent {
}
select() {
- this.squadSelected.emit(this.squad._id)
+ this.squadSelected.emit(this.squad._id);
}
delete() {
diff --git a/static/src/app/squads/squad-list/squad-list.component.ts b/static/src/app/squads/squad-list/squad-list.component.ts
index 31ae8cb..c423549 100644
--- a/static/src/app/squads/squad-list/squad-list.component.ts
+++ b/static/src/app/squads/squad-list/squad-list.component.ts
@@ -1,12 +1,12 @@
-import {Component, OnInit} from "@angular/core";
-import {Location} from "@angular/common";
+import {Component, OnInit} from '@angular/core';
+import {Location} from '@angular/common';
-import {FormControl} from "@angular/forms";
-import {ActivatedRoute, Router} from "@angular/router";
-import {Observable} from "rxjs/Observable";
-import {Squad} from "../../models/model-interfaces";
-import {SquadService} from "../../services/army-management/squad.service";
-import {Fraction} from "../../utils/fraction.enum";
+import {FormControl} from '@angular/forms';
+import {ActivatedRoute, Router} from '@angular/router';
+import {Observable} from 'rxjs/Observable';
+import {Squad} from '../../models/model-interfaces';
+import {SquadService} from '../../services/army-management/squad.service';
+import {Fraction} from '../../utils/fraction.enum';
@Component({
selector: 'squad-list',
@@ -65,7 +65,7 @@ export class SquadListComponent implements OnInit {
if (confirm('Soll das Squad "' + squad.name + '" (' + fraction + ') wirklich gelöscht werden?')) {
this.squadService.deleteSquad(squad)
.subscribe((res) => {
- })
+ });
}
}
diff --git a/static/src/app/squads/squads.component.ts b/static/src/app/squads/squads.component.ts
index c2fc5e6..3fc7469 100644
--- a/static/src/app/squads/squads.component.ts
+++ b/static/src/app/squads/squads.component.ts
@@ -1,7 +1,7 @@
-import {Component} from "@angular/core";
+import {Component} from '@angular/core';
@Component({
- selector: 'users',
+ selector: 'cc-users',
templateUrl: './squads.component.html',
styleUrls: ['./squads.component.css']
})
diff --git a/static/src/app/squads/squads.module.ts b/static/src/app/squads/squads.module.ts
index 919b3a9..43cfbd9 100644
--- a/static/src/app/squads/squads.module.ts
+++ b/static/src/app/squads/squads.module.ts
@@ -1,10 +1,10 @@
import {NgModule} from '@angular/core';
-import {CommonModule} from "@angular/common";
-import {SharedModule} from "../shared.module";
-import {squadRouterModule, squadsRoutingComponents} from "./squads.routing";
-import {SquadStore} from "../services/stores/squad.store";
-import {SquadService} from "../services/army-management/squad.service";
-import {ButtonsModule} from "ngx-bootstrap";
+import {CommonModule} from '@angular/common';
+import {SharedModule} from '../shared.module';
+import {squadRouterModule, squadsRoutingComponents} from './squads.routing';
+import {SquadStore} from '../services/stores/squad.store';
+import {SquadService} from '../services/army-management/squad.service';
+import {ButtonsModule} from 'ngx-bootstrap';
@NgModule({
declarations: squadsRoutingComponents,
diff --git a/static/src/app/squads/squads.routing.ts b/static/src/app/squads/squads.routing.ts
index ef29775..d6585aa 100644
--- a/static/src/app/squads/squads.routing.ts
+++ b/static/src/app/squads/squads.routing.ts
@@ -1,9 +1,9 @@
-import {RouterModule, Routes} from "@angular/router";
-import {SquadComponent} from "./squads.component";
-import {SquadListComponent} from "./squad-list/squad-list.component";
-import {EditSquadComponent} from "./edit-squad/edit-squad.component";
-import {ModuleWithProviders} from "@angular/core";
-import {SquadItemComponent} from "./squad-list/squad-item.component";
+import {RouterModule, Routes} from '@angular/router';
+import {SquadComponent} from './squads.component';
+import {SquadListComponent} from './squad-list/squad-list.component';
+import {EditSquadComponent} from './edit-squad/edit-squad.component';
+import {ModuleWithProviders} from '@angular/core';
+import {SquadItemComponent} from './squad-list/squad-item.component';
export const squadsRoutes: Routes = [{
path: '', component: SquadComponent,
diff --git a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.ts b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.ts
index cb315a8..416f751 100644
--- a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.ts
+++ b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.ts
@@ -1,24 +1,22 @@
-import {Component, EventEmitter} from "@angular/core";
-import {CampaignPlayer} from "../../models/model-interfaces";
-import {PlayerService} from "../../services/logs/player.service";
-import {ChartUtils} from "../../utils/chart-utils";
+import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
+import {CampaignPlayer} from '../../models/model-interfaces';
+import {PlayerService} from '../../services/logs/player.service';
+import {ChartUtils} from '../../utils/chart-utils';
@Component({
selector: 'campaign-player-detail',
templateUrl: './campaign-player-detail.component.html',
- inputs: ['campaignId', 'playerName'],
- outputs: ['switchTab'],
styleUrls: ['./campaign-player-detail.component.css', '../../style/list-entry.css',
'../../style/hide-scrollbar.css', '../../style/overview.css']
})
-export class CampaignPlayerDetailComponent {
+export class CampaignPlayerDetailComponent implements OnInit {
- campaignId: string;
+ @Input() campaignId: string;
- playerName: string;
+ @Input() playerName: string;
- switchTab = new EventEmitter();
+ @Output() switchTab = new EventEmitter();
campaignPlayer: CampaignPlayer = {campaign: {}, players: []};
@@ -90,16 +88,18 @@ export class CampaignPlayerDetailComponent {
this.playerService.getCampaignPlayer(this.campaignId, encodeURIComponent(this.playerName))
.subscribe(campaignPlayer => {
this.campaignPlayer = campaignPlayer;
- this.killData = this.assignData(this.yAxisKill, "kill");
- this.vehicleKillData = this.assignData(this.yAxisVehicleKill, "vehicle");
- this.friendlyFireData = this.assignData(this.yAxisFriendlyFire, "friendlyFire");
- this.deathData = this.assignData(this.yAxisDeath, "death");
- this.respawnData = this.assignData(this.yAxisRespawn, "respawn");
- this.reviveData = this.assignData(this.yAxisRevive, "revive");
- this.captureData = this.assignData(this.yAxisCapture, "flagTouch");
+ this.killData = this.assignData(this.yAxisKill, 'kill');
+ this.vehicleKillData = this.assignData(this.yAxisVehicleKill, 'vehicle');
+ this.friendlyFireData = this.assignData(this.yAxisFriendlyFire, 'friendlyFire');
+ this.deathData = this.assignData(this.yAxisDeath, 'death');
+ this.respawnData = this.assignData(this.yAxisRespawn, 'respawn');
+ this.reviveData = this.assignData(this.yAxisRevive, 'revive');
+ this.captureData = this.assignData(this.yAxisCapture, 'flagTouch');
this.kdRatio = parseFloat((this.totalKills / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2));
- if (this.kdRatio > 1) this.maxKd = this.kdRatio * 1.7;
+ if (this.kdRatio > 1) {
+ this.maxKd = this.kdRatio * 1.7;
+ }
this.respawnDeathRatio = parseFloat((this.totalRespawn / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2));
@@ -134,12 +134,13 @@ export class CampaignPlayerDetailComponent {
}
];
- Object.assign(this, [this.sumData, this.killData, this.friendlyFireData, this.vehicleKillData, this.deathData, this.respawnData, this.reviveData, this.captureData]);
+ Object.assign(this, [this.sumData, this.killData, this.friendlyFireData, this.vehicleKillData,
+ this.deathData, this.respawnData, this.reviveData, this.captureData]);
});
}
private assignData(label, field) {
- let killObj = {
+ const killObj = {
name: label,
series: []
};
diff --git a/static/src/app/statistic/campaign-submit/campaign-submit.component.html b/static/src/app/statistic/campaign-submit/campaign-submit.component.html
index c4b0880..771736b 100644
--- a/static/src/app/statistic/campaign-submit/campaign-submit.component.html
+++ b/static/src/app/statistic/campaign-submit/campaign-submit.component.html
@@ -9,7 +9,7 @@
id="title"
required maxlength="50"/>
-
+