diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index 01cd9e3a..0396eb74 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -9,8 +9,11 @@ const routes: Routes = [ }, { path: 'home', loadChildren: './home/home.module#HomePageModule' }, { path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' }, + { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' }, { path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' } + + ]; @NgModule({ diff --git a/Mohem/src/app/app.component.html b/Mohem/src/app/app.component.html index 03b58f52..8dd02575 100644 --- a/Mohem/src/app/app.component.html +++ b/Mohem/src/app/app.component.html @@ -1,9 +1,9 @@ + - +
@@ -28,7 +28,7 @@ --> - + @@ -36,7 +36,7 @@ {{ts.trPK('userProfile','title')}} - + diff --git a/Mohem/src/app/app.component.ts b/Mohem/src/app/app.component.ts index 16423e38..e38bb54c 100644 --- a/Mohem/src/app/app.component.ts +++ b/Mohem/src/app/app.component.ts @@ -7,6 +7,8 @@ import { AuthenticatedUser } from "./hmg-common/services/authentication/models/a import { TabsBarComponent } from "./hmg-common/ui/tabs-bar/tabs-bar.component"; import { KeyboardService } from "./hmg-common/services/keyboard/keyboard.service"; +import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response"; + import { LazyLoadingService } from "./hmg-common/services/lazy-loading/lazy-loading.service"; @Component({ @@ -20,7 +22,7 @@ export class AppComponent implements OnInit, AfterViewInit { start: any = false; menuList: any = []; User_name_Emp: string = ""; - user_image: string = "../assets/imgs/profile.png" + user_image: string = "../assets/imgs/profile.png"; menuSide: string = "left"; notBadge: number; companyUrl: string = "../assets/imgs/CS.png"; @@ -33,7 +35,8 @@ export class AppComponent implements OnInit, AfterViewInit { private platform: Platform, private events: Events, private keyboardService: KeyboardService, - private menu: MenuController + private menu: MenuController, + private authService: AuthenticationService ) {} ngOnInit() { this.initializeApp(); @@ -48,20 +51,45 @@ export class AppComponent implements OnInit, AfterViewInit { // this.statusBar.styleDefault(); this.start = true; this.watchLanguageChangeEvents(); - // this.checkIfUserLoggedInBefore(); + this.subscribeEvents(); this.keyboardService.watchKeyboard(); }); }); } + subscribeEvents() { + this.events.subscribe("setMenu", () => { + const user = this.authService + .loadAuthenticatedUser() + .subscribe((user: AuthenticatedUser) => { + if (user) { + this.companyUrl = user.CompanyImageURL + ? user.CompanyImageURL + : "../assets/imgs/CS.png"; + + this.companyDesc = user.CompanyImageDescription + ? user.CompanyImageDescription + : "Powered By Cloud Solutions"; + this.User_name_Emp = user.EMPLOYEE_DISPLAY_NAME; + this.user_image = user.EMPLOYEE_IMAGE + ? "data:image/png;base64," + user.EMPLOYEE_IMAGE + : "../assets/imgs/profile.png"; + console.log(user); + } else { + console.log(user); + } + }); + }); + this.events.subscribe("getNotCount", badge => { + this.notBadge = badge; + }); + } private initializeDirection() { this.direction = TranslatorService.getCurrentDirection(); } private watchUserLoginChangeEvents() { this.events.subscribe( AuthenticationService.LOGIN_EVENT, - (user: AuthenticatedUser, time: Date) => { - - } + (user: AuthenticatedUser, time: Date) => {} ); } private watchLanguageChangeEvents() { @@ -73,4 +101,14 @@ export class AppComponent implements OnInit, AfterViewInit { }, 100); }); } + logout() { + this.cs.sharedService.clearAll(); + this.menu.toggle(); + this.cs.openLogin(); + + } + profile() { + this.cs.openProfile(); + this.menu.toggle(); + } } diff --git a/Mohem/src/app/authentication/check-user/check-user.component.html b/Mohem/src/app/authentication/check-user/check-user.component.html index 40ce8b47..fc6f99e2 100644 --- a/Mohem/src/app/authentication/check-user/check-user.component.html +++ b/Mohem/src/app/authentication/check-user/check-user.component.html @@ -6,25 +6,16 @@ {{'login,forgot-password' | translate}} - - - - - {{ts.trPK('login','username')}} - - + + - - - -
diff --git a/Mohem/src/app/authentication/check-user/check-user.component.ts b/Mohem/src/app/authentication/check-user/check-user.component.ts index b510b256..ba44cdbe 100644 --- a/Mohem/src/app/authentication/check-user/check-user.component.ts +++ b/Mohem/src/app/authentication/check-user/check-user.component.ts @@ -6,11 +6,8 @@ import { AlertController } from '@ionic/angular'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request'; import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response'; -import { CheckActivationCodeRequest } from 'src/app/hmg-common/services/authentication/models/check-activation-code.request'; import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.service'; -import { ForgotFileIDResponse } from '../../hmg-common/services/authentication/models/forgot-File-ID.response'; import { InternationalMobileComponent } from 'src/app/hmg-common/ui/mobile-number/international-mobile/international-mobile.component'; -import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model'; import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request'; import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; import { Password } from '../models/password'; @@ -21,7 +18,7 @@ import { LoginModel } from '../models/LoginModel'; templateUrl: './check-user.component.html', styleUrls: ['./check-user.component.scss'], }) -export class CheckUserComponent implements OnInit,OnDestroy { +export class CheckUserComponent implements OnInit { public P_USER_NAME : string; private loginData = new LoginModel(); @@ -37,10 +34,6 @@ export class CheckUserComponent implements OnInit,OnDestroy { ngOnInit() {} - ngOnDestroy(): void { - this.smsService.stopSMSMonitoring(); - } - public onForgot() { this.sendSMSForForgotPassword(); } @@ -53,17 +46,12 @@ export class CheckUserComponent implements OnInit,OnDestroy { this.authService.checkUserAuthentication( request, () => { - //this.sendSMSForForgotPassword(); + /* Write code for error */ }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { if (this.cs.validResponse(result)) { this.checkUserResult = result; this.cs.stopLoading(); this.sendSMSForForgotPassword(); - - // if (result.isSMSSent) { - // this.startReceivingSMS(); - // this.presentSMSPasswordDialog(); - // } } }); } @@ -76,11 +64,12 @@ export class CheckUserComponent implements OnInit,OnDestroy { changePwdObj.MobileNumber= this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER; changePwdObj.P_USER_NAME=this.P_USER_NAME; changePwdObj.P_MOBILE_NUMBER=this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER; - + this.authService.sendPublicSMS( changePwdObj, () => { - this.sendSMSForForgotPassword(); + //this.sendSMSForForgotPassword(); + /* Write code for error */ }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { if (this.cs.validResponse(result)) { this.checkUserResult = result; @@ -94,5 +83,4 @@ export class CheckUserComponent implements OnInit,OnDestroy { this.cs.openSMSPage(); }}); } -} - +} \ No newline at end of file diff --git a/Mohem/src/app/authentication/forgot/forgot.component.scss b/Mohem/src/app/authentication/forgot/forgot.component.scss index e8ab06f1..139597f9 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.scss +++ b/Mohem/src/app/authentication/forgot/forgot.component.scss @@ -1,7 +1,2 @@ - .header-toolbar{ - --background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%); -} -.btnBack{ - background: transparent; -} \ No newline at end of file + diff --git a/Mohem/src/app/authentication/forgot/forgot.component.ts b/Mohem/src/app/authentication/forgot/forgot.component.ts index 26fba950..92865083 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.ts +++ b/Mohem/src/app/authentication/forgot/forgot.component.ts @@ -4,13 +4,9 @@ import { AuthenticationService } from 'src/app/hmg-common/services/authenticatio import { Router } from '@angular/router'; import { AlertController } from '@ionic/angular'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; -import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request'; import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response'; -import { CheckActivationCodeRequest } from 'src/app/hmg-common/services/authentication/models/check-activation-code.request'; import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.service'; -import { ForgotFileIDResponse } from '../../hmg-common/services/authentication/models/forgot-File-ID.response'; import { InternationalMobileComponent } from 'src/app/hmg-common/ui/mobile-number/international-mobile/international-mobile.component'; -import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model'; import { ForgetPassword } from '../models/forget.password'; import { LoginModel } from '../models/LoginModel'; import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; @@ -20,7 +16,7 @@ import { SharedDataService } from 'src/app/hmg-common/services/shared-data-servi templateUrl: './forgot.component.html', styleUrls: ['./forgot.component.scss'] }) -export class ForgotComponent implements OnInit,OnDestroy { +export class ForgotComponent implements OnInit { private loginData = new LoginModel(); public P_NEW_PASSWORD: string; @@ -42,10 +38,6 @@ export class ForgotComponent implements OnInit,OnDestroy { ngOnInit() { } - ngOnDestroy(): void { - this.smsService.stopSMSMonitoring(); - } - public onForgot() { this.sendSMSForForgotPassword(); } @@ -81,7 +73,7 @@ export class ForgotComponent implements OnInit,OnDestroy { if (this.cs.validResponse(result)) { this.checkUserResult = result; console.log(result); - this.cs.toastPK("changePassword","passwordchanged"); + this.cs.toastPK("changePassword","successChange"); this.cs.openLogin(); } }); diff --git a/Mohem/src/app/authentication/login/login.component.ts b/Mohem/src/app/authentication/login/login.component.ts index 6c9ee3bf..4e3b310b 100644 --- a/Mohem/src/app/authentication/login/login.component.ts +++ b/Mohem/src/app/authentication/login/login.component.ts @@ -1,25 +1,12 @@ -import { - Component, - OnInit, - ViewChild, - ChangeDetectorRef, - NgZone, - OnDestroy -} from "@angular/core"; +import { Component, OnInit, NgZone, OnDestroy } from "@angular/core"; import { CommonService } from "src/app/hmg-common/services/common/common.service"; import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; import { Router } from "@angular/router"; import { AlertController } from "@ionic/angular"; import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; -import { CheckUserAuthenticationRequest } from "src/app/hmg-common/services/authentication/models/check-user-auth.request"; import { CheckUserAuthenticationResponse } from "src/app/hmg-common/services/authentication/models/check-user-auth.response"; -import { CheckActivationCodeResponse } from "src/app/hmg-common/services/authentication/models/check-activation-code.response"; import { SmsReaderService } from "src/app/hmg-common/services/sms/sms-reader.service"; -import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user"; -import { PATIENT_TYPE } from "src/app/hmg-common/services/models/patient.type"; import { FingerprintAIO } from "@ionic-native/fingerprint-aio/ngx"; -import { GetLoginInfoRequest } from "src/app/hmg-common/services/authentication/models/get-login-info.request"; -import { GetLoginInfoResponse } from "src/app/hmg-common/services/authentication/models/get-login-info.response"; import { Device } from "@ionic-native/device/ngx"; import { SplashScreen } from "@ionic-native/splash-screen/ngx"; import { SharedDataService } from "src/app/hmg-common/services/shared-data-service/shared-data.service"; @@ -27,439 +14,95 @@ import { LoginModel } from "../models/LoginModel"; import { LoginRequest } from "src/app/hmg-common/services/authentication/models/login.request"; @Component({ - selector: "login", - templateUrl: "./login.component.html", - styleUrls: ["./login.component.scss"] + selector: "login", + templateUrl: "./login.component.html", + styleUrls: ["./login.component.scss"] }) export class LoginComponent implements OnInit, OnDestroy { - appLang: number = 1; - isExpired: boolean = false; - isSupportAr: boolean = false; - isAppleStore: boolean = false; - memberLogin: any = {}; - private password: string; - private language: string; - private username: string; - private currentLang: any = 1; - private patientOutSA: boolean; - private loginTokenID: string; - private isMobileFingerPrint: boolean; - private FingerPrintPatientIdentificationID: string; - private loginData = new LoginModel(); - constructor( - public cs: CommonService, - public authService: AuthenticationService, - public router: Router, - public alertController: AlertController, - public ts: TranslatorService, - public smsService: SmsReaderService, - private faio: FingerprintAIO, - public ngZone: NgZone, - public device: Device, - public splash: SplashScreen, - public sharedData: SharedDataService - ) {} - - ngOnInit() {} - - ngOnDestroy(): void { - this.backClicked(); - } - public changeLanguage() { - this.ts.switchLanguage(); - if (TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN) { - this.language = "US"; - } else { - this.language = "AR"; + appLang: number = 1; + isExpired: boolean = false; + isSupportAr: boolean = false; + isAppleStore: boolean = false; + memberLogin: any = {}; + private password: string; + private language: string; + private username: string; + private currentLang: any = 1; + private patientOutSA: boolean; + private loginTokenID: string; + private isMobileFingerPrint: boolean; + private FingerPrintPatientIdentificationID: string; + private loginData = new LoginModel(); + constructor( + public cs: CommonService, + public authService: AuthenticationService, + public router: Router, + public alertController: AlertController, + public ts: TranslatorService, + public smsService: SmsReaderService, + private faio: FingerprintAIO, + public ngZone: NgZone, + public device: Device, + public splash: SplashScreen, + public sharedData: SharedDataService + ) { } + + ngOnInit() { } + + ngOnDestroy(): void { + this.backClicked(); } - this.currentLang = TranslatorService.getCurrentLanguageCode(); - } - // private checkIfLoggedInBefore() { - // this.cs.startLoading(); - // // check if user logged in before - // this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => { - // if (user) { - // this.startBiometricLogin(user); - // } else { - // this.hideSplashScreen(true); - // } - // }); - // } - private forgetPasswordPage() { - this.cs.openUserForgot(); - } - private hideSplashScreen(stopLoading = false) { - // this.splash.hide(); - if (stopLoading) { - this.cs.stopLoading(); - } - } - // private startBiometricLogin(user: AuthenticatedUser) { - // this.faio.isAvailable().then((options) => { - // this.hideSplashScreen(true); - // if (user.biometricEnabled) { - // // ask if login with face or finger - // this.cs.presentConfirmDialog( - // this.ts.trPK('login', options), - // () => this.presentBiometricDialog(user), - // () => { } - // ); - // } else { - // // ask to enable biometric - // this.getPermissionToActivateBiometric(user); - // } - // }, () => { - // this.hideSplashScreen(true); - // }); - // } - - private getPermissionToActivateBiometric(user: AuthenticatedUser) { - this.cs.presentConfirmDialog( - this.ts.trPK("login", "enable-biometric"), - () => { - user["biometricEnabled"] = true; - this.authService - .updateLoggedInUser(user) - .subscribe((success: boolean) => { - this.presentBiometricDialog(user); - }); - }, - () => {} - ); - } - /* - activate biometric login for this user - */ - private getMobileInfo(user: AuthenticatedUser) { - this.authService - .getLoginInfo( - new GetLoginInfoRequest(user), - () => {}, - this.ts.trPK("general", "ok") - ) - .subscribe((result: GetLoginInfoResponse) => { - if (this.cs.validResponse(result)) { - if (!result.SMSLoginRequired) { - this.loginTokenID = result.LogInTokenID; - this.patientOutSA = result.PatientOutSA; - this.initializeForAuthentictedUser(user); - // sms for register the biometric - if (result.isSMSSent) { - this.startListeneingForSMS( - this.ts.trPK("general", "enter-sms-enable-biometric") - ); - } else { - this.checkActivationCode(); - } - } + public changeLanguage() { + this.ts.switchLanguage(); + if (TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN) { + this.language = "US"; + } else { + this.language = "AR"; } - }); - } - - private initializeForAuthentictedUser(user: AuthenticatedUser) { - this.ngZone.run(() => { - //this.isMobileFingerPrint = true; - //this.FingerPrintPatientIdentificationID = user.IdentificationNo; - //this.mobileNumber = user.MobileNumber; - //this.zipCode = CountryCode.localCode(user.ZipCode); - }); - } - - private presentBiometricDialog(user) { - this.faio - .show({ - clientId: "Fingerprint Authetnciation", - clientSecret: "Ate343_9347lajF", // Only necessary for Android - disableBackup: true, // Only for Android(optional) - localizedFallbackTitle: this.ts.trPK("login", "use-pin"), // Only for iOS - localizedReason: this.ts.trPK("login", "auth-please") // Only for iOS - }) - .then((result: any) => { - // this.checkActivationCode(); - this.getMobileInfo(user); - }) - .catch((error: any) => console.log(error)); - } - - public onLogin() { - this.checkUserAuthentication(); - } - - // public loginWithMyAccount() { - // // this.loginWithTamer(); - // this.loginWithTamer(); - // } - - /* - TODO to be removed later - */ - // public loginWithEnas() { - // alert('you are doing slient login width enas account '); - // const user = new AuthenticatedUser(); - // user.PatientID = 862616; - - // user.PatientTypeID = PATIENT_TYPE.PERMANENT; - // user.PatientOutSA = false; - // user.TokenID = '@dm!n'; - // user.ProjectID = 0; - // user.NationalityID = '2300948375'; - // user.MobileNo = user.MobileNumber = '554355126'; - // user.ZipCode = '+966'; - // user.Address = 'riyadh'; - // user.FirstName = 'MOHAMED'; - // user.MiddleName = 'yaghi'; - // user.LastName = 'mohammed'; - // user.Age = 30; - // user.agreed = true; - // const birthDate = new Date(); - // birthDate.setFullYear(birthDate.getFullYear() - 29); - // user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate)); - // user.Email = 'Mohamed.Afifi@cloudsolution-sa.com'; - // user.PatientName = 'enas yaghi'; - // this.authService.updateLoggedInUser(user).subscribe(done => { - // this.authService.startIdleMonitoring(); - // this.cs.openHome(); - // }); - // } - - // public loginWithVaccineUser() { - // alert('you are doing slient login width vaccine account '); - // const user = new AuthenticatedUser(); - // user.PatientID = 862616; // user with vaccines in dev - - // user.PatientTypeID = PATIENT_TYPE.PERMANENT; - // user.PatientOutSA = false; - // user.TokenID = '@dm!n'; - // user.NationalityID = '2300948375'; - // user.MobileNo = user.MobileNumber = '554355126'; - // user.ProjectID = 0; - // user.ZipCode = '+966'; - // user.Address = 'riyadh'; - // user.FirstName = 'MOHAMED'; - // user.MiddleName = 'yaghi'; - // user.LastName = 'mohammed'; - // user.Age = 30; - // user.agreed = true; - // const birthDate = new Date(); - // birthDate.setFullYear(birthDate.getFullYear() - 29); - // user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate)); - // user.Email = 'minna.barry@cloudsolution-sa.com'; - // user.PatientName = 'enas yaghi'; - // this.authService.updateLoggedInUser(user).subscribe(done => { - // this.authService.startIdleMonitoring(); - // this.cs.openHome(); - // }); - // } - - // public loginWithEyeMeasureUser() { - // alert('you are doing slient login width eye measurements user account '); - // const user = new AuthenticatedUser(); - // user.PatientID = 873010; - - // user.PatientTypeID = PATIENT_TYPE.PERMANENT; - // user.PatientOutSA = false; - // user.TokenID = '@dm!n'; - // user.NationalityID = '2302581828'; - // user.ProjectID = 0; - // user.MobileNo = user.MobileNumber = '555333541'; - // user.ZipCode = '+966'; - // user.Address = 'riyadh'; - // user.FirstName = 'eye'; - // user.MiddleName = 'user'; - // user.LastName = 'measurment'; - // user.Age = 30; - // user.agreed = true; - // const birthDate = new Date(); - // birthDate.setFullYear(birthDate.getFullYear() - 29); - // user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate)); - // user.Email = 'sultan.khan@hmg.local'; - // user.PatientName = 'eye user'; - // this.authService.updateLoggedInUser(user).subscribe(done => { - // this.authService.startIdleMonitoring(); - // this.cs.openHome(); - // }); - // } - - /* - TODO login with mr rwaid - */ - // public loginWithRwaid() { - // alert('you are doing slient login width mr: rwaid account'); - - // const user = new AuthenticatedUser(); - // // tamer with eye measurments 1231755 - // user.PatientID = 1018977; - // user.PatientTypeID = PATIENT_TYPE.PERMANENT; - // user.ProjectID = 0; - // user.PatientOutSA = false; - // user.TokenID = '@dm!n'; - // user.NationalityID = '1001242559'; - // user.MobileNo = user.MobileNumber = '545156035'; - // user.ZipCode = '+966'; - // user.Address = 'riyadh'; - // user.FirstName = 'rwaid'; - // user.MiddleName = 'el mallah'; - // user.LastName = 'mohammed'; - // user.Age = 30; - // user.agreed = true; - // const birthDate = new Date(); - // birthDate.setFullYear(birthDate.getFullYear() - 29); - // user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate)); - // user.Email = 'mohamed.afifi@cloudsolution-sa.com'; - // user.PatientName = 'rwaid al mallah'; - // this.authService.updateLoggedInUser(user).subscribe(done => { - // this.authService.startIdleMonitoring(); - // this.cs.openHome(); - // }); - - // } - - // public loginWithTamer() { - // alert('you are doing slient login width tamer account'); - - // const user = new AuthenticatedUser(); - // user.PatientID = 1231755; - // user.PatientTypeID = PATIENT_TYPE.PERMANENT; - // user.ProjectID = 0; - // user.PatientOutSA = false; - // user.TokenID = '@dm!n'; - // user.NationalityID = '1001242559'; - // user.MobileNo = user.MobileNumber = '537503378'; - // user.ZipCode = '+966'; - // user.Address = 'riyadh'; - // user.FirstName = 'tamer'; - // user.MiddleName = 'faneshah'; - // user.LastName = 'faneshah'; - // user.Age = 30; - // user.agreed = true; - // const birthDate = new Date(); - // birthDate.setFullYear(birthDate.getFullYear() - 29); - // user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate)); - // user.Email = 'mohamed.afifi@cloudsolution-sa.com'; - // user.PatientName = 'tamer fneshah'; - // this.authService.updateLoggedInUser(user).subscribe(done => { - // this.authService.startIdleMonitoring(); - // this.cs.openHome(); - // }); - - // } - - private startListeneingForSMS(title?: string) { - this.startReceivingSMS(); - //this.presentSMSPasswordDialog(title); - } - - private checkUserAuthentication() { - const request = new LoginRequest(); - request.P_USER_NAME = this.username; - request.P_LANGUAGE = this.language; - request.P_PASSWORD = this.password; - console.log(request); - this.authService - .login(request, () => {}, this.ts.trPK("general", "ok")) - .subscribe((result: CheckUserAuthenticationResponse) => { - if (this.cs.validResponse(result)) { - this.loginData.LogInTokenID = result.LogInTokenID; - this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER; - this.sharedData.setSharedData(this.loginData, "logindata"); - this.cs.openSMSPage(); + this.currentLang = TranslatorService.getCurrentLanguageCode(); + } + private forgetPasswordPage() { + this.cs.openUserForgot(); + } + private hideSplashScreen(stopLoading = false) { + // this.splash.hide(); + if (stopLoading) { + this.cs.stopLoading(); } - }); - } - - public backClicked() { - this.smsService.stopSMSMonitoring(); - } + } - private startReceivingSMS() { - // this.smsModal.presentModal(); - // this.smsService.startSMSMonitoring((code) => { - // this.smsModal.dismiss; - // this.global_code = code; - // SMSService.code = this.global_code; - // this.checkActivationCode(code); - // this.cs.dismissSMSDialog().subscribe(cleared => { - // this.checkActivationCode(code); - // }); - // }); - } - public presentSMSPasswordDialog(title?: string) { - this.cs.presentSMSPasswordDialog( - (code: string) => { - this.checkActivationCode(code); - }, - null, - title - ); - } - private checkActivationCode(readedCode?) { - /*const request = new CheckActivationCodeRequest(); - request.IsMobileFingerPrint = this.isMobileFingerPrint; - request.FingerPrintPatientIdentificationID = this.FingerPrintPatientIdentificationID; - request.LogInTokenID = this.loginTokenID; - request.PatientOutSA = this.patientOutSA ? 1 : 0; - request.activationCode = readedCode || '0000'; - request.IsSilentLogin = !readedCode; - request.PatientMobileNumber = this.mobileNumber; - request.ZipCode = this.zipCode; - request.isRegister = false;*/ - // request.SearchType = this.loginType; - // if (this.loginType === LoginComponent.IDENTIFCIATION_LOGIN_TYPE) { - // request.PatientIdentificationID = this.id; - // request.PatientID = 0; - // } else { - // request.PatientID = Number(this.id); - // request.PatientIdentificationID = ''; - // } - // this.authService.checkActivationCode( - // request, - // () => { - // //this.presentSMSPasswordDialog(); - // this.smsModal.presentModal(); - // }, this.ts.trPK('general', 'retry')).subscribe((result: CheckActivationCodeResponse) => { - // if (this.cs.validResponse(result)) { - // if (this.cs.hasData(result.List)) { - // this.smsService.stopSMSMonitoring(); - // this.checkIfUserAgreedBefore(result); - // } - // } - // }); - } - private checkIfUserAgreedBefore(result: CheckActivationCodeResponse) { - this.authService.setAuthenticatedUser(result).subscribe(() => { - // if (this.authService.isAgreedBefore()) { - // this.cs.openHome(); - // } else { - // // this.cs.openAgreement(); - // } - }); - } + public onLogin() { + this.checkUserAuthentication(); + } - private checkUserAgreement() {} + private checkUserAuthentication() { + this.cs.startLoading(); + const request = new LoginRequest(); + request.P_USER_NAME = this.username; + request.P_LANGUAGE = this.language; + request.P_PASSWORD = this.password; + console.log(request); + this.authService + .login(request, () => { }, this.ts.trPK("general", "ok")) + .subscribe((result: CheckUserAuthenticationResponse) => { + if (this.cs.validResponse(result)) { + this.loginData.LogInTokenID = result.LogInTokenID; + this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER; + this.sharedData.setSharedData(this.loginData, "logindata"); + this.cs.stopLoading(); + this.cs.openSMSPage(); + } + }); + } - public signOut() { - // this.cs.presentConfirmDialog(this.ts.trPK('login', 'sign-out'), - // () => { - // this.authService.clearUser().subscribe(success => { - // this.id = null; - // if (this.countryCode) { - // this.internationlMobile.setMobileNumber(this.countryCode.code, null); - // } - // }); - // }); - } + public backClicked() { + this.smsService.stopSMSMonitoring(); + } - public openForgotID() { - this.cs.openUserForgot(); - } + public openForgotID() { + this.cs.openUserForgot(); + } - public onDismiss() { - // this.global_code = SMSService.code; - //this.checkActivationCode(this.global_code); - } - public onCancelled() { - console.log("Modal pop up cancelled"); - } } diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.ts b/Mohem/src/app/authentication/sms-page/sms-page.page.ts index 51d127af..24a54baa 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts @@ -120,8 +120,6 @@ export class SmsPagePage implements OnInit { } } else { let msg: string = this.translate.trPK("general", "noOfTriesLogin"); - //this.common.showAlert(msg); - //this.navCtrl.pop(); goBack this.common.JustAlertDialog(this.translate.trPK("general", "ok"), msg); } } @@ -138,7 +136,6 @@ export class SmsPagePage implements OnInit { .subscribe((result: SMSCheckResponse) => { console.log(result); if (this.common.validResponse(result)) { - //this.sharedData.setSharedData(this.loginData, SmsPagePage.LOGIN_DATA); this.authService.setAuthenticatedUser(result).subscribe(() => { this.common.openHome(); }); @@ -152,8 +149,6 @@ export class SmsPagePage implements OnInit { (request.LogInTokenID = data.LogInTokenID), (request.activationCode = this.activationCode); - //request.P_USER_NAME=this.userName, - //request.MobileNumber=this.member.MemberLoginList.P_MOBILE_NUMBER console.log(data.LogInTokenID); this.authService @@ -162,9 +157,6 @@ export class SmsPagePage implements OnInit { console.log(result); if (this.common.validResponse(result)) { console.log(result); - - //this.loginData.LogInTokenID = result.LogInTokenID; - //this.sharedData.setSharedData(this.loginData, "logindata"); this.common.openForgotPassword(); } }); diff --git a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts index f3ddea32..210c3e6a 100644 --- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts +++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts @@ -304,6 +304,8 @@ export class AuthenticationService { user.P_SESSION_ID = result.P_SESSION_ID; user.MobileNumber = result.EMPLOYEE_MOBILE_NUMBER; user.TokenID = result.TokenID; + user.CompanyImageDescription=result.CompanyImageDescription; + user.CompanyImageURL=result.CompanyImageURL; user.LogInTokenID = this.cs.sharedService.getSharedData( "logindata" ).LogInTokenID; diff --git a/Mohem/src/app/hmg-common/services/authentication/models/authenticated-user.ts b/Mohem/src/app/hmg-common/services/authentication/models/authenticated-user.ts index 8a51c013..fd842744 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/authenticated-user.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/authenticated-user.ts @@ -75,4 +75,6 @@ USER_STATUS: string; P_SESSION_ID:number; MobileNumber:string; LogInTokenID:string; +CompanyImageDescription: string +CompanyImageURL: string } diff --git a/Mohem/src/app/hmg-common/services/authentication/models/check-activation-code.response.ts b/Mohem/src/app/hmg-common/services/authentication/models/check-activation-code.response.ts index 44749b80..f7718603 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/check-activation-code.response.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/check-activation-code.response.ts @@ -9,5 +9,8 @@ export class CheckActivationCodeResponse extends Response { LogInTokenID:string; EMPLOYEE_MOBILE_NUMBER:string; TokenID:string; + CompanyImageDescription:string; + CompanyImageURL: string; + MemberInformationList:AuthenticatedUser[]; } diff --git a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts index 741288ce..1ba738fd 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts @@ -10,5 +10,7 @@ export class SMSCheckResponse extends Response { public P_SESSION_ID: number; public MobileNumber : string; public LogInTokenID : string; + public CompanyImageDescription:string; + public CompanyImageURL:string; public EMPLOYEE_MOBILE_NUMBER:string; } diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index bcf530ef..aab50a10 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -248,7 +248,7 @@ export class CommonService { public userNeedToReLogin() { this.presentConfirmDialog(this.ts.trPK("general", "relogin"), () => { - //this.openUserLogin(); + this.openLogin(); }); } @@ -892,6 +892,9 @@ export class CommonService { public openForgotPassword() { this.nav.navigateForward(["/authentication/forgot"]); } + public openProfile() { + this.nav.navigateForward(["/profile/home"]); + } public reload(url: string, from: string) { console.log("force reload called from:" + from); diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index 2cb40649..c6613abd 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -121,7 +121,7 @@ export class ConnectorService { if (!this.cs.validResponse(result)) { // not authorized if (result.ErrorType === 2) { - // this.cs.userNeedToReLogin(); + this.cs.userNeedToReLogin(); } else { this.cs.showErrorMessageDialog(onError, errorLabel, result.ErrorEndUserMessage); } diff --git a/Mohem/src/app/hmg-common/ui/progressLoading/progress-loading.service.ts b/Mohem/src/app/hmg-common/ui/progressLoading/progress-loading.service.ts index 690e8c69..fdc08358 100644 --- a/Mohem/src/app/hmg-common/ui/progressLoading/progress-loading.service.ts +++ b/Mohem/src/app/hmg-common/ui/progressLoading/progress-loading.service.ts @@ -53,7 +53,7 @@ export class ProgressLoadingService { const template = // tslint:disable-next-line:quotemark "
" + - "" + + "" + "

" + message + "

" + "
"; return template; diff --git a/Mohem/src/app/home/home.page.html b/Mohem/src/app/home/home.page.html index 375f25ce..4751ae33 100644 --- a/Mohem/src/app/home/home.page.html +++ b/Mohem/src/app/home/home.page.html @@ -12,14 +12,14 @@ {{notBadge}}
-

{{ts.trPK('home','hello')}}, {{User_name_Emp}}, {{User_name_Emp}}

+

{{ts.trPK('home','hello')}}, {{userData.EMPLOYEE_DISPLAY_NAME}}

-

{{ts.trPK('home','dashboard')}}, {{User_name_Emp}}

+

{{ts.trPK('home','dashboard')}}

diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 2f849e2b..50e4f169 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -1,12 +1,12 @@ import { Component, OnInit } from "@angular/core"; import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; -import { MenuController } from "@ionic/angular"; +import { MenuController,Events } from "@ionic/angular"; import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; -import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response"; import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user"; import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service"; import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response"; import { CommonService } from "src/app/hmg-common/services/common/common.service"; + @Component({ selector: "app-home", templateUrl: "./home.page.html", @@ -21,7 +21,8 @@ export class HomePage implements OnInit { public menu: MenuController, public authService: AuthenticationService, public menuService: MenuService, - public common: CommonService + public common: CommonService, + public events:Events ) {} ngOnInit() { @@ -32,11 +33,13 @@ export class HomePage implements OnInit { this.menu.toggle(); } private getUserDetails() { - const user = this.authService + this.authService .loadAuthenticatedUser() .subscribe((user: AuthenticatedUser) => { if (user) { + this.events.publish('setMenu'); this.userData = user; + this.user_image = user.EMPLOYEE_IMAGE ? "data:image/png;base64,"+user.EMPLOYEE_IMAGE : this.user_image; console.log(user); } else { console.log(user); diff --git a/Mohem/src/app/profile/home/home.component.html b/Mohem/src/app/profile/home/home.component.html new file mode 100644 index 00000000..d88cac28 --- /dev/null +++ b/Mohem/src/app/profile/home/home.component.html @@ -0,0 +1,111 @@ + + + + + + {{ts.trPK('userProfile','title')}} + + + + + + + + +
{{personalInfo.EMPLOYEE_NAME}}
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
\ No newline at end of file diff --git a/Mohem/src/app/profile/home/home.component.scss b/Mohem/src/app/profile/home/home.component.scss new file mode 100644 index 00000000..60b11dbc --- /dev/null +++ b/Mohem/src/app/profile/home/home.component.scss @@ -0,0 +1,3 @@ +ion-col.colBold, ion-col.colBold > label{ + font-weight:bold; +} \ No newline at end of file diff --git a/Mohem/src/app/profile/home/home.component.spec.ts b/Mohem/src/app/profile/home/home.component.spec.ts new file mode 100644 index 00000000..5ec1377b --- /dev/null +++ b/Mohem/src/app/profile/home/home.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/profile/home/home.component.ts b/Mohem/src/app/profile/home/home.component.ts new file mode 100644 index 00000000..f5e10adf --- /dev/null +++ b/Mohem/src/app/profile/home/home.component.ts @@ -0,0 +1,38 @@ +import { Component, OnInit } from "@angular/core"; +import { CommonService } from "src/app/hmg-common/services/common/common.service"; +import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; +import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; +import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user"; +@Component({ + selector: "app-home", + templateUrl: "./home.component.html", + styleUrls: ["./home.component.scss"] +}) +export class HomeComponent implements OnInit { + personalInfo: any; + imageSrc: string = "../assets/imgs/profile.png"; + constructor( + public ts: TranslatorService, + public cs: CommonService, + public authService: AuthenticationService + ) {} + + ngOnInit() { + this.getProfile(); + } + getProfile() { + this.authService + .loadAuthenticatedUser() + .subscribe((user: AuthenticatedUser) => { + if (user) { + this.personalInfo = user; + this.imageSrc = user.EMPLOYEE_IMAGE + ? "data:image/png;base64," + user.EMPLOYEE_IMAGE + : this.imageSrc; + console.log(user); + } else { + console.log(user); + } + }); + } +} diff --git a/Mohem/src/app/profile/profile.module.ts b/Mohem/src/app/profile/profile.module.ts new file mode 100644 index 00000000..6688ce80 --- /dev/null +++ b/Mohem/src/app/profile/profile.module.ts @@ -0,0 +1,32 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { Routes, RouterModule } from '@angular/router'; + +import { IonicModule } from '@ionic/angular'; + +import { ProfilePage } from './profile.page'; +import { HomeComponent } from './home/home.component'; +const routes: Routes = [ + { + path: '', + component: ProfilePage, + children: [ + { + path: 'home', + component: HomeComponent + } + ], + } +]; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + RouterModule.forChild(routes) + ], + declarations: [ProfilePage , HomeComponent] +}) +export class ProfilePageModule {} diff --git a/Mohem/src/app/profile/profile.page.html b/Mohem/src/app/profile/profile.page.html new file mode 100644 index 00000000..e020ca2c --- /dev/null +++ b/Mohem/src/app/profile/profile.page.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Mohem/src/app/profile/profile.page.scss b/Mohem/src/app/profile/profile.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/profile/profile.page.spec.ts b/Mohem/src/app/profile/profile.page.spec.ts new file mode 100644 index 00000000..6f05c1ab --- /dev/null +++ b/Mohem/src/app/profile/profile.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProfilePage } from './profile.page'; + +describe('ProfilePage', () => { + let component: ProfilePage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ProfilePage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProfilePage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/profile/profile.page.ts b/Mohem/src/app/profile/profile.page.ts new file mode 100644 index 00000000..e24f8f60 --- /dev/null +++ b/Mohem/src/app/profile/profile.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-profile', + templateUrl: './profile.page.html', + styleUrls: ['./profile.page.scss'], +}) +export class ProfilePage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/assets/icon/moving.gif b/Mohem/src/assets/icon/moving.gif new file mode 100644 index 00000000..95e0fadc Binary files /dev/null and b/Mohem/src/assets/icon/moving.gif differ diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss index 79d867c3..9c90f0df 100644 --- a/Mohem/src/theme/styles.scss +++ b/Mohem/src/theme/styles.scss @@ -61,24 +61,18 @@ ion-label{ } -.loaderGif{ +.loading-gif{ background: transparent !important; width:100px; height: 100px; } -.loading-md .loading-wrapper, -.loading-ios .loading-wrapper{ +#custom-progress-loader .container{ background: transparent !important; box-shadow: none; -webkit-box-shadow:none; -moz-box-shadow: none; width: 150px; } -.loading-md ,.loading-ios { - ion-backdrop{ - background-color: #8c8c8c !important; - } -} /***********change header color***************/ .headerBtn{ @@ -87,7 +81,12 @@ ion-label{ .headerImg{ width: 36px; } - +.header-toolbar{ + --background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%); +} +.btnBack{ + background: transparent !important; +} /***************/ .attachImg{ max-width: 30px;