Add and connect new page for rank/decoration trace
parent
ed87dd5df1
commit
6ac4fc5a66
|
@ -26,6 +26,7 @@ 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,
|
||||
|
@ -51,7 +52,8 @@ import {MatSnackBarModule} from '@angular/material';
|
|||
routingProviders,
|
||||
CookieService,
|
||||
SnackBarService,
|
||||
SpinnerService
|
||||
SpinnerService,
|
||||
DataTraceService,
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
|
|
@ -13,12 +13,12 @@ h1, h3 {
|
|||
.decoration-overview-container {
|
||||
max-width: 1782px;
|
||||
min-width: 927px;
|
||||
margin:auto;
|
||||
position: relative;
|
||||
margin: auto auto 25px;
|
||||
}
|
||||
|
||||
.fraction-global {
|
||||
display: flow-root;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.fraction-global > h3 {
|
||||
|
@ -29,12 +29,12 @@ h1, h3 {
|
|||
float: left;
|
||||
width: 50%;
|
||||
padding-right:81px;
|
||||
margin-bottom: 135px;
|
||||
margin-bottom: 70px;
|
||||
}
|
||||
|
||||
.fraction-right {
|
||||
float: right;
|
||||
width: 50%;
|
||||
padding-left:81px;
|
||||
margin-bottom: 135px;
|
||||
margin-bottom: 70px;
|
||||
}
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
<div class="decoration-overview-container">
|
||||
<h1>Übersicht über alle Auszeichnungen</h1>
|
||||
|
||||
<div class="fraction-global">
|
||||
<h3>Global</h3>
|
||||
<cc-decoration-panel *ngFor="let decoration of decorationsGlobal"
|
||||
[decoration]="decoration">
|
||||
</cc-decoration-panel>
|
||||
</div>
|
||||
|
||||
<div class="fraction-left">
|
||||
<h3 [style.color]="fraction.COLOR_BLUFOR">{{fraction.BLUFOR}}</h3>
|
||||
<cc-decoration-panel *ngFor="let decoration of decorationsBlufor"
|
||||
[decoration]="decoration">
|
||||
[decoration]="decoration"
|
||||
(select)="select($event)">
|
||||
</cc-decoration-panel>
|
||||
</div>
|
||||
|
||||
<div class="fraction-right">
|
||||
<h3 [style.color]="fraction.COLOR_OPFOR">{{fraction.OPFOR}}</h3>
|
||||
<cc-decoration-panel *ngFor="let decoration of decorationsOpfor"
|
||||
[decoration]="decoration">
|
||||
[decoration]="decoration"
|
||||
(select)="select($event)">
|
||||
</cc-decoration-panel>
|
||||
</div>
|
||||
|
||||
<div class="fraction-global">
|
||||
<h3>Global</h3>
|
||||
<cc-decoration-panel *ngFor="let decoration of decorationsGlobal"
|
||||
[decoration]="decoration"
|
||||
(select)="select($event)">
|
||||
</cc-decoration-panel>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,6 +7,7 @@ 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({
|
||||
|
@ -29,6 +30,7 @@ export class DecorationOverviewComponent implements OnInit, OnDestroy {
|
|||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private decorationService: DecorationService,
|
||||
private dataTraceService: DataTraceService,
|
||||
@Inject(DOCUMENT) private document) {
|
||||
}
|
||||
|
||||
|
@ -45,6 +47,11 @@ export class DecorationOverviewComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
};
|
||||
|
||||
select(decoration: Decoration) {
|
||||
this.dataTraceService.setData(decoration);
|
||||
this.router.navigate(['../find'], {relativeTo: this.route});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (!this.router.url.includes(RouteConfig.overviewPath)) {
|
||||
this.document.getElementById('right').setAttribute('style', '');
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
padding: 0;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.decoration-card:hover {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<mat-card class="decoration-card">
|
||||
<mat-card class="decoration-card" (click)="selectDecoration()">
|
||||
<div class="image-head">
|
||||
<img src="resource/decoration/{{decoration._id}}.png"
|
||||
alt="{{decoration.name}}"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
|
||||
import {Decoration} from '../../../models/model-interfaces';
|
||||
import {Fraction} from '../../../utils/fraction.enum';
|
||||
|
@ -11,10 +11,13 @@ import {Fraction} from '../../../utils/fraction.enum';
|
|||
})
|
||||
export class DecorationPanelComponent {
|
||||
|
||||
@Input() decoration: Decoration;
|
||||
@Input() decoration: Decoration;
|
||||
|
||||
@Output() select = new EventEmitter();
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
constructor() {
|
||||
selectDecoration() {
|
||||
this.select.emit(this.decoration);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,12 @@ 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]
|
||||
providers: [DecorationService, RankService, DataTraceService]
|
||||
})
|
||||
export class PublicModule {
|
||||
static routes = pubRouterModule;
|
||||
|
|
|
@ -4,6 +4,7 @@ import {ModuleWithProviders} from '@angular/core';
|
|||
import {DecorationOverviewComponent} from './decoration-overview/decoration-overview.component';
|
||||
import {PublicComponent} from './public.component';
|
||||
import {DecorationPanelComponent} from './decoration-overview/decoration-panel/decoration-panel.component';
|
||||
import {TraceOverviewComponent} from './trace-overview/trace-overview.component';
|
||||
|
||||
export const publicRoutes: Routes = [
|
||||
{
|
||||
|
@ -16,10 +17,15 @@ export const publicRoutes: Routes = [
|
|||
component: DecorationOverviewComponent,
|
||||
outlet: 'right'
|
||||
},
|
||||
{
|
||||
path: 'find',
|
||||
component: TraceOverviewComponent,
|
||||
outlet: 'right'
|
||||
},
|
||||
];
|
||||
|
||||
export const pubRouterModule: ModuleWithProviders = RouterModule.forChild(publicRoutes);
|
||||
|
||||
export const pubRoutingComponents = [PublicComponent, RankOverviewComponent, DecorationOverviewComponent,
|
||||
DecorationPanelComponent];
|
||||
DecorationPanelComponent, TraceOverviewComponent];
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ table {
|
|||
|
||||
:host /deep/ tr.mat-row:hover {
|
||||
background: #ffffff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
td > img {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="selectRow(row)"></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="selectRow(row)"></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3,9 +3,10 @@ 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 {AppConfig, 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({
|
||||
|
@ -26,6 +27,7 @@ export class RankOverviewComponent implements OnInit, OnDestroy {
|
|||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private rankService: RankService,
|
||||
private dataTraceService: DataTraceService,
|
||||
@Inject(DOCUMENT) private document) {
|
||||
}
|
||||
|
||||
|
@ -41,6 +43,11 @@ export class RankOverviewComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
};
|
||||
|
||||
selectRow(row: Rank) {
|
||||
this.dataTraceService.setData(row);
|
||||
this.router.navigate(['../find'], {relativeTo: this.route});
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
if (!this.router.url.includes(RouteConfig.overviewPath)) {
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
import {Component, Inject, Input, 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 {RankService} from '../../services/army-management/rank.service';
|
||||
import {DataTraceService} from '../../services/army-service/data-trace.service';
|
||||
import {Decoration, Rank} from '../../models/model-interfaces';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'cc-trace-overview',
|
||||
templateUrl: './trace-overview.component.html',
|
||||
styleUrls: ['./trace-overview.component.css']
|
||||
})
|
||||
export class TraceOverviewComponent implements OnInit, OnDestroy {
|
||||
|
||||
traceItem: Rank | Decoration;
|
||||
|
||||
displayedColumns: string[] = ['picture', 'name'];
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private rankService: RankService,
|
||||
private dataTraceService: DataTraceService,
|
||||
@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'));
|
||||
|
||||
console.log(typeof this.traceItem);
|
||||
};
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
if (!this.router.url.includes(RouteConfig.overviewPath)) {
|
||||
this.document.getElementById('right').setAttribute('style', '');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,4 +16,3 @@ export class ArmyService {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue