Compare commits
No commits in common. "1bf7d176154afa1c15b343fdfc307964f53ff0d8" and "162453c894ef86d793662b31b077048f417f925c" have entirely different histories.
1bf7d17615
...
162453c894
|
@ -48,9 +48,6 @@
|
|||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a routerLink="{{config.request}}/{{config.sqlDashboardPath}}">Offene Anträge</a>
|
||||
</li>
|
||||
<li>
|
||||
<a routerLink="{{config.request}}/{{config.requestPromotionPath}}">Beförderung</a>
|
||||
</li>
|
||||
|
|
|
@ -17,6 +17,7 @@ export class AppConfig {
|
|||
public readonly apiSquadPath = this.apiUrl + '/squads/';
|
||||
public readonly apiUserPath = this.apiUrl + '/users/';
|
||||
public readonly apiWarPath = this.apiUrl + '/wars';
|
||||
|
||||
}
|
||||
|
||||
export const RouteConfig = {
|
||||
|
@ -33,6 +34,5 @@ export const RouteConfig = {
|
|||
requestAwardPath: 'award',
|
||||
requestPromotionPath: 'promotion',
|
||||
confirmAwardPath: 'confirm-award',
|
||||
confirmPromotionPath: 'confirm-promotion',
|
||||
sqlDashboardPath: 'sql-dashboard',
|
||||
confirmPromotionPath: 'confirm-promotion'
|
||||
};
|
||||
|
|
|
@ -94,7 +94,6 @@ export interface Promotion {
|
|||
oldRankLvl: number;
|
||||
newRankLvl: number;
|
||||
rejectReason?: string;
|
||||
confirmed?: number;
|
||||
}
|
||||
|
||||
export interface Decoration {
|
||||
|
|
|
@ -8,11 +8,10 @@ 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 {SqlDashboardComponent} from './sql-dashboard/sql-dashboard.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent,
|
||||
ConfirmAwardComponent, SqlDashboardComponent, FilterRankPipe],
|
||||
ConfirmAwardComponent, FilterRankPipe],
|
||||
imports: [CommonModule, SharedModule, requestRouterModule]
|
||||
})
|
||||
export class RequestModule {
|
||||
|
|
|
@ -8,7 +8,6 @@ import {RequestPromotionComponent} from './promotion/req-promotion.component';
|
|||
import {RequestComponent} from './request.component';
|
||||
import {RouteConfig} from '../app.config';
|
||||
import {LoginGuardHL, LoginGuardSQL} from '../login';
|
||||
import {SqlDashboardComponent} from './sql-dashboard/sql-dashboard.component';
|
||||
|
||||
|
||||
export const requestRoutes: Routes = [{
|
||||
|
@ -24,11 +23,6 @@ export const requestRoutes: Routes = [{
|
|||
component: RequestPromotionComponent,
|
||||
canActivate: [LoginGuardSQL]
|
||||
},
|
||||
{
|
||||
path: RouteConfig.sqlDashboardPath,
|
||||
component: SqlDashboardComponent,
|
||||
canActivate: [LoginGuardSQL]
|
||||
},
|
||||
{
|
||||
path: RouteConfig.confirmAwardPath,
|
||||
component: ConfirmAwardComponent,
|
||||
|
@ -38,7 +32,7 @@ export const requestRoutes: Routes = [{
|
|||
path: RouteConfig.confirmPromotionPath,
|
||||
component: ConfirmPromotionComponent,
|
||||
canActivate: [LoginGuardHL]
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
export const requestRouterModule: ModuleWithProviders = RouterModule.forChild(requestRoutes);
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
.overview {
|
||||
margin-left: 25px !important;
|
||||
}
|
||||
|
||||
.decoration-preview {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.trash {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.table {
|
||||
overflow-wrap: break-word;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
margin-top: 40px;
|
||||
overflow-x: auto;
|
||||
width: 90%;
|
||||
min-width: 800px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
width: 25%;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 80px 0 20px -20px;
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
<form #form="ngForm" class="overview">
|
||||
<h3>SQL Dashboard</h3>
|
||||
|
||||
<div class="table-container">
|
||||
<label>Beförderungsanträge</label>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-sm-1">Teilnehmer</th>
|
||||
<th class="col-sm-1">Alter Rang</th>
|
||||
<th class="col-sm-1">Neuer Rang</th>
|
||||
<th class="col-sm-1 ">Antragsteller</th>
|
||||
<th class="col-sm-1 text-center">Datum</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody *ngFor="let promotion of promotions">
|
||||
<tr>
|
||||
<td class="table-cell-id">
|
||||
{{promotion.userId.username}}
|
||||
</td>
|
||||
<td *ngFor="let rank of (ranks | rankfilter: promotion.oldRankLvl)">
|
||||
{{rank.name}}
|
||||
</td>
|
||||
<td *ngFor="let rank of (ranks | rankfilter: promotion.newRankLvl)">
|
||||
{{rank.name}}
|
||||
</td>
|
||||
<td>
|
||||
{{promotion.proposer.username}}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{{promotion.timestamp | date: 'dd.MM.yyyy'}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<label>Anträge für Orden/ Auszeichnungen</label>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-sm-1">Teilnehmer</th>
|
||||
<th class="col-sm-1">Bild</th>
|
||||
<th class="col-sm-2">Bezeichnung</th>
|
||||
<th class="col-sm-2">Begründung</th>
|
||||
<th class="col-sm-1 ">Antragsteller</th>
|
||||
<th class="col-sm-1 text-right">Datum</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody *ngFor="let award of awards">
|
||||
<tr>
|
||||
<td class="table-cell-id">
|
||||
{{award.userId.username}}
|
||||
</td>
|
||||
<td class="table-cell-id" *ngIf="award.decorationId.isMedal">
|
||||
<img height="40px" src="resource/decoration/{{award.decorationId._id}}.png">
|
||||
</td>
|
||||
<td class="table-cell-id" *ngIf="!award.decorationId.isMedal">
|
||||
<img width="60px" src="resource/decoration/{{award.decorationId._id}}.png">
|
||||
</td>
|
||||
<td>
|
||||
{{award.decorationId.name}}
|
||||
</td>
|
||||
<td>
|
||||
{{award.reason}}
|
||||
</td>
|
||||
<td>
|
||||
{{award.proposer?.username}}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{{award.date | date: 'dd.MM.yyyy'}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
|
@ -1,60 +0,0 @@
|
|||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Promotion, Rank} 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 {AwardingService} from '../../services/army-management/awarding.service';
|
||||
|
||||
|
||||
@Component({
|
||||
templateUrl: './sql-dashboard.component.html',
|
||||
styleUrls: ['./sql-dashboard.component.css', '../../style/overview.css'],
|
||||
})
|
||||
export class SqlDashboardComponent implements OnInit {
|
||||
|
||||
@ViewChild(NgForm) form: NgForm;
|
||||
|
||||
ranks: Rank[];
|
||||
|
||||
promotions: Promotion[] = [];
|
||||
|
||||
awards = [];
|
||||
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private rankService: RankService,
|
||||
private userService: UserService,
|
||||
private promotionService: PromotionService,
|
||||
private awardingService: AwardingService,
|
||||
private loginService: LoginService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const currentUser = this.loginService.getCurrentUser();
|
||||
|
||||
this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => {
|
||||
this.promotions = promotions.filter(promotion => promotion.confirmed === 0);
|
||||
});
|
||||
|
||||
this.userService.findUsers('', undefined, currentUser.squad._id).subscribe(users => {
|
||||
users.forEach(user => {
|
||||
this.awardingService.getUserAwardings(user._id).subscribe(awardings => {
|
||||
const unprocessedUserAwardings = awardings.filter(award => award.confirmed === 0);
|
||||
this.awards = this.awards.concat(unprocessedUserAwardings);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.rankService.findRanks('', currentUser.squad.fraction).subscribe(ranks => {
|
||||
this.ranks = ranks;
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this.router.navigate(['..'], {relativeTo: this.route});
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -51,6 +51,7 @@ export class AwardUserComponent implements OnInit {
|
|||
.subscribe(id => this.userId = id);
|
||||
}
|
||||
|
||||
|
||||
toggleDecoPreview(descriptionField, decorationId, image) {
|
||||
if (decorationId !== '0') {
|
||||
this.decoPreviewDisplay = 'flex'; // visible & keep same height for all children
|
||||
|
@ -71,10 +72,10 @@ export class AwardUserComponent implements OnInit {
|
|||
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)
|
||||
|
|
|
@ -53,12 +53,10 @@ export class EditUserComponent implements OnInit {
|
|||
user.squadId = '0';
|
||||
this.ranksDisplay = 'none';
|
||||
} else {
|
||||
this.rankService
|
||||
.findRanks('', user.squadId.fraction)
|
||||
.subscribe(ranks => {
|
||||
this.ranks = ranks;
|
||||
this.ranksDisplay = 'block';
|
||||
});
|
||||
this.rankService.findRanks('', user.squadId.fraction).subscribe(ranks => {
|
||||
this.ranks = ranks;
|
||||
this.ranksDisplay = 'block';
|
||||
});
|
||||
}
|
||||
this.user = user;
|
||||
});
|
||||
|
@ -70,14 +68,12 @@ export class EditUserComponent implements OnInit {
|
|||
|
||||
toggleRanks() {
|
||||
if (this.user.squadId !== '0') {
|
||||
this.rankService
|
||||
.findRanks('', this.user.squadId.fraction)
|
||||
.subscribe(
|
||||
ranks => {
|
||||
this.ranks = ranks;
|
||||
this.ranksDisplay = 'block';
|
||||
}
|
||||
);
|
||||
this.rankService.findRanks('', this.user.squadId.fraction).subscribe(
|
||||
ranks => {
|
||||
this.ranks = ranks;
|
||||
this.ranksDisplay = 'block';
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.ranksDisplay = 'none';
|
||||
}
|
||||
|
|
|
@ -34,5 +34,6 @@ export class UserItemComponent {
|
|||
delete() {
|
||||
this.userDelete.emit(this.user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ export class UserListComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.users$ = this.userService.users$;
|
||||
|
||||
const paramsStream = this.route.queryParams
|
||||
|
@ -105,4 +106,5 @@ export class UserListComponent implements OnInit {
|
|||
|
||||
this.location.replaceState(absoluteUrl, queryPart);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue