diff --git a/Mohem/src/app/app.component.html b/Mohem/src/app/app.component.html index 97f8ceb3..edf5dc1b 100644 --- a/Mohem/src/app/app.component.html +++ b/Mohem/src/app/app.component.html @@ -12,7 +12,7 @@ - + diff --git a/Mohem/src/app/app.component.scss b/Mohem/src/app/app.component.scss index 88fe6829..4c7c2b87 100644 --- a/Mohem/src/app/app.component.scss +++ b/Mohem/src/app/app.component.scss @@ -2,111 +2,174 @@ 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; - } - - /* + 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%; - } - /* +.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; - } - +.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 { - 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; - } - } + 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 { - 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; - } - \ No newline at end of file + 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; +} + +.sidebar-menu .header-div { + background: var(--primary); + background: -moz-linear-gradient(45deg, var(--primary) 0%, var(--secondary) 36%, var(--secondary) 59%, var(--customnavy) 100%); + background: -webkit-linear-gradient(45deg, var(--primary) 0%, var(--secondary) 36%, var(--secondary) 59%, var(--customnavy) 100%); + background: linear-gradient(45deg, var(--primary) 0%, var(--secondary) 36%, var(--secondary) 59%, var(--customnavy) 100%); + color: var(--light); + text-transform: capitalize; + height: 120px; + position: relative; + display: block; + margin-bottom: 40px; +} + +.list-md .item-block .item-inner, +.list-ios .item-block .item-inner { + border-color: var(--primary); + border-bottom: 0px; +} + +.list-md>.item-block:last-child .item-inner, +.list-ios>.item-block:last-child .item-inner { + border-bottom: 0px; +} + +button.menu-item.item.item-block.item-md, +button.menu-item.item.item-block.item-ios { + border-bottom: 1px solid var(--cusgray); + color: var(--customnavy); +} + +.TxtPlace { + margin: 0; + padding: 40px 0 10px 0; + text-align: center; +} + +.menuFooter { + position: fixed; + bottom: 0px; + text-align: center; + margin: auto; + width: 100%; +} + +.menuFooter div { + width: 80px; + // height: 80px; + margin: auto; +} + + +.menuFooter .CompanyImg { + width: 100%; + height: 100%; +} + +.companyTxt { + font-size: 12px; + color: var(--customnavy); + text-align: center; +} \ No newline at end of file diff --git a/Mohem/src/app/app.component.ts b/Mohem/src/app/app.component.ts index 966e42c2..f63666e8 100644 --- a/Mohem/src/app/app.component.ts +++ b/Mohem/src/app/app.component.ts @@ -20,7 +20,7 @@ export class AppComponent implements OnInit, AfterViewInit { start: any = false; menuList: any = []; User_name_Emp: string = ""; - user_image: string = ""; + user_image: string = "../assets/imgs/profile.png" menuSide: string = "left"; notBadge: number; companyUrl: string = "../assets/imgs/CS.png"; diff --git a/Mohem/src/app/authentication/authentication.module.ts b/Mohem/src/app/authentication/authentication.module.ts index c1551cb3..80456df0 100644 --- a/Mohem/src/app/authentication/authentication.module.ts +++ b/Mohem/src/app/authentication/authentication.module.ts @@ -18,6 +18,7 @@ import { MobileNumberModule } from 'src/app/hmg-common/ui/mobile-number/mobile- 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'; +import { CheckUserComponent } from './check-user/check-user.component'; @@ -41,6 +42,10 @@ const routes: Routes = [ { path: 'smspage', component: SmsPagePage + }, + { + path: 'checkuser', + component: CheckUserComponent } ] } @@ -65,7 +70,8 @@ const routes: Routes = [ LoginComponent, ForgotComponent, AgreementComponent, - SmsPagePage + SmsPagePage, + CheckUserComponent ], providers:[ FingerprintAIO, diff --git a/Mohem/src/app/authentication/check-user/check-user.component.html b/Mohem/src/app/authentication/check-user/check-user.component.html new file mode 100644 index 00000000..40ce8b47 --- /dev/null +++ b/Mohem/src/app/authentication/check-user/check-user.component.html @@ -0,0 +1,33 @@ + + + + + + {{'login,forgot-password' | translate}} + + + + + + + + + + + + {{ts.trPK('login','username')}} + + + + + + + + + + + + + {{ts.trPK('login','changepassword')}} + + \ No newline at end of file diff --git a/Mohem/src/app/authentication/check-user/check-user.component.scss b/Mohem/src/app/authentication/check-user/check-user.component.scss new file mode 100644 index 00000000..4357e11d --- /dev/null +++ b/Mohem/src/app/authentication/check-user/check-user.component.scss @@ -0,0 +1,7 @@ +.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/check-user/check-user.component.spec.ts b/Mohem/src/app/authentication/check-user/check-user.component.spec.ts new file mode 100644 index 00000000..b1d86516 --- /dev/null +++ b/Mohem/src/app/authentication/check-user/check-user.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CheckUserComponent } from './check-user.component'; + +describe('CheckUserComponent', () => { + let component: CheckUserComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CheckUserComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CheckUserComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/authentication/check-user/check-user.component.ts b/Mohem/src/app/authentication/check-user/check-user.component.ts new file mode 100644 index 00000000..b510b256 --- /dev/null +++ b/Mohem/src/app/authentication/check-user/check-user.component.ts @@ -0,0 +1,98 @@ +import { Component, OnInit, ViewChild, ChangeDetectorRef, 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 { 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'; +import { LoginModel } from '../models/LoginModel'; + +@Component({ + selector: 'app-check-user', + templateUrl: './check-user.component.html', + styleUrls: ['./check-user.component.scss'], +}) +export class CheckUserComponent implements OnInit,OnDestroy { + public P_USER_NAME : string; + private loginData = new LoginModel(); + + @ViewChild(InternationalMobileComponent) internationlMobile: InternationalMobileComponent; + constructor(public cs: CommonService, + public authService: AuthenticationService, + public router: Router, + public alertController: AlertController, + public ts: TranslatorService, + public smsService: SmsReaderService, + public sharedData: SharedDataService, + public changeDetector: ChangeDetectorRef) { } + + ngOnInit() {} + + ngOnDestroy(): void { + this.smsService.stopSMSMonitoring(); + } + + public onForgot() { + this.sendSMSForForgotPassword(); + } + + public userCheck() + { + this.cs.startLoading(); + const request = new CheckUserAuthenticationRequest(); + request.P_USER_NAME = this.P_USER_NAME; + this.authService.checkUserAuthentication( + request, + () => { + //this.sendSMSForForgotPassword(); + }, 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(); + // } + } + }); + } + + private checkUserResult: CheckUserAuthenticationResponse; + + private sendSMSForForgotPassword() { + this.cs.startLoading(); + let changePwdObj= new LoginRequest(); + 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.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { + if (this.cs.validResponse(result)) { + this.checkUserResult = result; + console.log("2"); + console.log(result); + this.loginData.LogInTokenID = result.LogInTokenID; + this.loginData.P_USER_NAME = this.P_USER_NAME; + this.sharedData.setSharedData(this.loginData, "logindata"); + this.sharedData.setSharedData(true,Password.IS_FORGET_PSW); + this.cs.stopLoading(); + this.cs.openSMSPage(); + }}); + } +} + diff --git a/Mohem/src/app/authentication/forgot/forgot.component.html b/Mohem/src/app/authentication/forgot/forgot.component.html index 1bc60365..9e46cdb7 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.html +++ b/Mohem/src/app/authentication/forgot/forgot.component.html @@ -12,14 +12,21 @@ - - - - {{ts.trPK('login','username')}} - - - - + + + {{'changePassword,newPassword' | translate}} + + + + + + + {{'changePassword,confirmPassword' | translate}} + + + @@ -28,6 +35,6 @@ - {{ts.trPK('login','changepassword')}} - + {{ts.trPK('login','changepassword')}} + \ 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 949f40a2..26fba950 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.ts +++ b/Mohem/src/app/authentication/forgot/forgot.component.ts @@ -11,7 +11,9 @@ import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.ser 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'; @Component({ selector: 'app-forgot', @@ -20,7 +22,10 @@ import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-m }) export class ForgotComponent implements OnInit,OnDestroy { - public countryCode: CountryCode; + private loginData = new LoginModel(); + public P_NEW_PASSWORD: string; + public P_Confirm_NEW_PASSWORD : string; + public P_USER_NAME : string; @ViewChild(InternationalMobileComponent) internationlMobile: InternationalMobileComponent; constructor( public cs: CommonService, @@ -29,7 +34,8 @@ export class ForgotComponent implements OnInit,OnDestroy { public alertController: AlertController, public ts: TranslatorService, public smsService: SmsReaderService, - public changeDetector: ChangeDetectorRef + public changeDetector: ChangeDetectorRef, + public sharedData: SharedDataService ) { } @@ -39,77 +45,46 @@ export class ForgotComponent implements OnInit,OnDestroy { ngOnDestroy(): void { this.smsService.stopSMSMonitoring(); } + public onForgot() { this.sendSMSForForgotPassword(); } - - public countryCodeChanged(countryCode: CountryCode) { - this.countryCode = countryCode; - } - - public isValidForm() { - return (this.countryCode && this.countryCode.isValid); - } - - - private checkUserResult: CheckUserAuthenticationResponse; private sendSMSForForgotPassword() { - const request = new CheckUserAuthenticationRequest(); - //request.PatientMobileNumber = this.countryCode.number; - //request.ZipCode = CountryCode.localCode(this.countryCode.code); - - this.authService.sendSMSForForgotFileNumber( + const request = new ForgetPassword(); + this.authService.sendForgetPassword( request, () => { this.sendSMSForForgotPassword(); }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { if (this.cs.validResponse(result)) { this.checkUserResult = result; - if (result.isSMSSent) { - this.startReceivingSMS(); - this.presentSMSPasswordDialog(); - } } }); } - - private startReceivingSMS() { - this.smsService.startSMSMonitoring((code) => { - this.cs.dismissSMSDialog().subscribe(cleared => { - this.checkActivationCode(code); - }); - }); - } - public presentSMSPasswordDialog() { - this.cs.presentSMSPasswordDialog( - (code: string) => { - this.checkActivationCode(code); - }); - } - - private checkActivationCode(readedCode?) { - const request = new CheckActivationCodeRequest(); - request.LogInTokenID = this.checkUserResult.LogInTokenID; - request.PatientOutSA = this.checkUserResult.PatientOutSA ? 1 : 0; - request.PatientMobileNumber = this.countryCode.number; - request.ZipCode = CountryCode.localCode(this.countryCode.code); - request.activationCode = readedCode; - - this.authService.forgotFileIdActivation(request, + public forgotpassword(){ + const data = this.sharedData.getSharedData("logindata", false); + this.loginData.P_USER_NAME = this.P_USER_NAME; + let request:ForgetPassword = new ForgetPassword(); + request.P_Confirm_NEW_PASSWORD=this.P_NEW_PASSWORD; + request.P_NEW_PASSWORD=this.P_Confirm_NEW_PASSWORD; + request.P_USER_NAME = data.P_USER_NAME; + + this.authService.submitForgetPassword( + request, () => { - this.presentSMSPasswordDialog(); - }, this.ts.trPK('general', 'retry')).subscribe((result: ForgotFileIDResponse) => { + //this.sendSMSForForgotPassword(); + }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { if (this.cs.validResponse(result)) { - this.smsService.stopSMSMonitoring(); - this.cs.presentAlert(result.ReturnMessage); + this.checkUserResult = result; + console.log(result); + this.cs.toastPK("changePassword","passwordchanged"); + this.cs.openLogin(); } }); - + } - - } diff --git a/Mohem/src/app/authentication/login/login.component.ts b/Mohem/src/app/authentication/login/login.component.ts index 7e533c27..c5da9e6f 100644 --- a/Mohem/src/app/authentication/login/login.component.ts +++ b/Mohem/src/app/authentication/login/login.component.ts @@ -17,6 +17,7 @@ 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'; import { LoginModel } from '../models/LoginModel'; +import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request'; @Component({ selector: 'login', @@ -30,11 +31,10 @@ export class LoginComponent implements OnInit, OnDestroy { isSupportAr:boolean=false; isAppleStore:boolean=false; memberLogin: any = {}; - private password: string; private language: string; private username : string; - private currentLang : any = 2; + private currentLang : any =1; private patientOutSA: boolean; private loginTokenID: string; private isMobileFingerPrint: boolean; @@ -56,12 +56,6 @@ export class LoginComponent implements OnInit, OnDestroy { } ngOnInit() { - console.log(this.currentLang); - //this.setIdPattern(); - // setTimeout(() => { - // this.checkIfLoggedInBefore(); - // // this.splash.hide(); - // }, 100); } @@ -355,12 +349,12 @@ export class LoginComponent implements OnInit, OnDestroy { } private checkUserAuthentication() { - const request = new CheckUserAuthenticationRequest(); + const request = new LoginRequest(); request.P_USER_NAME = this.username; request.P_LANGUAGE = this.language; request.P_PASSWORD = this.password; - - this.authService.checkUserAuthentication( + console.log(request); + this.authService.login( request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { diff --git a/Mohem/src/app/authentication/models/forget.password.ts b/Mohem/src/app/authentication/models/forget.password.ts new file mode 100644 index 00000000..b6cda129 --- /dev/null +++ b/Mohem/src/app/authentication/models/forget.password.ts @@ -0,0 +1,7 @@ +import { Request } from 'src/app/hmg-common/services/models/request'; +export class ForgetPassword extends Request { + public static IS_FORGET_PSW:string="is_forget_password"; + public P_NEW_PASSWORD: string; + public P_Confirm_NEW_PASSWORD:string; + public P_USER_NAME : string; +} diff --git a/Mohem/src/app/authentication/models/password.ts b/Mohem/src/app/authentication/models/password.ts new file mode 100644 index 00000000..4a160292 --- /dev/null +++ b/Mohem/src/app/authentication/models/password.ts @@ -0,0 +1,10 @@ +import { Request } from 'src/app/hmg-common/services/models/request'; + + +export class Password extends Request { + public static IS_FORGET_PSW:string="is_forget_password"; + public IS_FORGET_PWD:boolean; + public P_NEW_PASSWORD: string; + public P_OLD_PASSWORD:string; + public P_Confirm_NEW_PASSWORD:string; +} \ No newline at end of file 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 5cfcec6e..f879b8e2 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts @@ -1,13 +1,14 @@ -import { Component, OnInit } from "@angular/core"; -import { ElementRef } from "@angular/core"; -import { NavController } from "@ionic/angular"; -import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; -import { CommonService } from "src/app/hmg-common/services/common/common.service"; -import { SharedDataService } from "src/app/hmg-common/services/shared-data-service/shared-data.service"; -import { SMSCheckRequest } from "src/app/hmg-common/services/authentication/models/smscheck.request"; -import { LoginModel } from "../models/LoginModel"; -import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; -import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response"; +import { Component, OnInit } from '@angular/core'; +import { ElementRef } from '@angular/core'; +import { NavController } from '@ionic/angular'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; +import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request'; +import { LoginModel } from '../models/LoginModel'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; +import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response'; +import { Password } from '../models/password'; @Component({ selector: "app-sms-page", @@ -45,6 +46,8 @@ export class SmsPagePage implements OnInit { this.count = 0; this.initTimer(); this.startTimer(); + this.isForgetPwd = this.sharedData.getSharedData(Password.IS_FORGET_PSW) || false; + } initTimer() { @@ -145,5 +148,30 @@ export class SmsPagePage implements OnInit { }); } - public checkForgetPwdSMS() {} + public checkForgetPwdSMS() + { + 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 + console.log(data.LogInTokenID); + + this.authService.checkForgetSMS( + request, + () => { + }, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => { + console.log(result); + if (this.common.validResponse(result)) { + console.log(result); + + //this.loginData.LogInTokenID = result.LogInTokenID; + //this.sharedData.setSharedData(this.loginData, "logindata"); + this.common.openForgotPassword(); + } + }); + } + } diff --git a/Mohem/src/app/hmg-common/hmg-common.module.ts b/Mohem/src/app/hmg-common/hmg-common.module.ts index efc962c2..43ff4d57 100644 --- a/Mohem/src/app/hmg-common/hmg-common.module.ts +++ b/Mohem/src/app/hmg-common/hmg-common.module.ts @@ -90,6 +90,7 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; import { RateService } from './services/rate/rate.service'; import { PaymentComponent } from './ui/payment/payment.component'; import { PaymentService } from './ui/payment/service/payment.service'; +import { MenuService } from './services/menu/menuservice.service'; @NgModule({ imports: [ CommonModule, @@ -237,8 +238,8 @@ import { PaymentService } from './ui/payment/service/payment.service'; RatingService, InAppBrowser, RateService, - PaymentService - + PaymentService, + MenuService ] }) export class HmgCommonModule { } 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 f2db8173..69c0d4b7 100644 --- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts +++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts @@ -1,34 +1,35 @@ -import { Injectable } from '@angular/core'; -import { Request } from '../models/request'; -import { TranslatorService } from '../translator/translator.service'; -import { ConnectorService } from '../connector/connector.service'; -import { Observable, throwError } from 'rxjs'; -import { CheckPatientRegisterationRequest } from './models/check-patient-registeration.request'; -import { LoginRequest } from './models/login.request'; -import { Response } from '../models/response'; -import { AuthenticatedUser } from './models/authenticated-user'; -import { CommonService } from '../common/common.service'; -import { CheckUserAuthenticationRequest } from './models/check-user-auth.request'; -import { CheckActivationCodeRequest } from './models/check-activation-code.request'; -import { CheckUserAuthenticationResponse } from './models/check-user-auth.response'; -import { CheckActivationCodeResponse } from './models/check-activation-code.response'; -import { NativeStorage } from '@ionic-native/native-storage/ngx'; -import { CheckRegisterationCodeRequest } from './models/check-registeration-code.request'; -import { RegisterInformationRequest } from './models/register-information.request'; -import { ForgotFileIDResponse } from './models/forgot-File-ID.response'; -import { EmailRequest } from '../models/email-request'; -import { EmailInput } from '../../ui/email/models/email-input'; -import { UserLocalNotificationService } from '../user-local-notification/user-local-notification.service'; -import { GetLoginInfoRequest } from './models/get-login-info.request'; -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'; +import { Injectable } from "@angular/core"; +import { Request } from "../models/request"; +import { TranslatorService } from "../translator/translator.service"; +import { ConnectorService } from "../connector/connector.service"; +import { Observable, throwError } from "rxjs"; +import { CheckPatientRegisterationRequest } from "./models/check-patient-registeration.request"; +import { LoginRequest } from "./models/login.request"; +import { Response } from "../models/response"; +import { AuthenticatedUser } from "./models/authenticated-user"; +import { CommonService } from "../common/common.service"; +import { CheckUserAuthenticationRequest } from "./models/check-user-auth.request"; +import { CheckActivationCodeRequest } from "./models/check-activation-code.request"; +import { CheckUserAuthenticationResponse } from "./models/check-user-auth.response"; +import { CheckActivationCodeResponse } from "./models/check-activation-code.response"; +import { NativeStorage } from "@ionic-native/native-storage/ngx"; +import { CheckRegisterationCodeRequest } from "./models/check-registeration-code.request"; +import { RegisterInformationRequest } from "./models/register-information.request"; +import { ForgotFileIDResponse } from "./models/forgot-File-ID.response"; +import { EmailRequest } from "../models/email-request"; +import { EmailInput } from "../../ui/email/models/email-input"; +import { UserLocalNotificationService } from "../user-local-notification/user-local-notification.service"; +import { GetLoginInfoRequest } from "./models/get-login-info.request"; +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"; +import { ForgetPassword } from 'src/app/authentication/models/forget.password'; @Injectable({ - providedIn: 'root' + providedIn: "root" }) export class AuthenticationService { @@ -58,10 +59,17 @@ export class AuthenticationService { public static forgotFileIDURL = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo'; public static user: AuthenticatedUser; + /*user checking methods */ + public static userChecking = 'Services/ERP.svc/REST/Get_BasicUserInformation'; + public static changePasswordForget ='Services/ERP.svc/REST/ChangePassword_Forget'; + public static LOGIN_EVENT = 'user-login-event'; public static FAMILY_LOGIN_EVENT = 'family-login-event'; public static AUTHENTICATED_USER_KEY = 'save-authenticated-user'; + + + // private static user: AuthenticatedUser; constructor( public con: ConnectorService, @@ -77,11 +85,12 @@ export class AuthenticationService { this.setPublicFields(request); 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.P_SESSION_ID = user.P_SESSION_ID; + request.MobileNumber = user.EMPLOYEE_MOBILE_NUMBER; + request.LogInTokenID = user.LogInTokenID; + request.TokenID = user.TokenID; + request.P_USER_NAME = user.EMPLOYEE_NUMBER; + request.UserName = user.EMPLOYEE_NUMBER; if (AuthenticationService.requireRelogin) { this.sessionTimeOutDialog(); } @@ -95,56 +104,70 @@ export class AuthenticationService { } } */ - return request; - } - - public setPublicFields(request: Request): Request { - request.VersionID = 1; - request.Channel = 31; - request.LanguageID = TranslatorService.getCurrentLanguageCode(); - //request.IPAdress = '10.10.10.10'; - request.SessionID = 'any thing'; // ??? required for not authorized login funny - request.MobileType = "android"; - //request.isDentalAllowedBackend = false; - return request; - } - - public authenticateAndSetPersonalInformation(request: EmailRequest, examinationInfo?: any): EmailRequest { - // if not authenticated will be redirected to login - 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; - - if (examinationInfo) { - if (examinationInfo.SetupID) { request.SetupID = examinationInfo.SetupID; } - if (examinationInfo.ProjectName) { request.ProjectName = examinationInfo.ProjectName; } - if (examinationInfo.ClinicName) { request.ClinicName = examinationInfo.ClinicDescription; } - if (examinationInfo.DoctorName) { request.DoctorName = examinationInfo.DoctorName; } - if (examinationInfo.ProjectID) { request.ProjectID = examinationInfo.ProjectID; } - if (examinationInfo.InvoiceNo) { request.InvoiceNo = examinationInfo.InvoiceNo; } - if (examinationInfo.OrderDate) { - request.OrderDate = this.cs.getDateISO(this.cs.evaluteDateAsObject(examinationInfo.OrderDate)); - } - } - + return request; + } + + public setPublicFields(request: Request): Request { + request.VersionID = 1; + request.Channel = 31; + request.LanguageID = TranslatorService.getCurrentLanguageCode(); + //request.IPAdress = '10.10.10.10'; + //request.SessionID = "any thing"; // ??? required for not authorized login funny + request.MobileType = "android"; + //request.isDentalAllowedBackend = false; + return request; + } + public authenticateAndSetPersonalInformation( + request: EmailRequest, + examinationInfo?: any + ): EmailRequest { + // if not authenticated will be redirected to login + 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; + + if (examinationInfo) { + if (examinationInfo.SetupID) { + request.SetupID = examinationInfo.SetupID; } - return request; + if (examinationInfo.ProjectName) { + request.ProjectName = examinationInfo.ProjectName; + } + if (examinationInfo.ClinicName) { + request.ClinicName = examinationInfo.ClinicDescription; + } + if (examinationInfo.DoctorName) { + request.DoctorName = examinationInfo.DoctorName; + } + if (examinationInfo.ProjectID) { + request.ProjectID = examinationInfo.ProjectID; + } + if (examinationInfo.InvoiceNo) { + request.InvoiceNo = examinationInfo.InvoiceNo; + } + if (examinationInfo.OrderDate) { + request.OrderDate = this.cs.getDateISO( + this.cs.evaluteDateAsObject(examinationInfo.OrderDate) + ); + } + } } + return request; + } - - public getAuthenticatedRequest(login = true): Request { - const request = new Request(); - this.authenticateRequest(request, login); - return request; - } + public getAuthenticatedRequest(login = true): Request { + const request = new Request(); + this.authenticateRequest(request, login); + return request; + } @@ -156,11 +179,8 @@ export class AuthenticationService { public login(request: LoginRequest, onError: any, errorLabel: string): Observable { - request.PatientID = 0; - request.TokenID = ''; - request.isDentalAllowedBackend = false; - request.isRegister = false; - return this.con.post(AuthenticationService.loginURL, request, onError, errorLabel); + this.setPublicFields(request); + return this.con.post(AuthenticationService.login, request, onError, errorLabel); } @@ -180,192 +200,219 @@ export class AuthenticationService { * 1- user stored in local storage without token * @param result check activation code result */ - public setAuthenticatedUser(result: CheckActivationCodeResponse): Observable { - + public setAuthenticatedUser( + result: CheckActivationCodeResponse + ): Observable { return Observable.create(observer => { - this.loadAuthenticatedUser().subscribe((loadedUser: AuthenticatedUser) => { - AuthenticationService.requireRelogin = false; - this.startIdleMonitoring(); - const user = this.updateAuthenticatedUser(result, loadedUser); - /* we store in hd without token but with token in memory*/ - this.saveUserInStorage(user).subscribe((success: boolean) => { - AuthenticationService.user = user; - this.publishUserChangeEvent(); - observer.next(true); - observer.complete(); - }); - }); - }); - - } - - public resetAuthenticatedUser(user: AuthenticatedUser ) { - AuthenticationService.user = user; - AuthenticationService.requireRelogin = false; - this.startIdleMonitoring(); - this.publishUserChangeEvent(); - - } - - public setAuthenticatedMemberFamilyUser(result: CheckActivationCodeResponse) { - - const authUser = new AuthenticatedUser(); - AuthenticationService.requireRelogin = false; - this.startIdleMonitoring(); - const user = this.updateAuthenticatedUser(result, authUser); - - - // user["hello"]= "ok"; - /* we store in hd without token but with token in memory*/ - AuthenticationService.user = user; - this.publishFamilyMemeberUserChangeEvent(); - - } - - - public updateLoggedInUser(newUser: AuthenticatedUser): Observable { - return Observable.create(observer => { - /* we store in hd without token but with token in memory*/ - this.saveUserInStorage(newUser).subscribe((success: boolean) => { - AuthenticationService.requireRelogin = false; - AuthenticationService.user = newUser; + this.loadAuthenticatedUser().subscribe( + (loadedUser: AuthenticatedUser) => { + AuthenticationService.requireRelogin = false; + this.startIdleMonitoring(); + const user = this.updateAuthenticatedUser(result, loadedUser); + /* we store in hd without token but with token in memory*/ + this.saveUserInStorage(user).subscribe((success: boolean) => { + AuthenticationService.user = user; + this.publishUserChangeEvent(); - observer.next(success); - observer.complete(); - }); - - }); - - } - - public setDeviceToken(token: string) { - const user = this.getAuthenticatedUser(); - if (user) { - // user.deviceToken = token; - this.updateLoggedInUser(user).subscribe((success: boolean) => { - // console.log('token stored:' + token); - }); - } - } - - public registerTempUser(request: RegisterInformationRequest, onError: any, errorLabel: string) - : Observable { - this.setPublicFields(request); - request.TokenID = ''; - return this.con.post(AuthenticationService.registerTempUserURL, request, onError, errorLabel); - } - - public getLoginInfo(request: GetLoginInfoRequest, onError: any, errorLabel: string) - : Observable { - this.setPublicFields(request); - return this.con.post(AuthenticationService.getLoginInfoURL, request, onError, errorLabel); - } - - - /** - *update new authenticated user from previously stored and loaded user - */ - private updateAuthenticatedUser(result: CheckActivationCodeResponse, loadedUser: AuthenticatedUser): AuthenticatedUser { - const user = result.MemberInformationList[0]; - - return user; - } - - public isRealEmail(email: string): boolean { - return EmailInput.isValidEmail(email); - } - - public isAuthenticatedUserHasRealEmail(): boolean { - const user = this.getAuthenticatedUser(); - return user ? this.isRealEmail(user.EMPLOYEE_EMAIL_ADDRESS) : false; - } - - /** - * we store in localstorage without token but we keep it in the static member - */ - private saveUserInStorage(user: AuthenticatedUser): Observable { - - return Observable.create(observer => { - if (user) { - // const TokenID = user.TokenID; - // user.TokenID = null; - this.nativeStorage.setItem(AuthenticationService.AUTHENTICATED_USER_KEY, user) - .then( - () => { - //user.TokenID = TokenID; - observer.next(true); - observer.complete(); - }, - error => { - // user.TokenID = TokenID; - - observer.next(false); - observer.complete(); - } - ); - } else { - observer.next(false); + observer.next(true); observer.complete(); + }); } - - }); - - } - - /** - * signout - *clear user session and storage information - */ - public clearUser(): Observable { - this.clearUserSession(); - return Observable.create(observer => { - this.publishUserChangeEvent(); - this.nativeStorage.remove(AuthenticationService.AUTHENTICATED_USER_KEY).then( - () => { - observer.next(true); - observer.complete(); - }, - () => { - observer.next(false); - observer.complete(); - }); + ); }); - } - - private publishUserChangeEvent() { - this.events.publish(AuthenticationService.LOGIN_EVENT, this.getAuthenticatedUser(), Date.now()); - } - - private publishFamilyMemeberUserChangeEvent() { - this.events.publish(AuthenticationService.FAMILY_LOGIN_EVENT, this.getAuthenticatedUser(), Date.now()); - } - - public clearUserSession() { - AuthenticationService.user = null; - } - - public loadAuthenticatedUser(): Observable { - return Observable.create(observer => { - - this.nativeStorage.getItem(AuthenticationService.AUTHENTICATED_USER_KEY) - .then( - (user) => { - observer.next(user); - observer.complete(); - }, - error => { - // 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(); - } - ); - }); - } - // TODO you should read from local storage and update static member - public getAuthenticatedUser(): AuthenticatedUser { - /* + } + + + public resetAuthenticatedUser(user: AuthenticatedUser) { + AuthenticationService.user = user; + AuthenticationService.requireRelogin = false; + this.startIdleMonitoring(); + this.publishUserChangeEvent(); + } + + public setAuthenticatedMemberFamilyUser(result: CheckActivationCodeResponse) { + const authUser = new AuthenticatedUser(); + AuthenticationService.requireRelogin = false; + this.startIdleMonitoring(); + const user = this.updateAuthenticatedUser(result, authUser); + + // user["hello"]= "ok"; + /* we store in hd without token but with token in memory*/ + AuthenticationService.user = user; + this.publishFamilyMemeberUserChangeEvent(); + } + + public updateLoggedInUser(newUser: AuthenticatedUser): Observable { + return Observable.create(observer => { + /* we store in hd without token but with token in memory*/ + this.saveUserInStorage(newUser).subscribe((success: boolean) => { + AuthenticationService.requireRelogin = false; + AuthenticationService.user = newUser; + this.publishUserChangeEvent(); + observer.next(success); + observer.complete(); + }); + }); + } + public setDeviceToken(token: string) { + const user = this.getAuthenticatedUser(); + if (user) { + // user.deviceToken = token; + this.updateLoggedInUser(user).subscribe((success: boolean) => { + // console.log('token stored:' + token); + }); + } + } + + public registerTempUser( + request: RegisterInformationRequest, + onError: any, + errorLabel: string + ): Observable { + this.setPublicFields(request); + request.TokenID = ""; + return this.con.post( + AuthenticationService.registerTempUserURL, + request, + onError, + errorLabel + ); + } + + public getLoginInfo( + request: GetLoginInfoRequest, + onError: any, + errorLabel: string + ): Observable { + this.setPublicFields(request); + return this.con.post( + AuthenticationService.getLoginInfoURL, + request, + onError, + errorLabel + ); + } + + /** + *update new authenticated user from previously stored and loaded user + */ + private updateAuthenticatedUser( + result: CheckActivationCodeResponse, + loadedUser: AuthenticatedUser + ): AuthenticatedUser { + const user = result.MemberInformationList[0]; + user.P_SESSION_ID = result.P_SESSION_ID; + user.MobileNumber = result.EMPLOYEE_MOBILE_NUMBER; + user.TokenID = result.TokenID; + user.LogInTokenID = this.cs.sharedService.getSharedData( + "logindata" + ).LogInTokenID; + return user; + } + + public isRealEmail(email: string): boolean { + return EmailInput.isValidEmail(email); + } + + public isAuthenticatedUserHasRealEmail(): boolean { + const user = this.getAuthenticatedUser(); + return user ? this.isRealEmail(user.EMPLOYEE_EMAIL_ADDRESS) : false; + } + + /** + * we store in localstorage without token but we keep it in the static member + */ + private saveUserInStorage(user: AuthenticatedUser): Observable { + return Observable.create(observer => { + if (user) { + // const TokenID = user.TokenID; + // user.TokenID = null; + this.nativeStorage + .setItem(AuthenticationService.AUTHENTICATED_USER_KEY, user) + .then( + () => { + //user.TokenID = TokenID; + observer.next(true); + observer.complete(); + }, + error => { + // user.TokenID = TokenID; + + observer.next(false); + observer.complete(); + } + ); + } else { + observer.next(false); + observer.complete(); + } + }); + } + /** + * signout + *clear user session and storage information + */ + public clearUser(): Observable { + this.clearUserSession(); + return Observable.create(observer => { + this.publishUserChangeEvent(); + this.nativeStorage + .remove(AuthenticationService.AUTHENTICATED_USER_KEY) + .then( + () => { + observer.next(true); + observer.complete(); + }, + () => { + observer.next(false); + observer.complete(); + } + ); + }); + } + + private publishUserChangeEvent() { + this.events.publish( + AuthenticationService.LOGIN_EVENT, + this.getAuthenticatedUser(), + Date.now() + ); + } + + private publishFamilyMemeberUserChangeEvent() { + this.events.publish( + AuthenticationService.FAMILY_LOGIN_EVENT, + this.getAuthenticatedUser(), + Date.now() + ); + } + + public clearUserSession() { + AuthenticationService.user = null; + } + + public loadAuthenticatedUser(): Observable { + return Observable.create(observer => { + this.nativeStorage + .getItem(AuthenticationService.AUTHENTICATED_USER_KEY) + .then( + user => { + observer.next(user); + observer.complete(); + }, + error => { + // 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(); + } + ); + }); + } + // TODO you should read from local storage and update static member + public getAuthenticatedUser(): AuthenticatedUser { + /* if (AuthenticationService.requireRelogin) { this.sessionTimeOutDialog(); return new AuthenticatedUser(); @@ -380,7 +427,7 @@ export class AuthenticationService { public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string) : Observable { this.setPublicFields(request); - return this.con.post(AuthenticationService.login, request, onError, errorLabel); + return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel); } public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string) @@ -395,19 +442,24 @@ export class AuthenticationService { return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel); } + public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string) + : Observable { + this.setPublicFields(request); + return this.con.post(AuthenticationService.smsCheckForget, request, onError, errorLabel); + } + + public sendPublicSMS(request: SMSCheckRequest, onError: any, errorLabel: string) + : Observable { + this.setPublicFields(request); + return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel); + } + /* client side: id no , mobile no , zip code */ - public checkPatientForRegisteration(request: CheckPatientRegisterationRequest, onError: any, errorLabel: string) - : Observable { - this.setPublicFields(request); - request.TokenID = ''; - request.PatientID = 0; - request.isRegister = false; - return this.con.post(AuthenticationService.checkPatientForRegisterationURL, request, onError, errorLabel); - } - /* + + /* client side: id no , mobile no , zip code */ @@ -415,7 +467,6 @@ export class AuthenticationService { : Observable { this.setPublicFields(request); request.TokenID = ''; - request.PatientID = 0; request.isRegister = false; return this.con.post(AuthenticationService.sendSmsForRegisterURL, request, onError, errorLabel); } @@ -426,12 +477,23 @@ export class AuthenticationService { return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel); } + public sendForgetPassword(request: ForgetPassword, onError: any, errorLabel: string) + : Observable { + this.setPublicFields(request); + return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel); + } + + public submitForgetPassword(request: ForgetPassword, onError: any, errorLabel: string) + : Observable { + this.setPublicFields(request); + return this.con.post(AuthenticationService.changePasswordForget, request, onError, errorLabel); + } + + public sendSMSForForgotFileNumber(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string) : Observable { this.setPublicFields(request); request.TokenID = ''; - request.PatientIdentificationID = ''; - request.PatientID = 0; //request.SearchType = 2; //request.isRegister = false; return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel); @@ -441,140 +503,135 @@ export class AuthenticationService { : Observable { this.setPublicFields(request); request.TokenID = ''; - request.PatientIdentificationID = ''; - request.PatientID = 0; request.SearchType = 2; request.isRegister = false; return this.con.post(AuthenticationService.forgotFileIDURL, request, onError, errorLabel); } - public isSAUDIIDValid(id: string): boolean { if (!id) { - return false; + return false; } try { - id = id.toString(); - id = id.trim(); - const returnValue = Number(id); - let sum = 0; - if (returnValue > 0) { - const type = Number(id.charAt(0)); - - if (id.length !== 10) { - return false; - } - if (type !== 2 && type !== 1) { - return false; - } - - for (let i = 0; i < 10; i++) { - if ((i % 2) === 0) { - const a = id.charAt(i); - const x = Number(a) * 2; - let b = x.toString(); - if (b.length === 1) { - b = '0' + b; - } - sum += Number(b.charAt(0)) + Number(b.charAt(1)); - - } else { - sum += Number(id.charAt(i)); - } + id = id.toString(); + id = id.trim(); + const returnValue = Number(id); + let sum = 0; + if (returnValue > 0) { + const type = Number(id.charAt(0)); + + if (id.length !== 10) { + return false; + } + if (type !== 2 && type !== 1) { + return false; + } + + for (let i = 0; i < 10; i++) { + if (i % 2 === 0) { + const a = id.charAt(i); + const x = Number(a) * 2; + let b = x.toString(); + if (b.length === 1) { + b = "0" + b; } - return ((sum % 10) === 0); + sum += Number(b.charAt(0)) + Number(b.charAt(1)); + } else { + sum += Number(id.charAt(i)); + } } - } catch (err) { - - } + return sum % 10 === 0; + } + } catch (err) {} return false; - } - - - public checkUserHasEmailDialog(): Observable { - - return Observable.create(observer => { - if (this.isAuthenticatedUserHasRealEmail()) { - const message = this.ts.trPK('general', 'send-email') - .replace('[0]', this.getAuthenticatedUser().EmailAddress); - this.cs.presentConfirmDialog(message, - () => { - observer.next(); - observer.complete(); - }); - } else { - this.cs.presentConfirmDialog(this.ts.trPK('login', 'enter-email'), - () => { - //this.cs.openPatientProfile(); - observer.complete(); - }); - } + } + + public checkUserHasEmailDialog(): Observable { + return Observable.create(observer => { + if (this.isAuthenticatedUserHasRealEmail()) { + const message = this.ts + .trPK("general", "send-email") + .replace("[0]", this.getAuthenticatedUser().EmailAddress); + this.cs.presentConfirmDialog(message, () => { + observer.next(); + observer.complete(); }); - - } - - /* + } else { + this.cs.presentConfirmDialog( + this.ts.trPK("login", "enter-email"), + () => { + //this.cs.openPatientProfile(); + observer.complete(); + } + ); + } + }); + } + + /* user session timeout after idle for 20 Minute */ - private static requireRelogin = false; - public static monitorInterval_M = 20 * 60 * 1000; - // public static monitorInterval_M = 15 * 1000; - private static timerID; - - private stopIdleTimer() { - if (AuthenticationService.timerID) { - clearTimeout(AuthenticationService.timerID); - } - } - - private sessionTimeOutDialog() { - this.cs.presentConfirmDialog(this.ts.trPK('general', 'idle-relogin'), () => { - // this.cs.openUserLogin(); - }); - } - - /* + private static requireRelogin = false; + public static monitorInterval_M = 20 * 60 * 1000; + // public static monitorInterval_M = 15 * 1000; + private static timerID; + + private stopIdleTimer() { + if (AuthenticationService.timerID) { + clearTimeout(AuthenticationService.timerID); + } + } + + private sessionTimeOutDialog() { + this.cs.presentConfirmDialog( + this.ts.trPK("general", "idle-relogin"), + () => { + // this.cs.openUserLogin(); + } + ); + } + + /* reset and start idling interval */ - private detectIdle() { - this.stopIdleTimer(); - AuthenticationService.timerID = setTimeout(() => { - if (AuthenticationService.user) { - AuthenticationService.requireRelogin = true; - this.clearUserSession(); - this.publishUserChangeEvent(); - this.sessionTimeOutDialog(); - this.cs.openHome(); - } - }, AuthenticationService.monitorInterval_M); - } - - private registerDocumentEvents(events: string[], handler: any) { - for (const event of events) { - document.addEventListener(event, handler); - } - } - - private static eventsRegistered = false; - public startIdleMonitoring() { - if (!AuthenticationService.eventsRegistered) { - AuthenticationService.eventsRegistered = true; - // every time we have and event - this.registerDocumentEvents(['mousedown', 'touchstart', 'click', 'keyup'], () => { - // if user still logged in and session not expired - if (AuthenticationService.user && !AuthenticationService.requireRelogin) { - // reset and start idling timer - this.detectIdle(); - } - }); + private detectIdle() { + this.stopIdleTimer(); + AuthenticationService.timerID = setTimeout(() => { + if (AuthenticationService.user) { + AuthenticationService.requireRelogin = true; + this.clearUserSession(); + this.publishUserChangeEvent(); + this.sessionTimeOutDialog(); + this.cs.openHome(); + } + }, AuthenticationService.monitorInterval_M); + } + + private registerDocumentEvents(events: string[], handler: any) { + for (const event of events) { + document.addEventListener(event, handler); + } + } + + private static eventsRegistered = false; + public startIdleMonitoring() { + if (!AuthenticationService.eventsRegistered) { + AuthenticationService.eventsRegistered = true; + // every time we have and event + this.registerDocumentEvents( + ["mousedown", "touchstart", "click", "keyup"], + () => { + // if user still logged in and session not expired + if ( + AuthenticationService.user && + !AuthenticationService.requireRelogin + ) { + // reset and start idling timer + this.detectIdle(); + } } - + ); } - - - - + } } - - 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 e67c293e..8a51c013 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 @@ -2,73 +2,77 @@ import { PatientUserModel } from './PatientUserModel'; import { TestBed } from '@angular/core/testing'; export class AuthenticatedUser extends PatientUserModel { -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 + TokenID:string; +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; +P_SESSION_ID:number; +MobileNumber:string; +LogInTokenID:string; } diff --git a/Mohem/src/app/hmg-common/services/authentication/models/basic.info.ts b/Mohem/src/app/hmg-common/services/authentication/models/basic.info.ts new file mode 100644 index 00000000..fc4a19a1 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/authentication/models/basic.info.ts @@ -0,0 +1,7 @@ + +export class BasicInfo extends Request{ + public P_EMAIL_ADDRESS:string; + public P_MOBILE_NUMBER: string; + public P_RETURN_MSG: string; + public P_RETURN_STATUS: 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 db1d7795..44749b80 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 @@ -4,5 +4,10 @@ import { AuthenticatedUser } from './authenticated-user'; export class CheckActivationCodeResponse extends Response { AuthenticationTokenID: string; + P_SESSION_ID:number; + MobileNumber:string; + LogInTokenID:string; + EMPLOYEE_MOBILE_NUMBER:string; + TokenID:string; MemberInformationList:AuthenticatedUser[]; } diff --git a/Mohem/src/app/hmg-common/services/authentication/models/check-user-auth.response.ts b/Mohem/src/app/hmg-common/services/authentication/models/check-user-auth.response.ts index e7e942f0..cc33d22d 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/check-user-auth.response.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/check-user-auth.response.ts @@ -1,4 +1,6 @@ import { Response } from '../../models/response'; +import { BasicInfo } from './basic.info'; +import { MemberList } from './member.list'; export class CheckUserAuthenticationResponse extends Response { PatientHasFile: boolean; @@ -10,4 +12,12 @@ export class CheckUserAuthenticationResponse extends Response { hasFile: boolean; isSMSSent: boolean; LogInTokenID: string; + P_EMAIL_ADDRESS : string; + P_MOBILE_NUMBER : string; + P_RETURN_MSG : string; + P_RETURN_STATUS : string; + public IsPasswordExpired: boolean; + //public P_SESSION_ID:string; + public MemberLoginList: MemberList ; + public BasicMemberInformation: BasicInfo; } diff --git a/Mohem/src/app/hmg-common/services/authentication/models/login.request.ts b/Mohem/src/app/hmg-common/services/authentication/models/login.request.ts index 5d6b3511..cb1cdbf5 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/login.request.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/login.request.ts @@ -7,6 +7,11 @@ export class LoginRequest extends Request { SearchType: number; // 1 for iqama 2 for file number TokenID: string; // "" ZipCode: string; // "966" + MobileNumber: string; + P_USER_NAME : string; + P_MOBILE_NUMBER : string; + P_PASSWORD : string; + P_LANGUAGE : string; // isDentalAllowedBackend: false isRegister: boolean; // false } diff --git a/Mohem/src/app/hmg-common/services/authentication/models/member.list.ts b/Mohem/src/app/hmg-common/services/authentication/models/member.list.ts new file mode 100644 index 00000000..e74b563f --- /dev/null +++ b/Mohem/src/app/hmg-common/services/authentication/models/member.list.ts @@ -0,0 +1,9 @@ +export class MemberList { + public P_EMAIL_ADDRESS:string; + public P_INVALID_LOGIN_MSG: string; + public P_MOBILE_NUMBER: string; + public P_PASSOWRD_EXPIRED: string; + public P_RETURN_MSG: string; + public P_RETURN_STATUS: string; + public P_SESSION_ID: number; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.request.ts b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.request.ts index 5c32c928..4f9f153b 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.request.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.request.ts @@ -1,6 +1,6 @@ import { Request } from '../../models/request'; export class SMSCheckRequest extends Request { - LogInTokenID?: string ; + LogInTokenID: string ; activationCode?: string; } \ No newline at end of file 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 eaf1ac1f..741288ce 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 @@ -3,5 +3,12 @@ import { AuthenticatedUser } from './authenticated-user'; export class SMSCheckResponse extends Response { AuthenticationTokenID: string; MemberInformationList:AuthenticatedUser[]; - + public TokenID: string; + public SessionID: string; + public MobileType: string; + public BookedBy?: number; + public P_SESSION_ID: number; + public MobileNumber : string; + public LogInTokenID : 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 9402bbd9..bcf530ef 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -889,6 +889,9 @@ export class CommonService { public openHome() { this.nav.navigateForward(["/home"]); } + public openForgotPassword() { + this.nav.navigateForward(["/authentication/forgot"]); + } public reload(url: string, from: string) { console.log("force reload called from:" + from); @@ -928,9 +931,12 @@ export class CommonService { } } + public openLogin() { + this.nav.navigateRoot(["/authentication/login"]); + } public openUserForgot() { - this.nav.navigateForward(["/authentication/forgot"]); + this.nav.navigateForward(["/authentication/checkuser"]); } public openSMSPage() { this.nav.navigateForward(["/authentication/smspage"]); diff --git a/Mohem/src/app/hmg-common/services/geofencing/geofencing.service.ts b/Mohem/src/app/hmg-common/services/geofencing/geofencing.service.ts index d7abce84..954e9ad3 100644 --- a/Mohem/src/app/hmg-common/services/geofencing/geofencing.service.ts +++ b/Mohem/src/app/hmg-common/services/geofencing/geofencing.service.ts @@ -54,8 +54,8 @@ export class GeofencingService { const req = new InsertLocationRequest(); req.PointsID = id; req.GeoType = type; - req.PatientID = userData.PatientID; - req.PatientOutSA = userData.PatientOutSA; + //req.PatientID = userData.PatientID; + //req.PatientOutSA = userData.PatientOutSA; this.auth.setPublicFields(req); this.con.postNoLoad(GeofencingService.loggingUrl, req, () => { zone.pendingRequest = type; // failed to log, setup pending request diff --git a/Mohem/src/app/hmg-common/services/menu/menuservice.service.spec.ts b/Mohem/src/app/hmg-common/services/menu/menuservice.service.spec.ts new file mode 100644 index 00000000..f80116c5 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/menu/menuservice.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { MenuserviceService } from './menuservice.service'; + +describe('MenuserviceService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: MenuserviceService = TestBed.get(MenuserviceService); + expect(service).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/hmg-common/services/menu/menuservice.service.ts b/Mohem/src/app/hmg-common/services/menu/menuservice.service.ts new file mode 100644 index 00000000..2b49d10e --- /dev/null +++ b/Mohem/src/app/hmg-common/services/menu/menuservice.service.ts @@ -0,0 +1,50 @@ +import {Injectable} from '@angular/core'; +import {Http, Response, Headers, } from "@angular/http"; +import {AuthenticationService} from "../authentication/authentication.service"; +import { Observable } from 'rxjs'; +import {MenuEntries} from './models/menu-entries.request'; +import {Request} from '../models/request'; +import {MenuResponse} from './models/menu-response' +import { ConnectorService } from '../connector/connector.service'; +@Injectable() +export class MenuService { + public static getMenu ='Services/ERP.svc/REST/GET_MENU'; + public static getMenuEntries = 'Services/ERP.svc/REST/GET_MENU_ENTRIES'; + public static getMyTeam = 'Services/ERP.svc/REST/GET_EMPLOYEE_SUBORDINATES'; + public static getNotCount='Services/ERP.svc/REST/GET_OPEN_NOTIFICATIONS_NUM'; + public static disableSession="Services/ERP.svc/REST/DisableSession"; + public static detectLanguage='Services/ERP.svc/REST/Get_LanguageAvailable'; + constructor( + public authService: AuthenticationService, + public con:ConnectorService + + ) { } + + public getMenu(onError?: any, errorLabel?: string): Observable { + const request = new Request(); + this.authService.authenticateRequest(request); + return this.con.post(MenuService.getMenu, request, onError, errorLabel); + } + public getMenuEntires(menuEntries:any, onError?: any, errorLabel?: string): Observable { + const request = menuEntries; + this.authService.authenticateRequest(request); + return this.con.post(MenuService.getMenuEntries, request, onError, errorLabel); + } + public getNotificationCount(req:any, onError?: any, errorLabel?: string): Observable { + const request = req; + this.authService.authenticateRequest(request); + return this.con.post(MenuService.getNotCount, request, onError, errorLabel); + } + + public disableSession(req:any, onError?: any, errorLabel?: string): Observable { + const request = req; + this.authService.authenticateRequest(request); + return this.con.post(MenuService.disableSession, request, onError, errorLabel); + } + + public getAppLanguages(req:any, onError?: any, errorLabel?: string): Observable { + const request = req; + this.authService.authenticateRequest(request); + return this.con.post(MenuService.detectLanguage, request, onError, errorLabel); + } +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/menu/models/list.menu.ts b/Mohem/src/app/hmg-common/services/menu/models/list.menu.ts new file mode 100644 index 00000000..80c37768 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/menu/models/list.menu.ts @@ -0,0 +1,7 @@ +export class ListMenu { +public MENU_ID:number; +public MENU_NAME:string; +public MENU_TYPE:string; +public RESP_ID:number; +public SUB_MENU_NAME:string; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/menu/models/menu-entries.request.ts b/Mohem/src/app/hmg-common/services/menu/models/menu-entries.request.ts new file mode 100644 index 00000000..69a71f55 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/menu/models/menu-entries.request.ts @@ -0,0 +1,6 @@ +import { Request } from '../models/request'; +export class MenuEntries extends Request { + public P_MENU_TYPE:string; + public P_SELECTED_EMPLOYEE_NUMBER:string; + public P_SELECTED_RESP_ID:number +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts b/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts new file mode 100644 index 00000000..85e91a8c --- /dev/null +++ b/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts @@ -0,0 +1,9 @@ +import { ListMenu } from './list.menu'; +import { MenuEntry } from './menu.entry'; +export class MenuResponse { + public static SHARED_DATA = 'menu_response'; + public static SHARED_SEL_EMP= 'sel_empolyee'; + public static SHARED_SEL_RESP_ID= 'sel_resp_id'; + public List_Menu:ListMenu; + public GetMenuEntriesList:MenuEntry; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/menu/models/menu.entry.ts b/Mohem/src/app/hmg-common/services/menu/models/menu.entry.ts new file mode 100644 index 00000000..7a52d8c6 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/menu/models/menu.entry.ts @@ -0,0 +1,13 @@ +export class MenuEntry { + public MENU_NAME:string; + public ADD_BUTTON:string; + public DELETE_BUTTON:string; + public UPDATE_BUTTON:string; + public ENTRY_SEQUENCE:number; + public FUNCTION_NAME:string; + public LVL:number; + public MENU_ENTRY_TYPE:string; + public PARENT_MENU_NAME:string; + public PROMPT:string; + public REQUEST_TYPE:string; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/menu/models/request.ts b/Mohem/src/app/hmg-common/services/menu/models/request.ts new file mode 100644 index 00000000..8cf1c27f --- /dev/null +++ b/Mohem/src/app/hmg-common/services/menu/models/request.ts @@ -0,0 +1,18 @@ +export class Request { + public P_USER_NAME: string; + public LanguageID: number; + //public IPAdress: string; + public P_SESSION_ID: number; + public VersionID: number; + public Channel: number; + public P_PASSWORD: string; + public P_MOBILE_NUMBER: string; + public P_EMAIL_ADDRESS: string; + public TokenID:string; + public P_NOTIFICATION_ID:number; + public MobileNumber: string; + public UserName:string; + public LogInTokenID:string; + public MobileType:string; + +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/models/request.ts b/Mohem/src/app/hmg-common/services/models/request.ts index 77dee9a3..6da4a70d 100644 --- a/Mohem/src/app/hmg-common/services/models/request.ts +++ b/Mohem/src/app/hmg-common/services/models/request.ts @@ -1,19 +1,16 @@ export class Request { - public ClinicID: number; - public PatientOutSA: number; - public PatientID: number; - public ProjectID: number; public LanguageID: number; public IPAdress: string; public VersionID: number; public Channel: number; - public PatientTypeID: number; public isDentalAllowedBackend: boolean; public IsIrisPrescription: boolean; public TokenID: string; - public SessionID: string; public MobileType: string; - public PatientIdentificationID: string; - public PatientMobileNumber: string; public BookedBy?: number; + public P_SESSION_ID: number; + public MobileNumber : string; + public LogInTokenID : string; + public P_USER_NAME:string; + public UserName:string; } diff --git a/Mohem/src/app/home/home.page.html b/Mohem/src/app/home/home.page.html index 1d3c8baa..f9578e5b 100644 --- a/Mohem/src/app/home/home.page.html +++ b/Mohem/src/app/home/home.page.html @@ -12,14 +12,14 @@ {{notBadge}} - {{"home.hello" | translate}}, {{User_name_Emp}} + {{"userData.hello" | translate}}, {{User_name_Emp}} - {{"home.dashboard" | translate}} + {{"userData.dashboard" | translate}} @@ -37,7 +37,7 @@ - + {{"vacationRule.vacationRule" | translate}} diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 707b17a5..2f849e2b 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -1,50 +1,61 @@ -import { Component, OnInit } from '@angular/core'; -import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; -import { MenuController, NavController } from '@ionic/angular'; +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'; +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', - styleUrls: ['./home.page.scss'], + selector: "app-home", + templateUrl: "./home.page.html", + styleUrls: ["./home.page.scss"] }) export class HomePage implements OnInit { userData: any = {}; user_image: any = "../assets/imgs/profile.png"; - constructor(public ts: TranslatorService, public menu: MenuController, public authService: AuthenticationService, public nav: NavController) { } + menuList: any = []; + constructor( + public ts: TranslatorService, + public menu: MenuController, + public authService: AuthenticationService, + public menuService: MenuService, + public common: CommonService + ) {} ngOnInit() { this.getUserDetails(); + this.getMenu(); } 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); - } + const user = this.authService + .loadAuthenticatedUser() + .subscribe((user: AuthenticatedUser) => { + if (user) { + this.userData = user; + console.log(user); + } else { + console.log(user); + } + }); + } + public Vacation_Rule() { + this.common.navigateForward('/vacation-rule/home'); + } + private getMenu() { + this.menuService.getMenu().subscribe((result: MenuResponse) => { + this.handleMenuResult(result); }); } - - public Vaction_Rule() { - this.nav.navigateForward(['/vacation-rule/home']); + private handleMenuResult(result) { + if (this.common.validResponse(result)) { + if (this.common.hasData(result.List_Menu)) { + this.menuList = result.List_Menu; + } + } } - - // 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; - // } - // } } diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 93391298..ecf32be9 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -703,5 +703,682 @@ "en": "Vacation Rule", "ar": "قاعدة عطلة" } + "en": "Login", + "ar": "الدخول" + }, + "username":{ + "en":"User Name", + "ar":"اسم المستخدم" + }, + "login-type": { + "en": "Login Type", + "ar": "نوع الدخول" + }, + "register": { + "en": "Register", + "ar": "التسجيل" + }, + "sign-out": { + "en": "Are you sure you want to Sign Out", + "ar": "هل أنت متأكد من إغلاق الحساب" + }, + "forgot-id": { + "en": "Forgot Patient ID", + "ar": "نسيت رقم الملف" + }, + "forgot-password": { + "en": "Forgot Password", + "ar": "نسيت كلمة المرور" + }, + "password": { + "en": "Password", + "ar": "كلمه السر" + }, + "changepassword": { + "en": "Change Password", + "ar": "غير كلمة السر" + }, + "forgot-your-id": { + "en": "Forgot Your Patient ID", + "ar": "هل نسيت رقم ملف المريض" + }, + "forgot-desc": { + "en": "Enter your mobile number to receive your patient file number via SMS", + "ar": "أدخل رقم جوالك لاستلام رقم الملف الخاص بك عن طريق الرسائل النصية" + }, + "enter-email": { + "en": "Please you need to enter your email", + "ar": "لو سمحت أدخل البريد الإلكتروني الخاص بك" + }, + "enable-biometric": { + "en": "Do you want to use biometric sensors to ease your login", + "ar": "هل ترغب في استخدام أجهزة الاستشعار البصمة لتسهيل تسجيل دخولك" + }, + "face": { + "en": "Do you want to login with face recognition", + "ar": "هل تود الدخول ببصمة الوجة" + }, + "finger": { + "en": "Do you want to login with finger print", + "ar": "هل تود الدخول ببصمة الإصبع" + }, + "signout": { + "en": "Sign Out", + "ar": "تسجيل خروج" + }, + "find-us": { + "en": "Find us on social", + "ar": "تواصل معنا" + }, + "login-register": { + "en": "Login / Register", + "ar": "دخول / تسجيل" + }, + "id-or-file": { + "en": "ID or File No", + "ar": "هوية أو رقم الملف" + }, + "national-id-or-iqama": { + "en": "National ID or Iqama", + "ar": "رقم الهوية أو الإقامة" + }, + "sms-page":{ + "en": "Verify OTP", + "ar":"تحقق مرة واحدة كلمة المرور" + } +}, +"changePassword":{ + "newPassword":{ + "en":"New Password", + "ar":"كلمة المرور الجديدة" + }, + "confirmPassword":{ + "en":"Confirm Password", + "ar":"تأكيد كلمة المرور" + }, + "passwordchanged":{ + "en":"Your password changed successfully", + "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": { + "birth_date": { + "en": "Birth Date", + "ar": "تاريخ الميلاد" + }, + "alert": { + "en": "Alert", + "ar": "تنبية" + }, + "details": { + "en": "Details", + "ar": "التفاصيل" + }, + "title": { + "en": "Title", + "ar": "العنوان" + }, + "info": { + "en": "Information", + "ar": "معلومات" + }, + "reset": { + "en": "Reset", + "ar": "إعادة تعيين" + }, + "ok": { + "en": "Ok", + "ar": "موافق" + }, + "confirm": { + "en": "Confirm", + "ar": "تأكيد" + }, + "cancel": { + "en": "Cancel", + "ar": "إلغاء" + }, + "done": { + "en": "Done", + "ar": "تم" + }, + "close": { + "en": "Close", + "ar": "إغلق" + }, + "back": { + "en": "Back", + "ar": "رجوع" + }, + "about": { + "en": "About", + "ar": "عن" + }, + "hide": { + "en": "Hide", + "ar": "إخفي" + }, + "select-only": { + "en": "Select", + "ar": "إختر" + }, + "select": { + "en": "Please select", + "ar": "إختر لو سمحت" + }, + "need": { + "en": "You need", + "ar": "أنت تحتاج" + }, + "hospital.location": { + "en": "Hospital Location", + "ar": "مكان المستشفي" + }, + "complaint": { + "en": "Raise Complaint", + "ar": "إرفع شكوي" + }, + "retry": { + "en": "Retry", + "ar": "أعد" + }, + "cart": { + "en": "Add to cart", + "ar": "أضف للسلة" + }, + "reminder": { + "en": "Add Reminder", + "ar": "أضف تذكير" + }, + "cancel-reminder": { + "en": "Cancel Reminder", + "ar": "الغي تذكير" + }, + "send-copy": { + "en": "Send Copy", + "ar": "أرسل نسخة" + }, + "personal-info": { + "en": "Personal Information", + "ar": "البيانات الشخصية" + }, + "qualification": { + "en": "Qualifications", + "ar": "المؤهلات" + }, + "nationality": { + "en": "Nationality", + "ar": "الجنسية" + }, + "empty": { + "en": "Sorry no data avaiable", + "ar": "لا يوجد بيانات" + }, + "no-match": { + "en": "Sorry no match", + "ar": "لا توجد نتيجة" + }, + "home": { + "en": "Home", + "ar": "الرئيسية" + }, + "date": { + "en": "Date", + "ar": "التاريخ" + }, + "num": { + "en": "No", + "ar": "الرقم" + }, + "time": { + "en": "Time", + "ar": "االوقت" + }, + "week": { + "en": "Week", + "ar": "أسبوع" + }, + "weeks": { + "en": "Weeks", + "ar": "أسابيع" + }, + "month": { + "en": "Month", + "ar": "شهر" + }, + "year": { + "en": "Year", + "ar": "سنة" + }, + "delete": { + "en": "Delete", + "ar": "إحذف" + }, + "add": { + "en": "Add", + "ar": "أضف" + }, + "edit": { + "en": "Edit", + "ar": "تعديل" + }, + "measure-unit": { + "en": "Measure unit", + "ar": "وحدة القياس" + }, + "measure-time": { + "en": "Measure time", + "ar": "وقت القياس" + }, + "save": { + "en": "Save", + "ar": "إحفظ" + }, + "success": { + "en": "Done successfully", + "ar": "تم بنجاح" + }, + "other": { + "en": "Other", + "ar": "أخري" + }, + "provide-missing": { + "en": "Please provide required information", + "ar": "لو سمحت قم بإدخال البيانات المطلوبة" + }, + "type": { + "en": "Type", + "ar": "النوع" + }, + "location": { + "en": "Location", + "ar": "المكان" + }, + "sequence": { + "en": "Sequence", + "ar": "رقم" + }, + "status": { + "en": "Status", + "ar": "الحالة" + }, + "scan": { + "en": "Scan", + "ar": "إبحث" + }, + "stop": { + "en": "Stop", + "ar": "توقف" + }, + "stop-connection": { + "en": "Stop Connection", + "ar": "وقف الإتصال" + }, + "remove-measure": { + "en": "Are you sure you want to remove this measure", + "ar": "هل متأكد تريد حذف عذة القراءة" + }, + "optional": { + "en": "Optional", + "ar": "خياري" + }, + "search": { + "en": "Search", + "ar": "إبحث" + }, + "advanced-search": { + "en": "Advanced Search", + "ar": "بحث متقدم" + }, + "email": { + "en": "Email", + "ar": "البريد الالكتروني" + }, + "filter": { + "en": "Filter", + "ar": "تفضيل" + }, + "first-name": { + "en": "First Name", + "ar": "الاسم الأول" + }, + "middle-name": { + "en": "Middle Name", + "ar": "إسم الوالد" + }, + "last-name": { + "en": "Last Name", + "ar": "إسم العائلة" + }, + "subject": { + "en": "Subject", + "ar": "موضوع" + }, + "message": { + "en": "Message", + "ar": "رسالة" + }, + "attachment": { + "en": "Attachment", + "ar": "مرفق" + }, + "select-attachment": { + "en": "Select Attachment", + "ar": "إختر مرفق" + }, + "large-file": { + "en": "Kindly select smaller file", + "ar": "لو سمحت إختر ملف أصغر" + }, + "open": { + "en": "Open", + "ar": "إفتح" + }, + "submit": { + "en": "Submit", + "ar": "أرسل" + }, + "enter-sms-code": { + "en": "Enter verification code", + "ar": "أدخل رقم التعريف" + }, + "enter-sms-enable-biometric": { + "en": "Enter verification for biometric", + "ar": "أدخل رقم التفعيل للبصمة" + }, + "enter-sms": { + "en": "Enter sms ", + "ar": "أدخل رقم الرسالة" + }, + "no-need": { + "en": "No Need", + "ar": "لا حاجة" + }, + "search-citeria": { + "en": "Select search criteria", + "ar": "إختر كيفية البحث" + }, + "search-by-complaint": { + "en": "Chaif Complaint Number", + "ar": "رقم الشكوي" + }, + "complaint-num": { + "en": "Complaint No", + "ar": "رقم الشكوي" + }, + "search-by-file": { + "en": "File Number", + "ar": "رقم الملف" + }, + "search-by-id": { + "en": "Identification Number", + "ar": "رقم الإقامة" + }, + "enter-complaint-no": { + "en": "Enter Chaif Complaint Number", + "ar": "أدخل رقم الشكوي" + }, + "enter-file-no": { + "en": "Enter File Number", + "ar": "أدخل رقم الملف" + }, + "file-no": { + "en": "File Number", + "ar": "رقم الملف" + }, + "enter-id-no": { + "en": "Enter Identification Number", + "ar": "أدخل رقم الإقامة أو الهوية" + }, + "id-no": { + "en": "Identification Number", + "ar": "رقم الإقامة أو الهوية" + }, + "enter-national-id": { + "en": "Enter National ID", + "ar": "أدخل رقم الهوية" + }, + "national-id": { + "en": "National ID", + "ar": "رقم الهوية" + }, + "enter-iqama-no": { + "en": "Enter ID Number", + "ar": "أدخل رقم الإقامة" + }, + "iqama-no": { + "en": "ID Number", + "ar": "رقم الإقامة" + }, + "complaint-no": { + "en": "Complaint No", + "ar": "رقم الشكوي" + }, + "number": { + "en": "Number", + "ar": "الرقم" + }, + "accept": { + "en": "Accept", + "ar": "موافق" + }, + "decline": { + "en": "Decline", + "ar": "أرفض" + }, + "usage-agreement": { + "en": "Usage Agreement", + "ar": "إتفاق الإستخدام" + }, + "loading": { + "en": "Loading ...", + "ar": "يتم التحميل ..." + }, + "email-sent": { + "en": "Email sent successfully", + "ar": "تم إرسال نسخة إلي البريد الإلكتروني" + }, + "send-email": { + "en": "Do you want to send copy of this examination to your personal email [0]", + "ar": "هل تريد إرسال نسخة من هذا الاختبار إلى بريدك الإلكتروني الشخصي [0]" + }, + "relogin": { + "en": "You need to login to use this service", + "ar": "تحتاج إلي الدخول لحسابك من أجل إستخدام هذة الخدمة" + }, + "idle-relogin": { + "en": "Your session has expired kindly relogin to use this service ", + "ar": "انتهت صلاحية جلستك يرجى التفضل بإعادة الدخول لإستخدام هذه الخدمة" + }, + "select-type": { + "en": "Select One", + "ar": "اختر فئة" + }, + "from": { + "en": "From", + "ar": "من" + }, + "to": { + "en": "To", + "ar": "الى" + }, + "result": { + "en": "Result", + "ar": "النتيجة" + }, + "select-date": { + "en": "Select Date", + "ar": "إختر ميعاد" + }, + "normal": { + "en": "Normal", + "ar": "عادي" + }, + "use-pin": { + "en": "Use Pin", + "ar": "إستخدم الرقم التعريفي" + }, + "auth-please": { + "en": "Please Authenticated", + "ar": "عرف نفسك" + }, + "dial-code": { + "en": "Dial Code", + "ar": "كود الإتصال" + }, + "country": { + "en": "Country", + "ar": "الدولة" + }, + "settings": { + "en": "Settings", + "ar": "إعدادات" + }, + "about-app": { + "en": "About the app", + "ar": "عن التطبيق" + }, + "mobile": { + "en": "Mobile No", + "ar": "رقم الجوال" + }, + "english": { + "en": "English", + "ar": "الإنجليزية" + }, + "english-change": { + "en": "الإنجليزية", + "ar": "English" + }, + "arabic": { + "en": "Arabic", + "ar": "العربية" + }, + "arabic-change": { + "en": "العربية", + "ar": "Arabic" + }, + "switch-lng": { + "en": "Do you want to change current language", + "ar": "هل تريد تغيير اللغة" + }, + "show-more": { + "en": "Show More >", + "ar": "عرض المزيد >" + }, + "read-less": { + "en": "Read Less <", + "ar": "قراءة أقل <" + }, + "read-more": { + "en": "Read More >", + "ar": "اقرأ المزيد >" + }, + "more":{ + "en": "More...", + "ar": "أكثر..." + }, + "send-email-short": { + "en": "Email", + "ar": "بريد" + }, + "hi": { + "en": "HI", + "ar": "مرحبا" + }, + "blood-type": { + "en": "blood type", + "ar": "فصيلة الدم" + }, + "sync-success": { + "en": "Data Synced Successfully", + "ar": "تمت مزامنة البيانات بنجاح" + }, + "already-synced": { + "en": "Latest data already synced", + "ar": "أحدث البيانات المتزامنة بالفعل" + }, + "weekly": { + "en": "Weekly", + "ar": "أسبوعي" + }, + "monthly": { + "en": "Monthly", + "ar": "شهريا" + }, + "yearly": { + "en": "Yearly", + "ar": "سنوي" + }, + "report-view": { + "en": "Report View", + "ar": "عرض تقرير" + }, + "graph-view": { + "en": "Graph View", + "ar": "عرض الرسم البياني" + }, + "distance-covered": { + "en": "Distance covered in KMs", + "ar": "المسافة المقطوعة بالكيلومترات" + }, + "steps-covered": { + "en": "Steps covered", + "ar": "الخطوات المغطاة" + }, + "hours-asleep": { + "en": "Time asleep in hours", + "ar": "الوقت نائم في ساعات" + }, + "bad": { + "en": "Bad", + "ar": "سيئ" + }, + "poor": { + "en": "Poor", + "ar": "ضعيف" + }, + "acceptable": { + "en": "Acceptable", + "ar": "مقبول" + }, + "good": { + "en": "Good", + "ar": "جيد" + }, + "excellent": { + "en": "Excellent", + "ar": "ممتاز" + }, + "not-allowed": { + "en": "User has no permissions", + "ar": "المستخدم ليس لدية صلاحيات" } } \ No newline at end of file diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss index 307a507a..7b52e4e6 100644 --- a/Mohem/src/theme/styles.scss +++ b/Mohem/src/theme/styles.scss @@ -139,10 +139,10 @@ ion-header ion-icon.icon.icon-ios.ion-ios-add{ color: (--darkgray); } .toolbar-background { - background: (--primary); - background: -moz-linear-gradient(45deg, (--primary) 0%, (--secondary) 36%,(--secondary) 59%, (--customnavy) 100%); - background: -webkit-linear-gradient(45deg, (--primary) 0%, (--secondary) 36%,(--secondary) 59%, (--customnavy) 100%); - background: linear-gradient(45deg, (--primary) 0%, (--secondary) 36%,(--secondary) 59%, (--customnavy) 100%); + background: var(--primary); + background: -moz-linear-gradient(45deg, var(--primary) 0%, var(--secondary) 36%,var(--secondary) 59%, var(--customnavy) 100%); + background: -webkit-linear-gradient(45deg, var(--primary) 0%, var(--secondary) 36%,var(--secondary) 59%, var(--customnavy) 100%); + background: linear-gradient(45deg, var(--primary) 0%, var(--secondary) 36%,var(--secondary) 59%, var(--customnavy) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='var(--primary)', endColorstr='--var(customnavy)',GradientType=1 ); } /***************button bckground***************/
{{"home.hello" | translate}}, {{User_name_Emp}}
{{"userData.hello" | translate}}, {{User_name_Emp}}
{{"home.dashboard" | translate}}
{{"userData.dashboard" | translate}}
{{"vacationRule.vacationRule" | translate}}