haroon amjad 6 years ago
commit ecb14d5df7

@ -1,19 +1,21 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
{
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
data: { preload: true, delay: 1000 }
}, { path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' }
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
const routes: Routes = [
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
{
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
data: { preload: true, delay: 1000 }
},
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{ path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' }
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }

@ -2,8 +2,8 @@
<!-- <ion-nav [root]="rootPage" #mycontent swipeBackEnabled="false"></ion-nav> -->
<ion-app [dir]="direction">
<ion-split-pane>
<!-- <ion-menu persistent="true" id="leftMenu" class="menu"
side="left" *ngIf="direction==='ltr'" >
<ion-menu [side]=" direction === 'rtl' ? 'end' : 'start'" [swipeGesture]="false" (ionWillOpen)="menuOpened(true)"
(ionWillClose)="menuOpened(false)">
<ion-content class="sidebar-menu">
<div class="header-div">
<div class="centerDiv">
@ -39,42 +39,6 @@
</ion-content>
</ion-menu>
<ion-menu persistent="true" id="rightMenu" class="menu"
side="right" *ngIf="direction==='rtl'" >
<ion-content class="sidebar-menu">
<div class="header-div">
<div class="centerDiv">
<p class="TxtPlace">{{"home.hello" | translate}}, {{User_name_Emp}}</p>
<div> <img src="{{user_image}}" class="profileImg" ></div>
</div>
</div>
<ion-list>
<button class="menu-item" ion-item menuClose ion-item (click)="goToWorkListPage()" >
<img width="30" src="../assets/imgs/bell.png" item-left >
{{"home.worklist" | translate }}
<ion-badge item-end>{{notBadge}}</ion-badge>
</button>
<button class="menu-item" ion-item menuClose ion-item (click)="goToProfile()" >
<img width="30" src="../assets/imgs/username.png" item-left >
{{"userProfile.title" | translate }}
</button>
<button class="menu-item" ion-item menuClose ion-item (click)="logout()" >
<img width="30" src="../assets/imgs/signout.png" item-left >
{{"home.logout" | translate }}
</button>
</ion-list>
<div class="menuFooter">
<div> <img src="{{companyUrl}}" class="CompanyImg" ></div>
<p class="companyTxt">{{companyDesc}}</p>
</div>
</ion-content>
</ion-menu> -->
<ion-router-outlet main></ion-router-outlet>

@ -40,14 +40,13 @@ export class AppComponent implements OnInit, AfterViewInit {
}
ngAfterViewInit() {}
initializeApp() {
this.start = false;
this.lazyLoadingService.monitorLazyLoading(15, true);
this.platform.ready().then(() => {
this.translatorService.loadResources(() => {
this.initializeDirection();
// this.statusBar.styleDefault();
this.start = true;
// this.statusBar.styleDefault();
this.start = true;
this.watchLanguageChangeEvents();
// this.checkIfUserLoggedInBefore();
this.keyboardService.watchKeyboard();
@ -61,11 +60,7 @@ export class AppComponent implements OnInit, AfterViewInit {
this.events.subscribe(
AuthenticationService.LOGIN_EVENT,
(user: AuthenticatedUser, time: Date) => {
// if (user) {
// this.loggedInMainUser = user;
// this.loggedInUser = user;
// this.loadFamilyMembers();
// }
}
);
}

@ -33,7 +33,7 @@ export class AgreementComponent implements OnInit {
}, this.ts.trPK('general', 'retry')).subscribe((result: CheckUserAgreementResponse) => {
if (this.cs.validResponse(result)) {
if (result.IsPatientAlreadyAgreed) {
this.auth.setUserAgreed(true);
// this.auth.setUserAgreed(true);
this.cs.openHome();
} else {
this.getUserAgreement();
@ -59,7 +59,7 @@ export class AgreementComponent implements OnInit {
this.onAcceptClicked();
}, this.ts.trPK('general', 'retry')).subscribe((result: GetUserAgreementResponse) => {
if (this.cs.validResponse(result)) {
this.auth.setUserAgreed(true);
//this.auth.setUserAgreed(true);
this.cs.openHome();
}
});

@ -34,8 +34,7 @@ export class LoginComponent implements OnInit, OnDestroy {
private password: string;
private language: string;
private username : string;
private currentLang : any;
private currentLang : any = 2;
private patientOutSA: boolean;
private loginTokenID: string;
private isMobileFingerPrint: boolean;
@ -57,12 +56,13 @@ export class LoginComponent implements OnInit, OnDestroy {
}
ngOnInit() {
console.log(this.currentLang);
//this.setIdPattern();
setTimeout(() => {
this.checkIfLoggedInBefore();
// this.splash.hide();
}, 100);
this.currentLang = TranslatorService.getCurrentLanguageCode();
// setTimeout(() => {
// this.checkIfLoggedInBefore();
// // this.splash.hide();
// }, 100);
}
ngOnDestroy(): void {
@ -70,7 +70,6 @@ export class LoginComponent implements OnInit, OnDestroy {
}
public changeLanguage(){
this.ts.switchLanguage();
console.log(this.ts.getCurrentSystemLanguageName());
if(TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN)
{
this.language = "US";
@ -79,19 +78,19 @@ export class LoginComponent implements OnInit, OnDestroy {
this.language = "AR";
}
this.currentLang = TranslatorService.getCurrentLanguageCode();
console.log(this.currentLang);
}
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 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();
}
@ -101,24 +100,24 @@ export class LoginComponent implements OnInit, OnDestroy {
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 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(
@ -188,165 +187,165 @@ export class LoginComponent implements OnInit, OnDestroy {
public loginWithMyAccount() {
// this.loginWithTamer();
this.loginWithTamer();
}
// 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();
});
}
// 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();
});
}
// 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();
// });
// }
@ -360,13 +359,12 @@ export class LoginComponent implements OnInit, OnDestroy {
request.P_USER_NAME = this.username;
request.P_LANGUAGE = this.language;
request.P_PASSWORD = this.password;
console.log(request);
this.authService.checkUserAuthentication(
request,
() => {
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
console.log(result);
if (this.cs.validResponse(result)) {
this.loginData.LogInTokenID = result.LogInTokenID;
this.sharedData.setSharedData(this.loginData, "logindata");
this.cs.openSMSPage();
@ -438,11 +436,11 @@ export class LoginComponent implements OnInit, OnDestroy {
private checkIfUserAgreedBefore(result: CheckActivationCodeResponse) {
this.authService.setAuthenticatedUser(result).subscribe(() => {
if (this.authService.isAgreedBefore()) {
this.cs.openHome();
} else {
// this.cs.openAgreement();
}
// if (this.authService.isAgreedBefore()) {
// this.cs.openHome();
// } else {
// // this.cs.openAgreement();
// }
});
}

@ -1,22 +1,21 @@
import { Component, OnInit } from '@angular/core';
import { ElementRef } from '@angular/core';
import { NavController } from '@ionic/angular';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request';
import { LoginModel } from '../models/LoginModel';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response';
import { Component, OnInit } from "@angular/core";
import { ElementRef } from "@angular/core";
import { NavController } from "@ionic/angular";
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { SharedDataService } from "src/app/hmg-common/services/shared-data-service/shared-data.service";
import { SMSCheckRequest } from "src/app/hmg-common/services/authentication/models/smscheck.request";
import { LoginModel } from "../models/LoginModel";
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response";
@Component({
selector: 'app-sms-page',
templateUrl: './sms-page.page.html',
styleUrls: ['./sms-page.page.scss'],
selector: "app-sms-page",
templateUrl: "./sms-page.page.html",
styleUrls: ["./sms-page.page.scss"]
})
export class SmsPagePage implements OnInit {
public static LOGIN_DATA = 'LOGIN_DATA';
Channel: number = 0;
activationCode: string;
P_SESSION_ID: number;
@ -33,18 +32,19 @@ export class SmsPagePage implements OnInit {
public count: number = 0;
private loginData = new LoginModel();
constructor(public navCtrl: NavController,
constructor(
public navCtrl: NavController,
public translate: TranslatorService,
public common: CommonService,
private elementRef: ElementRef,
public authService: AuthenticationService,
public sharedData: SharedDataService) { }
public sharedData: SharedDataService
) {}
ngOnInit() {
this.count = 0;
this.initTimer();
this.startTimer();
}
initTimer() {
@ -78,14 +78,16 @@ export class SmsPagePage implements OnInit {
timerTick() {
setTimeout(() => {
if (!this.runTimer) { return; }
if (!this.runTimer) {
return;
}
this.remainingTime--;
this.displayTime = this.common.getSecondsAsDigitalClock(this.remainingTime);
this.displayTime = this.common.getSecondsAsDigitalClock(
this.remainingTime
);
if (this.remainingTime > 0) {
this.timerTick();
}
else {
} else {
this.hasFinished = true;
this.pauseTimer();
this.navCtrl.pop();
@ -99,7 +101,11 @@ export class SmsPagePage implements OnInit {
checkVerificationCode() {
if (this.count < 3) {
if (this.activationCode == undefined || this.activationCode == null || this.activationCode == "") {
if (
this.activationCode == undefined ||
this.activationCode == null ||
this.activationCode == ""
) {
// this.common.showAlert(this.translate.translate('verificationcode.emptyCode'));
} else {
this.count = this.count + 1;
@ -110,40 +116,34 @@ export class SmsPagePage implements OnInit {
}
}
} else {
let msg: string = this.translate.trPK('general', 'noOfTriesLogin');
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);
}
}
};
public checkSMS()
{
public checkSMS() {
const data = this.sharedData.getSharedData("logindata", false);
const request = new SMSCheckRequest();
request.LogInTokenID= data.LogInTokenID,
request.activationCode =this.activationCode;
(request.LogInTokenID = data.LogInTokenID),
(request.activationCode = this.activationCode);
//request.P_USER_NAME=this.userName,
//request.MobileNumber=this.member.MemberLoginList.P_MOBILE_NUMBER
this.authService.checkSMS(
request,
() => {
}, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => {
this.authService
.checkSMS(request, () => {}, this.translate.trPK("general", "ok"))
.subscribe((result: SMSCheckResponse) => {
console.log(result);
if (this.common.validResponse(result)) {
console.log(result);
//this.loginData.LogInTokenID = result.LogInTokenID;
//this.sharedData.setSharedData(this.loginData, "logindata");
//this.common.openHome();
}
if (this.common.validResponse(result)) {
//this.sharedData.setSharedData(this.loginData, SmsPagePage.LOGIN_DATA);
this.authService.setAuthenticatedUser(result).subscribe(() => {
this.common.openHome();
})
}
});
}
public checkForgetPwdSMS()
{
}
public checkForgetPwdSMS() {}
}

@ -78,10 +78,10 @@ export class AuthenticationService {
const user = this.getAuthenticatedUser();
if (user) {
/*user with eye prescriptions*/
request.PatientID = user.PatientID;
request.TokenID = user.TokenID;
request.PatientOutSA = user.PatientOutSA ? 1 : 0;
request.PatientTypeID = user.PatientTypeID;
// request.PatientID = user.PatientID;
// request.TokenID = user.TokenID;
// request.PatientOutSA = user.PatientOutSA ? 1 : 0;
// request.PatientTypeID = user.PatientTypeID;
if (AuthenticationService.requireRelogin) {
this.sessionTimeOutDialog();
}
@ -114,13 +114,13 @@ export class AuthenticationService {
this.authenticateRequest(request);
const user = this.getAuthenticatedUser();
if (user) {
request.To = user.Email;
request.DateofBirth = user.DateofBirth;
request.PatientIditificationNum = user.PatientIdentificationNo;
request.PatientMobileNumber = user.MobileNo;
request.PatientName = user.PatientName;
request.PatientOutSA = user.PatientOutSA ? 1 : 0;
request.PatientTypeID = user.PatientTypeID;
// request.To = user.Email;
// request.DateofBirth = user.DateofBirth;
// request.PatientIditificationNum = user.PatientIdentificationNo;
// request.PatientMobileNumber = user.MobileNo;
// request.PatientName = user.PatientName;
// request.PatientOutSA = user.PatientOutSA ? 1 : 0;
// request.PatientTypeID = user.PatientTypeID;
if (examinationInfo) {
if (examinationInfo.SetupID) { request.SetupID = examinationInfo.SetupID; }
@ -168,13 +168,7 @@ export class AuthenticationService {
return AuthenticationService.user != null;
}
public isAuthenticatedFamilyMember(): boolean {
if ( AuthenticationService.user != null ) {
return AuthenticationService.user.familyMember;
}
return false;
}
/**
* this fucntion load from user information if he logged in before
@ -219,8 +213,8 @@ export class AuthenticationService {
AuthenticationService.requireRelogin = false;
this.startIdleMonitoring();
const user = this.updateAuthenticatedUser(result, authUser);
user["familyMember"] = true;
user.familyMember = true;
// user["hello"]= "ok";
/* we store in hd without token but with token in memory*/
AuthenticationService.user = user;
@ -247,7 +241,7 @@ export class AuthenticationService {
public setDeviceToken(token: string) {
const user = this.getAuthenticatedUser();
if (user) {
user.deviceToken = token;
// user.deviceToken = token;
this.updateLoggedInUser(user).subscribe((success: boolean) => {
// console.log('token stored:' + token);
});
@ -272,35 +266,8 @@ export class AuthenticationService {
*update new authenticated user from previously stored and loaded user
*/
private updateAuthenticatedUser(result: CheckActivationCodeResponse, loadedUser: AuthenticatedUser): AuthenticatedUser {
const user = result.List[0];
if (loadedUser) {
// only if same user we fetch previous settings
if (loadedUser.PatientID === user.PatientID) {
user.agreed = loadedUser.agreed;
user.biometricEnabled = loadedUser.biometricEnabled;
} else {
this.localNotifications.deleteAllNotifications();
}
}
if (user.FirstName && user.LastName) {
user.PatientName = user.FirstName + ' ' + user.LastName;
}
user.IdentificationNo = user.PatientIdentificationNo;
/*
since suliman al habib has no support now for international phone number we do this woraround
*/
if (user.PatientOutSA) {
user.ZipCode = InternationalMobileComponent.EMIRATE_DIAL_CODE;
} else {
user.ZipCode = InternationalMobileComponent.SAUDI_DIAL_CODE;
}
user.Email = this.isRealEmail(user.EmailAddress) ? user.EmailAddress : null;
user.MobileNumber = user.MobileNumber.substr(1, user.MobileNumber.length - 1);
user.MobileNo = user.MobileNumber;
user.PatientOutSA = result.PatientOutSA;
user.PatientTypeID = result.PatientType;
user.TokenID = result.AuthenticationTokenID;
const user = result.MemberInformationList[0];
return user;
}
@ -310,29 +277,9 @@ export class AuthenticationService {
public isAuthenticatedUserHasRealEmail(): boolean {
const user = this.getAuthenticatedUser();
return user ? this.isRealEmail(user.Email) : false;
return user ? this.isRealEmail(user.EMPLOYEE_EMAIL_ADDRESS) : false;
}
public setUserAgreed(agreed: boolean) {
const user = this.getAuthenticatedUser();
if (user) {
user.agreed = agreed;
// user['agreed'] = agreed;
this.saveUserInStorage(user).subscribe(result => {
});
} else {
}
}
public isAgreedBefore(): boolean {
const user = this.getAuthenticatedUser();
if (user) {
return (user.agreed != null) ? user.agreed : false;
} else {
return false;
}
}
/**
* we store in localstorage without token but we keep it in the static member
*/
@ -340,17 +287,17 @@ export class AuthenticationService {
return Observable.create(observer => {
if (user) {
const TokenID = user.TokenID;
user.TokenID = null;
// const TokenID = user.TokenID;
// user.TokenID = null;
this.nativeStorage.setItem(AuthenticationService.AUTHENTICATED_USER_KEY, user)
.then(
() => {
user.TokenID = TokenID;
//user.TokenID = TokenID;
observer.next(true);
observer.complete();
},
error => {
user.TokenID = TokenID;
// user.TokenID = TokenID;
observer.next(false);
observer.complete();
@ -407,7 +354,10 @@ export class AuthenticationService {
observer.complete();
},
error => {
observer.next(null);
// this.getAuthenticatedUser()
//commented for now will uncomment when we are going to deploy on the device;
//observer.next(null);
observer.next(AuthenticationService.user);
observer.complete();
}
);
@ -547,7 +497,7 @@ export class AuthenticationService {
return Observable.create(observer => {
if (this.isAuthenticatedUserHasRealEmail()) {
const message = this.ts.trPK('general', 'send-email')
.replace('[0]', this.getAuthenticatedUser().EmailAddress || this.getAuthenticatedUser().Email);
.replace('[0]', this.getAuthenticatedUser().EmailAddress);
this.cs.presentConfirmDialog(message,
() => {
observer.next();

@ -2,16 +2,73 @@ import { PatientUserModel } from './PatientUserModel';
import { TestBed } from '@angular/core/testing';
export class AuthenticatedUser extends PatientUserModel {
PatientName: string;
TokenID: string;
MobileNo: string;
Email: string;
PatientOutSA: boolean;
PatientTypeID: number;
agreed: boolean;
IdentificationNo: string;
deviceToken: string;
biometricEnabled: boolean;
ProjectID: number;
familyMember: boolean;
ACTUAL_TERMINATION_DATE: string
ASSIGNMENT_END_DATE: string
ASSIGNMENT_ID: number
ASSIGNMENT_NUMBER: string
ASSIGNMENT_START_DATE: string
ASSIGNMENT_STATUS_TYPE_ID: number
ASSIGNMENT_TYPE: string
BUSINESS_GROUP_ID: number
BUSINESS_GROUP_NAME: string
CURRENT_EMPLOYEE_FLAG: string
EMPLOYEE_DISPLAY_NAME: string
EMPLOYEE_EMAIL_ADDRESS:string
EMPLOYEE_IMAGE:string
EMPLOYEE_MOBILE_NUMBER: string
EMPLOYEE_NAME:string
EMPLOYEE_NUMBER: string
EMPLOYEE_WORK_NUMBER:string
EMPLOYMENT_CATEGORY: string
EMPLOYMENT_CATEGORY_MEANING: string
FREQUENCY: string
FREQUENCY_MEANING: string
FROM_ROW_NUM: number
GRADE_ID: number
GRADE_NAME: string
HIRE_DATE: string
JOB_ID: number
JOB_NAME: string
LEDGER_ID: number
LOCATION_ID: number
LOCATION_NAME: string
MANUAL_TIMECARD_FLAG: string
MANUAL_TIMECARD_MEANING: string
NATIONALITY_CODE: string
NATIONALITY_MEANING: string
NATIONAL_IDENTIFIER:string
NORMAL_HOURS: string
NO_OF_ROWS: number
ORGANIZATION_ID: number
ORGANIZATION_NAME: string
PAYROLL_CODE: string
PAYROLL_ID: number
PAYROLL_NAME: string
PERSON_ID: number
PERSON_TYPE:string
PERSON_TYPE_ID: number
PER_INFORMATION_CATEGORY: string
POSITION_ID: number
POSITION_NAME: string
PRIMARY_FLAG: string
ROW_NUM:number
SUPERVISOR_ASSIGNMENT_ID: string
SUPERVISOR_DISPLAY_NAME: string
SUPERVISOR_EMAIL_ADDRESS: string
SUPERVISOR_ID: number
SUPERVISOR_MOBILE_NUMBER: string
SUPERVISOR_NAME: string
SUPERVISOR_NUMBER: string
SUPERVISOR_WORK_NUMBER: string
SWIPES_EXEMPTED_FLAG: string
SWIPES_EXEMPTED_MEANING: string
SYSTEM_PERSON_TYPE: string
TK_EMAIL_ADDRESS: string
TK_EMPLOYEE_DISPLAY_NAME: string
TK_EMPLOYEE_NAME: string
TK_EMPLOYEE_NUMBER: string
TK_PERSON_ID: number
TO_ROW_NUM: number
UNIT_NUMBER: string
USER_STATUS: string
}

@ -3,8 +3,6 @@ import { PatientUserModel } from './PatientUserModel';
import { AuthenticatedUser } from './authenticated-user';
export class CheckActivationCodeResponse extends Response {
List: AuthenticatedUser[];
AuthenticationTokenID: string;
PatientOutSA: boolean;
PatientType: number;
MemberInformationList:AuthenticatedUser[];
}

@ -16,11 +16,11 @@ export class GetLoginInfoRequest extends Request {
isRegister: boolean; // false
constructor(user: AuthenticatedUser) {
super();
this.NationalID = user.IdentificationNo;
this.MobileNo = this.PatientMobileNumber = user.MobileNo;
this.DeviceToken = user.deviceToken;
this.PatientID = user.PatientID;
this.ProjectOutSA = user.PatientOutSA ;
// this.NationalID = user.IdentificationNo;
// this.MobileNo = this.PatientMobileNumber = user.MobileNo;
// this.DeviceToken = user.deviceToken;
// this.PatientID = user.PatientID;
// this.ProjectOutSA = user.PatientOutSA ;
this.LoginType = 2;
this.ZipCode = CountryCode.localCode( user.ZipCode);
this.SearchType = 2;

@ -2,6 +2,6 @@ import { Response } from '../../models/response';
import { AuthenticatedUser } from './authenticated-user';
export class SMSCheckResponse extends Response {
AuthenticationTokenID: string;
PatientOutSA: boolean;
PatientType: number;
MemberInformationList:AuthenticatedUser[];
}

@ -886,10 +886,8 @@ export class CommonService {
open calls
*/
public static HOME_URL = ["/home", "/home-page"];
public openHome() {
this.alternateNavigate(CommonService.HOME_URL, "home-open", true);
this.nav.navigateForward(["/home"]);
}
public reload(url: string, from: string) {

@ -395,9 +395,9 @@ export class GeofencingService {
const user = this.authService.getAuthenticatedUser();
this.turnTrackingOff();
this.cs.presentConfirmDialog(this.ts.trPK('settings', 'enable-geo'), () => {
this.turnTrackingOn(user.PatientID, +user.PatientOutSA);
// this.turnTrackingOn(user.PatientID, +user.PatientOutSA);
}, () => {
this.turnTrackingOn(user.PatientID, +user.PatientOutSA);
// this.turnTrackingOn(user.PatientID, +user.PatientOutSA);
this.turnTrackingOff();
});
}

@ -171,12 +171,12 @@ export class PushService {
request.DeviceToken = deviceToken;
request.DeviceType = this.getDeviceType();
const user = this.authService.getAuthenticatedUser();
request.PatientMobileNumber = user.MobileNo;
request.NationalID = user.IdentificationNo;
// request.PatientMobileNumber = user.MobileNo;
//request.NationalID = user.IdentificationNo;
request.Gender = user.Gender;
request.PatientID = user.PatientID;
request.PatientOutSA = user.PatientOutSA ? 1 : 0;
request.LoginType = user.biometricEnabled ? 2 : 1; // 1 sms , 2 touch id
// request.PatientOutSA = user.PatientOutSA ? 1 : 0;
//request.LoginType = user.biometricEnabled ? 2 : 1; // 1 sms , 2 touch id
request.MACAddress = '00:00:00:00:00:00';
return this.con.postNoLoad(PushService.loggedInUserURL, request
, () => { }).subscribe((result: Response) => {

@ -73,9 +73,9 @@ export class PaymentService {
private generateURL(amount: number, orderDesc: string, transactionID: string): string {
let form = this.getForm();
const user = this.authService.getAuthenticatedUser();
if (user) {
form = form.replace('EMAIL_VALUE', user.Email || user.EmailAddress);
}
// if (user) {
// form = form.replace('EMAIL_VALUE', user.Email || user.EmailAddress);
// }
form = form.replace('AMOUNT_VALUE', (amount || 0).toString());
form = form.replace('ORDER_DESCRIPTION_VALUE', orderDesc);
form = form.replace('SESSION_ID_VALUE', transactionID);

@ -124,11 +124,11 @@ export class TabsBarComponent implements OnInit {
*/
private monitUrlChange() {
this.router.events.subscribe((val) => {
if (val instanceof NavigationEnd) {
if (this.matchesURL(val, CommonService.HOME_URL, TabsBarComponent.home)) {
this.cs.openHome();
}
}
// if (val instanceof NavigationEnd) {
// if (this.matchesURL(val, CommonService.HOME_URL, TabsBarComponent.home)) {
// this.cs.openHome();
// }
// }
});
}

@ -0,0 +1,31 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { IonicModule } from '@ionic/angular';
import { HomePage } from './home.page';
const routes: Routes = [
{
path: '',
component: HomePage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HmgCommonModule,
RouterModule.forChild([
{
path: '',
component: HomePage
}
])
],
declarations: [HomePage]
})
export class HomePageModule {}

@ -0,0 +1,69 @@
<!-- <ion-header no-shadow no-border>
<ion-toolbar>
<nav-buttons [enableMenu]="true" [enableBack]="false" [navigate]="false"></nav-buttons>
<ion-title>home </ion-title>
<ion-badge id="homeBadgeBtn" item-end>{{notBadge}}</ion-badge>
</ion-toolbar>
</ion-header> -->
<ion-content >
<div class="header-div">
<button ion-button icon-only menuToggle class="menubutton" (click)="openMenu()">
<ion-icon name="menu"></ion-icon>
<ion-badge id="homeBadgeBtn" item-end>{{notBadge}}</ion-badge>
</button>
<div class="centerDiv" (click)="openPersonalInfo()">
<p class="TxtPlace">{{"home.hello" | translate}}, {{User_name_Emp}}</p>
<div class="profileDiv"><ion-img class="profileImg" src="{{user_image}}"></ion-img></div>
</div>
</div>
<div>
<div>
<p class="dash-header text-caps">{{"home.dashboard" | translate}}</p>
</div>
<div>
<ion-grid class="cus-grid">
<ion-row>
<ion-col size="6" class="col-grid" *ngFor="let item of menuList; let i=index">
<button ion-button block class="serviceItem" (click)="getMeunDetails(i)">
<img class="serviceItemImg" src="../assets/imgs/{{item.MENU_TYPE}}.png"/>
<p> {{ item.MENU_NAME }} {{item.SUB_MENU_NAME}}</p>
</button>
</ion-col>
<ion-col size="6" class="col-grid">
<button ion-button block class="serviceItem" (click)="attendance()">
<ion-img class="serviceItemImg" src="../assets/imgs/attend.png"></ion-img>
<p>{{"attendance.attendance" | translate}}</p>
</button>
</ion-col>
<ion-col size="6" class="col-grid">
<button ion-button block class="serviceItem" (click)="Vaction_Rule()">
<ion-img class="serviceItemImg" src="../assets/imgs/vacationrule.png"></ion-img>
<p>{{"vacationRule.vacationRule" | translate}}</p>
</button>
</ion-col>
<ion-col size="6" class="col-grid">
<button ion-button block class="serviceItem" (click)="accrualBalance()">
<ion-img class="serviceItemImg" src="../assets/imgs/accu.png"></ion-img>
<p>{{"absenceList.accrualBalances" | translate}}</p>
</button>
</ion-col>
<ion-col size="6" class="col-grid">
<button ion-button block class="serviceItem" (click)="Change_password()">
<ion-img class="serviceItemImg" src="../assets/imgs/changepass.png"></ion-img>
<p>{{"changePassword.changePassword" | translate}}</p>
</button>
</ion-col>
</ion-row>
<!-- <button class="menu-item" ion-item menuClose ion-item *ngFor="let item of menuList; let i=index" (click)="getMeunDetails(i)" >
<img width="30" src="../assets/imgs/arrownew.png" item-left class="flipImg">
{{ item.MENU_NAME }} {{item.SUB_MENU_NAME}}
</button> -->
</ion-grid>
</div>
</div>
</ion-content>

@ -0,0 +1,93 @@
.button-menutoggle.button-menutoggle-md,button-menutoggle.button-menutoggle-ios,
.bar-buttons.bar-buttons-ios.button.button-ios.button-default.button-default-ios.button-menutoggle.button-menutoggle-ios{
box-shadow: none;
-webkit-box-shadow:none;
-moz-box-shadow: none;
background: transparent !important;
}
.menubutton{
white-space: normal;
color: var(--light);
text-transform: capitalize;
min-height: 47px;
background: transparent;
font-size: 2rem;
}
#homeBadgeBtn{
position: absolute;
top: 2px;
width: 20px;
font-size: 10px;
height: 20px;
padding: 0px;
line-height: 2;
min-width: auto;
min-height: auto;
}
.header-div{
background:var(--primary);
background: -moz-linear-gradient(45deg, var(--primary) 0%, var(--secondary) 36%,var(--secondary) 59%, var(--customnavy) 100%);
background: -webkit-linear-gradient(45deg, (--primary) 0%, var(--secondary) 36%,var(--secondary) 59%, var(--customnavy) 100%);
background: linear-gradient(45deg, var(--primary) 0%, var(--secondary) 36%,var(--secondary) 59%, var(--customnavy) 100%);
color:var(--light);
text-transform: capitalize;
display: block;
position: relative;
height: 120px;
margin-bottom:60px;
}
.dash-header{
text-align: center;
margin: 16px 0 0 0;
}
.TxtPlace {
margin: 0;
padding: 0 0 10px 0;
text-align: center;
}
.serviceItem {
min-height: 160px !important;
padding: 0;
width:100%;
border: 2px solid #e4e5e7;
background: transparent !important;
color: var(--dark);
p{
margin-top: 0px; margin-bottom:0px;
font-weight: normal;
font-size: 14px;
min-height: 20px;
// white-space: normal;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
span {
display: block;
}
.serviceItemImg {
min-width: 60px !important;
min-height: 70px !important;
width: 80px;
height: 80px;
margin: 10px auto;
background: transparent !important;
}
}
.serviceItem.button,.serviceItem.button-md, .serviceItem.button-ios{
background: transparent !important;
color:var(--dark);
box-shadow: none;
-webkit-box-shadow:none;
-moz-box-shadow: none;
border: 2px solid var(--gray);
min-width: auto;
}

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

@ -0,0 +1,46 @@
import { Component, OnInit } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { MenuController } 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';
@Component({
selector: 'app-home',
templateUrl: './home.page.html',
styleUrls: ['./home.page.scss'],
})
export class HomePage implements OnInit {
userData: any ={};
user_image : any = "../assets/imgs/profile.png";
constructor(public ts: TranslatorService, public menu: MenuController, public authService: AuthenticationService ) { }
ngOnInit() {
this.getUserDetails();
}
private openMenu(){
this.menu.toggle();
}
private getUserDetails(){
const user = this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
if (user) {
this.userData=user;
console.log(user);
}else{
console.log(user);
}
})
}
// private getMenu(){
// this.menuService.getMenu().
// subscribe((result: MenuResponse) => {
// this.handleMenuResult(result);
// });
// }
// private handleMenuResult(result){
// if (this.common.validResponse(result)) {
// if (this.common.hasData(result.List_Menu)) {
// this.menuList = result.List_Menu;
// }
// }
}
Loading…
Cancel
Save