home page update

MOHEMM-Q3-DEV-LATEST
Sultan Khan 7 years ago
commit fe7e62bbe6

@ -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: 'home', loadChildren: './home/home.module#HomePageModule' }
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 { }

@ -0,0 +1,112 @@
/*
header
*/
.menu-header {
height: 2.5cm;
}
.content-ios:not([no-bounce]) > .scroll-content::before {
bottom: 0;
}
.menu-header .logo {
position: absolute;
left: 0.6cm;
top: 0.9cm;
width: 1.6cm;
}
.menu-header .background {
height: 1.5cm;
width: 100%;
}
/* title */
.title-v-spacer {
height: 0.7cm;
}
.suliman-title {
margin-left: 0.3cm;
margin-right: 0.3cm;
font-weight: bold;
font-size: 0.5cm;
}
.group-title {
margin-left: 0.4cm;
margin-right: 0.4cm;
font-size: 0.4cm;
}
/*
items
*/
.items-buttons-spacer {
height: 10%;
}
/*
user information
*/
.user-v-spacer {
height: 0.5cm;
}
.user-name-title {
margin-left: 0.3cm;
margin-right: 0.3cm;
font-weight: bold;
}
.file-id-title {
margin-left: 0.4cm;
margin-right: 0.4cm;
}
.social-media-container {
position: absolute !important;
width: 100%;
bottom: 0.2cm;
background-color: white;
}
.icon-spacer {
margin-right: 0.3cm;
margin-left: 0.3cm;
}
/*mobile Landscape */
@media only screen and (min-device-height: 0px) and (max-device-height: 515px) and (orientation: landscape) {
.social-media-container {
display: none;
}
}
.info-container {
overflow-y: scroll;
width: 100%;
position: absolute;
top: 2.6cm;
bottom: 0.2cm;
padding-bottom: 4.5cm;
}
@media only screen and (orientation: landscape) {
.info-container {
padding-bottom: 0.2cm;
}
}
.member {
border-bottom-color: var(--ion-color-medium) !important;
border-bottom-width: 0.02cm;
border-bottom-style: solid;
/* margin-left: 0.4cm; */
}
.selected-member {
border-bottom-color: var(--ion-color-secondary) !important;
border-bottom-width: 0.02cm;
border-bottom-style: solid;
margin-left: 0.2cm;
}

@ -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();
}
});

