# Conflicts:
#	Mohem/src/app/app-routing.module.ts
#	Mohem/src/assets/localization/i18n.json
production
haroon amjad 7 years ago
commit 3b5da38b09

@ -9,8 +9,11 @@ const routes: Routes = [
},
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{ path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' },
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' }
];
@NgModule({

@ -1,9 +1,9 @@
<!-- <ion-nav [root]="rootPage" #mycontent swipeBackEnabled="false"></ion-nav> -->
<!-- (ionWillOpen)="menuOpened(true)" -->
<ion-app [dir]="direction">
<ion-split-pane>
<ion-menu [side]=" direction === 'rtl' ? 'end' : 'start'" [swipeGesture]="false" (ionWillOpen)="menuOpened(true)"
(ionWillClose)="menuOpened(false)">
<ion-menu [side]=" direction === 'rtl' ? 'end' : 'start'" [swipeGesture]="false" >
<ion-content class="sidebar-menu" >
<div class="header-div">
<div class="centerDiv">
@ -28,7 +28,7 @@
</button> -->
</ion-item>
<ion-item>
<ion-item (click)="profile()">
<ion-thumbnail slot="start" class="menu-thumb">
<img width="30" src="../assets/imgs/username.png" item-left >
</ion-thumbnail>
@ -36,7 +36,7 @@
{{ts.trPK('userProfile','title')}}
</ion-label>
</ion-item>
<ion-item>
<ion-item (click)="logout();">
<ion-thumbnail slot="start" class="menu-thumb">

@ -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 { 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";
@Component({
@ -20,7 +22,7 @@ export class AppComponent implements OnInit, AfterViewInit {
start: any = false;
menuList: any = [];
User_name_Emp: string = "";
user_image: string = "../assets/imgs/profile.png"
user_image: string = "../assets/imgs/profile.png";
menuSide: string = "left";
notBadge: number;
companyUrl: string = "../assets/imgs/CS.png";
@ -33,7 +35,8 @@ export class AppComponent implements OnInit, AfterViewInit {
private platform: Platform,
private events: Events,
private keyboardService: KeyboardService,
private menu: MenuController
private menu: MenuController,
private authService: AuthenticationService
) {}
ngOnInit() {
this.initializeApp();
@ -48,20 +51,45 @@ export class AppComponent implements OnInit, AfterViewInit {
// this.statusBar.styleDefault();
this.start = true;
this.watchLanguageChangeEvents();
// this.checkIfUserLoggedInBefore();
this.subscribeEvents();
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() {
this.direction = TranslatorService.getCurrentDirection();
}
private watchUserLoginChangeEvents() {
this.events.subscribe(
AuthenticationService.LOGIN_EVENT,
(user: AuthenticatedUser, time: Date) => {
}
(user: AuthenticatedUser, time: Date) => {}
);
}
private watchLanguageChangeEvents() {
@ -73,4 +101,14 @@ export class AppComponent implements OnInit, AfterViewInit {
}, 100);
});
}
logout() {
this.cs.sharedService.clearAll();
this.menu.toggle();
this.cs.openLogin();
}
profile() {
this.cs.openProfile();
this.menu.toggle();
}
}

@ -6,25 +6,16 @@
<ion-title color="light" > {{'login,forgot-password' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-grid>
<ion-item>
<img class="item-icon" src="assets/imgs/username.png" item-start />
<ion-label>{{ts.trPK('login','username')}}</ion-label>
<ion-input required type="text" [(ngModel)]="P_USER_NAME">
</ion-input>
<ion-input required type="text" [(ngModel)]="P_USER_NAME">
</ion-input>
</ion-item>
</ion-grid>
<page-trailer [small]="true"></page-trailer>
</ion-content>
<ion-footer>
<div class="centerDiv">

@ -6,11 +6,8 @@ import { AlertController } from '@ionic/angular';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request';
import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response';
import { CheckActivationCodeRequest } from 'src/app/hmg-common/services/authentication/models/check-activation-code.request';
import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.service';
import { ForgotFileIDResponse } from '../../hmg-common/services/authentication/models/forgot-File-ID.response';
import { InternationalMobileComponent } from 'src/app/hmg-common/ui/mobile-number/international-mobile/international-mobile.component';
import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model';
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
import { Password } from '../models/password';
@ -21,7 +18,7 @@ import { LoginModel } from '../models/LoginModel';
templateUrl: './check-user.component.html',
styleUrls: ['./check-user.component.scss'],
})
export class CheckUserComponent implements OnInit,OnDestroy {
export class CheckUserComponent implements OnInit {
public P_USER_NAME : string;
private loginData = new LoginModel();
@ -37,10 +34,6 @@ export class CheckUserComponent implements OnInit,OnDestroy {
ngOnInit() {}
ngOnDestroy(): void {
this.smsService.stopSMSMonitoring();
}
public onForgot() {
this.sendSMSForForgotPassword();
}
@ -53,17 +46,12 @@ export class CheckUserComponent implements OnInit,OnDestroy {
this.authService.checkUserAuthentication(
request,
() => {
//this.sendSMSForForgotPassword();
/* Write code for error */
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
this.checkUserResult = result;
this.cs.stopLoading();
this.sendSMSForForgotPassword();
// if (result.isSMSSent) {
// this.startReceivingSMS();
// this.presentSMSPasswordDialog();
// }
}
});
}
@ -76,11 +64,12 @@ export class CheckUserComponent implements OnInit,OnDestroy {
changePwdObj.MobileNumber= this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;
changePwdObj.P_USER_NAME=this.P_USER_NAME;
changePwdObj.P_MOBILE_NUMBER=this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;
this.authService.sendPublicSMS(
changePwdObj,
() => {
this.sendSMSForForgotPassword();
//this.sendSMSForForgotPassword();
/* Write code for error */
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
this.checkUserResult = result;
@ -94,5 +83,4 @@ export class CheckUserComponent implements OnInit,OnDestroy {
this.cs.openSMSPage();
}});
}
}
}

@ -1,7 +1,2 @@
.header-toolbar{
--background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%);
}
.btnBack{
background: transparent;
}

@ -4,13 +4,9 @@ import { AuthenticationService } from 'src/app/hmg-common/services/authenticatio
import { Router } from '@angular/router';
import { AlertController } from '@ionic/angular';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request';
import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response';
import { CheckActivationCodeRequest } from 'src/app/hmg-common/services/authentication/models/check-activation-code.request';
import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.service';
import { ForgotFileIDResponse } from '../../hmg-common/services/authentication/models/forgot-File-ID.response';
import { InternationalMobileComponent } from 'src/app/hmg-common/ui/mobile-number/international-mobile/international-mobile.component';
import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model';
import { ForgetPassword } from '../models/forget.password';
import { LoginModel } from '../models/LoginModel';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
@ -20,7 +16,7 @@ import { SharedDataService } from 'src/app/hmg-common/services/shared-data-servi
templateUrl: './forgot.component.html',
styleUrls: ['./forgot.component.scss']
})
export class ForgotComponent implements OnInit,OnDestroy {
export class ForgotComponent implements OnInit {
private loginData = new LoginModel();
public P_NEW_PASSWORD: string;
@ -42,10 +38,6 @@ export class ForgotComponent implements OnInit,OnDestroy {
ngOnInit() {
}
ngOnDestroy(): void {
this.smsService.stopSMSMonitoring();
}
public onForgot() {
this.sendSMSForForgotPassword();
}
@ -81,7 +73,7 @@ export class ForgotComponent implements OnInit,OnDestroy {
if (this.cs.validResponse(result)) {
this.checkUserResult = result;
console.log(result);
this.cs.toastPK("changePassword","passwordchanged");
this.cs.toastPK("changePassword","successChange");
this.cs.openLogin();
}
});

@ -1,25 +1,12 @@
import {
Component,
OnInit,
ViewChild,
ChangeDetectorRef,
NgZone,
OnDestroy
} from "@angular/core";
import { Component, OnInit, NgZone, OnDestroy } from "@angular/core";
import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { Router } from "@angular/router";
import { AlertController } from "@ionic/angular";
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { CheckUserAuthenticationRequest } from "src/app/hmg-common/services/authentication/models/check-user-auth.request";
import { CheckUserAuthenticationResponse } from "src/app/hmg-common/services/authentication/models/check-user-auth.response";
import { CheckActivationCodeResponse } from "src/app/hmg-common/services/authentication/models/check-activation-code.response";
import { SmsReaderService } from "src/app/hmg-common/services/sms/sms-reader.service";
import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user";
import { PATIENT_TYPE } from "src/app/hmg-common/services/models/patient.type";
import { FingerprintAIO } from "@ionic-native/fingerprint-aio/ngx";
import { GetLoginInfoRequest } from "src/app/hmg-common/services/authentication/models/get-login-info.request";
import { GetLoginInfoResponse } from "src/app/hmg-common/services/authentication/models/get-login-info.response";
import { Device } from "@ionic-native/device/ngx";
import { SplashScreen } from "@ionic-native/splash-screen/ngx";
import { SharedDataService } from "src/app/hmg-common/services/shared-data-service/shared-data.service";
@ -27,439 +14,95 @@ import { LoginModel } from "../models/LoginModel";
import { LoginRequest } from "src/app/hmg-common/services/authentication/models/login.request";
@Component({
selector: "login",
templateUrl: "./login.component.html",
styleUrls: ["./login.component.scss"]
selector: "login",
templateUrl: "./login.component.html",
styleUrls: ["./login.component.scss"]
})
export class LoginComponent implements OnInit, OnDestroy {
appLang: number = 1;
isExpired: boolean = false;
isSupportAr: boolean = false;
isAppleStore: boolean = false;
memberLogin: any = {};
private password: string;
private language: string;
private username: string;
private currentLang: any = 1;
private patientOutSA: boolean;
private loginTokenID: string;
private isMobileFingerPrint: boolean;
private FingerPrintPatientIdentificationID: string;
private loginData = new LoginModel();
constructor(
public cs: CommonService,
public authService: AuthenticationService,
public router: Router,
public alertController: AlertController,
public ts: TranslatorService,
public smsService: SmsReaderService,
private faio: FingerprintAIO,
public ngZone: NgZone,
public device: Device,
public splash: SplashScreen,
public sharedData: SharedDataService
) {}
ngOnInit() {}
ngOnDestroy(): void {
this.backClicked();
}
public changeLanguage() {
this.ts.switchLanguage();
if (TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN) {
this.language = "US";
} else {
this.language = "AR";
appLang: number = 1;
isExpired: boolean = false;
isSupportAr: boolean = false;
isAppleStore: boolean = false;
memberLogin: any = {};
private password: string;
private language: string;
private username: string;
private currentLang: any = 1;
private patientOutSA: boolean;
private loginTokenID: string;
private isMobileFingerPrint: boolean;
private FingerPrintPatientIdentificationID: string;
private loginData = new LoginModel();
constructor(
public cs: CommonService,
public authService: AuthenticationService,
public router: Router,
public alertController: AlertController,
public ts: TranslatorService,
public smsService: SmsReaderService,
private faio: FingerprintAIO,
public ngZone: NgZone,
public device: Device,
public splash: SplashScreen,
public sharedData: SharedDataService
) { }
ngOnInit() { }
ngOnDestroy(): void {
this.backClicked();
}
this.currentLang = TranslatorService.getCurrentLanguageCode();
}
// private checkIfLoggedInBefore() {
// this.cs.startLoading();
// // check if user logged in before
// this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
// if (user) {
// this.startBiometricLogin(user);
// } else {
// this.hideSplashScreen(true);
// }
// });
// }
private forgetPasswordPage() {
this.cs.openUserForgot();
}
private hideSplashScreen(stopLoading = false) {
// this.splash.hide();
if (stopLoading) {
this.cs.stopLoading();
}
}
// private startBiometricLogin(user: AuthenticatedUser) {
// this.faio.isAvailable().then((options) => {
// this.hideSplashScreen(true);
// if (user.biometricEnabled) {
// // ask if login with face or finger
// this.cs.presentConfirmDialog(
// this.ts.trPK('login', options),
// () => this.presentBiometricDialog(user),
// () => { }
// );
// } else {
// // ask to enable biometric
// this.getPermissionToActivateBiometric(user);
// }
// }, () => {
// this.hideSplashScreen(true);
// });
// }
private getPermissionToActivateBiometric(user: AuthenticatedUser) {
this.cs.presentConfirmDialog(
this.ts.trPK("login", "enable-biometric"),
() => {
user["biometricEnabled"] = true;
this.authService
.updateLoggedInUser(user)
.subscribe((success: boolean) => {
this.presentBiometricDialog(user);
});
},
() => {}
);
}
/*
activate biometric login for this user
*/
private getMobileInfo(user: AuthenticatedUser) {
this.authService
.getLoginInfo(
new GetLoginInfoRequest(user),
() => {},
this.ts.trPK("general", "ok")
)
.subscribe((result: GetLoginInfoResponse) => {
if (this.cs.validResponse(result)) {
if (!result.SMSLoginRequired) {
this.loginTokenID = result.LogInTokenID;
this.patientOutSA = result.PatientOutSA;
this.initializeForAuthentictedUser(user);
// sms for register the biometric
if (result.isSMSSent) {
this.startListeneingForSMS(
this.ts.trPK("general", "enter-sms-enable-biometric")
);
} else {
this.checkActivationCode();
}
}
public changeLanguage() {
this.ts.switchLanguage();
if (TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN) {
this.language = "US";
} else {
this.language = "AR";
}
});
}
private initializeForAuthentictedUser(user: AuthenticatedUser) {
this.ngZone.run(() => {
//this.isMobileFingerPrint = true;
//this.FingerPrintPatientIdentificationID = user.IdentificationNo;
//this.mobileNumber = user.MobileNumber;
//this.zipCode = CountryCode.localCode(user.ZipCode);
});
}
private presentBiometricDialog(user) {
this.faio
.show({
clientId: "Fingerprint Authetnciation",
clientSecret: "Ate343_9347lajF", // Only necessary for Android
disableBackup: true, // Only for Android(optional)
localizedFallbackTitle: this.ts.trPK("login", "use-pin"), // Only for iOS
localizedReason: this.ts.trPK("login", "auth-please") // Only for iOS
})
.then((result: any) => {
// this.checkActivationCode();
this.getMobileInfo(user);
})
.catch((error: any) => console.log(error));
}
public onLogin() {
this.checkUserAuthentication();
}
// public loginWithMyAccount() {
// // this.loginWithTamer();
// this.loginWithTamer();
// }
/*
TODO to be removed later
*/
// public loginWithEnas() {
// alert('you are doing slient login width enas account ');
// const user = new AuthenticatedUser();
// user.PatientID = 862616;
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
// user.PatientOutSA = false;
// user.TokenID = '@dm!n';
// user.ProjectID = 0;
// user.NationalityID = '2300948375';
// user.MobileNo = user.MobileNumber = '554355126';
// user.ZipCode = '+966';
// user.Address = 'riyadh';
// user.FirstName = 'MOHAMED';
// user.MiddleName = 'yaghi';
// user.LastName = 'mohammed';
// user.Age = 30;
// user.agreed = true;
// const birthDate = new Date();
// birthDate.setFullYear(birthDate.getFullYear() - 29);
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
// user.Email = 'Mohamed.Afifi@cloudsolution-sa.com';
// user.PatientName = 'enas yaghi';
// this.authService.updateLoggedInUser(user).subscribe(done => {
// this.authService.startIdleMonitoring();
// this.cs.openHome();
// });
// }
// public loginWithVaccineUser() {
// alert('you are doing slient login width vaccine account ');
// const user = new AuthenticatedUser();
// user.PatientID = 862616; // user with vaccines in dev
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
// user.PatientOutSA = false;
// user.TokenID = '@dm!n';
// user.NationalityID = '2300948375';
// user.MobileNo = user.MobileNumber = '554355126';
// user.ProjectID = 0;
// user.ZipCode = '+966';
// user.Address = 'riyadh';
// user.FirstName = 'MOHAMED';
// user.MiddleName = 'yaghi';
// user.LastName = 'mohammed';
// user.Age = 30;
// user.agreed = true;
// const birthDate = new Date();
// birthDate.setFullYear(birthDate.getFullYear() - 29);
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
// user.Email = 'minna.barry@cloudsolution-sa.com';
// user.PatientName = 'enas yaghi';
// this.authService.updateLoggedInUser(user).subscribe(done => {
// this.authService.startIdleMonitoring();
// this.cs.openHome();
// });
// }
// public loginWithEyeMeasureUser() {
// alert('you are doing slient login width eye measurements user account ');
// const user = new AuthenticatedUser();
// user.PatientID = 873010;
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
// user.PatientOutSA = false;
// user.TokenID = '@dm!n';
// user.NationalityID = '2302581828';
// user.ProjectID = 0;
// user.MobileNo = user.MobileNumber = '555333541';
// user.ZipCode = '+966';
// user.Address = 'riyadh';
// user.FirstName = 'eye';
// user.MiddleName = 'user';
// user.LastName = 'measurment';
// user.Age = 30;
// user.agreed = true;
// const birthDate = new Date();
// birthDate.setFullYear(birthDate.getFullYear() - 29);
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
// user.Email = 'sultan.khan@hmg.local';
// user.PatientName = 'eye user';
// this.authService.updateLoggedInUser(user).subscribe(done => {
// this.authService.startIdleMonitoring();
// this.cs.openHome();
// });
// }
/*
TODO login with mr rwaid
*/
// public loginWithRwaid() {
// alert('you are doing slient login width mr: rwaid account');
// const user = new AuthenticatedUser();
// // tamer with eye measurments 1231755
// user.PatientID = 1018977;
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
// user.ProjectID = 0;
// user.PatientOutSA = false;
// user.TokenID = '@dm!n';
// user.NationalityID = '1001242559';
// user.MobileNo = user.MobileNumber = '545156035';
// user.ZipCode = '+966';
// user.Address = 'riyadh';
// user.FirstName = 'rwaid';
// user.MiddleName = 'el mallah';
// user.LastName = 'mohammed';
// user.Age = 30;
// user.agreed = true;
// const birthDate = new Date();
// birthDate.setFullYear(birthDate.getFullYear() - 29);
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
// user.Email = 'mohamed.afifi@cloudsolution-sa.com';
// user.PatientName = 'rwaid al mallah';
// this.authService.updateLoggedInUser(user).subscribe(done => {
// this.authService.startIdleMonitoring();
// this.cs.openHome();
// });
// }
// public loginWithTamer() {
// alert('you are doing slient login width tamer account');
// const user = new AuthenticatedUser();
// user.PatientID = 1231755;
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
// user.ProjectID = 0;
// user.PatientOutSA = false;
// user.TokenID = '@dm!n';
// user.NationalityID = '1001242559';
// user.MobileNo = user.MobileNumber = '537503378';
// user.ZipCode = '+966';
// user.Address = 'riyadh';
// user.FirstName = 'tamer';
// user.MiddleName = 'faneshah';
// user.LastName = 'faneshah';
// user.Age = 30;
// user.agreed = true;
// const birthDate = new Date();
// birthDate.setFullYear(birthDate.getFullYear() - 29);
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
// user.Email = 'mohamed.afifi@cloudsolution-sa.com';
// user.PatientName = 'tamer fneshah';
// this.authService.updateLoggedInUser(user).subscribe(done => {
// this.authService.startIdleMonitoring();
// this.cs.openHome();
// });
// }
private startListeneingForSMS(title?: string) {
this.startReceivingSMS();
//this.presentSMSPasswordDialog(title);
}
private checkUserAuthentication() {
const request = new LoginRequest();
request.P_USER_NAME = this.username;
request.P_LANGUAGE = this.language;
request.P_PASSWORD = this.password;
console.log(request);
this.authService
.login(request, () => {}, this.ts.trPK("general", "ok"))
.subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
this.loginData.LogInTokenID = result.LogInTokenID;
this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER;
this.sharedData.setSharedData(this.loginData, "logindata");
this.cs.openSMSPage();
this.currentLang = TranslatorService.getCurrentLanguageCode();
}
private forgetPasswordPage() {
this.cs.openUserForgot();
}
private hideSplashScreen(stopLoading = false) {
// this.splash.hide();
if (stopLoading) {
this.cs.stopLoading();
}
});
}
public backClicked() {
this.smsService.stopSMSMonitoring();
}
}
private startReceivingSMS() {
// this.smsModal.presentModal();
// this.smsService.startSMSMonitoring((code) => {
// this.smsModal.dismiss;
// this.global_code = code;
// SMSService.code = this.global_code;
// this.checkActivationCode(code);
// this.cs.dismissSMSDialog().subscribe(cleared => {
// this.checkActivationCode(code);
// });
// });
}
public presentSMSPasswordDialog(title?: string) {
this.cs.presentSMSPasswordDialog(
(code: string) => {
this.checkActivationCode(code);
},
null,
title
);
}
private checkActivationCode(readedCode?) {
/*const request = new CheckActivationCodeRequest();
request.IsMobileFingerPrint = this.isMobileFingerPrint;
request.FingerPrintPatientIdentificationID = this.FingerPrintPatientIdentificationID;
request.LogInTokenID = this.loginTokenID;
request.PatientOutSA = this.patientOutSA ? 1 : 0;
request.activationCode = readedCode || '0000';
request.IsSilentLogin = !readedCode;
request.PatientMobileNumber = this.mobileNumber;
request.ZipCode = this.zipCode;
request.isRegister = false;*/
// request.SearchType = this.loginType;
// if (this.loginType === LoginComponent.IDENTIFCIATION_LOGIN_TYPE) {
// request.PatientIdentificationID = this.id;
// request.PatientID = 0;
// } else {
// request.PatientID = Number(this.id);
// request.PatientIdentificationID = '';
// }
// this.authService.checkActivationCode(
// request,
// () => {
// //this.presentSMSPasswordDialog();
// this.smsModal.presentModal();
// }, this.ts.trPK('general', 'retry')).subscribe((result: CheckActivationCodeResponse) => {
// if (this.cs.validResponse(result)) {
// if (this.cs.hasData(result.List)) {
// this.smsService.stopSMSMonitoring();
// this.checkIfUserAgreedBefore(result);
// }
// }
// });
}
private checkIfUserAgreedBefore(result: CheckActivationCodeResponse) {
this.authService.setAuthenticatedUser(result).subscribe(() => {
// if (this.authService.isAgreedBefore()) {
// this.cs.openHome();
// } else {
// // this.cs.openAgreement();
// }
});
}
public onLogin() {
this.checkUserAuthentication();
}
private checkUserAgreement() {}
private checkUserAuthentication() {
this.cs.startLoading();
const request = new LoginRequest();
request.P_USER_NAME = this.username;
request.P_LANGUAGE = this.language;
request.P_PASSWORD = this.password;
console.log(request);
this.authService
.login(request, () => { }, this.ts.trPK("general", "ok"))
.subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
this.loginData.LogInTokenID = result.LogInTokenID;
this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER;
this.sharedData.setSharedData(this.loginData, "logindata");
this.cs.stopLoading();
this.cs.openSMSPage();
}
});
}
public signOut() {
// this.cs.presentConfirmDialog(this.ts.trPK('login', 'sign-out'),
// () => {
// this.authService.clearUser().subscribe(success => {
// this.id = null;
// if (this.countryCode) {
// this.internationlMobile.setMobileNumber(this.countryCode.code, null);
// }
// });
// });
}
public backClicked() {
this.smsService.stopSMSMonitoring();
}
public openForgotID() {
this.cs.openUserForgot();
}
public openForgotID() {
this.cs.openUserForgot();
}
public onDismiss() {
// this.global_code = SMSService.code;
//this.checkActivationCode(this.global_code);
}
public onCancelled() {
console.log("Modal pop up cancelled");
}
}

