Use snackbar for success/error labels; Add material loading indicator
parent
69f0ec41d6
commit
b7a3c69540
|
@ -2,11 +2,6 @@
|
||||||
|
|
||||||
<h2>Admin Panel</h2>
|
<h2>Admin Panel</h2>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="absolute-label label label-success label-small">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="pull-left" style="margin-top:20px;">
|
<div class="pull-left" style="margin-top:20px;">
|
||||||
<div class="table-container" style="width: 75%; min-width: 500px">
|
<div class="table-container" style="width: 75%; min-width: 500px">
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
|
|
|
@ -4,6 +4,8 @@ import {Observable} from 'rxjs/Observable';
|
||||||
import {AppUserService} from '../services/app-user-service/app-user.service';
|
import {AppUserService} from '../services/app-user-service/app-user.service';
|
||||||
import {SquadService} from '../services/army-management/squad.service';
|
import {SquadService} from '../services/army-management/squad.service';
|
||||||
import {Fraction} from '../utils/fraction.enum';
|
import {Fraction} from '../utils/fraction.enum';
|
||||||
|
import {SnackBarService} from '../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {Message} from '../i18n/de.messages';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -17,12 +19,11 @@ export class AdminComponent implements OnInit {
|
||||||
|
|
||||||
squads: Squad[] = [];
|
squads: Squad[] = [];
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
readonly fraction = Fraction;
|
readonly fraction = Fraction;
|
||||||
|
|
||||||
constructor(private appUserService: AppUserService,
|
constructor(private appUserService: AppUserService,
|
||||||
private squadService: SquadService) {
|
private squadService: SquadService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -46,10 +47,7 @@ export class AdminComponent implements OnInit {
|
||||||
|
|
||||||
this.appUserService.updateUser(updateObject)
|
this.appUserService.updateUser(updateObject)
|
||||||
.subscribe(resUser => {
|
.subscribe(resUser => {
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span *ngIf="loading" class="load-indicator load-arrow glyphicon-refresh-animate"></span>
|
<mat-spinner class="load-indicator" *ngIf="loading"></mat-spinner>
|
||||||
<div id="left">
|
<div id="left">
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,9 +23,11 @@ import {UserService} from './services/army-management/user.service';
|
||||||
import {UserStore} from './services/stores/user.store';
|
import {UserStore} from './services/stores/user.store';
|
||||||
import {CookieService} from 'ngx-cookie-service';
|
import {CookieService} from 'ngx-cookie-service';
|
||||||
import {SnackBarService} from './services/user-interface/snack-bar/snack-bar.service';
|
import {SnackBarService} from './services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {MaterialComponentsModule} from './material-components.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule],
|
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule,
|
||||||
|
MaterialComponentsModule],
|
||||||
providers: [
|
providers: [
|
||||||
HttpClient,
|
HttpClient,
|
||||||
LoginService,
|
LoginService,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {RouteConfig} from '../app.config';
|
||||||
import {AwardingService} from '../services/army-management/awarding.service';
|
import {AwardingService} from '../services/army-management/awarding.service';
|
||||||
import {Fraction} from '../utils/fraction.enum';
|
import {Fraction} from '../utils/fraction.enum';
|
||||||
import {DOCUMENT} from '@angular/common';
|
import {DOCUMENT} from '@angular/common';
|
||||||
import {CSSHelpers} from '../global.helpers';
|
import {CSSHelpers} from '../utils/global.helpers';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Fraction} from '../utils/fraction.enum';
|
import {Fraction} from '../utils/fraction.enum';
|
||||||
import {DOCUMENT} from '@angular/common';
|
import {DOCUMENT} from '@angular/common';
|
||||||
import {RouteConfig} from '../app.config';
|
import {RouteConfig} from '../app.config';
|
||||||
import {CSSHelpers} from '../global.helpers';
|
import {CSSHelpers} from '../utils/global.helpers';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
/**
|
|
||||||
* Angular material imports
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import {
|
|
||||||
MatSidenavModule,
|
|
||||||
MatFormFieldModule,
|
|
||||||
MatInputModule,
|
|
||||||
MatButtonModule,
|
|
||||||
MatCheckboxModule,
|
|
||||||
MatTableModule,
|
|
||||||
MatPaginatorModule,
|
|
||||||
MatSortModule,
|
|
||||||
MatIconModule,
|
|
||||||
MatSnackBarModule,
|
|
||||||
MatToolbarModule,
|
|
||||||
MatExpansionModule
|
|
||||||
} from '@angular/material';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
MatSidenavModule,
|
|
||||||
MatFormFieldModule,
|
|
||||||
MatInputModule,
|
|
||||||
MatButtonModule,
|
|
||||||
MatCheckboxModule,
|
|
||||||
MatTableModule,
|
|
||||||
MatPaginatorModule,
|
|
||||||
MatSortModule,
|
|
||||||
MatIconModule,
|
|
||||||
MatSnackBarModule,
|
|
||||||
MatToolbarModule,
|
|
||||||
MatExpansionModule
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
MatSidenavModule,
|
|
||||||
MatFormFieldModule,
|
|
||||||
MatInputModule,
|
|
||||||
MatButtonModule,
|
|
||||||
MatCheckboxModule,
|
|
||||||
MatTableModule,
|
|
||||||
MatPaginatorModule,
|
|
||||||
MatSortModule,
|
|
||||||
MatIconModule,
|
|
||||||
MatSnackBarModule,
|
|
||||||
MatToolbarModule,
|
|
||||||
MatExpansionModule
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
export class MaterialComponentsModule {}
|
|
|
@ -75,11 +75,4 @@
|
||||||
[disabled]="!form.valid">
|
[disabled]="!form.valid">
|
||||||
Bestätigen
|
Bestätigen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="label label-success label-small"
|
|
||||||
style="margin-left: inherit">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -5,6 +5,8 @@ import {Decoration} from '../../models/model-interfaces';
|
||||||
import {DecorationService} from '../../services/army-management/decoration.service';
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||||
import {Subscription} from 'rxjs/Subscription';
|
import {Subscription} from 'rxjs/Subscription';
|
||||||
import {Fraction} from '../../utils/fraction.enum';
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './edit-decoration.component.html',
|
templateUrl: './edit-decoration.component.html',
|
||||||
|
@ -22,15 +24,14 @@ export class EditDecorationComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
imagePreviewSrc;
|
imagePreviewSrc;
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
@ViewChild(NgForm) form: NgForm;
|
@ViewChild(NgForm) form: NgForm;
|
||||||
|
|
||||||
readonly fraction = Fraction;
|
readonly fraction = Fraction;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private decorationService: DecorationService) {
|
private decorationService: DecorationService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -81,10 +82,7 @@ export class EditDecorationComponent implements OnInit, OnDestroy {
|
||||||
this.imagePreviewSrc = 'resource/decoration/' + this.decoration._id + '.png?' + Date.now();
|
this.imagePreviewSrc = 'resource/decoration/' + this.decoration._id + '.png?' + Date.now();
|
||||||
}, 300);
|
}, 300);
|
||||||
fileInput.value = '';
|
fileInput.value = '';
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
export enum Message {
|
||||||
|
SIGN_UP_SUCCESS = 'Account erfolgreich erstellt',
|
||||||
|
SUCCESS_SAVE = 'Erfolgreich gespeichert',
|
||||||
|
DUPLICATED_NAME_ERR = 'Benutzername existiert bereits',
|
||||||
|
}
|
|
@ -21,28 +21,12 @@
|
||||||
<input #secret type="text" id="inputSecret" class="form-control" placeholder="Geheimer Text für PN Abgleich"
|
<input #secret type="text" id="inputSecret" class="form-control" placeholder="Geheimer Text für PN Abgleich"
|
||||||
required="">
|
required="">
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="submit" class="btn btn-lg btn-block btn-primary">
|
<button type="submit" class="btn btn-lg btn-block btn-primary">
|
||||||
<span *ngIf="!loading">Registrieren</span>
|
<span *ngIf="!loading">Registrieren</span>
|
||||||
<span *ngIf="loading" class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span>
|
<span *ngIf="loading" class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span>
|
||||||
</button>
|
</button>
|
||||||
<h3 class="text-center">
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="label label-success label-small"
|
|
||||||
style="margin-left: inherit">
|
|
||||||
Account erfolgreich erstellt
|
|
||||||
</span>
|
|
||||||
</h3>
|
|
||||||
<span *ngIf="showErrorLabel"
|
|
||||||
class="center-block label label-danger" style="font-size: medium; padding: 2px; margin-top: 2px">
|
|
||||||
{{error}}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ import {Component, OnInit} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {LoginService} from '../services/app-user-service/login-service';
|
import {LoginService} from '../services/app-user-service/login-service';
|
||||||
import {RouteConfig} from '../app.config';
|
import {RouteConfig} from '../app.config';
|
||||||
|
import {Message} from '../i18n/de.messages';
|
||||||
|
import {SnackBarService} from '../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -12,19 +14,14 @@ import {RouteConfig} from '../app.config';
|
||||||
|
|
||||||
export class SignupComponent implements OnInit {
|
export class SignupComponent implements OnInit {
|
||||||
|
|
||||||
showErrorLabel = false;
|
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
error: string;
|
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|
||||||
returnUrl: string;
|
returnUrl: string;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private loginService: LoginService) {
|
private loginService: LoginService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -41,15 +38,11 @@ export class SignupComponent implements OnInit {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SIGN_UP_SUCCESS);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.error = error;
|
|
||||||
this.showErrorLabel = true;
|
|
||||||
setTimeout(() => {
|
|
||||||
this.showErrorLabel = false;
|
|
||||||
}, 4000);
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
this.snackBarService.showError(error, 10000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
* Angular material imports
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import {
|
||||||
|
MatSidenavModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatCheckboxModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatPaginatorModule,
|
||||||
|
MatSortModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatSnackBarModule,
|
||||||
|
MatToolbarModule,
|
||||||
|
MatExpansionModule,
|
||||||
|
MatProgressSpinnerModule
|
||||||
|
} from '@angular/material';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
// MatSidenavModule,
|
||||||
|
// MatFormFieldModule,
|
||||||
|
// MatInputModule,
|
||||||
|
// MatButtonModule,
|
||||||
|
// MatCheckboxModule,
|
||||||
|
// MatTableModule,
|
||||||
|
// MatPaginatorModule,
|
||||||
|
// MatSortModule,
|
||||||
|
// MatIconModule,
|
||||||
|
MatSnackBarModule,
|
||||||
|
MatProgressSpinnerModule,
|
||||||
|
// MatToolbarModule,
|
||||||
|
// MatExpansionModule
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
// MatSidenavModule,
|
||||||
|
// MatFormFieldModule,
|
||||||
|
// MatInputModule,
|
||||||
|
// MatButtonModule,
|
||||||
|
// MatCheckboxModule,
|
||||||
|
// MatTableModule,
|
||||||
|
// MatPaginatorModule,
|
||||||
|
// MatSortModule,
|
||||||
|
// MatIconModule,
|
||||||
|
MatSnackBarModule,
|
||||||
|
MatProgressSpinnerModule,
|
||||||
|
// MatToolbarModule,
|
||||||
|
// MatExpansionModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
export class MaterialComponentsModule {}
|
|
@ -3,7 +3,7 @@ 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 '../../global.helpers';
|
import {CSSHelpers} from '../../utils/global.helpers';
|
||||||
import {RouteConfig} from '../../app.config';
|
import {RouteConfig} from '../../app.config';
|
||||||
import {Decoration} from '../../models/model-interfaces';
|
import {Decoration} from '../../models/model-interfaces';
|
||||||
import {DecorationService} from '../../services/army-management/decoration.service';
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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 '../../global.helpers';
|
import {CSSHelpers} from '../../utils/global.helpers';
|
||||||
import {RouteConfig} from '../../app.config';
|
import {RouteConfig} from '../../app.config';
|
||||||
import {Rank} from '../../models/model-interfaces';
|
import {Rank} from '../../models/model-interfaces';
|
||||||
import {RankService} from '../../services/army-management/rank.service';
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
|
|
|
@ -56,11 +56,4 @@
|
||||||
[disabled]="!form.valid">
|
[disabled]="!form.valid">
|
||||||
Bestätigen
|
Bestätigen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="label label-success label-small"
|
|
||||||
style="margin-left: inherit">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -5,6 +5,8 @@ import {Rank} from '../../models/model-interfaces';
|
||||||
import {RankService} from '../../services/army-management/rank.service';
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
import {Subscription} from 'rxjs/Subscription';
|
import {Subscription} from 'rxjs/Subscription';
|
||||||
import {Fraction} from '../../utils/fraction.enum';
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -25,15 +27,14 @@ export class EditRankComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
imagePreviewSrc;
|
imagePreviewSrc;
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
@ViewChild(NgForm) form: NgForm;
|
@ViewChild(NgForm) form: NgForm;
|
||||||
|
|
||||||
readonly fraction = Fraction;
|
readonly fraction = Fraction;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private rankService: RankService) {
|
private rankService: RankService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -85,10 +86,7 @@ export class EditRankComponent implements OnInit, OnDestroy {
|
||||||
this.imagePreviewSrc = 'resource/rank/' + this.rank._id + '.png?' + Date.now();
|
this.imagePreviewSrc = 'resource/rank/' + this.rank._id + '.png?' + Date.now();
|
||||||
}, 300);
|
}, 300);
|
||||||
fileInput.value = '';
|
fileInput.value = '';
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,11 +62,6 @@
|
||||||
Bestätigen
|
Bestätigen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="absolute-label label label-success label-small">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="table-container" *ngIf="showForm">
|
<div class="table-container" *ngIf="showForm">
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -6,6 +6,8 @@ import {AwardingService} from '../../services/army-management/awarding.service';
|
||||||
import {DecorationService} from '../../services/army-management/decoration.service';
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||||
import {UserService} from '../../services/army-management/user.service';
|
import {UserService} from '../../services/army-management/user.service';
|
||||||
import {LoginService} from '../../services/app-user-service/login-service';
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -18,8 +20,6 @@ export class RequestAwardComponent implements OnInit {
|
||||||
|
|
||||||
showForm = false;
|
showForm = false;
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
user: User = {_id: '0'};
|
user: User = {_id: '0'};
|
||||||
|
|
||||||
decoration: Decoration = {_id: '0'};
|
decoration: Decoration = {_id: '0'};
|
||||||
|
@ -39,7 +39,8 @@ export class RequestAwardComponent implements OnInit {
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private awardingService: AwardingService,
|
private awardingService: AwardingService,
|
||||||
private decorationService: DecorationService,
|
private decorationService: DecorationService,
|
||||||
private loginService: LoginService) {
|
private loginService: LoginService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -93,10 +94,7 @@ export class RequestAwardComponent implements OnInit {
|
||||||
this.decoration = {_id: '0'};
|
this.decoration = {_id: '0'};
|
||||||
this.reason = previewImage.src = descriptionField.innerHTML = '';
|
this.reason = previewImage.src = descriptionField.innerHTML = '';
|
||||||
this.decoPreviewDisplay = 'none';
|
this.decoPreviewDisplay = 'none';
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
<form #form="ngForm" class="overview">
|
<form #form="ngForm" class="overview">
|
||||||
<h3>Offene Anträge - Auszeichnungen</h3>
|
<h3>Offene Anträge - Auszeichnungen</h3>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="absolute-label label label-success label-small">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -2,6 +2,8 @@ import {Component, OnInit} from '@angular/core';
|
||||||
import {Award} from '../../models/model-interfaces';
|
import {Award} from '../../models/model-interfaces';
|
||||||
import {AwardingService} from '../../services/army-management/awarding.service';
|
import {AwardingService} from '../../services/army-management/awarding.service';
|
||||||
import {LoginService} from '../../services/app-user-service/login-service';
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -12,10 +14,9 @@ export class ConfirmAwardComponent implements OnInit {
|
||||||
|
|
||||||
awards: Award[];
|
awards: Award[];
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
constructor(private awardingService: AwardingService,
|
constructor(private awardingService: AwardingService,
|
||||||
private loginService: LoginService) {
|
private loginService: LoginService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -46,13 +47,8 @@ export class ConfirmAwardComponent implements OnInit {
|
||||||
if (awards.length < 1) {
|
if (awards.length < 1) {
|
||||||
this.awardingService.hasUnprocessedAwards = false;
|
this.awardingService.hasUnprocessedAwards = false;
|
||||||
}
|
}
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
<form #form="ngForm" class="overview">
|
<form #form="ngForm" class="overview">
|
||||||
<h3>Offene Anträge - Beförderung</h3>
|
<h3>Offene Anträge - Beförderung</h3>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="absolute-label label label-success label-small">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -55,6 +50,4 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -3,6 +3,8 @@ import {Promotion, Rank} from '../../models/model-interfaces';
|
||||||
import {RankService} from '../../services/army-management/rank.service';
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
import {PromotionService} from '../../services/army-management/promotion.service';
|
import {PromotionService} from '../../services/army-management/promotion.service';
|
||||||
import {LoginService} from '../../services/app-user-service/login-service';
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -11,15 +13,14 @@ import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
})
|
})
|
||||||
export class ConfirmPromotionComponent implements OnInit {
|
export class ConfirmPromotionComponent implements OnInit {
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
ranks: Rank[];
|
ranks: Rank[];
|
||||||
|
|
||||||
promotions: Promotion[];
|
promotions: Promotion[];
|
||||||
|
|
||||||
constructor(private rankService: RankService,
|
constructor(private rankService: RankService,
|
||||||
private promotionService: PromotionService,
|
private promotionService: PromotionService,
|
||||||
private loginService: LoginService) {
|
private loginService: LoginService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -50,12 +51,8 @@ export class ConfirmPromotionComponent implements OnInit {
|
||||||
if (promotions.length < 1) {
|
if (promotions.length < 1) {
|
||||||
this.promotionService.hasUnprocessedPromotion = false;
|
this.promotionService.hasUnprocessedPromotion = false;
|
||||||
}
|
}
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,6 @@
|
||||||
Bestätigen
|
Bestätigen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="absolute-label label label-success label-small">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<label>Beförderungsanträge</label>
|
<label>Beförderungsanträge</label>
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
|
|
|
@ -6,6 +6,8 @@ import {UserService} from '../../services/army-management/user.service';
|
||||||
import {RankService} from '../../services/army-management/rank.service';
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
import {PromotionService} from '../../services/army-management/promotion.service';
|
import {PromotionService} from '../../services/army-management/promotion.service';
|
||||||
import {LoginService} from '../../services/app-user-service/login-service';
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -18,8 +20,6 @@ export class RequestPromotionComponent implements OnInit {
|
||||||
|
|
||||||
showForm = false;
|
showForm = false;
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
user: User = {_id: '0'};
|
user: User = {_id: '0'};
|
||||||
|
|
||||||
newLevel: number;
|
newLevel: number;
|
||||||
|
@ -37,7 +37,8 @@ export class RequestPromotionComponent implements OnInit {
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private rankService: RankService,
|
private rankService: RankService,
|
||||||
private promotionService: PromotionService,
|
private promotionService: PromotionService,
|
||||||
private loginService: LoginService) {
|
private loginService: LoginService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -79,10 +80,7 @@ export class RequestPromotionComponent implements OnInit {
|
||||||
this.uncheckedPromotions = promotions;
|
this.uncheckedPromotions = promotions;
|
||||||
this.showForm = false;
|
this.showForm = false;
|
||||||
this.user = {_id: '0'};
|
this.user = {_id: '0'};
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ export class SnackBarService {
|
||||||
return this.show(message, undefined, 2500, ['custom-snack-bar', 'label-success']);
|
return this.show(message, undefined, 2500, ['custom-snack-bar', 'label-success']);
|
||||||
}
|
}
|
||||||
|
|
||||||
showError(message: string) {
|
showError(message: string, duration?: number) {
|
||||||
return this.show(message, 'OK', undefined, ['custom-snack-bar', 'label-danger']);
|
return this.show(message, 'OK', duration, ['custom-snack-bar', 'label-danger']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,10 @@ import {NgModule} from '@angular/core';
|
||||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
import {ShowErrorComponent} from './common/show-error/show-error.component';
|
import {ShowErrorComponent} from './common/show-error/show-error.component';
|
||||||
import {CommonModule} from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
import {MaterialComponentsModule} from './common/modules/material-components.module';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [ShowErrorComponent],
|
declarations: [ShowErrorComponent],
|
||||||
imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialComponentsModule],
|
imports: [CommonModule, FormsModule, ReactiveFormsModule],
|
||||||
exports: [FormsModule, ReactiveFormsModule, ShowErrorComponent],
|
exports: [FormsModule, ReactiveFormsModule, ShowErrorComponent],
|
||||||
})
|
})
|
||||||
export class SharedModule {
|
export class SharedModule {
|
||||||
|
|
|
@ -56,11 +56,4 @@
|
||||||
[disabled]="!form.valid">
|
[disabled]="!form.valid">
|
||||||
Bestätigen
|
Bestätigen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="label label-success label-small"
|
|
||||||
style="margin-left: inherit">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -5,6 +5,8 @@ import {Squad} from '../../models/model-interfaces';
|
||||||
import {SquadService} from '../../services/army-management/squad.service';
|
import {SquadService} from '../../services/army-management/squad.service';
|
||||||
import {Subscription} from 'rxjs/Subscription';
|
import {Subscription} from 'rxjs/Subscription';
|
||||||
import {Fraction} from '../../utils/fraction.enum';
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -23,8 +25,6 @@ export class EditSquadComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
showImageError = false;
|
showImageError = false;
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
imagePreviewSrc;
|
imagePreviewSrc;
|
||||||
|
|
||||||
@ViewChild(NgForm) form: NgForm;
|
@ViewChild(NgForm) form: NgForm;
|
||||||
|
@ -33,7 +33,8 @@ export class EditSquadComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private squadService: SquadService) {
|
private squadService: SquadService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -85,10 +86,7 @@ export class EditSquadComponent implements OnInit, OnDestroy {
|
||||||
this.imagePreviewSrc = 'resource/squad/' + this.squad._id + '.png?' + Date.now();
|
this.imagePreviewSrc = 'resource/squad/' + this.squad._id + '.png?' + Date.now();
|
||||||
}, 300);
|
}, 300);
|
||||||
fileInput.value = '';
|
fileInput.value = '';
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {NgForm} from '@angular/forms';
|
||||||
import {WarService} from '../../../services/logs/war.service';
|
import {WarService} from '../../../services/logs/war.service';
|
||||||
import {War} from '../../../models/model-interfaces';
|
import {War} from '../../../models/model-interfaces';
|
||||||
import {CampaignService} from '../../../services/logs/campaign.service';
|
import {CampaignService} from '../../../services/logs/campaign.service';
|
||||||
|
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -22,8 +23,6 @@ export class WarSubmitComponent {
|
||||||
|
|
||||||
showFileError = false;
|
showFileError = false;
|
||||||
|
|
||||||
showErrorLabel = false;
|
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|
||||||
error;
|
error;
|
||||||
|
@ -33,6 +32,7 @@ export class WarSubmitComponent {
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private warService: WarService,
|
private warService: WarService,
|
||||||
|
private snackBarService: SnackBarService,
|
||||||
public campaignService: CampaignService) {
|
public campaignService: CampaignService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,9 @@ export class WarSubmitComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveWar() {
|
saveWar() {
|
||||||
if (this.fileList) {
|
if (!this.fileList) {
|
||||||
|
return window.alert(`Logfile ist ein Pflichtfeld`);
|
||||||
|
}
|
||||||
const file: File = this.fileList[0];
|
const file: File = this.fileList[0];
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
|
@ -57,13 +59,10 @@ export class WarSubmitComponent {
|
||||||
this.router.navigate(['../war/' + war._id], {relativeTo: this.route});
|
this.router.navigate(['../war/' + war._id], {relativeTo: this.route});
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.error = error._body.error.message;
|
|
||||||
this.showErrorLabel = true;
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
const errorMsg = JSON.parse(error._body).error.message;
|
||||||
|
this.snackBarService.showError('Error: '.concat(errorMsg), 10000);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
return window.alert(`Logfile ist ein Pflichtfeld`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
|
|
|
@ -1,9 +1,38 @@
|
||||||
.load-indicator {
|
.load-indicator {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 48.5%;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
@media only screen and (max-width: 1199px) {
|
||||||
|
.load-indicator {
|
||||||
|
left: 46%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (min-width: 1200px) {
|
||||||
|
.load-indicator {
|
||||||
|
left: 46%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (min-width: 1376px) {
|
||||||
|
.load-indicator {
|
||||||
|
left: 46.5%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (min-width: 1600px) {
|
||||||
|
.load-indicator {
|
||||||
|
left: 47.5%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (min-width: 1925px) {
|
||||||
|
.load-indicator {
|
||||||
|
left: 48%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:host /deep/ .mat-progress-spinner circle, .mat-spinner circle {
|
||||||
|
stroke: #000000 !important;
|
||||||
|
stroke-linecap: round;
|
||||||
|
}
|
||||||
|
|
||||||
.load-arrow {
|
.load-arrow {
|
||||||
background: url(../../assets/loading.png) no-repeat;
|
background: url(../../assets/loading.png) no-repeat;
|
||||||
|
|
|
@ -58,12 +58,6 @@
|
||||||
Bestätigen
|
Bestätigen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span *ngIf="showSuccessLabel"
|
|
||||||
class="label label-success label-small"
|
|
||||||
style="margin-left: inherit">
|
|
||||||
Erfolgreich gespeichert
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -5,6 +5,8 @@ import {NgForm} from '@angular/forms';
|
||||||
import {AwardingService} from '../../services/army-management/awarding.service';
|
import {AwardingService} from '../../services/army-management/awarding.service';
|
||||||
import {DecorationService} from '../../services/army-management/decoration.service';
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||||
import {Fraction} from '../../utils/fraction.enum';
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -15,8 +17,6 @@ export class AwardUserComponent implements OnInit {
|
||||||
|
|
||||||
@ViewChild(NgForm) form: NgForm;
|
@ViewChild(NgForm) form: NgForm;
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
userId: string;
|
userId: string;
|
||||||
|
|
||||||
decorations: Decoration[];
|
decorations: Decoration[];
|
||||||
|
@ -30,7 +30,8 @@ export class AwardUserComponent implements OnInit {
|
||||||
constructor(private router: Router,
|
constructor(private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private awardingService: AwardingService,
|
private awardingService: AwardingService,
|
||||||
private decorationService: DecorationService) {
|
private decorationService: DecorationService,
|
||||||
|
private snackBarService: SnackBarService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -83,10 +84,7 @@ export class AwardUserComponent implements OnInit {
|
||||||
this.decoPreviewDisplay = 'none';
|
this.decoPreviewDisplay = 'none';
|
||||||
decorationField.value = undefined;
|
decorationField.value = undefined;
|
||||||
reasonField.value = previewImage.src = descriptionField.innerHTML = '';
|
reasonField.value = previewImage.src = descriptionField.innerHTML = '';
|
||||||
this.showSuccessLabel = true;
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -104,11 +102,7 @@ export class AwardUserComponent implements OnInit {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
this.showSuccessLabel = true;
|
|
||||||
setTimeout(() => {
|
|
||||||
this.showSuccessLabel = false;
|
|
||||||
}, 4000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,10 +56,4 @@
|
||||||
[disabled]="!form.valid">
|
[disabled]="!form.valid">
|
||||||
Bestätigen
|
Bestätigen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span *ngIf="showErrorLabel"
|
|
||||||
class="center-block label label-danger" style="font-size: medium; padding: 2px; margin-top: 2px">
|
|
||||||
{{error}}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {Subscription} from 'rxjs/Subscription';
|
||||||
import {NgForm} from '@angular/forms';
|
import {NgForm} from '@angular/forms';
|
||||||
import {Fraction} from '../../utils/fraction.enum';
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||||
|
import {Message} from '../../i18n/de.messages';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -26,12 +27,8 @@ export class EditUserComponent implements OnInit {
|
||||||
|
|
||||||
ranks: Rank[] = [];
|
ranks: Rank[] = [];
|
||||||
|
|
||||||
showSuccessLabel = false;
|
|
||||||
|
|
||||||
ranksDisplay = 'none';
|
ranksDisplay = 'none';
|
||||||
|
|
||||||
showErrorLabel = false;
|
|
||||||
|
|
||||||
error: string;
|
error: string;
|
||||||
|
|
||||||
readonly fraction = Fraction;
|
readonly fraction = Fraction;
|
||||||
|
@ -103,7 +100,7 @@ export class EditUserComponent implements OnInit {
|
||||||
user.squad = '0';
|
user.squad = '0';
|
||||||
}
|
}
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.snackBarService.showSuccess('Erfolgreich gespeichert');
|
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.userService.submitUser(updateObject)
|
this.userService.submitUser(updateObject)
|
||||||
|
@ -114,7 +111,7 @@ export class EditUserComponent implements OnInit {
|
||||||
error => {
|
error => {
|
||||||
// duplicated user error message
|
// duplicated user error message
|
||||||
if (error._body.includes('duplicate')) {
|
if (error._body.includes('duplicate')) {
|
||||||
this.snackBarService.showError('Benutzername existiert bereits');
|
this.snackBarService.showError(Message.DUPLICATED_NAME_ERR, 10000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue