Add tracing result pages for ranks/awards and connect to user detail pages
parent
b3b166d283
commit
78cc61232b
|
@ -26,7 +26,6 @@ import {SnackBarService} from './services/user-interface/snack-bar/snack-bar.ser
|
|||
import {HttpClientModule} from '@angular/common/http';
|
||||
import {SpinnerService} from './services/user-interface/spinner/spinner.service';
|
||||
import {MatSnackBarModule} from '@angular/material';
|
||||
import {DataTraceService} from './services/army-service/data-trace.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, HttpClientModule,
|
||||
|
@ -53,7 +52,6 @@ import {DataTraceService} from './services/army-service/data-trace.service';
|
|||
CookieService,
|
||||
SnackBarService,
|
||||
SpinnerService,
|
||||
DataTraceService,
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
|
|
@ -6,10 +6,9 @@ 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 {DOCUMENT, Location} from '@angular/common';
|
||||
import {CSSHelpers} from '../../utils/global.helpers';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'army-member',
|
||||
templateUrl: './army-member.component.html',
|
||||
|
@ -33,6 +32,7 @@ export class ArmyMemberComponent implements OnInit, OnDestroy {
|
|||
private route: ActivatedRoute,
|
||||
private userService: UserService,
|
||||
private awardingService: AwardingService,
|
||||
private location: Location,
|
||||
@Inject(DOCUMENT) private document) {
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,6 @@ export class ArmyMemberComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
backToOverview() {
|
||||
this.router.navigate([RouteConfig.overviewPath]);
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ h1, h3 {
|
|||
.fraction-left {
|
||||
float: left;
|
||||
width: 50%;
|
||||
padding-right:81px;
|
||||
padding-right: 81px;
|
||||
margin-bottom: 70px;
|
||||
}
|
||||
|
||||
.fraction-right {
|
||||
float: right;
|
||||
width: 50%;
|
||||
padding-left:81px;
|
||||
padding-left: 81px;
|
||||
margin-bottom: 70px;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import {CSSHelpers} from '../../utils/global.helpers';
|
|||
import {RouteConfig} from '../../app.config';
|
||||
import {Decoration} from '../../models/model-interfaces';
|
||||
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||
import {DataTraceService} from '../../services/army-service/data-trace.service';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -30,7 +29,6 @@ export class DecorationOverviewComponent implements OnInit, OnDestroy {
|
|||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private decorationService: DecorationService,
|
||||
private dataTraceService: DataTraceService,
|
||||
@Inject(DOCUMENT) private document) {
|
||||
}
|
||||
|
||||
|
@ -48,8 +46,7 @@ export class DecorationOverviewComponent implements OnInit, OnDestroy {
|
|||
};
|
||||
|
||||
select(decoration: Decoration) {
|
||||
this.dataTraceService.setData(decoration);
|
||||
this.router.navigate(['../find'], {relativeTo: this.route});
|
||||
this.router.navigate(['../find/award', decoration._id], {relativeTo: this.route});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
box-shadow: 0 0 18px 2px #666666;
|
||||
}
|
||||
|
||||
.decoration-description {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.decoration-card:hover .decoration-description {
|
||||
background: #ffffff;
|
||||
position: relative;
|
||||
|
|
|
@ -6,12 +6,11 @@ import {pubRouterModule, pubRoutingComponents} from './public.routing';
|
|||
import {DecorationService} from '../services/army-management/decoration.service';
|
||||
import {MatTableModule} from '@angular/material/table';
|
||||
import {MatCardModule} from '@angular/material/card';
|
||||
import {DataTraceService} from '../services/army-service/data-trace.service';
|
||||
|
||||
@NgModule({
|
||||
declarations: pubRoutingComponents,
|
||||
imports: [CommonModule, SharedModule, MatTableModule, MatCardModule, pubRouterModule],
|
||||
providers: [DecorationService, RankService, DataTraceService]
|
||||
providers: [DecorationService, RankService]
|
||||
})
|
||||
export class PublicModule {
|
||||
static routes = pubRouterModule;
|
||||
|
|
|
@ -5,6 +5,7 @@ import {DecorationOverviewComponent} from './decoration-overview/decoration-over
|
|||
import {PublicComponent} from './public.component';
|
||||
import {DecorationPanelComponent} from './decoration-overview/decoration-panel/decoration-panel.component';
|
||||
import {TraceOverviewComponent} from './trace-overview/trace-overview.component';
|
||||
import {RankPanelComponent} from './rank-overview/rank-panel/rank-panel.component';
|
||||
|
||||
export const publicRoutes: Routes = [
|
||||
{
|
||||
|
@ -18,7 +19,12 @@ export const publicRoutes: Routes = [
|
|||
outlet: 'right'
|
||||
},
|
||||
{
|
||||
path: 'find',
|
||||
path: 'find/rank/:id',
|
||||
component: TraceOverviewComponent,
|
||||
outlet: 'right'
|
||||
},
|
||||
{
|
||||
path: 'find/award/:id',
|
||||
component: TraceOverviewComponent,
|
||||
outlet: 'right'
|
||||
},
|
||||
|
@ -27,5 +33,5 @@ export const publicRoutes: Routes = [
|
|||
export const pubRouterModule: ModuleWithProviders = RouterModule.forChild(publicRoutes);
|
||||
|
||||
export const pubRoutingComponents = [PublicComponent, RankOverviewComponent, DecorationOverviewComponent,
|
||||
DecorationPanelComponent, TraceOverviewComponent];
|
||||
DecorationPanelComponent, TraceOverviewComponent, RankPanelComponent];
|
||||
|
||||
|
|
|
@ -26,6 +26,6 @@ h3 {
|
|||
}
|
||||
|
||||
.column-container {
|
||||
width:48%;
|
||||
width: 48%;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
<table mat-table [dataSource]="ranksBlufor" class="mat-elevation-z8">
|
||||
|
||||
<ng-container matColumnDef="picture">
|
||||
<th mat-header-cell *matHeaderCellDef> Rankabzeichen </th>
|
||||
<th mat-header-cell *matHeaderCellDef> Rankabzeichen</th>
|
||||
<td mat-cell *matCellDef="let element"><img src="resource/rank/{{element._id}}.png"></td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef> Name </th>
|
||||
<th mat-header-cell *matHeaderCellDef> Name</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.name}}</td>
|
||||
</ng-container>
|
||||
|
||||
|
@ -27,13 +27,13 @@
|
|||
<table mat-table [dataSource]="ranksOpfor" class="pull-right mat-elevation-z8">
|
||||
|
||||
<ng-container matColumnDef="picture">
|
||||
<th mat-header-cell *matHeaderCellDef> Rankabzeichen </th>
|
||||
<th mat-header-cell *matHeaderCellDef> Rankabzeichen</th>
|
||||
<td mat-cell *matCellDef="let element"><img src="resource/rank/{{element._id}}.png"></td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef> Name </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.name}}</td>
|
||||
<th mat-header-cell *matHeaderCellDef> Name</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.name}}</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
|
|
|
@ -3,10 +3,9 @@ import {ActivatedRoute, Router} from '@angular/router';
|
|||
import {DOCUMENT} from '@angular/common';
|
||||
import {Fraction} from '../../utils/fraction.enum';
|
||||
import {CSSHelpers} from '../../utils/global.helpers';
|
||||
import {AppConfig, RouteConfig} from '../../app.config';
|
||||
import {RouteConfig} from '../../app.config';
|
||||
import {Rank} from '../../models/model-interfaces';
|
||||
import {RankService} from '../../services/army-management/rank.service';
|
||||
import {DataTraceService} from '../../services/army-service/data-trace.service';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -27,7 +26,6 @@ export class RankOverviewComponent implements OnInit, OnDestroy {
|
|||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private rankService: RankService,
|
||||
private dataTraceService: DataTraceService,
|
||||
@Inject(DOCUMENT) private document) {
|
||||
}
|
||||
|
||||
|
@ -43,9 +41,8 @@ export class RankOverviewComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
};
|
||||
|
||||
selectRow(row: Rank) {
|
||||
this.dataTraceService.setData(row);
|
||||
this.router.navigate(['../find'], {relativeTo: this.route});
|
||||
selectRow(rank: Rank) {
|
||||
this.router.navigate(['../find/rank', rank._id], {relativeTo: this.route});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
.rank-card {
|
||||
background: rgba(255, 255, 255, 0.87);
|
||||
width: 275px;
|
||||
height: 160px;
|
||||
margin: 6px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rank-card:hover {
|
||||
background: #ffffff;
|
||||
overflow: visible;
|
||||
box-shadow: 0 0 18px 2px #666666;
|
||||
}
|
||||
|
||||
.rank-image {
|
||||
float: left;
|
||||
padding: 20px 20px 20px 25px;
|
||||
}
|
||||
|
||||
.rank-name {
|
||||
width: 169px;
|
||||
height: 100%;
|
||||
display: table-cell;
|
||||
padding-top: 36%;
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<mat-card class="rank-card" (click)="selectRank()">
|
||||
<mat-card-content>
|
||||
<div class="rank-image">
|
||||
<img src="resource/rank/{{rank._id}}.png"
|
||||
alt="{{rank.name}}">
|
||||
</div>
|
||||
<div class="rank-name">
|
||||
{{rank.name}}
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
|
@ -0,0 +1,21 @@
|
|||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
import {Rank} from '../../../models/model-interfaces';
|
||||
import {Fraction} from '../../../utils/fraction.enum';
|
||||
|
||||
@Component({
|
||||
selector: 'cc-rank-panel',
|
||||
templateUrl: './rank-panel.component.html',
|
||||
styleUrls: ['./rank-panel.component.css']
|
||||
})
|
||||
export class RankPanelComponent {
|
||||
|
||||
@Input() rank: Rank;
|
||||
|
||||
@Output() select = new EventEmitter();
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
selectRank() {
|
||||
this.select.emit(this.rank);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
.tracer-container {
|
||||
text-align: center;
|
||||
max-width: 1100px;
|
||||
min-width: 800px;
|
||||
position: relative;
|
||||
margin: auto auto 25px;
|
||||
height: calc(100vh - 95px);
|
||||
}
|
||||
|
||||
.show-panel {
|
||||
display: inline-block;
|
||||
margin: inherit;
|
||||
}
|
||||
|
||||
.decoration-show-panel {
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
.user-table-container {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
table.mat-table {
|
||||
width: 50%;
|
||||
margin: auto;
|
||||
text-align: left;
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
table.mat-table:hover {
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
:host /deep/ tr.mat-row:hover {
|
||||
background: #ffffff;
|
||||
cursor: pointer;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<div class="tracer-container">
|
||||
<h1>Alle aktiven Teilnehmer mit {{isRank ? 'Rang' : 'Auszeichnung'}}</h1>
|
||||
|
||||
<div class="show-panel"
|
||||
*ngIf="isRank">
|
||||
<cc-rank-panel [rank]="traceItem">
|
||||
</cc-rank-panel>
|
||||
</div>
|
||||
<div class="show-panel decoration-show-panel"
|
||||
*ngIf="!isRank">
|
||||
<cc-decoration-panel [decoration]="traceItem">
|
||||
</cc-decoration-panel>
|
||||
</div>
|
||||
|
||||
<div class="user-table-container">
|
||||
<table mat-table [dataSource]="users" class="mat-elevation-z8">
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef>Name</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.username}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="fraction">
|
||||
<th mat-header-cell *matHeaderCellDef>Fraktion</th>
|
||||
<td mat-cell *matCellDef="let element"
|
||||
[style.color]="traceItem.fraction === 'BLUFOR' ? fraction.COLOR_BLUFOR :fraction.COLOR_OPFOR">
|
||||
{{element.squadId.fraction === 'BLUFOR' ? fraction.BLUFOR : fraction.OPFOR}}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="squadName">
|
||||
<th mat-header-cell *matHeaderCellDef>Squad</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.squadId.name}}</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="selectUser(row)"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
|
@ -1,12 +1,13 @@
|
|||
import {Component, Inject, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Component, Inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {DOCUMENT} from '@angular/common';
|
||||
import {Fraction} from '../../utils/fraction.enum';
|
||||
import {CSSHelpers} from '../../utils/global.helpers';
|
||||
import {RouteConfig} from '../../app.config';
|
||||
import {Decoration, Rank, User} from '../../models/model-interfaces';
|
||||
import {UserService} from '../../services/army-management/user.service';
|
||||
import {RankService} from '../../services/army-management/rank.service';
|
||||
import {DataTraceService} from '../../services/army-service/data-trace.service';
|
||||
import {Decoration, Rank} from '../../models/model-interfaces';
|
||||
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -16,36 +17,54 @@ import {Decoration, Rank} from '../../models/model-interfaces';
|
|||
})
|
||||
export class TraceOverviewComponent implements OnInit, OnDestroy {
|
||||
|
||||
traceItem: Rank | Decoration;
|
||||
traceItem: Rank | Decoration = {};
|
||||
|
||||
displayedColumns: string[] = ['picture', 'name'];
|
||||
users: User[];
|
||||
|
||||
isRank = true;
|
||||
|
||||
displayedColumns: string[] = ['name', 'fraction', 'squadName'];
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private userService: UserService,
|
||||
private rankService: RankService,
|
||||
private dataTraceService: DataTraceService,
|
||||
private decorationService: DecorationService,
|
||||
@Inject(DOCUMENT) private document) {
|
||||
this.traceItem = this.dataTraceService.getData();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
// set background image css
|
||||
this.document.getElementById('right').setAttribute('style', CSSHelpers.getBackgroundCSS('../assets/bg.jpg'));
|
||||
this.route.params.subscribe(params => {
|
||||
const itemId = params.id;
|
||||
|
||||
|
||||
if (this.traceItem.hasOwnProperty('isMedal')) {
|
||||
// Decoration
|
||||
const decorationItem = <Decoration> this.traceItem
|
||||
console.log("DECORATION");
|
||||
} else if (this.traceItem.hasOwnProperty('level')) {
|
||||
// Rank
|
||||
const rankItem = <Rank> this.traceItem
|
||||
console.log("RANK");
|
||||
}
|
||||
if (this.router.url.includes('find/award/')) {
|
||||
// Award
|
||||
this.isRank = false;
|
||||
console.log(itemId);
|
||||
this.decorationService.getDecoration(itemId).subscribe(decoration => {
|
||||
this.traceItem = decoration;
|
||||
console.log(decoration)
|
||||
});
|
||||
} else if (this.router.url.includes('find/rank/')) {
|
||||
// Rank
|
||||
this.isRank = true;
|
||||
this.rankService.getRank(itemId).subscribe(rank => {
|
||||
this.traceItem = rank;
|
||||
this.userService.findUsers('', rank.fraction).subscribe(users => {
|
||||
this.users = users.filter(user => user.rankLvl === rank.level);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
selectUser(user) {
|
||||
this.router.navigate(['overview', {outlets: {'right': ['member', user._id]}}]);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (!this.router.url.includes(RouteConfig.overviewPath)) {
|
||||
|
|
|
@ -37,7 +37,7 @@ export class RankService {
|
|||
return this.ranks$;
|
||||
}
|
||||
|
||||
getRank(id: number | string): Observable<Decoration> {
|
||||
getRank(id: number | string): Observable<Rank> {
|
||||
return this.http.get(this.config.apiRankPath + id)
|
||||
.map(res => res.json());
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Decoration, Rank} from '../../models/model-interfaces';
|
||||
|
||||
@Injectable()
|
||||
export class DataTraceService {
|
||||
|
||||
data: Rank | Decoration = {};
|
||||
|
||||
setData(data: Rank | Decoration) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
getData(): Rank | Decoration {
|
||||
return this.data;
|
||||
}
|
||||
}
|
|
@ -113,5 +113,4 @@ export class CampaignPlayerDetailComponent implements OnInit {
|
|||
navigateBack() {
|
||||
this.switchTab.emit(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<ng-container matColumnDef="{{tableHead[1].prop}}">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="{{tableHead[1].prop}}">{{tableHead[1].head}}</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.fraction}}</td>
|
||||
<td mat-cell *matCellDef="let element">{{element.fraction === 'BLUFOR' ? fraction.BLUFOR : fraction.OPFOR}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngFor="let column of tableHead.slice(2, tableHead.length)" matColumnDef="{{column.prop}}">
|
||||
|
@ -25,7 +25,7 @@
|
|||
matTooltip="{{column.head}}"
|
||||
alt="{{column.head}}">
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element[column.prop]}}</td>
|
||||
<td mat-cell *matCellDef="let element">{{element[column.prop]}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="interact">
|
||||
|
|
Loading…
Reference in New Issue