diff --git a/api/middleware/auth-middleware.js b/api/middleware/auth-middleware.js index c9f811a..aecac3e 100644 --- a/api/middleware/auth-middleware.js +++ b/api/middleware/auth-middleware.js @@ -1,4 +1,4 @@ -"use strict" +"use strict"; const jwt = require('jsonwebtoken'); const config = require('../config/config'); diff --git a/api/routes/decorations.js b/api/routes/decorations.js index d469bf6..2292141 100644 --- a/api/routes/decorations.js +++ b/api/routes/decorations.js @@ -31,7 +31,7 @@ decoration.route('/') if (req.query.q) { filter.name = {$regex: req.query.q, $options: 'i'} } - DecorationModel.find(filter, {}, {sort: {fraction: 'asc', sortingNumber: 'asc'}}, (err, items) => { + DecorationModel.find(filter, {}, {sort: {fraction: 'asc', sortingNumber: 'asc', name: 'asc'}}, (err, items) => { if (err) { err.status = codes.servererror; return next(err); diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index d89d622..7b13506 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -6,12 +6,12 @@ import {usersRoutes, usersRoutingComponents} from "./users/users.routing"; import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing"; import {decorationsRoutes, decorationsRoutingComponents} from "./decorations/decoration.routing"; import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing"; -import {ArmyComponent} from "./army/army.component"; +import {armyRoutes, armyRoutingComponents} from "./army/army.routing"; export const appRoutes: Routes = [ - {path: 'cc-overview', component: ArmyComponent}, + {path: 'cc-overview', children: armyRoutes}, {path: 'login', component: LoginComponent}, {path: 'cc-users', children: usersRoutes, canActivate: [LoginGuard]}, @@ -28,7 +28,7 @@ export const appRoutes: Routes = [ export const appRouting = RouterModule.forRoot(appRoutes); -export const routingComponents = [LoginComponent, ArmyComponent, NotFoundComponent, ...usersRoutingComponents, +export const routingComponents = [LoginComponent, ...armyRoutingComponents , NotFoundComponent, ...usersRoutingComponents, ...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents]; export const routingProviders = [LoginGuard]; diff --git a/static/src/app/army/army-member.component.css b/static/src/app/army/army-member.component.css new file mode 100644 index 0000000..448af57 --- /dev/null +++ b/static/src/app/army/army-member.component.css @@ -0,0 +1,39 @@ +.overview { + position: fixed; + width: 75%; + padding-left: 50px; + padding-top: 20px; + margin-left: 10px; + height: 100vh; +} + +.table { + overflow-wrap: break-word; + table-layout: fixed; +} + +.table-container { + margin-top: 10px; + overflow-x: auto; +} + +.opfor { + color: firebrick; + margin: 40px 0 40px 0; + font-weight: 600 +} + +.blufor { + color: blue; + margin: 40px 0 40px 0; + font-weight: 600 +} + +.table-head { + background: #222222; + color: white; +} + +.cell-outline { + outline:1px solid #D4D4D4; +} diff --git a/static/src/app/army/army-member.component.html b/static/src/app/army/army-member.component.html new file mode 100644 index 0000000..394d0cd --- /dev/null +++ b/static/src/app/army/army-member.component.html @@ -0,0 +1,43 @@ +< zurück zur Übersicht + +
+ +

Auszeichnungen von {{user.rank?.name}} + {{user.username}}

+ +
+
+ + + + + + + + + + + + + + + + + + +
BezeichnungBegründungVerliehen am
+ + + + + {{award.decorationId.name}} + + {{award.reason}} + + {{award.date | date: 'dd.MM.yyyy'}} +
+
+ +
+ +
diff --git a/static/src/app/army/army-member.component.ts b/static/src/app/army/army-member.component.ts new file mode 100644 index 0000000..3d5808e --- /dev/null +++ b/static/src/app/army/army-member.component.ts @@ -0,0 +1,39 @@ +import {Component} from "@angular/core"; +import {User} from "../models/model-interfaces"; +import {ActivatedRoute, Router} from "@angular/router"; +import {UserService} from "../services/user-service/user.service"; +import {Subscription} from "rxjs/Subscription"; + + +@Component({ + selector: 'army-member', + templateUrl: './army-member.component.html', + styleUrls: ['./army-member.component.css'] +}) +export class ArmyMemberComponent { + + subscription: Subscription; + + user: User = {}; + + constructor(private router: Router, + private route: ActivatedRoute, + private userService: UserService) { + } + + ngOnInit() { + this.subscription = this.route.params + .map(params => params['id']) + .filter(id => id != undefined) + .flatMap(id => this.userService.getUser(id)) + .subscribe(user => { + this.user = user; + }); + + }; + + backToOverview() { + this.router.navigate(['cc-overview']); + } + +} diff --git a/static/src/app/army/army.component.css b/static/src/app/army/army.component.css index ffcc23e..0e04a8f 100644 --- a/static/src/app/army/army.component.css +++ b/static/src/app/army/army.component.css @@ -15,7 +15,6 @@ img{ border-radius: 10px; margin-left: 1%; width: auto; - background-color: rgba(240, 248, 255, 0.29); border-spacing: 5px; /* cellspacing:poor IE support for this */ } @@ -30,3 +29,21 @@ img{ display: table-column; padding: 5px 15px 5px 15px; } + +.army-head { + font-weight: bolder; + text-align: center +} + +.member-link { + cursor: pointer; + text-decoration: underline; +} + +.text-opfor { + color: blue; +} + +.text-blufor { + color: firebrick; +} diff --git a/static/src/app/army/army.component.html b/static/src/app/army/army.component.html index e5f96c7..078893d 100644 --- a/static/src/app/army/army.component.html +++ b/static/src/app/army/army.component.html @@ -3,8 +3,8 @@
-

NATO

-
+

NATO

+
@@ -14,9 +14,9 @@

{{squad.name}}

-
+
-
{{member.rank}} {{member.username}}
+


@@ -31,8 +31,8 @@
-

CSAT

-
+

CSAT

+
@@ -44,7 +44,7 @@
-
{{member.rank}} {{member.username}}
+


diff --git a/static/src/app/army/army.component.ts b/static/src/app/army/army.component.ts index e1dfa52..55565dd 100644 --- a/static/src/app/army/army.component.ts +++ b/static/src/app/army/army.component.ts @@ -1,6 +1,7 @@ import {Component} from "@angular/core"; import {Army} from "../models/model-interfaces"; import {ArmyService} from "../services/army-service/army.service"; +import {ActivatedRoute, Router} from "@angular/router"; @Component({ @@ -12,7 +13,9 @@ export class ArmyComponent { army: Army = {NATO: {squads: [], memberCount: 0}, CSAT: {squads: [], memberCount: 0}}; - constructor(private armyService: ArmyService) { + constructor(private router: Router, + private route: ActivatedRoute, + private armyService: ArmyService) { } ngOnInit() { @@ -21,4 +24,9 @@ export class ArmyComponent { this.army = army; }); }; + + select(memberId) { + this.router.navigate(['member', memberId], {relativeTo: this.route}); + } + } diff --git a/static/src/app/army/army.routing.ts b/static/src/app/army/army.routing.ts new file mode 100644 index 0000000..b708cf0 --- /dev/null +++ b/static/src/app/army/army.routing.ts @@ -0,0 +1,18 @@ +import {Routes} from "@angular/router"; +import {ArmyComponent} from "./army.component"; +import {ArmyMemberComponent} from "./army-member.component"; + + +export const armyRoutes: Routes = [ + { + path: '', + component: ArmyComponent + }, + { + path: 'member/:id', + component: ArmyMemberComponent, + } +]; + +export const armyRoutingComponents = [ArmyComponent, ArmyMemberComponent]; + diff --git a/static/src/app/users/award-user/award-user.component.ts b/static/src/app/users/award-user/award-user.component.ts index 1371ca2..248cd4d 100644 --- a/static/src/app/users/award-user/award-user.component.ts +++ b/static/src/app/users/award-user/award-user.component.ts @@ -10,7 +10,7 @@ import {DecorationService} from "../../services/decoration-service/decoration.se templateUrl: './award-user.component.html', styleUrls: ['./award-user.component.css'], }) -export class UserAwardComponent { +export class AwardUserComponent { @ViewChild(NgForm) form: NgForm; diff --git a/static/src/app/users/user-list/user-item.component.css b/static/src/app/users/user-list/user-item.component.css index e642677..2769f96 100644 --- a/static/src/app/users/user-list/user-item.component.css +++ b/static/src/app/users/user-list/user-item.component.css @@ -3,5 +3,5 @@ width: 27px; height: 42px; display: block; - margin-right: 12px; + margin-right: 25px; } diff --git a/static/src/app/users/users.routing.ts b/static/src/app/users/users.routing.ts index f44182c..9e51e3a 100644 --- a/static/src/app/users/users.routing.ts +++ b/static/src/app/users/users.routing.ts @@ -2,7 +2,7 @@ import {Routes} from "@angular/router"; import {UsersComponent} from "./users.component"; import {EditUserComponent} from "./edit-user/edit-user.component"; import {UserListComponent} from "./user-list/user-list.component"; -import {UserAwardComponent} from "./award-user/award-user.component"; +import {AwardUserComponent} from "./award-user/award-user.component"; export const usersRoutes: Routes = [{ path: '', component: UsersComponent, @@ -25,9 +25,9 @@ export const usersRoutes: Routes = [{ }, { path: 'award/:id', - component: UserAwardComponent, + component: AwardUserComponent, outlet: 'right' } ]; -export const usersRoutingComponents = [UsersComponent, UserListComponent, EditUserComponent, UserAwardComponent]; +export const usersRoutingComponents = [UsersComponent, UserListComponent, EditUserComponent, AwardUserComponent];