@ -120,8 +120,6 @@ export class SmsPagePage implements OnInit {
}
} else {
let msg: string = this.translate.trPK("general", "noOfTriesLogin");
//this.common.showAlert(msg);
//this.navCtrl.pop(); goBack
this.common.JustAlertDialog(this.translate.trPK("general", "ok"), msg);
}
}
@ -138,7 +136,6 @@ export class SmsPagePage implements OnInit {
.subscribe((result: SMSCheckResponse) => {
console.log(result);
if (this.common.validResponse(result)) {
//this.sharedData.setSharedData(this.loginData, SmsPagePage.LOGIN_DATA);
this.authService.setAuthenticatedUser(result).subscribe(() => {
this.common.openHome();
});
@ -152,8 +149,6 @@ export class SmsPagePage implements OnInit {
(request.LogInTokenID = data.LogInTokenID),
(request.activationCode = this.activationCode);
//request.P_USER_NAME=this.userName,
//request.MobileNumber=this.member.MemberLoginList.P_MOBILE_NUMBER
console.log(data.LogInTokenID);
this.authService
@ -162,9 +157,6 @@ export class SmsPagePage implements OnInit {
console.log(result);
if (this.common.validResponse(result)) {
console.log(result);
//this.loginData.LogInTokenID = result.LogInTokenID;
//this.sharedData.setSharedData(this.loginData, "logindata");
this.common.openForgotPassword();
}
});

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

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

@ -9,5 +9,8 @@ export class CheckActivationCodeResponse extends Response {
LogInTokenID:string;
EMPLOYEE_MOBILE_NUMBER:string;
TokenID:string;
CompanyImageDescription:string;
CompanyImageURL: string;
MemberInformationList:AuthenticatedUser[];
}

@ -10,5 +10,7 @@ export class SMSCheckResponse extends Response {
public P_SESSION_ID: number;
public MobileNumber : string;
public LogInTokenID : string;
public CompanyImageDescription:string;
public CompanyImageURL:string;
public EMPLOYEE_MOBILE_NUMBER:string;
}

@ -248,7 +248,7 @@ export class CommonService {
public userNeedToReLogin() {
this.presentConfirmDialog(this.ts.trPK("general", "relogin"), () => {
//this.openUserLogin();
this.openLogin();
});
}
@ -892,6 +892,9 @@ export class CommonService {
public openForgotPassword() {
this.nav.navigateForward(["/authentication/forgot"]);
}
public openProfile() {
this.nav.navigateForward(["/profile/home"]);
}
public reload(url: string, from: string) {
console.log("force reload called from:" + from);

@ -121,7 +121,7 @@ export class ConnectorService {
if (!this.cs.validResponse(result)) {
// not authorized
if (result.ErrorType === 2) {
// this.cs.userNeedToReLogin();
this.cs.userNeedToReLogin();
} else {
this.cs.showErrorMessageDialog(onError, errorLabel, result.ErrorEndUserMessage);
}

@ -53,7 +53,7 @@ export class ProgressLoadingService {
const template =
// tslint:disable-next-line:quotemark
"<div class='container' > " +
"<img class='loading-gif' src='assets/icon/progress-loading.gif' >" +
"<img class='loading-gif' src='assets/icon/moving.gif' >" +
" <p class='title' >" + message + "</p>" + "</div>";
return template;

@ -12,14 +12,14 @@
<ion-badge id="homeBadgeBtn" item-end>{{notBadge}}</ion-badge>
</button>
<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>
</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')}}</p>
</div>
<div>
<ion-grid class="cus-grid">

@ -1,12 +1,12 @@
import { Component, OnInit } from "@angular/core";
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 { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response";
import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user";
import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service";
import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response";
import { CommonService } from "src/app/hmg-common/services/common/common.service";
@Component({
selector: "app-home",
templateUrl: "./home.page.html",
@ -21,7 +21,8 @@ export class HomePage implements OnInit {
public menu: MenuController,
public authService: AuthenticationService,
public menuService: MenuService,
public common: CommonService
public common: CommonService,
public events:Events
) {}
ngOnInit() {
@ -32,11 +33,13 @@ export class HomePage implements OnInit {
this.menu.toggle();
}
private getUserDetails() {
const user = this.authService
this.authService
.loadAuthenticatedUser()
.subscribe((user: AuthenticatedUser) => {
if (user) {
this.events.publish('setMenu');
this.userData = user;
this.user_image = user.EMPLOYEE_IMAGE ? "data:image/png;base64,"+user.EMPLOYEE_IMAGE : this.user_image;
console.log(user);
} else {
console.log(user);

@ -0,0 +1,111 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" defaultHref="/home"></ion-back-button>
</ion-buttons>
<ion-title color="light" > {{ts.trPK('userProfile','title')}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-card *ngIf="personalInfo">
<ion-card-header class="boxHdr">
<div class="hrTitle">{{personalInfo.EMPLOYEE_NAME}}</div>
</ion-card-header>
<ion-card-content>
<div>
<div class="centerDiv profileDiv">
<!-- <p class="TxtPlace boldTxt">{{User_name_Emp}}</p> -->
<ion-img class="profileImg" [src]="imageSrc"></ion-img>
</div>
<ion-grid class="profile-grid">
<div>
<ion-row>
<ion-col class="colBold" size="5">
<label> {{ts.trPK('userProfile','empNo')}}</label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.EMPLOYEE_NUMBER}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','busG')}}</label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.BUSINESS_GROUP_NAME}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','job')}}</label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.JOB_NAME}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','locName')}}</label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.LOCATION_NAME}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','payrol')}}</label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.PAYROLL_NAME}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','orgEmail')}}</label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.EMPLOYEE_EMAIL_ADDRESS}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','orgName')}} </label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.ORGANIZATION_NAME}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','position')}}</label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.POSITION_NAME}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','grade')}} </label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.GRADE_NAME}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold" size="5">
<label>{{ts.trPK('userProfile','category')}}</label>
</ion-col>
<ion-col size="7">
<label>{{personalInfo.EMPLOYMENT_CATEGORY_MEANING}}</label>
</ion-col>
</ion-row>
</div>
</ion-grid>
</div>
</ion-card-content>
</ion-card>
</ion-content>

@ -0,0 +1,3 @@
ion-col.colBold, ion-col.colBold > label{
font-weight:bold;
}

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,38 @@
import { Component, OnInit } from "@angular/core";
import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user";
@Component({
selector: "app-home",
templateUrl: "./home.component.html",
styleUrls: ["./home.component.scss"]
})
export class HomeComponent implements OnInit {
personalInfo: any;
imageSrc: string = "../assets/imgs/profile.png";
constructor(
public ts: TranslatorService,
public cs: CommonService,
public authService: AuthenticationService
) {}
ngOnInit() {
this.getProfile();
}
getProfile() {
this.authService
.loadAuthenticatedUser()
.subscribe((user: AuthenticatedUser) => {
if (user) {
this.personalInfo = user;
this.imageSrc = user.EMPLOYEE_IMAGE
? "data:image/png;base64," + user.EMPLOYEE_IMAGE
: this.imageSrc;
console.log(user);
} else {
console.log(user);
}
});
}
}

@ -0,0 +1,32 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { ProfilePage } from './profile.page';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{
path: '',
component: ProfilePage,
children: [
{
path: 'home',
component: HomeComponent
}
],
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [ProfilePage , HomeComponent]
})
export class ProfilePageModule {}

@ -0,0 +1,6 @@
<ion-content>
<ion-router-outlet></ion-router-outlet>
</ion-content>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ProfilePage } from './profile.page';
describe('ProfilePage', () => {
let component: ProfilePage;
let fixture: ComponentFixture<ProfilePage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProfilePage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ProfilePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-profile',
templateUrl: './profile.page.html',
styleUrls: ['./profile.page.scss'],
})
export class ProfilePage implements OnInit {
constructor() { }
ngOnInit() {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 KiB

@ -61,24 +61,18 @@ ion-label{
}
.loaderGif{
.loading-gif{
background: transparent !important;
width:100px;
height: 100px;
}
.loading-md .loading-wrapper,
.loading-ios .loading-wrapper{
#custom-progress-loader .container{
background: transparent !important;
box-shadow: none;
-webkit-box-shadow:none;
-moz-box-shadow: none;
width: 150px;
}
.loading-md ,.loading-ios {
ion-backdrop{
background-color: #8c8c8c !important;
}
}
/***********change header color***************/
.headerBtn{
@ -87,7 +81,12 @@ ion-label{
.headerImg{
width: 36px;
}
.header-toolbar{
--background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%);
}
.btnBack{
background: transparent !important;
}
/***************/
.attachImg{
max-width: 30px;

Loading…
Cancel
Save