commit
0097616454
|
@ -29,6 +29,9 @@ const AwardingSchema = new Schema({
|
|||
max: 2,
|
||||
default: 0
|
||||
},
|
||||
rejectReason: {
|
||||
type: String
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
default: Date.now()
|
||||
|
|
|
@ -32,6 +32,9 @@ const PromotionSchema = new Schema({
|
|||
min: 0,
|
||||
max: 2,
|
||||
required: true
|
||||
},
|
||||
rejectReason: {
|
||||
type: String
|
||||
}
|
||||
}, {
|
||||
collection: 'promotion',
|
||||
|
|
|
@ -47,7 +47,7 @@ let authCheck = (username, password, res) => {
|
|||
AppUserModel.findOne({username: username.toLowerCase()}).populate('squad').exec((err, user) => {
|
||||
if (err) deferred.reject(err.name + ': ' + err.message);
|
||||
|
||||
const diff = 7 * 60 * 24; // time till expiration [minutes]
|
||||
const diff = 28 * 60 * 24; // time till expiration [minutes]
|
||||
|
||||
if (user && !user.activated) {
|
||||
res.status(codes.unauthorized).send('Account is not yet activated');
|
||||
|
|
|
@ -114,7 +114,6 @@ awarding.route('/:id')
|
|||
return; // prevent node to process this function further after next() has finished.
|
||||
}
|
||||
|
||||
// optional task 3: increment version manually as we do not use .save(.)
|
||||
req.body.updatedAt = new Date();
|
||||
req.body.$inc = {__v: 1};
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<code_scheme name="Default" version="173">
|
||||
<JSCodeStyleSettings>
|
||||
<option name="USE_CHAINED_CALLS_GROUP_INDENTS" value="true" />
|
||||
</JSCodeStyleSettings>
|
||||
<TypeScriptCodeStyleSettings>
|
||||
<option name="USE_CHAINED_CALLS_GROUP_INDENTS" value="true" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="RIGHT_MARGIN" value="120" />
|
||||
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
|
||||
<option name="WRAP_COMMENTS" value="true" />
|
||||
<option name="WRAP_ON_TYPING" value="1" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
|
||||
<option name="WRAP_COMMENTS" value="true" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "opt-cc",
|
||||
"version": "1.7.0",
|
||||
"version": "1.7.1",
|
||||
"author": "Florian Hartwich <hardi@noarch.de>",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
|
@ -42,12 +42,15 @@
|
|||
},
|
||||
"lint": [
|
||||
{
|
||||
"files": "src/**/*.ts",
|
||||
"project": "src/tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"files": "src/**/*.ts",
|
||||
"project": "src/tsconfig.spec.json"
|
||||
},
|
||||
{
|
||||
"files": "src/**/*.ts",
|
||||
"project": "e2e/tsconfig.e2e.json"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -4,13 +4,13 @@ import {browser, by, element} from 'protractor';
|
|||
describe('Main Page Access', function () {
|
||||
|
||||
beforeEach(() => {
|
||||
browser.get('/')
|
||||
browser.get('/');
|
||||
});
|
||||
|
||||
it('should open army overview initially', async () => {
|
||||
let elem = element(by.css('h1'));
|
||||
let text = elem.getText();
|
||||
expect(text).toBe("Übersicht über alle Spieler, Squads und Armeen");
|
||||
const elem = element(by.css('h1'));
|
||||
const text = elem.getText();
|
||||
expect(text).toBe('Übersicht über alle Spieler, Squads und Armeen');
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {AppUser, Squad} from "../models/model-interfaces";
|
||||
import {Observable} from "rxjs/Observable";
|
||||
import {AppUserService} from "../services/app-user-service/app-user.service";
|
||||
import {SquadService} from "../services/army-management/squad.service";
|
||||
import {Fraction} from "../utils/fraction.enum";
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {AppUser, Squad} from '../models/model-interfaces';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {AppUserService} from '../services/app-user-service/app-user.service';
|
||||
import {SquadService} from '../services/army-management/squad.service';
|
||||
import {Fraction} from '../utils/fraction.enum';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -11,7 +11,7 @@ import {Fraction} from "../utils/fraction.enum";
|
|||
templateUrl: './admin.component.html',
|
||||
styleUrls: ['./admin.component.css', '../style/overview.css']
|
||||
})
|
||||
export class AdminComponent {
|
||||
export class AdminComponent implements OnInit {
|
||||
|
||||
users$: Observable<AppUser[]>;
|
||||
|
||||
|
@ -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) => {
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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 = [
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}};
|
||||
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) => {
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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']
|
||||
})
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
name="title"
|
||||
id="title"
|
||||
required maxlength="50"/>
|
||||
<show-error text="Name" path="title"></show-error>
|
||||
<show-error displayName="Name" controlPath="title"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -21,7 +21,7 @@
|
|||
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
||||
<option value="GLOBAL">Global</option>
|
||||
</select>
|
||||
<show-error text="Fraktion" path="fraction"></show-error>
|
||||
<show-error displayName="Fraktion" controlPath="fraction"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -32,14 +32,14 @@
|
|||
<option value="true">Orden</option>
|
||||
<option value="false">Ribbon</option>
|
||||
</select>
|
||||
<show-error text="Art" path="type"></show-error>
|
||||
<show-error displayName="Art" controlPath="type"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sort">Sortierung</label>
|
||||
<input id="sort" name="sort" type="number" class="form-control btn dropdown-toggle"
|
||||
[(ngModel)]="decoration.sortingNumber">
|
||||
<show-error text="Sortierung" path="sort"></show-error>
|
||||
<show-error displayName="Sortierung" controlPath="sort"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -47,7 +47,7 @@
|
|||
<textarea id="description" name="description" class="form-control" rows="5"
|
||||
required
|
||||
[(ngModel)]="decoration.description"></textarea>
|
||||
<show-error text="Beschreibung" path="description"></show-error>
|
||||
<show-error displayName="Beschreibung" controlPath="description"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
id="title"
|
||||
required maxlength="50"/>
|
||||
|
||||
<show-error text="Name" path="title"></show-error>
|
||||
<show-error displayName="Name" controlPath="title"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -21,14 +21,14 @@
|
|||
<option value="OPFOR">{{fraction.OPFOR}}</option>
|
||||
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
||||
</select>
|
||||
<show-error text="Fraktion" path="fraction"></show-error>
|
||||
<show-error displayName="Fraktion" controlPath="fraction"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="level">Stufe</label>
|
||||
<input id="level" name="level" type="number" class="form-control btn dropdown-toggle"
|
||||
[(ngModel)]="rank.level">
|
||||
<show-error text="Stufe" path="level"></show-error>
|
||||
<show-error displayName="Stufe" controlPath="level"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) => {
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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']
|
||||
})
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 = [{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
.table-container {
|
||||
margin-top: 40px;
|
||||
overflow-x: auto;
|
||||
width: 75%;
|
||||
width: 90%;
|
||||
min-width: 800px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
<th class="col-sm-1 ">Antragsteller</th>
|
||||
<th class="col-sm-1 text-right">Datum</th>
|
||||
<th class="col-sm-1 text-center">Status</th>
|
||||
<th class="col-sm-2 text-right">Grund für Ablehnung</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody *ngFor="let award of awards">
|
||||
|
@ -102,6 +103,9 @@
|
|||
<td class="text-center">
|
||||
{{award.confirmed === 0? 'In Bearbeitung' : (award.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{{award.rejectReason ? award.rejectReason : ''}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
.table-container {
|
||||
margin-top: 40px;
|
||||
overflow-x: auto;
|
||||
width: 75%;
|
||||
width: 90%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<th class="col-sm-2">Begründung</th>
|
||||
<th class="col-sm-1 ">Antragsteller</th>
|
||||
<th class="col-sm-1 text-right">Datum</th>
|
||||
<th class="col-sm-2 text-right"></th>
|
||||
<th class="col-sm-1 text-right">Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -34,7 +35,10 @@
|
|||
{{award.decorationId.name}}
|
||||
</td>
|
||||
<td>
|
||||
{{award.reason}}
|
||||
<textarea style="width:100%;"
|
||||
rows="3"
|
||||
title="reason"
|
||||
#reason>{{award.reason}}</textarea>
|
||||
</td>
|
||||
<td>
|
||||
{{award.proposer?.username}}
|
||||
|
@ -42,9 +46,16 @@
|
|||
<td class="text-right">
|
||||
{{award.date | date: 'dd.MM.yyyy'}}
|
||||
</td>
|
||||
<td>
|
||||
<textarea style="width: 100%;"
|
||||
rows="3"
|
||||
title="rejectReason"
|
||||
placeholder="Begründung für Ablehnung (optional)"
|
||||
#rejectReason></textarea>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<a class="action" (click)="confirm(award, true)">Bestätigen</a><br>
|
||||
<a class="action" (click)="confirm(award, false)">Ablehnen</a>
|
||||
<a class="action" (click)="confirm(award, true, reason.value)">Bestätigen</a><br>
|
||||
<a class="action" (click)="confirm(award, false, reason.value, rejectReason.value)">Ablehnen</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
.table-container {
|
||||
margin-top: 40px;
|
||||
overflow-x: auto;
|
||||
width: 65%;
|
||||
width: 90%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
<th class="col-sm-1 ">Antragsteller</th>
|
||||
<th class="col-sm-1 text-center">Datum</th>
|
||||
<th class="col-sm-1 text-center">Status</th>
|
||||
<th class="col-sm-1 text-center">Aktion</th>
|
||||
<th class="col-sm-2 text-right"></th>
|
||||
<th class="col-sm-1 text-right">Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody *ngFor="let promotion of promotions">
|
||||
|
@ -39,9 +40,16 @@
|
|||
<td class="text-center">
|
||||
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
|
||||
</td>
|
||||
<td>
|
||||
<textarea style="width: 100%;"
|
||||
rows="3"
|
||||
title="rejectReason"
|
||||
placeholder="Begründung für Ablehnung (optional)"
|
||||
#rejectReason></textarea>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<a class="action" (click)="confirm(promotion, true)">Bestätigen</a><br>
|
||||
<a class="action" (click)="confirm(promotion, false)">Ablehnen</a>
|
||||
<a class="action" (click)="confirm(promotion, false, rejectReason.value)">Ablehnen</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
.table-container {
|
||||
margin-top: 40px;
|
||||
overflow-x: auto;
|
||||
width: 65%;
|
||||
width: 90%;
|
||||
min-width: 800px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
<th class="col-sm-1 ">Antragsteller</th>
|
||||
<th class="col-sm-1 text-center">Datum</th>
|
||||
<th class="col-sm-1 text-center">Status</th>
|
||||
<th class="col-sm-2 text-right">Grund für Ablehnung</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody *ngFor="let promotion of uncheckedPromotions">
|
||||
|
@ -96,6 +97,9 @@
|
|||
<td class="text-center">
|
||||
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{{promotion.rejectReason ? promotion.rejectReason : ''}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -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);
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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']
|
||||
})
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 = [{
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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<T extends Identifiable> {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
id="title"
|
||||
required maxlength="50"/>
|
||||
|
||||
<show-error text="Name" path="title"></show-error>
|
||||
<show-error displayName="Name" controlPath="title"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -21,14 +21,14 @@
|
|||
<option value="OPFOR">{{fraction.OPFOR}}</option>
|
||||
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
||||
</select>
|
||||
<show-error text="Fraktion" path="fraction"></show-error>
|
||||
<show-error displayName="Fraktion" controlPath="fraction"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sort">Sortierung</label>
|
||||
<input id="sort" name="sort" type="number" class="form-control btn dropdown-toggle"
|
||||
[(ngModel)]="squad.sortingNumber">
|
||||
<show-error text="Sortierung" path="sort"></show-error>
|
||||
<show-error displayName="Sortierung" controlPath="sort"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) => {
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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']
|
||||
})
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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: []
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
id="title"
|
||||
required maxlength="50"/>
|
||||
|
||||
<show-error text="Name" path="title"></show-error>
|
||||
<show-error displayName="Name" controlPath="title"></show-error>
|
||||
</div>
|
||||
|
||||
<button id="cancel"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {Component, ViewChild} from "@angular/core";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {NgForm} from "@angular/forms";
|
||||
import {Campaign} from "../../models/model-interfaces";
|
||||
import {CampaignService} from "../../services/logs/campaign.service";
|
||||
import {Component, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {NgForm} from '@angular/forms';
|
||||
import {Campaign} from '../../models/model-interfaces';
|
||||
import {CampaignService} from '../../services/logs/campaign.service';
|
||||
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -58,6 +58,7 @@ ngx-datatable {
|
|||
}
|
||||
|
||||
/* Table Scrollbar BEGIN */
|
||||
|
||||
:host /deep/ .ngx-datatable.scroll-vertical .datatable-body::-webkit-scrollbar {
|
||||
width: 12px;
|
||||
}
|
||||
|
@ -72,4 +73,5 @@ ngx-datatable {
|
|||
background: #4b4b4b;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
/* Table Scrollbar END */
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</span>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="valueColWidth" name="Fahrzeug-Kills" prop="vehicle"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="valueColWidth" name="FahrzeugKill" prop="vehicle"></ngx-datatable-column>
|
||||
</ngx-datatable>
|
||||
|
||||
<ngx-datatable
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {ActivatedRoute} from "@angular/router";
|
||||
import {PlayerService} from "../../services/logs/player.service";
|
||||
import {CampaignService} from "../../services/logs/campaign.service";
|
||||
import {Fraction} from "../../utils/fraction.enum";
|
||||
import {FormControl} from "@angular/forms";
|
||||
import {Observable} from "rxjs/Observable";
|
||||
import {Player} from "../../models/model-interfaces";
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {PlayerService} from '../../services/logs/player.service';
|
||||
import {CampaignService} from '../../services/logs/campaign.service';
|
||||
import {Fraction} from '../../utils/fraction.enum';
|
||||
import {FormControl} from '@angular/forms';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Player} from '../../models/model-interfaces';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'stats-highscore',
|
||||
templateUrl: './highscore.component.html',
|
||||
styleUrls: ['./highscore.component.css', '../../style/list-entry.css', '../../style/overview.css'],
|
||||
inputs: ['campaigns']
|
||||
styleUrls: ['./highscore.component.css', '../../style/list-entry.css', '../../style/overview.css']
|
||||
})
|
||||
export class StatisticHighScoreComponent {
|
||||
export class StatisticHighScoreComponent implements OnInit {
|
||||
|
||||
@Input() campaigns;
|
||||
|
||||
id = '';
|
||||
|
||||
|
@ -57,8 +58,8 @@ export class StatisticHighScoreComponent {
|
|||
this.initData();
|
||||
} else {
|
||||
this.campaignService.getAllCampaigns().subscribe(campaigns => {
|
||||
this.initData()
|
||||
})
|
||||
this.initData();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -76,7 +77,7 @@ export class StatisticHighScoreComponent {
|
|||
this.playerService.getCampaignHighscore(this.id).subscribe(players => {
|
||||
this.players = players;
|
||||
this.playersStored = players;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
filterPlayers() {
|
||||
|
@ -91,7 +92,7 @@ export class StatisticHighScoreComponent {
|
|||
respawn: this.filterPlayerAttribute('respawn'),
|
||||
revive: this.filterPlayerAttribute('revive'),
|
||||
flagTouch: this.filterPlayerAttribute('flagTouch')
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,12 +101,12 @@ export class StatisticHighScoreComponent {
|
|||
|
||||
return this.playersStored[attribute].filter(player => {
|
||||
for (let i = 0; i < query.length; i++) {
|
||||
if (query[i].trim() != '' && player.name.toLowerCase().includes(query[i].trim())) {
|
||||
if (query[i].trim() !== '' && player.name.toLowerCase().includes(query[i].trim())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {ActivatedRoute} from "@angular/router";
|
||||
import {CampaignService} from "../../services/logs/campaign.service";
|
||||
import {ChartUtils} from "../../utils/chart-utils";
|
||||
import {Fraction} from "../../utils/fraction.enum";
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {CampaignService} from '../../services/logs/campaign.service';
|
||||
import {ChartUtils} from '../../utils/chart-utils';
|
||||
import {Fraction} from '../../utils/fraction.enum';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'stats-overview',
|
||||
templateUrl: './stats-overview.component.html',
|
||||
styleUrls: ['./stats-overview.component.css', '../../style/list-entry.css', '../../style/overview.css'],
|
||||
inputs: ['campaigns']
|
||||
styleUrls: ['./stats-overview.component.css', '../../style/list-entry.css', '../../style/overview.css']
|
||||
})
|
||||
export class StatisticOverviewComponent {
|
||||
export class StatisticOverviewComponent implements OnInit {
|
||||
|
||||
id = "";
|
||||
title = "";
|
||||
@Input() campaigns;
|
||||
|
||||
id = '';
|
||||
title = '';
|
||||
|
||||
pointData: any[] = [];
|
||||
pointSumData: any[] = [];
|
||||
|
@ -33,7 +34,7 @@ export class StatisticOverviewComponent {
|
|||
legendTitle = '';
|
||||
showXAxisLabel = true;
|
||||
showYAxisLabel = true;
|
||||
yAxisLabel = "";
|
||||
yAxisLabel = '';
|
||||
autoscale = true;
|
||||
timeline = false;
|
||||
|
||||
|
@ -51,7 +52,7 @@ export class StatisticOverviewComponent {
|
|||
} else {
|
||||
this.campaignService.getAllCampaigns().subscribe(campaigns => {
|
||||
this.initWars(campaigns);
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -65,34 +66,38 @@ export class StatisticOverviewComponent {
|
|||
itemsProcessed++;
|
||||
if (itemsProcessed === campaigns.length) {
|
||||
if (this.id === 'all') {
|
||||
this.title = "Gesamtübersicht";
|
||||
this.title = 'Gesamtübersicht';
|
||||
wars.sort((a, b) => {
|
||||
// sort by dates, because older campaign can contain newer war
|
||||
if (a['date'] > (b['date'])) return -1;
|
||||
if (a['date'] < (b['date'])) return 1;
|
||||
if (a['date'] > (b['date'])) {
|
||||
return -1;
|
||||
}
|
||||
if (a['date'] < (b['date'])) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
});
|
||||
} else {
|
||||
this.title = campaign.title;
|
||||
}
|
||||
this.initChart(wars);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
goToSlide(index: number) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
this.currentData = this.pointSumData;
|
||||
this.yAxisLabel = "Gesamtpunkte";
|
||||
this.yAxisLabel = 'Gesamtpunkte';
|
||||
break;
|
||||
case 1:
|
||||
this.currentData = this.pointData;
|
||||
this.yAxisLabel = "Punkte";
|
||||
this.yAxisLabel = 'Punkte';
|
||||
break;
|
||||
case 2:
|
||||
this.currentData = this.playerData;
|
||||
this.yAxisLabel = "Anzahl Spieler";
|
||||
this.yAxisLabel = 'Anzahl Spieler';
|
||||
break;
|
||||
}
|
||||
this.activeSlideIndex = index;
|
||||
|
@ -140,7 +145,7 @@ export class StatisticOverviewComponent {
|
|||
this.pointData = pointsObj;
|
||||
this.pointSumData = pointsSumObj;
|
||||
this.playerData = playersObj;
|
||||
if (this.id != 'all') {
|
||||
if (this.id !== 'all') {
|
||||
this.goToSlide(0);
|
||||
} else {
|
||||
this.goToSlide(1);
|
||||
|
@ -149,7 +154,7 @@ export class StatisticOverviewComponent {
|
|||
}
|
||||
|
||||
isActiveSlide(index) {
|
||||
return this.activeSlideIndex === index ? '#d9edf7' : 'white'
|
||||
return this.activeSlideIndex === index ? '#d9edf7' : 'white';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'stats',
|
||||
selector: 'cc-stats',
|
||||
templateUrl: './stats.component.html',
|
||||
styleUrls: ['./stats.component.css']
|
||||
})
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {SharedModule} from "../shared.module";
|
||||
import {statsRouterModule, statsRoutingComponents} from "./stats.routing";
|
||||
import {WarService} from "../services/logs/war.service";
|
||||
import {NgxChartsModule} from "@swimlane/ngx-charts";
|
||||
import {AccordionModule, ButtonsModule} from "ngx-bootstrap";
|
||||
import {CampaignService} from "../services/logs/campaign.service";
|
||||
import {NgxDatatableModule} from "@swimlane/ngx-datatable";
|
||||
import {PlayerService} from "../services/logs/player.service";
|
||||
import {LogsService} from "../services/logs/logs.service";
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {SharedModule} from '../shared.module';
|
||||
import {statsRouterModule, statsRoutingComponents} from './stats.routing';
|
||||
import {WarService} from '../services/logs/war.service';
|
||||
import {NgxChartsModule} from '@swimlane/ngx-charts';
|
||||
import {AccordionModule, ButtonsModule} from 'ngx-bootstrap';
|
||||
import {CampaignService} from '../services/logs/campaign.service';
|
||||
import {NgxDatatableModule} from '@swimlane/ngx-datatable';
|
||||
import {PlayerService} from '../services/logs/player.service';
|
||||
import {LogsService} from '../services/logs/logs.service';
|
||||
|
||||
@NgModule({
|
||||
declarations: statsRoutingComponents,
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import {RouterModule, Routes} from "@angular/router";
|
||||
import {StatisticComponent} from "./stats.component";
|
||||
import {WarListComponent} from "./war-list/war-list.component";
|
||||
import {StatisticOverviewComponent} from "./overview/stats-overview.component";
|
||||
import {WarItemComponent} from "./war-list/war-item.component";
|
||||
import {ModuleWithProviders} from "@angular/core";
|
||||
import {CampaignSubmitComponent} from "./campaign-submit/campaign-submit.component";
|
||||
import {CampaignPlayerDetailComponent} from "./campaign-player-detail/campaign-player-detail.component";
|
||||
import {WarDetailComponent} from "./war-detail/war-detail.component";
|
||||
import {ScoreboardComponent} from "./war-detail/scoreboard/scoreboard.component";
|
||||
import {WarSubmitComponent} from "./war-submit/war-submit.component";
|
||||
import {FractionStatsComponent} from "./war-detail/fraction-stats/fraction-stats.component";
|
||||
import {StatisticHighScoreComponent} from "./highscore/highscore.component";
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {StatisticComponent} from './stats.component';
|
||||
import {WarListComponent} from './war-list/war-list.component';
|
||||
import {StatisticOverviewComponent} from './overview/stats-overview.component';
|
||||
import {WarItemComponent} from './war-list/war-item.component';
|
||||
import {ModuleWithProviders} from '@angular/core';
|
||||
import {CampaignSubmitComponent} from './campaign-submit/campaign-submit.component';
|
||||
import {CampaignPlayerDetailComponent} from './campaign-player-detail/campaign-player-detail.component';
|
||||
import {WarDetailComponent} from './war-detail/war-detail.component';
|
||||
import {ScoreboardComponent} from './war-detail/scoreboard/scoreboard.component';
|
||||
import {WarSubmitComponent} from './war-submit/war-submit.component';
|
||||
import {FractionStatsComponent} from './war-detail/fraction-stats/fraction-stats.component';
|
||||
import {StatisticHighScoreComponent} from './highscore/highscore.component';
|
||||
|
||||
|
||||
export const statsRoutes: Routes = [{
|
||||
|
@ -51,7 +51,7 @@ export const statsRoutes: Routes = [{
|
|||
path: 'campaign-player/:id/:playerName',
|
||||
component: CampaignPlayerDetailComponent,
|
||||
outlet: 'right'
|
||||
},];
|
||||
}];
|
||||
|
||||
export const statsRouterModule: ModuleWithProviders = RouterModule.forChild(statsRoutes);
|
||||
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
import {Component, ElementRef, SimpleChanges, ViewChild} from "@angular/core";
|
||||
import * as d3 from "d3";
|
||||
import {ChartUtils} from "../../../utils/chart-utils";
|
||||
import {Fraction} from "../../../utils/fraction.enum";
|
||||
import {War} from "../../../models/model-interfaces";
|
||||
import {Component, ElementRef, Input, OnChanges, OnInit, SimpleChanges, ViewChild} from '@angular/core';
|
||||
import * as d3 from 'd3';
|
||||
import {ChartUtils} from '../../../utils/chart-utils';
|
||||
import {Fraction} from '../../../utils/fraction.enum';
|
||||
import {War} from '../../../models/model-interfaces';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'war-detail-fraction',
|
||||
templateUrl: './fraction-stats.component.html',
|
||||
inputs: ['war', 'logData'],
|
||||
styleUrls: ['./fraction-stats.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
||||
})
|
||||
export class FractionStatsComponent {
|
||||
export class FractionStatsComponent implements OnInit, OnChanges {
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
@ViewChild('overview') private overviewContainer: ElementRef;
|
||||
|
||||
war: War;
|
||||
@Input() war: War;
|
||||
|
||||
logData: any;
|
||||
@Input() logData: any;
|
||||
|
||||
startDateObj: Date;
|
||||
|
||||
|
@ -178,7 +177,7 @@ export class FractionStatsComponent {
|
|||
}
|
||||
let killCountBlufor = 0, killCountOpfor = 0, ffKillCountBlufor = 0, ffKillCountOpfor = 0;
|
||||
|
||||
for (const {killEntry, index} of this.logData.kill.map((killEntry, index) => ({killEntry, index}))) {
|
||||
for (const {killEntry, index} of this.logData.kill.map((entry, pos) => ({entry, pos}))) {
|
||||
const killEntryDate = new Date(killEntry.time);
|
||||
if (killEntry.friendlyFire === false) {
|
||||
if (killEntry.fraction === 'BLUFOR') {
|
||||
|
@ -212,7 +211,7 @@ export class FractionStatsComponent {
|
|||
}
|
||||
|
||||
this.addFinalTimeData(this.tmpKillData);
|
||||
this.addFinalTimeData(this.tmpFrienlyFireData)
|
||||
this.addFinalTimeData(this.tmpFrienlyFireData);
|
||||
this.initialized.kill = true;
|
||||
}
|
||||
|
||||
|
@ -221,7 +220,7 @@ export class FractionStatsComponent {
|
|||
return;
|
||||
}
|
||||
let reviveCountBlufor = 0, reviveCountOpfor = 0, stabilizeCountBlufor = 0, stabilizeCountOpfor = 0;
|
||||
for (const {reviveEntry, index} of this.logData.revive.map((reviveEntry, index) => ({reviveEntry, index}))) {
|
||||
for (const {reviveEntry, index} of this.logData.revive.map((entry, pos) => ({entry, pos}))) {
|
||||
const reviveEntryDate = new Date(reviveEntry.time);
|
||||
if (reviveEntry.stabilized === false) {
|
||||
if (reviveEntry.fraction === 'BLUFOR') {
|
||||
|
@ -261,8 +260,8 @@ export class FractionStatsComponent {
|
|||
return;
|
||||
}
|
||||
let vehicleKillCountBlufor = 0, vehicleKillCountOpfor = 0;
|
||||
for (const {transportEntry: vehicleEntry, index} of this.logData.vehicle.map((transportEntry, index) => ({
|
||||
transportEntry,
|
||||
for (const {transportEntry: vehicleEntry, index} of this.logData.vehicle.map((entry, pos) => ({
|
||||
pos,
|
||||
index
|
||||
}))) {
|
||||
const vehicleEntryDate = new Date(vehicleEntry.time);
|
||||
|
@ -285,9 +284,9 @@ export class FractionStatsComponent {
|
|||
return;
|
||||
}
|
||||
let transportCountBlufor = 0, transportCountOpfor = 0;
|
||||
for (const {transportEntry, index} of this.logData.transport.map((transportEntry, index) => ({
|
||||
transportEntry,
|
||||
index
|
||||
for (const {transportEntry, index} of this.logData.transport.map((entry, pos) => ({
|
||||
entry,
|
||||
pos
|
||||
}))) {
|
||||
const transportEntryDate = new Date(transportEntry.time);
|
||||
if (transportEntry.fraction === 'BLUFOR') {
|
||||
|
@ -321,7 +320,7 @@ export class FractionStatsComponent {
|
|||
}
|
||||
this.tmpFlagCaptureData[flagEntry.flagFraction === 'BLUFOR' ? 0 : 1].series.push(
|
||||
ChartUtils.getSeriesEntry(new Date(flagEntry.time), flagEntry.flagFraction === 'BLUFOR' ? flagStatusBlufor : flagStatusOpfor)
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
this.addFinalTimeData(this.tmpFlagCaptureData);
|
||||
|
@ -329,7 +328,7 @@ export class FractionStatsComponent {
|
|||
}
|
||||
|
||||
protected isTwoMinutesAhead(entryDate: Date, tmpData: any): boolean {
|
||||
return entryDate.getTime() >= tmpData[0].series[tmpData[0].series.length - 1].name.getTime() + (1.5 * 60000)
|
||||
return entryDate.getTime() >= tmpData[0].series[tmpData[0].series.length - 1].name.getTime() + (1.5 * 60000);
|
||||
}
|
||||
|
||||
initializeTempCollections() {
|
||||
|
@ -343,10 +342,11 @@ export class FractionStatsComponent {
|
|||
this.tmpStabilizeData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||
this.tmpFlagCaptureData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||
|
||||
[this.tmpKillData, this.tmpFrienlyFireData, this.tmpVehicleData, this.tmpReviveData, this.tmpStabilizeData, this.tmpTransportData].forEach(tmp => {
|
||||
[this.tmpKillData, this.tmpFrienlyFireData, this.tmpVehicleData, this.tmpReviveData, this.tmpStabilizeData,
|
||||
this.tmpTransportData].forEach(tmp => {
|
||||
[0, 1].forEach(index => {
|
||||
tmp[index].series.push(ChartUtils.getSeriesEntry(this.startDateObj, 0));
|
||||
})
|
||||
});
|
||||
});
|
||||
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(this.startDateObj, this.war.budgetBlufor));
|
||||
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(this.startDateObj, this.war.budgetOpfor));
|
||||
|
@ -358,9 +358,10 @@ export class FractionStatsComponent {
|
|||
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetBlufor));
|
||||
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetOpfor));
|
||||
} else {
|
||||
for (let j in [0, 1]) {
|
||||
for (const j in [0, 1]) {
|
||||
if (tmpCollection[j].series[tmpCollection[j].series.length - 1].name < endDate) {
|
||||
tmpCollection[j].series.push(ChartUtils.getSeriesEntry(endDate, tmpCollection[j].series[tmpCollection[j].series.length - 1].value));
|
||||
tmpCollection[j].series.push(ChartUtils.getSeriesEntry(endDate, tmpCollection[j]
|
||||
.series[tmpCollection[j].series.length - 1].value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +1,30 @@
|
|||
import {Component, ElementRef, EventEmitter, SimpleChanges} from "@angular/core";
|
||||
import {War} from "../../../models/model-interfaces";
|
||||
import {Fraction} from "../../../utils/fraction.enum";
|
||||
import {PlayerUtils} from "../../../utils/player-utils";
|
||||
import {Component, ElementRef, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
|
||||
import {War} from '../../../models/model-interfaces';
|
||||
import {Fraction} from '../../../utils/fraction.enum';
|
||||
import {PlayerUtils} from '../../../utils/player-utils';
|
||||
|
||||
@Component({
|
||||
selector: 'scoreboard',
|
||||
selector: 'cc-scoreboard',
|
||||
templateUrl: './scoreboard.component.html',
|
||||
inputs: ['war', 'fractionFilterSelected'],
|
||||
outputs: ['playerTabSwitch'],
|
||||
styleUrls: ['./scoreboard.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
||||
})
|
||||
export class ScoreboardComponent {
|
||||
export class ScoreboardComponent implements OnChanges {
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
playerTabSwitch = new EventEmitter();
|
||||
@Input() war: War;
|
||||
|
||||
war: War;
|
||||
@Input() fractionFilterSelected: string;
|
||||
|
||||
@Output() playerTabSwitch = new EventEmitter();
|
||||
|
||||
isSteamUUID = PlayerUtils.isSteamUUID;
|
||||
|
||||
fractionFilterSelected: string;
|
||||
|
||||
cellHeight = 40;
|
||||
|
||||
rows = [];
|
||||
|
||||
reorderable: boolean = false;
|
||||
reorderable = false;
|
||||
|
||||
customClasses = {
|
||||
sortAscending: 'glyphicon glyphicon-triangle-top',
|
||||
|
@ -40,7 +38,7 @@ export class ScoreboardComponent {
|
|||
this.playerTabSwitch.emit({
|
||||
view: view,
|
||||
player: player
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
@ -51,7 +49,7 @@ export class ScoreboardComponent {
|
|||
.scrollTo(0, 0);
|
||||
}
|
||||
if (changes.fractionFilterSelected) {
|
||||
this.filterPlayersByFraction(this.fractionFilterSelected)
|
||||
this.filterPlayersByFraction(this.fractionFilterSelected);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +57,7 @@ export class ScoreboardComponent {
|
|||
if (fraction) {
|
||||
this.rows = this.war.players.filter((player) => {
|
||||
return player.fraction === fraction;
|
||||
})
|
||||
});
|
||||
} else {
|
||||
this.rows = this.war.players;
|
||||
}
|
||||
|
|
|
@ -64,12 +64,12 @@
|
|||
|
||||
<!--Sub-Components (=TABS)-->
|
||||
<div *ngIf="war">
|
||||
<scoreboard
|
||||
<cc-scoreboard
|
||||
*ngIf="tab === 0"
|
||||
[war]="war"
|
||||
[fractionFilterSelected]="fractionFilterSelected"
|
||||
(playerTabSwitch)="switchToPlayerTab($event)">
|
||||
</scoreboard>
|
||||
</cc-scoreboard>
|
||||
<war-detail-fraction
|
||||
*ngIf="tab === 1 && logData"
|
||||
[war]="war"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {ActivatedRoute} from "@angular/router";
|
||||
import {WarService} from "../../services/logs/war.service";
|
||||
import {War} from "../../models/model-interfaces";
|
||||
import {ChartUtils} from "../../utils/chart-utils";
|
||||
import {Fraction} from "../../utils/fraction.enum";
|
||||
import {LogsService} from "../../services/logs/logs.service";
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {WarService} from '../../services/logs/war.service';
|
||||
import {War} from '../../models/model-interfaces';
|
||||
import {ChartUtils} from '../../utils/chart-utils';
|
||||
import {Fraction} from '../../utils/fraction.enum';
|
||||
import {LogsService} from '../../services/logs/logs.service';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -12,7 +12,7 @@ import {LogsService} from "../../services/logs/logs.service";
|
|||
templateUrl: './war-detail.component.html',
|
||||
styleUrls: ['./war-detail.component.css', '../../style/list-entry.css', '../../style/hide-scrollbar.css']
|
||||
})
|
||||
export class WarDetailComponent {
|
||||
export class WarDetailComponent implements OnInit {
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
|
@ -44,7 +44,7 @@ export class WarDetailComponent {
|
|||
ngOnInit() {
|
||||
this.route.params
|
||||
.map(params => params['id'])
|
||||
.filter(id => id != undefined)
|
||||
.filter(id => id !== undefined)
|
||||
.flatMap(id => this.warService.getWar(id))
|
||||
.subscribe(war => {
|
||||
this.war = war;
|
||||
|
@ -55,7 +55,7 @@ export class WarDetailComponent {
|
|||
|
||||
this.playerChart = ChartUtils.getSingleDataArray(Fraction.OPFOR, war.playersOpfor, Fraction.BLUFOR, war.playersBlufor);
|
||||
Object.assign(this, [this.playerChart]);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
switchTab(index: number) {
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
|
||||
import {War} from "../../models/model-interfaces";
|
||||
import {LoginService} from "../../services/app-user-service/login-service";
|
||||
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {War} from '../../models/model-interfaces';
|
||||
import {LoginService} from '../../services/app-user-service/login-service';
|
||||
|
||||
@Component({
|
||||
selector: 'pjm-war-item',
|
||||
templateUrl: './war-item.component.html',
|
||||
styleUrls: ['./war-item.component.css', '../../style/list-entry.css'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
inputs: ['war', 'selected'],
|
||||
outputs: ['warSelected', 'warDelete']
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class WarItemComponent {
|
||||
export class WarItemComponent implements OnInit {
|
||||
|
||||
selected: boolean;
|
||||
@Input() selected: boolean;
|
||||
|
||||
war: War;
|
||||
@Input() war: War;
|
||||
|
||||
warSelected = new EventEmitter();
|
||||
@Output() warSelected = new EventEmitter();
|
||||
|
||||
warDelete = new EventEmitter();
|
||||
@Output() warDelete = new EventEmitter();
|
||||
|
||||
constructor(public loginService: LoginService) {
|
||||
}
|
||||
|
@ -27,7 +25,7 @@ export class WarItemComponent {
|
|||
}
|
||||
|
||||
select() {
|
||||
this.warSelected.emit(this.war._id)
|
||||
this.warSelected.emit(this.war._id);
|
||||
}
|
||||
|
||||
delete() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {Component, OnInit} from "@angular/core";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {Campaign, War} from "../../models/model-interfaces";
|
||||
import {WarService} from "../../services/logs/war.service";
|
||||
import {LoginService} from "../../services/app-user-service/login-service";
|
||||
import {CampaignService} from "../../services/logs/campaign.service";
|
||||
import {RouteConfig} from "../../app.config";
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Campaign, War} from '../../models/model-interfaces';
|
||||
import {WarService} from '../../services/logs/war.service';
|
||||
import {LoginService} from '../../services/app-user-service/login-service';
|
||||
import {CampaignService} from '../../services/logs/campaign.service';
|
||||
import {RouteConfig} from '../../app.config';
|
||||
|
||||
@Component({
|
||||
selector: 'war-list',
|
||||
|
@ -37,9 +37,9 @@ export class WarListComponent implements OnInit {
|
|||
if (url.endsWith(RouteConfig.statsPath)) {
|
||||
this.selectOverview(this.campaigns[0]._id);
|
||||
} else if (url.indexOf(subPathWar) !== -1) {
|
||||
this.selectedWarId = url.substring(url.lastIndexOf(subPathWar) + subPathWar.length, url.lastIndexOf(")"));
|
||||
this.selectedWarId = url.substring(url.lastIndexOf(subPathWar) + subPathWar.length, url.lastIndexOf(')'));
|
||||
} else if (url.indexOf(subPathOverview) !== -1) {
|
||||
this.selectedWarId = url.substring(url.lastIndexOf(subPathOverview) + subPathOverview.length, url.lastIndexOf(")"));
|
||||
this.selectedWarId = url.substring(url.lastIndexOf(subPathOverview) + subPathOverview.length, url.lastIndexOf(')'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -55,21 +55,21 @@ export class WarListComponent implements OnInit {
|
|||
}
|
||||
|
||||
selectWar(warId) {
|
||||
if (this.selectedWarId != warId) {
|
||||
if (this.selectedWarId !== warId) {
|
||||
this.selectedWarId = warId;
|
||||
this.router.navigate([{outlets: {'right': ['war', warId]}}], {relativeTo: this.route});
|
||||
}
|
||||
}
|
||||
|
||||
selectOverview(campaignId) {
|
||||
if (this.selectedWarId != campaignId) {
|
||||
if (this.selectedWarId !== campaignId) {
|
||||
this.selectedWarId = campaignId;
|
||||
this.router.navigate([{outlets: {'right': ['overview', campaignId]}}], {relativeTo: this.route});
|
||||
}
|
||||
}
|
||||
|
||||
selectHighscore(campaignId) {
|
||||
if (this.selectedWarId != campaignId + this.highscore) {
|
||||
if (this.selectedWarId !== campaignId + this.highscore) {
|
||||
this.selectedWarId = campaignId + this.highscore;
|
||||
this.router.navigate([{outlets: {'right': ['highscore', campaignId]}}], {relativeTo: this.route});
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ export class WarListComponent implements OnInit {
|
|||
this.selectOverview('all');
|
||||
}
|
||||
this.campaigns.splice(this.campaigns.indexOf(war), 1);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ export class WarListComponent implements OnInit {
|
|||
this.selectOverview('all');
|
||||
}
|
||||
this.campaigns.splice(this.campaigns.indexOf(campaign), 1);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
id="title"
|
||||
required maxlength="50"/>
|
||||
|
||||
<show-error text="Name" path="title"></show-error>
|
||||
<show-error displayName="Name" controlPath="title"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {Component, ViewChild} from "@angular/core";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {NgForm} from "@angular/forms";
|
||||
import {WarService} from "../../services/logs/war.service";
|
||||
import {War} from "../../models/model-interfaces";
|
||||
import {CampaignService} from "../../services/logs/campaign.service";
|
||||
import {Component, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {NgForm} from '@angular/forms';
|
||||
import {WarService} from '../../services/logs/war.service';
|
||||
import {War} from '../../models/model-interfaces';
|
||||
import {CampaignService} from '../../services/logs/campaign.service';
|
||||
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</option>
|
||||
</select>
|
||||
|
||||
<show-error text="Auszeichnung" path="decoration"></show-error>
|
||||
<show-error displayName="Auszeichnung" controlPath="decoration"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="div-table-row" [style.display]="decoPreviewDisplay" style="margin-top: 5px; margin-bottom:10px">
|
||||
|
@ -41,7 +41,7 @@
|
|||
<label for="reason">Begründung</label>
|
||||
<textarea class="form-control center-block" name="reason" [ngModel]="undefined" required
|
||||
id="reason" placeholder="Begründung eingeben..." rows="3" #awardTextArea></textarea>
|
||||
<show-error text="Begründung" path="reason"></show-error>
|
||||
<show-error displayName="Begründung" controlPath="reason"></show-error>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import {Component, ViewChild} from "@angular/core";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {Award, Decoration} 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 {Fraction} from "../../utils/fraction.enum";
|
||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Award, Decoration} 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 {Fraction} from '../../utils/fraction.enum';
|
||||
|
||||
|
||||
@Component({
|
||||
templateUrl: './award-user.component.html',
|
||||
styleUrls: ['./award-user.component.css', '../../style/overview.css', '../../style/hide-scrollbar.css'],
|
||||
})
|
||||
export class AwardUserComponent {
|
||||
export class AwardUserComponent implements OnInit {
|
||||
|
||||
@ViewChild(NgForm) form: NgForm;
|
||||
|
||||
|
@ -48,7 +48,7 @@ export class AwardUserComponent {
|
|||
|
||||
this.route.params
|
||||
.map(params => params['id'])
|
||||
.subscribe(id => this.userId = id)
|
||||
.subscribe(id => this.userId = id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,10 +72,10 @@ export class AwardUserComponent {
|
|||
const reason = reasonField.value;
|
||||
if (decorationId && reason.length > 0) {
|
||||
const award = {
|
||||
"userId": this.userId,
|
||||
"decorationId": decorationId,
|
||||
"reason": reason,
|
||||
"date": Date.now()
|
||||
'userId': this.userId,
|
||||
'decorationId': decorationId,
|
||||
'reason': reason,
|
||||
'date': Date.now()
|
||||
};
|
||||
this.awardingService.addAwarding(award).subscribe(() => {
|
||||
this.awardingService.getUserAwardings(this.userId)
|
||||
|
@ -87,9 +87,9 @@ export class AwardUserComponent {
|
|||
this.showSuccessLabel = true;
|
||||
setTimeout(() => {
|
||||
this.showSuccessLabel = false;
|
||||
}, 2000)
|
||||
})
|
||||
})
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,9 +101,9 @@ export class AwardUserComponent {
|
|||
this.showSuccessLabel = true;
|
||||
setTimeout(() => {
|
||||
this.showSuccessLabel = false;
|
||||
}, 2000)
|
||||
})
|
||||
})
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
required
|
||||
maxlength="50"/>
|
||||
|
||||
<show-error text="Name" path="title"></show-error>
|
||||
<show-error displayName="Name" controlPath="title"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -28,7 +28,7 @@
|
|||
</option>
|
||||
</select>
|
||||
|
||||
<show-error text="Squad" path="squad"></show-error>
|
||||
<show-error displayName="Squad" controlPath="squad"></show-error>
|
||||
</div>
|
||||
|
||||
<div class="form-group" [style.display]="ranksDisplay">
|
||||
|
@ -41,7 +41,7 @@
|
|||
<option *ngFor="let rank of ranks" [value]="rank.level">{{rank.name}}</option>
|
||||
</select>
|
||||
|
||||
<show-error text="Squad" path="squad"></show-error>
|
||||
<show-error displayName="Squad" controlPath="squad"></show-error>
|
||||
</div>
|
||||
|
||||
<button id="cancel"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue