dashboard changes

production
Sultan Khan 7 years ago
parent 0bf7dbd72e
commit e083d0c783

@ -1,9 +1,9 @@
<!-- <ion-nav [root]="rootPage" #mycontent swipeBackEnabled="false"></ion-nav> --> <!-- <ion-nav [root]="rootPage" #mycontent swipeBackEnabled="false"></ion-nav> -->
<!-- (ionWillOpen)="menuOpened(true)" -->
<ion-app [dir]="direction"> <ion-app [dir]="direction">
<ion-split-pane> <ion-split-pane>
<ion-menu [side]=" direction === 'rtl' ? 'end' : 'start'" [swipeGesture]="false" (ionWillOpen)="menuOpened(true)" <ion-menu [side]=" direction === 'rtl' ? 'end' : 'start'" [swipeGesture]="false" >
(ionWillClose)="menuOpened(false)">
<ion-content class="sidebar-menu" > <ion-content class="sidebar-menu" >
<div class="header-div"> <div class="header-div">
<div class="centerDiv"> <div class="centerDiv">

@ -7,6 +7,8 @@ import { AuthenticatedUser } from "./hmg-common/services/authentication/models/a
import { TabsBarComponent } from "./hmg-common/ui/tabs-bar/tabs-bar.component"; import { TabsBarComponent } from "./hmg-common/ui/tabs-bar/tabs-bar.component";
import { KeyboardService } from "./hmg-common/services/keyboard/keyboard.service"; import { KeyboardService } from "./hmg-common/services/keyboard/keyboard.service";
import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response";
import { LazyLoadingService } from "./hmg-common/services/lazy-loading/lazy-loading.service"; import { LazyLoadingService } from "./hmg-common/services/lazy-loading/lazy-loading.service";
@Component({ @Component({
@ -20,7 +22,7 @@ export class AppComponent implements OnInit, AfterViewInit {
start: any = false; start: any = false;
menuList: any = []; menuList: any = [];
User_name_Emp: string = ""; User_name_Emp: string = "";
user_image: string = "../assets/imgs/profile.png" user_image: string = "../assets/imgs/profile.png";
menuSide: string = "left"; menuSide: string = "left";
notBadge: number; notBadge: number;
companyUrl: string = "../assets/imgs/CS.png"; companyUrl: string = "../assets/imgs/CS.png";
@ -33,7 +35,8 @@ export class AppComponent implements OnInit, AfterViewInit {
private platform: Platform, private platform: Platform,
private events: Events, private events: Events,
private keyboardService: KeyboardService, private keyboardService: KeyboardService,
private menu: MenuController private menu: MenuController,
private authService: AuthenticationService
) {} ) {}
ngOnInit() { ngOnInit() {
this.initializeApp(); this.initializeApp();
@ -48,20 +51,45 @@ export class AppComponent implements OnInit, AfterViewInit {
// this.statusBar.styleDefault(); // this.statusBar.styleDefault();
this.start = true; this.start = true;
this.watchLanguageChangeEvents(); this.watchLanguageChangeEvents();
// this.checkIfUserLoggedInBefore(); this.subscribeEvents();
this.keyboardService.watchKeyboard(); this.keyboardService.watchKeyboard();
}); });
}); });
} }
subscribeEvents() {
this.events.subscribe("setMenu", () => {
const user = this.authService
.loadAuthenticatedUser()
.subscribe((user: AuthenticatedUser) => {
if (user) {
this.companyUrl = user.CompanyImageURL
? user.CompanyImageURL
: "../assets/imgs/CS.png";
this.companyDesc = user.CompanyImageDescription
? user.CompanyImageDescription
: "Powered By Cloud Solutions";
this.User_name_Emp = user.EMPLOYEE_DISPLAY_NAME;
this.user_image = user.EMPLOYEE_IMAGE
? "data:image/png;base64," + user.EMPLOYEE_IMAGE
: "../assets/imgs/profile.png";
console.log(user);
} else {
console.log(user);
}
});
});
this.events.subscribe("getNotCount", badge => {
this.notBadge = badge;
});
}
private initializeDirection() { private initializeDirection() {
this.direction = TranslatorService.getCurrentDirection(); this.direction = TranslatorService.getCurrentDirection();
} }
private watchUserLoginChangeEvents() { private watchUserLoginChangeEvents() {
this.events.subscribe( this.events.subscribe(
AuthenticationService.LOGIN_EVENT, AuthenticationService.LOGIN_EVENT,
(user: AuthenticatedUser, time: Date) => { (user: AuthenticatedUser, time: Date) => {}
}
); );
} }
private watchLanguageChangeEvents() { private watchLanguageChangeEvents() {
@ -73,4 +101,11 @@ export class AppComponent implements OnInit, AfterViewInit {
}, 100); }, 100);
}); });
} }
logout() {
// let req:any={};
// this.menuService.disableSession(req).subscribe((result: any) => {
// });
this.cs.sharedService.clearAll();
this.cs.openLogin();
}
} }

@ -304,6 +304,8 @@ export class AuthenticationService {
user.P_SESSION_ID = result.P_SESSION_ID; user.P_SESSION_ID = result.P_SESSION_ID;
user.MobileNumber = result.EMPLOYEE_MOBILE_NUMBER; user.MobileNumber = result.EMPLOYEE_MOBILE_NUMBER;
user.TokenID = result.TokenID; user.TokenID = result.TokenID;
user.CompanyImageDescription=result.CompanyImageDescription;
user.CompanyImageURL=result.CompanyImageURL;
user.LogInTokenID = this.cs.sharedService.getSharedData( user.LogInTokenID = this.cs.sharedService.getSharedData(
"logindata" "logindata"
).LogInTokenID; ).LogInTokenID;

@ -75,4 +75,6 @@ USER_STATUS: string;
P_SESSION_ID:number; P_SESSION_ID:number;
MobileNumber:string; MobileNumber:string;
LogInTokenID:string; LogInTokenID:string;
CompanyImageDescription: string
CompanyImageURL: string
} }

@ -12,14 +12,14 @@
<ion-badge id="homeBadgeBtn" item-end>{{notBadge}}</ion-badge> <ion-badge id="homeBadgeBtn" item-end>{{notBadge}}</ion-badge>
</button> </button>
<div class="centerDiv" (click)="openPersonalInfo()"> <div class="centerDiv" (click)="openPersonalInfo()">
<p class="TxtPlace">{{ts.trPK('home','hello')}}, {{User_name_Emp}}, {{User_name_Emp}}</p> <p class="TxtPlace">{{ts.trPK('home','hello')}}, {{userData.EMPLOYEE_DISPLAY_NAME}}</p>
<div class="profileDiv"><ion-img class="profileImg" src="{{user_image}}"></ion-img></div> <div class="profileDiv"><ion-img class="profileImg" src="{{user_image}}"></ion-img></div>
</div> </div>
</div> </div>
<div> <div>
<div> <div>
<p class="dash-header text-caps">{{ts.trPK('home','dashboard')}}, {{User_name_Emp}}</p> <p class="dash-header text-caps">{{ts.trPK('home','dashboard')}}, {{userData.EMPLOYEE_DISPLAY_NAME}}</p>
</div> </div>
<div> <div>
<ion-grid class="cus-grid"> <ion-grid class="cus-grid">

@ -1,12 +1,12 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { MenuController } from "@ionic/angular"; import { MenuController,Events } from "@ionic/angular";
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response";
import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user"; import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user";
import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service"; import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service";
import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response"; import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response";
import { CommonService } from "src/app/hmg-common/services/common/common.service"; import { CommonService } from "src/app/hmg-common/services/common/common.service";
@Component({ @Component({
selector: "app-home", selector: "app-home",
templateUrl: "./home.page.html", templateUrl: "./home.page.html",
@ -21,7 +21,8 @@ export class HomePage implements OnInit {
public menu: MenuController, public menu: MenuController,
public authService: AuthenticationService, public authService: AuthenticationService,
public menuService: MenuService, public menuService: MenuService,
public common: CommonService public common: CommonService,
public events:Events
) {} ) {}
ngOnInit() { ngOnInit() {
@ -37,7 +38,9 @@ export class HomePage implements OnInit {
.loadAuthenticatedUser() .loadAuthenticatedUser()
.subscribe((user: AuthenticatedUser) => { .subscribe((user: AuthenticatedUser) => {
if (user) { if (user) {
this.events.publish('setMenu');
this.userData = user; this.userData = user;
this.user_image=user.EMPLOYEE_IMAGE?user.EMPLOYEE_IMAGE: this.user_image;
console.log(user); console.log(user);
} else { } else {
console.log(user); console.log(user);

Loading…
Cancel
Save