Add tables for rank overview

pull/40/head
HardiReady 2018-07-10 20:48:52 +02:00
parent fab0b438cd
commit ed238e311e
4 changed files with 67 additions and 83 deletions

View File

@ -4,10 +4,12 @@ import {CommonModule} from '@angular/common';
import {RankService} from '../services/army-management/rank.service'; import {RankService} from '../services/army-management/rank.service';
import {pubRouterModule, pubRoutingComponents} from './public.routing'; import {pubRouterModule, pubRoutingComponents} from './public.routing';
import {DecorationService} from '../services/army-management/decoration.service'; import {DecorationService} from '../services/army-management/decoration.service';
import {MatTableModule} from '@angular/material/table';
@NgModule({ @NgModule({
declarations: pubRoutingComponents, declarations: pubRoutingComponents,
imports: [CommonModule, SharedModule, pubRouterModule], imports: [CommonModule, SharedModule, MatTableModule, pubRouterModule],
providers: [DecorationService, RankService] providers: [DecorationService, RankService]
}) })
export class PublicModule { export class PublicModule {

View File

@ -1,75 +1,25 @@
.squad-layout { table {
overflow: hidden; width: 100%;
padding: 5px 15px 5px 15px;
} }
.row { :host /deep/ table.mat-table {
clear: both; background: rgba(255, 255, 255, 0.6);
} }
.squad-cell { td > img {
display: table-cell; height: 120px;
padding: 5px;
}
.colored-row {
background: rgb(34, 34, 34);
}
.title-row {
border-radius: 12px 12px 0 0;
}
.footer-row {
border-radius: 0 0 12px 12px;
}
.middle-row {
min-height: 120px;
border: rgb(34, 34, 34);
background-color: rgba(255, 255, 255, 0.88);
border-left-style: solid;
border-right-style: solid;
}
.title {
color: whitesmoke;
font-weight: bold;
font-size: 14px;
}
.name-cell {
display: inherit;
margin-left: 200px;
}
h1 {
text-align: center;
}
img {
position: absolute;
margin-top: 8px;
margin-left: 25px;
}
.member-link {
cursor: pointer;
text-decoration: underline;
}
.army-head {
font-weight: bolder;
text-align: center
}
.member-count {
margin-top: 15px;
padding: 8px; padding: 8px;
text-align: center;
font-weight: bold;
color: whitesmoke;
background: #222222;
border-radius: 12px;
} }
h1, h3 {
text-align: center;
}
h3 {
font-weight: bolder;
}
.column-container {
width:48%;
padding-bottom: 20px;
}

View File

@ -1,18 +1,45 @@
<div style="width: 1100px; margin:auto; position: relative;"> <div style="width: 1000px; margin:auto; position: relative;">
<h1>Übersicht über alle Ränge</h1> <h1>Übersicht über alle Ränge</h1>
<div class="pull-left" style="width: 45%;"> <div class="column-container pull-left">
<h3 class="army-head" [style.color]="fraction.COLOR_BLUFOR">{{fraction.BLUFOR}}</h3> <h3 [style.color]="fraction.COLOR_BLUFOR">{{fraction.BLUFOR}}</h3>
<div class="squad-layout" *ngFor="let rank of ranks">
{{rank.name}} <table mat-table [dataSource]="ranksBlufor" class="mat-elevation-z8">
</div>
<ng-container matColumnDef="picture">
<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>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div> </div>
<div class="pull-right" style="width: 45%;"> <div class="column-container pull-right">
<h3 class="army-head" [style.color]="fraction.COLOR_OPFOR">{{fraction.OPFOR}}</h3> <h3 [style.color]="fraction.COLOR_OPFOR">{{fraction.OPFOR}}</h3>
<div class="squad-layout" *ngFor="let rank of ranks">
{{rank.name}} <table mat-table [dataSource]="ranksOpfor" class="pull-right mat-elevation-z8">
</div>
<ng-container matColumnDef="picture">
<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>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div> </div>
</div> </div>

View File

@ -1,6 +1,5 @@
import {Component, Inject, OnDestroy, OnInit} from '@angular/core'; import {Component, Inject, OnDestroy, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {DOCUMENT} from '@angular/common'; import {DOCUMENT} from '@angular/common';
import {Fraction} from '../../utils/fraction.enum'; import {Fraction} from '../../utils/fraction.enum';
import {CSSHelpers} from '../../utils/global.helpers'; import {CSSHelpers} from '../../utils/global.helpers';
@ -16,7 +15,11 @@ import {RankService} from '../../services/army-management/rank.service';
}) })
export class RankOverviewComponent implements OnInit, OnDestroy { export class RankOverviewComponent implements OnInit, OnDestroy {
ranks: Rank[]; ranksOpfor: Rank[];
ranksBlufor: Rank[];
displayedColumns: string[] = ['picture', 'name'];
readonly fraction = Fraction; readonly fraction = Fraction;
@ -33,10 +36,12 @@ export class RankOverviewComponent implements OnInit, OnDestroy {
// init rank data // init rank data
this.rankService.findRanks() this.rankService.findRanks()
.subscribe(ranks => { .subscribe(ranks => {
this.ranks = ranks; this.ranksBlufor = ranks.filter(r => r.fraction === 'BLUFOR');
this.ranksOpfor = ranks.filter(r => r.fraction === 'OPFOR');
}); });
}; };
ngOnDestroy() { ngOnDestroy() {
if (!this.router.url.includes(RouteConfig.overviewPath)) { if (!this.router.url.includes(RouteConfig.overviewPath)) {
this.document.getElementById('right').setAttribute('style', ''); this.document.getElementById('right').setAttribute('style', '');