2019-02-25 10:10:41 +01:00
|
|
|
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
2019-02-25 00:16:19 +01:00
|
|
|
import {BaseConfig, RouteConfig} from '../../app.config';
|
|
|
|
import {LoginService} from '../../services/app-user-service/login-service';
|
|
|
|
import {PromotionService} from '../../services/army-management/promotion.service';
|
|
|
|
import {AwardingService} from '../../services/army-management/awarding.service';
|
|
|
|
import {environment} from '../../../environments/environment';
|
|
|
|
import {TranslateService} from '@ngx-translate/core';
|
|
|
|
import {SettingsService} from '../../services/settings.service';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-sidenav-list',
|
|
|
|
templateUrl: './sidenav-list.component.html',
|
|
|
|
styleUrls: ['./sidenav-list.component.scss']
|
|
|
|
})
|
|
|
|
export class SidenavListComponent implements OnInit {
|
|
|
|
|
|
|
|
@Output() sidenavClose = new EventEmitter();
|
|
|
|
|
|
|
|
@Output() userLogout = new EventEmitter();
|
|
|
|
|
2019-02-25 10:10:41 +01:00
|
|
|
@Input() currentUrl;
|
|
|
|
|
2019-02-25 00:16:19 +01:00
|
|
|
readonly features = environment.features;
|
|
|
|
|
|
|
|
readonly availableLanguages = BaseConfig.i18n.availableLanguages;
|
|
|
|
|
|
|
|
config = RouteConfig;
|
|
|
|
|
|
|
|
language;
|
|
|
|
|
|
|
|
constructor(public loginService: LoginService,
|
|
|
|
public promotionService: PromotionService,
|
|
|
|
public awardingService: AwardingService,
|
|
|
|
private translate: TranslateService,
|
|
|
|
private settingsService: SettingsService) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.settingsService.getLanguage().subscribe((language) => {
|
|
|
|
this.language = language;
|
|
|
|
this.translate.setDefaultLang(language)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public onSidenavClose() {
|
|
|
|
this.sidenavClose.emit();
|
|
|
|
};
|
|
|
|
|
|
|
|
public doUserLogout() {
|
|
|
|
this.userLogout.emit()
|
|
|
|
};
|
|
|
|
|
|
|
|
setLanguage(language: string) {
|
|
|
|
if (language) {
|
|
|
|
this.language = language;
|
|
|
|
this.settingsService.setLanguage(language);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|