@ -17,6 +17,7 @@ import { SearchableOptionsModule } from '../hmg-common/ui/searchable-select/sear
import { MobileNumberModule } from 'src/app/hmg-common/ui/mobile-number/mobile-number.module';
import { SmsdialogPageModule } from 'src/app/hmg-common/ui/smsdialog/smsdialog.module';
import { SmsPageModule } from 'src/app/hmg-common/ui/sms/sms.module';
import { SmsPagePage } from './sms-page/sms-page.page';
@ -36,6 +37,10 @@ const routes: Routes = [
{
path: 'agreement',
component: AgreementComponent
},
{
path: 'smspage',
component: SmsPagePage
}
]
}
@ -60,6 +65,7 @@ const routes: Routes = [
LoginComponent,
ForgotComponent,
AgreementComponent,
SmsPagePage
],
providers:[
FingerprintAIO,

@ -1,9 +1,14 @@
<ion-header>
<nav-buttons ></nav-buttons>
<ion-title>{{'login,forgot-password' | translate}}</ion-title>
<ion-toolbar class="header-toolbar">
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" ></ion-back-button>
</ion-buttons>
<ion-title color="light" > {{'login,forgot-password' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-grid>
@ -23,6 +28,6 @@
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button color="customnavy" ion-button (click)=" userCheck()">{{ts.trPK('login','username')}}</ion-button>
<ion-button color="customnavy" ion-button (click)=" userCheck()">{{ts.trPK('login','changepassword')}}</ion-button>
</div>
</ion-footer>

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

@ -58,8 +58,8 @@ export class ForgotComponent implements OnInit,OnDestroy {
private sendSMSForForgotPassword() {
const request = new CheckUserAuthenticationRequest();
request.PatientMobileNumber = this.countryCode.number;
request.ZipCode = CountryCode.localCode(this.countryCode.code);
//request.PatientMobileNumber = this.countryCode.number;
//request.ZipCode = CountryCode.localCode(this.countryCode.code);
this.authService.sendSMSForForgotFileNumber(
request,

@ -16,18 +16,18 @@
<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)]="memberLogin.P_USER_NAME">
<ion-input required type="text" [(ngModel)]="username">
</ion-input>
</ion-item>
<ion-item>
<img class="item-icon" src="assets/imgs/password.png" item-start />
<ion-label>{{ts.trPK('login','password')}}</ion-label>
<ion-input required type="password" [(ngModel)]="memberLogin.P_PASSWORD">
<ion-input required type="password" [(ngModel)]="password">
</ion-input>
</ion-item>
<div class="centerDiv signupDiv" *ngIf="isAppleStore==true">
<div class="centerDiv signupDiv" *ngIf="isAppleStore==false">
<a (click)="signUp()">{{ts.trPK('login','signup')}}</a>
</div>
<div class="gridDiv">
@ -38,7 +38,7 @@
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button color="customnavy" (click)="http_call()">{{ts.trPK('login','login')}}</ion-button>
<ion-button color="customnavy" (click)="onLogin()">{{ts.trPK('login','login')}}</ion-button>
</div>
<br/>
<div class="centerDiv">

@ -6,7 +6,6 @@ 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 { 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';
@ -16,8 +15,8 @@ import { GetLoginInfoRequest } from 'src/app/hmg-common/services/authentication/
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 { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model';
import { SMSService } from 'src/app/hmg-common/ui/sms/service/smsservice';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
import { LoginModel } from '../models/LoginModel';
@Component({
selector: 'login',
@ -31,11 +30,16 @@ export class LoginComponent implements OnInit, OnDestroy {
isSupportAr:boolean=false;
isAppleStore:boolean=false;
memberLogin: any = {};
private currentLang : any;
private password: string;
private language: string;
private username : string;
private currentLang : any = 2;
private patientOutSA: boolean;
private loginTokenID: string;
private isMobileFingerPrint: boolean;
private FingerPrintPatientIdentificationID: string;
private loginData = new LoginModel();
constructor(
public cs: CommonService,
public authService: AuthenticationService,
@ -46,17 +50,19 @@ export class LoginComponent implements OnInit, OnDestroy {
private faio: FingerprintAIO,
public ngZone: NgZone,
public device: Device,
public splash: SplashScreen
public splash: SplashScreen,
public sharedData: SharedDataService
) {
}
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 {
@ -64,20 +70,27 @@ export class LoginComponent implements OnInit, OnDestroy {
}
public changeLanguage(){
this.ts.switchLanguage();
if(TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN)
{
this.language = "US";
}
else{
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();
}
@ -87,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(
@ -143,10 +156,10 @@ export class LoginComponent implements OnInit, OnDestroy {
private initializeForAuthentictedUser(user: AuthenticatedUser) {
this.ngZone.run(() => {
this.isMobileFingerPrint = true;
this.FingerPrintPatientIdentificationID = user.IdentificationNo;
this.mobileNumber = user.MobileNumber;
this.zipCode = CountryCode.localCode(user.ZipCode);
//this.isMobileFingerPrint = true;
//this.FingerPrintPatientIdentificationID = user.IdentificationNo;
//this.mobileNumber = user.MobileNumber;
//this.zipCode = CountryCode.localCode(user.ZipCode);
});
}
@ -165,16 +178,7 @@ export class LoginComponent implements OnInit, OnDestroy {
}).catch((error: any) => console.log(error));
}
/**
we need holders here since the country code maybe is not loaded yet for automatic login
*/
private mobileNumber: string;
private zipCode: string;
public onLogin() {
this.checkUserAuthentication();
}
@ -183,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();
// });
// }
@ -352,27 +356,18 @@ export class LoginComponent implements OnInit, OnDestroy {
private checkUserAuthentication() {
const request = new CheckUserAuthenticationRequest();
request.PatientMobileNumber = this.mobileNumber;
request.ZipCode = this.zipCode;
request.isRegister = false;
request.TokenID = '';
request.P_USER_NAME = this.username;
request.P_LANGUAGE = this.language;
request.P_PASSWORD = this.password;
this.authService.checkUserAuthentication(
request,
() => {
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
this.loginTokenID = result.LogInTokenID;
this.patientOutSA = result.PatientOutSA;
this.isMobileFingerPrint = false;
this.FingerPrintPatientIdentificationID = '';
if (result.isSMSSent) {
this.startListeneingForSMS();
} else {
this.smsService.stopSMSMonitoring();
this.checkActivationCode();
}
if (this.cs.validResponse(result)) {
this.loginData.LogInTokenID = result.LogInTokenID;
this.sharedData.setSharedData(this.loginData, "logindata");
this.cs.openSMSPage();
}
});
}
@ -402,7 +397,7 @@ export class LoginComponent implements OnInit, OnDestroy {
}
private checkActivationCode(readedCode?) {
const request = new CheckActivationCodeRequest();
/*const request = new CheckActivationCodeRequest();
request.IsMobileFingerPrint = this.isMobileFingerPrint;
request.FingerPrintPatientIdentificationID = this.FingerPrintPatientIdentificationID;
request.LogInTokenID = this.loginTokenID;
@ -411,6 +406,8 @@ export class LoginComponent implements OnInit, OnDestroy {
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;
@ -419,7 +416,6 @@ export class LoginComponent implements OnInit, OnDestroy {
// request.PatientID = Number(this.id);
// request.PatientIdentificationID = '';
// }
request.isRegister = false;
// this.authService.checkActivationCode(
// request,
// () => {
@ -440,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();
// }
});
}

@ -0,0 +1,6 @@
export class LoginModel {
LogInTokenID: string;
activationCode: string;
P_USER_NAME: string;
MobileNumber: string;
}

@ -0,0 +1,26 @@
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 { SmsPagePage } from './sms-page.page';
const routes: Routes = [
{
path: '',
component: SmsPagePage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [SmsPagePage]
})
export class SmsPagePageModule {}

@ -0,0 +1,39 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" ></ion-back-button>
</ion-buttons>
<ion-title color="light" > {{'verificationcode,verificationcode' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-grid>
<ion-row>
<ion-col class="colPad">
<ion-img class="centerDiv" src="../assets/imgs/CS.png"></ion-img>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<p class="centerDiv">{{'verificationcode,title' | translate}}<span class="boldTxtNav">{{'verificationcode,verificationcode' | translate}}</span> {{'verificationcode,by' | translate}}<span class="boldTxtNav">{{'verificationcode,sms' | translate}}</span>{{'verificationcode,instruct' | translate}}<span class="boldTxtNav">{{'general,submit' | translate}}</span></p>
</ion-col>
</ion-row>
</ion-grid>
<br/><br/>
<!-- <p style="color: #c0c0c0; margin-left: 32%">{{'verificationcode.verificationcode' | translate}}</p> -->
<div>
<h1 text-center>{{displayTime}}</h1>
<br/><br/>
<ion-item>
<ion-label>{{'verificationcode,verificationcode' | translate}}</ion-label>
<!-- <img class="item-icon" src="assets/imgs/password.png" item-start /> -->
<ion-input required type="tel" [(ngModel)]="activationCode"></ion-input>
</ion-item>
</div>
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button color="customnavy" ion-button (click)="checkVerificationCode()">{{'general,submit' | translate}}</ion-button>
</div>
</ion-footer>

@ -0,0 +1,21 @@
.header-toolbar{
--background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%);
}
.btnBack{
background: transparent;
}
ion-img{
width: 180px;
height: 180px;
background:transparent;
}
h1{
font-size: 28px !important;
}
span{
font-weight: bold;
}

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

@ -0,0 +1,149 @@
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"]
})
export class SmsPagePage implements OnInit {
public static LOGIN_DATA = 'LOGIN_DATA';
Channel: number = 0;
activationCode: string;
P_SESSION_ID: number;
timeInSeconds: any;
time: any;
runTimer: any;
hasStarted: any;
hasFinished: any;
remainingTime: any;
displayTime: any;
loginTokenID: string;
public isForgetPwd: boolean = false;
public isExpiredPwd: boolean = false;
public count: number = 0;
private loginData = new LoginModel();
constructor(
public navCtrl: NavController,
public translate: TranslatorService,
public common: CommonService,
private elementRef: ElementRef,
public authService: AuthenticationService,
public sharedData: SharedDataService
) {}
ngOnInit() {
this.count = 0;
this.initTimer();
this.startTimer();
}
initTimer() {
// Pomodoro is usually for 25 minutes
if (!this.timeInSeconds) {
this.timeInSeconds = 600;
}
this.time = this.timeInSeconds;
this.runTimer = false;
this.hasStarted = false;
this.hasFinished = false;
this.remainingTime = this.timeInSeconds;
this.displayTime = this.common.getSecondsAsDigitalClock(this.remainingTime);
}
startTimer() {
this.runTimer = true;
this.hasStarted = true;
this.timerTick();
}
pauseTimer() {
this.runTimer = false;
}
resumeTimer() {
this.startTimer();
}
timerTick() {
setTimeout(() => {
if (!this.runTimer) {
return;
}
this.remainingTime--;
this.displayTime = this.common.getSecondsAsDigitalClock(
this.remainingTime
);
if (this.remainingTime > 0) {
this.timerTick();
} else {
this.hasFinished = true;
this.pauseTimer();
this.navCtrl.pop();
}
}, 1000);
}
ionViewWillLeave() {
this.pauseTimer();
}
checkVerificationCode() {
if (this.count < 3) {
if (
this.activationCode == undefined ||
this.activationCode == null ||
this.activationCode == ""
) {
// this.common.showAlert(this.translate.translate('verificationcode.emptyCode'));
} else {
this.count = this.count + 1;
if (this.isForgetPwd || this.isExpiredPwd) {
this.checkForgetPwdSMS();
} else {
this.checkSMS();
}
}
} 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);
}
};
public checkSMS() {
const data = this.sharedData.getSharedData("logindata", false);
const request = new SMSCheckRequest();
(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) => {
console.log(result);
if (this.common.validResponse(result)) {
//this.sharedData.setSharedData(this.loginData, SmsPagePage.LOGIN_DATA);
this.authService.setAuthenticatedUser(result).subscribe(() => {
this.common.openHome();
})
}
});
}
public checkForgetPwdSMS() {}
}

@ -24,6 +24,8 @@ import { GetLoginInfoResponse } from './models/get-login-info.response';
import { analyzeAndValidateNgModules } from '@angular/compiler';
import { Events } from '@ionic/angular';
import { InternationalMobileComponent } from '../../ui/mobile-number/international-mobile/international-mobile.component';
import { SMSCheckRequest } from './models/smscheck.request';
import { SMSCheckResponse } from './models/smscheck.response';
@Injectable({
providedIn: 'root'
@ -36,9 +38,16 @@ export class AuthenticationService {
/* login methods */
public static loginURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
public static checkUserAuthURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
public static login = 'Services/ERP.svc/REST/MemberLogin';
public static activationCodeURL = 'Services/Authentication.svc/REST/CheckActivationCode';
public static getLoginInfoURL = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
public static smsCheck='Services/ERP.svc/REST/CheckActivationCode';
public static smsCheckForget='Services/ERP.svc/REST/CheckPublicActivationCode';
public static smsSendCode='Services/ERP.svc/REST/SendPublicActivationCode';
/* register methods */
public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration';
@ -69,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();
}
@ -90,12 +99,13 @@ export class AuthenticationService {
}
public setPublicFields(request: Request): Request {
request.VersionID = 3.6;
request.Channel = 3;
request.VersionID = 1;
request.Channel = 31;
request.LanguageID = TranslatorService.getCurrentLanguageCode();
request.IPAdress = '10.10.10.10';
//request.IPAdress = '10.10.10.10';
request.SessionID = 'any thing'; // ??? required for not authorized login funny
request.isDentalAllowedBackend = false;
request.MobileType = "android";
//request.isDentalAllowedBackend = false;
return request;
}
@ -104,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; }
@ -158,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
@ -209,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;
@ -237,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);
});
@ -262,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;
}
@ -300,29 +277,9 @@ export class AuthenticationService {
public isAuthenticatedUserHasRealEmail(): boolean {
const user = this.getAuthenticatedUser();
return user ? this.isRealEmail(user.Email) : false;
}
public setUserAgreed(agreed: boolean) {
const user = this.getAuthenticatedUser();
if (user) {
user.agreed = agreed;
// user['agreed'] = agreed;
this.saveUserInStorage(user).subscribe(result => {
});
} else {
}
return user ? this.isRealEmail(user.EMPLOYEE_EMAIL_ADDRESS) : false;
}
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
*/
@ -330,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();
@ -397,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();
}
);
@ -420,7 +380,7 @@ export class AuthenticationService {
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.checkUserAuthURL, request, onError, errorLabel);
return this.con.post(AuthenticationService.login, request, onError, errorLabel);
}
public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
@ -429,6 +389,12 @@ export class AuthenticationService {
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
}
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<SMSCheckResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel);
}
/*
client side:
id no , mobile no , zip code
@ -466,8 +432,8 @@ export class AuthenticationService {
request.TokenID = '';
request.PatientIdentificationID = '';
request.PatientID = 0;
request.SearchType = 2;
request.isRegister = false;
//request.SearchType = 2;
//request.isRegister = false;
return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel);
}
@ -531,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[];
}

@ -1,10 +1,14 @@
import { Request } from '../../models/request';
export class CheckUserAuthenticationRequest extends Request {
PatientIdentificationID: string; // id
PatientMobileNumber: string; // phone number
ZipCode: string;
SearchType: number; // 1 for id , 2 for file no
isRegister: boolean; // false
LogInTokenID?: string;
// PatientIdentificationID: string; // id
// PatientMobileNumber: string; // phone number
// ZipCode: string;
// SearchType: number; // 1 for id , 2 for file no
// isRegister: boolean; // false
// LogInTokenID?: string;
P_USER_NAME:string;
P_LANGUAGE: string;
P_PASSWORD: string;
}

@ -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;

@ -0,0 +1,6 @@
import { Request } from '../../models/request';
export class SMSCheckRequest extends Request {
LogInTokenID?: string ;
activationCode?: string;
}

@ -0,0 +1,7 @@
import { Response } from '../../models/response';
import { AuthenticatedUser } from './authenticated-user';
export class SMSCheckResponse extends Response {
AuthenticationTokenID: string;
MemberInformationList:AuthenticatedUser[];
}

@ -120,6 +120,21 @@ export class CommonService {
}
}
getSecondsAsDigitalClock(inputSeconds: number) {
var sec_num = parseInt(inputSeconds.toString(), 10); // don't forget the second param
var hours = Math.floor(sec_num / 3600);
var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
var seconds = sec_num - (hours * 3600) - (minutes * 60);
var hoursString = '';
var minutesString = '';
var secondsString = '';
hoursString = (hours < 10) ? "0" + hours : hours.toString();
minutesString = (minutes < 10) ? "0" + minutes : minutes.toString();
secondsString = (seconds < 10) ? "0" + seconds : seconds.toString();
return minutesString + ':' + secondsString;
}
public toastPK(page: string, key: string) {
this.toast(this.ts.trPK(page, key));
}
@ -255,6 +270,26 @@ export class CommonService {
);
}
async JustAlertDialog(acceptLabel: string,
message: string)
{
this.clearAllAlerts();
const alert = await this.alertControllerIonic.create({
header: this.ts.trPK("general", "info"),
message: message,
buttons: [
{
text: acceptLabel,
handler: () => {
this.alertControllerIonic.dismiss();
}
}
]
});
// this.alerts.push(alert);
await alert.present();
}
async confirmAlertDialog(
onAccept: any,
acceptLabel: string,
@ -851,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) {
@ -899,6 +932,9 @@ export class CommonService {
public openUserForgot() {
this.nav.navigateForward(["/authentication/forgot"]);
}
public openSMSPage() {
this.nav.navigateForward(["/authentication/smspage"]);
}
public navigateTo(url: 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();
});
}

@ -12,6 +12,7 @@ export class Request {
public IsIrisPrescription: boolean;
public TokenID: string;
public SessionID: string;
public MobileType: string;
public PatientIdentificationID: string;
public PatientMobileNumber: string;
public BookedBy?: number;

@ -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);

@ -1,51 +1,36 @@
<ion-header>
<ion-toolbar>
<ion-title>{{'sms,title' | translate}}</ion-title>
</ion-toolbar>
<ion-toolbar>
<ion-title>{{'verificationcode.verificationcode' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-grid>
<!-- identification number / file id -->
<ion-row class="ion-justify-content-center">
<img src="assets/icon/verification-code.png" style="width: 25%;height: 35%;" />
</ion-row>
<ion-row class="ion-justify-content-center" >
<ion-text text-center>
<h6>{{ 'home,verification-code-text'| translate}}</h6>
</ion-text>
<ion-text text-center>
<h6>{{mobile}}</h6>
</ion-text>
</ion-row>
<ion-row class="sms_code">
<ion-col [size]="12">
<ion-label class="input-label" >{{ 'h2o,verification_message' | translate}}</ion-label>
<ion-input class="input_bottom" [placeholder]="'h2o,sms_code' | translate" [(ngModel)]="smc_code" pattern="number"></ion-input>
</ion-col>
</ion-row>
<!-- international mobile number-->
<ion-row class="timer-body" >
<ion-col [size]="9">
<ion-label class="input-label" >{{ 'h2o,validation_message' | translate}}</ion-label>
</ion-col>
<ion-col [size]="3">
<ion-label class="input-label-strong" > {{displayTime}} </ion-label>
</ion-col>
<ion-content padding>
<ion-grid>
<ion-row>
<ion-col class="colPad">
<ion-img class="centerDiv" src="../assets/imgs/CS.png"></ion-img>
</ion-col>
</ion-row>
<ion-row *ngIf="resend" >
<ion-col [size]="8" >
<p> {{'h2o,code_failure' | translate}} </p>
</ion-col>
<ion-col [size]="4" class="resend-coloumn" >
<ion-button (click)="ResendOTP()"> {{'h2o,resend' | translate}} </ion-button>
</ion-col>
</ion-row>
<ion-row class="ion-justify-content-center bottom-grid" >
<ion-col [size]="12" >
<ion-button (click)="validate()" expand="full"> {{'general,submit' | translate}} </ion-button>
</ion-col>
<ion-row>
<ion-col>
<p class="centerDiv">{{'verificationcode.title' | translate}}<span class="boldTxtNav">{{'verificationcode.verificationcode' | translate}}</span> {{'verificationcode.by' | translate}}<span class="boldTxtNav">{{'verificationcode.sms' | translate}}</span>{{'verificationcode.instruct' | translate}}<span class="boldTxtNav">{{'general.submit' | translate}}</span></p>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
</ion-grid>
<br/><br/>
<!-- <p style="color: #c0c0c0; margin-left: 32%">{{'verificationcode.verificationcode' | translate}}</p> -->
<div>
<h1 text-center>{{displayTime}}</h1>
<br/><br/>
<ion-item>
<ion-label>{{'verificationcode.verificationcode' | translate}}</ion-label>
<!-- <img class="item-icon" src="assets/imgs/password.png" item-start /> -->
<ion-input required type="tel" [(ngModel)]="activationCode"></ion-input>
</ion-item>
</div>
</ion-content>
<ion-footer>
<div class="centerDiv">
<button ion-button (click)="checkVerificationCode()">{{'general.submit' | translate}}</button>
</div>
</ion-footer>

@ -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();
// }
// }
});
}

@ -7,7 +7,7 @@
</ion-header> -->
<ion-content >
<div class="header-div">
<button ion-button icon-only menuToggle class="menubutton">
<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>

@ -1,16 +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 {
home: any ={};
userData: any ={};
user_image : any = "../assets/imgs/profile.png";
constructor(public ts:TranslatorService ) { }
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;
// }
// }
}

@ -37,6 +37,10 @@
"en": "Password",
"ar": "كلمه السر"
},
"changepassword": {
"en": "Change Password",
"ar": "غير كلمة السر"
},
"forgot-your-id": {
"en": "Forgot Your Patient ID",
"ar": "هل نسيت رقم ملف المريض"
@ -80,6 +84,37 @@
"national-id-or-iqama": {
"en": "National ID or Iqama",
"ar": "رقم الهوية أو الإقامة"
},
"sms-page":{
"en": "Verify OTP",
"ar":"تحقق مرة واحدة كلمة المرور"
}
},
"verificationcode":
{
"verificationcode":{
"en":"Verification Code",
"ar":"رمز التحقق"
},
"emptyCode":{
"en":"Please enter the verification code",
"ar":"الرجاء ادخال رمز التحقق"
},
"title":{
"en":"You will receive a ",
"ar":" سوف تستلم "
},
"by":{
"en":" by ",
"ar":"عن طريق "
},
"sms":{
"en":"SMS",
"ar":" رسالة نصية "
},
"instruct":{
"en":" fill the code and ",
"ar":" ادخل الرمز و اضغط "
}
},
"general": {

Loading…
Cancel
Save