*
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { UserProfileService, MenusService } from 'src/app/shared/services';
import { CookieService } from 'ngx-cookie-service';
brandName: string;
brandLogoImagePath: string;
isSystemUser: boolean = false;
+ languages: string[] = [];
+ result: any;
+
+ @Output() languageEvent = new EventEmitter();
constructor(public router: Router, private userProfileService: UserProfileService, private menusService: MenusService, private cookieService: CookieService) {
if(this.api.brandLogoImagePath != ''){
this.brandLogoImagePath = this.api.brandLogoImagePath;
}
+
+ this.menusService.getAllLanguages().subscribe(data =>{
+ this.result = data;
+ for(let lang of this.result.languageList ){
+ this.languages.push(lang);
+ }
+
+ this.menusService.getCurrentLang(this.loginSnippetUserid).subscribe(data=>{
+ this.result = data;
+ this.languages.map((obj:any)=>{
+ obj.selected = obj.languageId == parseInt(this.result.languageId);
+ }) ;
+ });
+ });
}
getUserInformation() {
onLoggedout() {
localStorage.removeItem('isLoggedin');
}
+
+ setLanguage(langId : string){
+
+ this.menusService.setLanguage(langId, this.loginSnippetUserid).subscribe(data =>{
+ this.languageEvent.emit(langId);
+ });
+ }
}