diff --git a/Mohem/package-lock.json b/Mohem/package-lock.json index fc11c970..7c7d2b6c 100644 --- a/Mohem/package-lock.json +++ b/Mohem/package-lock.json @@ -1103,6 +1103,13 @@ "integrity": "sha512-UKNfGmwxy6++21KkZwZxXf0/t1zIKkybwCk6NVRwyuEnPTtNgnynA2G10pYOfTkOFu5UnK8WpqFagRJbHHBHdg==", "requires": { "@types/cordova": "^0.0.34" + }, + "dependencies": { + "@types/cordova": { + "version": "0.0.34", + "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", + "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=" + } } }, "@ionic-native/geolocation": { diff --git a/Mohem/src/app/app.component.html b/Mohem/src/app/app.component.html index 1556b050..f3b35531 100644 --- a/Mohem/src/app/app.component.html +++ b/Mohem/src/app/app.component.html @@ -1,25 +1,109 @@ +
-
-

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

- -
+
+ + + + +
+
+
+ +
+
+ + +
+
+ + +

{{User_name_Emp}}

+ +

{{User_Job_name}}

+ +
- - + + + + + +
+ +
+ + + + + + + + + +
+ + + +
+ + + + +
+ + + + + + + + + {{ts.trPK('userProfile','title')}} + + + + + + + + + {{ts.trPK('login','changepassword')}} {{notBadge}} @@ -29,15 +113,15 @@ --> - + +
@@ -55,7 +139,7 @@

{{CompanyImageDescription}}

diff --git a/Mohem/src/app/app.component.scss b/Mohem/src/app/app.component.scss index 0a6314c5..d7c1c6e7 100644 --- a/Mohem/src/app/app.component.scss +++ b/Mohem/src/app/app.component.scss @@ -8,9 +8,112 @@ header .content-ios:not([no-bounce])>.scroll-content::before { bottom: 0; } + +.mohemmLogo{ + + max-width: 46% !important; + border: 0 !important; + margin-left: 70px !important; + margin-top: -24px !important; + margin-bottom: 11px; +} +.closeIcon{ + + height: 10px !important; + margin-left: 255px !important; + margin-top: 0px !important; + background: transparent; + --background: white !important; + +} +// .editIcon{ +// margin-left: 174px !important; +// margin-bottom: -104px !important; +// padding: 6px -3px !important; +// // margin-top: 50px !important; +// background: transparent; +// --background: rgb(235, 232, 232) !important; +// --border-radius: 80% !important; +// // border-color: rgb(211, 208, 208) !important; +// --box-shadow: 3px 0 rgb(194, 191, 191) !important; +// z-index: 3 !important; + +// } + +.menubutton{ + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 39px; + background: #f0ecec; + font-size: 2rem; + position: absolute; + width: 35px !important; + height: 19px; + box-shadow: 3px 0px 7px 0px #c5c2c2; + border-radius: 50%; + + // box-shadow: 0px 2px 7px 0px #dfe1e3 #7f8c8d; + // white-space: normal; + // color: var(--light); + // text-transform: capitalize; + // min-height: 47px; + // background: transparent; + // font-size: 2rem; + // position: absolute; + // top: 40px; +} + +.changeIcon{ + /* background: #c1c1c1; */ + width: 21px; + /* height: 26px; */ + border-radius: 50% !important; + position: relative; + color: #7f8c8d; + + // background: #c1c1c1; + // width: 40px; + // height: 39px; + // border-radius: 50% !important; + // position: relative; + // left: 51px; + // top:16px; +} + +.changeImgBtn{ + // margin: 0; + position: absolute; + top: 18%; + left: 68%; + // -ms-transform: translate(-50%, -50%); + // transform: translate(-50%, -50%); +} + + +.logout{ + background-color:#22C6B3; + border: none; + color:white; + // padding: 20px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 12px; + margin-left: 120px !important; + margin-top: 15px !important; + margin-bottom: 20px !important; + border-radius: 30px; +// width: 40px; +height: 26px; +padding: 6px 24px; + +} + .menuImg{ - width: 80px; - height: 80px; + width: 105px !important; + height: 105px !important; + margin-left: 90px !important; display: inline-flex; overflow: hidden; background: transparent; @@ -122,17 +225,19 @@ header 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); + // 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; + height: 100px; position: relative; display: block; - margin-bottom: 40px; + margin-bottom: -28px; } .list-md .item-block .item-inner, @@ -154,8 +259,20 @@ button.menu-item.item.item-block.item-ios { .TxtPlace { margin: 0; - padding: 40px 0 10px 0; + padding: 0; text-align: center; + font-weight: bolder; + color: black; + font-size: 16px; +} +.TxtPlaces{ + + margin: 0; + padding: 0; + text-align: center; + font-weight: bolder; + font-size: 14px; + color: darkgray; } .menuFooter { @@ -189,6 +306,17 @@ button.menu-item.item.item-block.item-ios { text-align: center; } ion-thumbnail.menu-thumb{ - width:30px; - height:30px; + width:20px; + height:20px; + // margin-top: 5px !important; +} +.changepassword{ +color: black !important; +font-weight: bolder !important; + +} +.profile{ + color: black !important; + font-weight: bolder !important; + } \ No newline at end of file diff --git a/Mohem/src/app/app.component.ts b/Mohem/src/app/app.component.ts index fde78091..a1e655df 100644 --- a/Mohem/src/app/app.component.ts +++ b/Mohem/src/app/app.component.ts @@ -28,6 +28,7 @@ export class AppComponent implements OnInit, AfterViewInit { companyUrl: string = "../assets/imgs/CS.png"; companyDesc: string = "Powered By Cloud Solutions"; public direction = "ltr"; + User_Job_name: string; constructor( public ts: TranslatorService, private cs: CommonService, @@ -89,6 +90,8 @@ export class AppComponent implements OnInit, AfterViewInit { this.user_image = user.EMPLOYEE_IMAGE ? "data:image/png;base64," + user.EMPLOYEE_IMAGE : "../assets/imgs/profile.png"; + this.User_Job_name=user.JOB_NAME; + console.log(user); } else { console.log(user); @@ -133,4 +136,18 @@ export class AppComponent implements OnInit, AfterViewInit { this.menu.toggle(); } + openChangePassword(){ + this.cs.openChangePassword(); + this.menu.toggle(); + } + + private changeImage() { + this.cs.openChangeImagePage(); + this.menu.toggle(); + } + + closeMenu(){ + this.menu.toggle(); + } + } diff --git a/Mohem/src/app/authentication/authentication.module.ts b/Mohem/src/app/authentication/authentication.module.ts index 520c6c77..31c88e82 100644 --- a/Mohem/src/app/authentication/authentication.module.ts +++ b/Mohem/src/app/authentication/authentication.module.ts @@ -21,7 +21,7 @@ import { SmsPageComponent } from './sms-page/sms-page.page'; import { CheckUserComponent } from './check-user/check-user.component'; import { ChangePasswordComponent } from './change-password/change-password.component'; import {ConfirmLoginComponent} from '../authentication/confirm-login/confirm-login.component' - +import {WelcomeComponent} from '../authentication/welcome/welcome.component' const routes: Routes = [ { @@ -51,6 +51,10 @@ const routes: Routes = [ { path: 'confirmLogin', component: ConfirmLoginComponent + }, + { + path: 'welcom', + component: WelcomeComponent } ] } @@ -77,7 +81,8 @@ const routes: Routes = [ SmsPageComponent, CheckUserComponent, ChangePasswordComponent, - ConfirmLoginComponent + // ConfirmLoginComponent, + WelcomeComponent ], providers:[ FingerprintAIO, diff --git a/Mohem/src/app/authentication/change-password/change-password.component.html b/Mohem/src/app/authentication/change-password/change-password.component.html index 383e5f88..ef0cdcd7 100644 --- a/Mohem/src/app/authentication/change-password/change-password.component.html +++ b/Mohem/src/app/authentication/change-password/change-password.component.html @@ -12,23 +12,37 @@ - + + + + + + + +
+
+

{{'changePassword,changePassword' | translate}}

+ + - +

{{'changePassword,newPassword' | translate}}

+ + - - + @@ -40,6 +54,6 @@
- {{ts.trPK('login','changepassword')}} +
\ No newline at end of file diff --git a/Mohem/src/app/authentication/change-password/change-password.component.scss b/Mohem/src/app/authentication/change-password/change-password.component.scss index e69de29b..baffb4ff 100644 --- a/Mohem/src/app/authentication/change-password/change-password.component.scss +++ b/Mohem/src/app/authentication/change-password/change-password.component.scss @@ -0,0 +1,31 @@ +.login-input { + border: none; +} +.item-input{ + --min-height: 1.0cm !important; + --border-radius: 12px; + --ion-color-base: white !important; + // --background: color: var(--darkgray) !important; + // background: #7f8c8d !important; + border-radius: 33px; + --border: solid #9999992b !important; + border: solid #9999992b !important; + margin-bottom :12px; + margin-left: 12px; + margin-right: 12px; +} + +.button-login{ + + --background: var(--newgreen) !important; + background: var(--newgreen) !important; + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 1.0cm; + --border-radius: 33px !important; + border-radius: 33px !important; + --min-height: 1.6cm !important; + width: 315px; +} + diff --git a/Mohem/src/app/authentication/change-password/change-password.component.ts b/Mohem/src/app/authentication/change-password/change-password.component.ts index ee3ece29..455ffffb 100644 --- a/Mohem/src/app/authentication/change-password/change-password.component.ts +++ b/Mohem/src/app/authentication/change-password/change-password.component.ts @@ -24,7 +24,8 @@ export class ChangePasswordComponent implements OnInit { public P_Confirm_NEW_PASSWORD : string; public P_OLD_PASSWORD : string; public P_USER_NAME : string; - + public logo = "assets/icon/login/lock.png"; + userData: any = {}; public isExpiredPwd: boolean = false; constructor( 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 fc6f99e2..766c4349 100644 --- a/Mohem/src/app/authentication/check-user/check-user.component.html +++ b/Mohem/src/app/authentication/check-user/check-user.component.html @@ -8,10 +8,27 @@ - + + + + + + + +
+
+ + +

{{ts.trPK('login','check-user-text1')}}{{ts.trPK('login','check-user-text2')}} {{ts.trPK('login','check-user-text3')}}

+
+
+ + + +
@@ -19,6 +36,6 @@
- {{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 index 4357e11d..0628ac93 100644 --- a/Mohem/src/app/authentication/check-user/check-user.component.scss +++ b/Mohem/src/app/authentication/check-user/check-user.component.scss @@ -4,4 +4,38 @@ .btnBack{ background: transparent; -} \ No newline at end of file +} + +/////////////////////////////////////////////////////////// + +.login-input { + border: none; +} +.item-input{ + --min-height: 1.0cm !important; + --border-radius: 12px; + --ion-color-base: white !important; + // --background: color: var(--darkgray) !important; + // background: #7f8c8d !important; + border-radius: 33px; + --border: solid #9999992b !important; + border: solid #9999992b !important; + margin-bottom :12px; + margin-left: 12px; + margin-right: 12px; +} + +.button-login{ + + --background: var(--newgreen) !important; + background: var(--newgreen) !important; + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 1.0cm; + --border-radius: 33px !important; + border-radius: 33px !important; + --min-height: 1.6cm !important; + width: 315px; +} +/////////////////////////////////////////// \ No newline at end of file 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 d0b0579a..f0bd66a9 100644 --- a/Mohem/src/app/authentication/check-user/check-user.component.ts +++ b/Mohem/src/app/authentication/check-user/check-user.component.ts @@ -21,7 +21,8 @@ import {LoginComponent} from 'src/app/authentication/login/login.component'; export class CheckUserComponent implements OnInit { public P_USER_NAME : string; private loginData = new LoginModel(); - + public logo = "assets/icon/login/lock.png"; + @ViewChild(InternationalMobileComponent) internationlMobile: InternationalMobileComponent; constructor(public cs: CommonService, public authService: AuthenticationService, diff --git a/Mohem/src/app/authentication/confirm-login/confirm-login.component.html b/Mohem/src/app/authentication/confirm-login/confirm-login.component.html index 794c4955..ba09e11a 100644 --- a/Mohem/src/app/authentication/confirm-login/confirm-login.component.html +++ b/Mohem/src/app/authentication/confirm-login/confirm-login.component.html @@ -1,4 +1,4 @@ - + @@ -9,20 +9,28 @@ - - + + - + - - + + -

{{ts.trPK('login','verify-login-with')}}

+ + + + +

{{empname}}

+
+

{{ts.trPK('login','verify-login-with')}}

@@ -32,19 +40,32 @@
- - - + + + + + + + + + + + *ngIf="button.visible" + [buttonClass]="button.buttonClass" [pClass]="button.pClass"> + + + + +
- -
\ No newline at end of file + +
diff --git a/Mohem/src/app/authentication/confirm-login/confirm-login.component.scss b/Mohem/src/app/authentication/confirm-login/confirm-login.component.scss index e69de29b..eb5390a3 100644 --- a/Mohem/src/app/authentication/confirm-login/confirm-login.component.scss +++ b/Mohem/src/app/authentication/confirm-login/confirm-login.component.scss @@ -0,0 +1,10 @@ +.content-class { + height: 25vh; +} + +.rowOutside{ + // margin-top: -37px; + +} + + diff --git a/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts b/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts index fcb3a40e..1dec3179 100644 --- a/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts +++ b/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; import {ButtonSettings} from "src/app/hmg-common/ui/button/models/button-settingsl"; @@ -27,6 +27,8 @@ import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/mod import { PushService } from 'src/app/hmg-common/services/push/push.service'; import { Platform } from '@ionic/angular'; +import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response'; +import { LoginModel } from '../models/LoginModel'; @@ -44,7 +46,7 @@ import { Platform } from '@ionic/angular'; export class ConfirmLoginComponent implements OnInit { - public logo = "assets/imgs/CS.png"; + public logo = "assets/icon/login/password.png"; public buttons:any=[]; @@ -52,7 +54,7 @@ export class ConfirmLoginComponent implements OnInit { onlySMSBox: any = true; - loginData:any; + public loginData = new LoginModel(); selectedOption: any; @@ -62,7 +64,12 @@ export class ConfirmLoginComponent implements OnInit { deviceToken:any; - + @Input() accessFromOutSide = false; + @Input() visible = true; + username: any; + password:any; + loginType: any; + empname: string; constructor( @@ -87,14 +94,15 @@ export class ConfirmLoginComponent implements OnInit { ) { + this.loginData= this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); - console.log(this.loginData); + console.log("logindata: "+this.loginData); - this.deviceToken= this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false); + this.deviceToken= this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false); - console.log("deviceToken :"+this.deviceToken); + console.log("deviceToken :"+this.deviceToken); //if device token undefind @@ -108,7 +116,9 @@ export class ConfirmLoginComponent implements OnInit { this.lastLogin = this.cs.sharedService.getSharedData(AuthenticationService.LAST_LOGIN, false); - + this.username = localStorage.getItem("user"); + this.password = localStorage.getItem("password"); + this.empname = localStorage.getItem("emp-name"); } @@ -121,8 +131,9 @@ export class ConfirmLoginComponent implements OnInit { this.checkIfAvailable(); //**getSharedData of IMEI_USER_DATA and REGISTER_DATA_FOR_LOGIIN to set defult value **// - - + this.username = localStorage.getItem("user"); + this.password = localStorage.getItem("password"); + this.empname = localStorage.getItem("emp-name"); // this.setDefault(); @@ -214,7 +225,10 @@ export class ConfirmLoginComponent implements OnInit { disabled: this.isFaceorFinger === "finger" || this.isFaceorFinger === "biometric" ? false : true, - visible: this.onlySMSBox + visible: this.onlySMSBox, + buttonClass: 'buttonClassWhite', + pClass: 'pClassMyFileIconBlack', + class: 'nationalIdIcon', }, @@ -232,7 +246,10 @@ export class ConfirmLoginComponent implements OnInit { disabled: this.isFaceorFinger === "face" ? false : true, - visible: this.onlySMSBox + visible: this.onlySMSBox, + buttonClass: 'buttonClassWhite', + pClass: 'pClassMyFileIconBlack', + class: 'nationalIdIcon', }, @@ -248,7 +265,10 @@ export class ConfirmLoginComponent implements OnInit { value: 4, - visible: true + visible: true, + buttonClass: 'buttonClassWhite', + pClass: 'pClassMyFileIconBlack', + class: 'nationalIdIcon', }, @@ -264,7 +284,10 @@ export class ConfirmLoginComponent implements OnInit { value: 1, - visible: true + visible: true, + buttonClass: 'buttonClassWhite', + pClass: 'pClassMyFileIconBlack', + class: 'nationalIdIcon', } @@ -278,6 +301,7 @@ export class ConfirmLoginComponent implements OnInit { confirm(el: any) { + console.log("confirm:"+ el ); this.selectedOption = this.selectedOption && !this.onlySMSBox ? this.selectedOption : el.value; @@ -286,13 +310,15 @@ export class ConfirmLoginComponent implements OnInit { case 1: - console.log(el.value); - + console.log(el.value); + localStorage.setItem("login-type",el.value); + console.log("login-type: "+ localStorage.getItem("login-type")) this.loginWithSMS(el); break; case 2: + localStorage.setItem("login-type",el.value); console.log(el.value); @@ -303,6 +329,7 @@ export class ConfirmLoginComponent implements OnInit { break; case 3: + localStorage.setItem("login-type",el.value); console.log(el.value); @@ -316,6 +343,7 @@ export class ConfirmLoginComponent implements OnInit { console.log(el.value); + localStorage.setItem("login-type",el.value); this.loginWithWhatsapp(el); @@ -335,7 +363,7 @@ export class ConfirmLoginComponent implements OnInit { AuthenticationService.LAST_LOGIN ); - + } @@ -460,7 +488,7 @@ export class ConfirmLoginComponent implements OnInit { this.cs.sharedService.setSharedData({ - MobileNumber: this.loginData.mobileNumber, + MobileNumber: this.loginData.MobileNumber, loginType: this.selectedOption @@ -651,7 +679,7 @@ export class ConfirmLoginComponent implements OnInit { if ( result.Mohemm_GetPatientID_List[0].LoginType == 2 || result.Mohemm_GetPatientID_List[0].LoginType == 3) { this.loginTokenID = result.LogInTokenID; - + //send silent sms this.checkSMS(); } else { @@ -712,11 +740,13 @@ export class ConfirmLoginComponent implements OnInit { this.authService.setAuthenticatedUser(result).subscribe(() => { console.log("insert"); - + localStorage.setItem("emp-name",result.MemberInformationList[0].EMPLOYEE_NAME); + console.log("empnmae: "+ localStorage.getItem("emp-name")); if (this.platform.is("cordova")) { - + this.insertMobileLogin(); + } this.cs.openHome(); @@ -785,6 +815,77 @@ console.log("succssful insertMobileLoginInfo" ); } +//do silent login +private checkUserAuthentication() { + console.log("debug Here!!"); + this.cs.startLoading(); + const request = new LoginRequest(); + request.P_USER_NAME = this.username; + request.P_LANGUAGE = "US";//this.language; + request.P_PASSWORD = this.password; + console.log(request); + this.authService + .login(request, () => { + console.log("error here"); + //console.log(result.MessageStatus); + //this.sharedData.setSharedData(true, Password.IS_EXPIRED_PSW); + //this.userCheck(); + }, this.ts.trPK("general", "ok")) + .subscribe((result: CheckUserAuthenticationResponse) => { + console.log("success"); + this.cs.stopLoading(); + if (this.cs.validResponse(result)) { + + console.log("result.LogInTokenID "+ result.LogInTokenID); + console.log("this.loginData before "+ this.loginData); + this.loginData = new LoginModel(); + console.log("this.loginData after "+ this.loginData); + + this.loginData.LogInTokenID = result.LogInTokenID; + this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER; + this.loginData.P_USER_NAME = this.username; + this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA); + this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA); + //this.remeberMyInfo(); + //this.cs.openSMSPage(); phase#1 one type of OTP + // if(!this.welcomeBack){ + //this.cs.openConfirmLoginPage();//phase#2 add 4 types for OTP + // } + this.confirm(this.loginType); + + + } else { + console.log("result.IsPasswordExpired"); + console.log(result.IsPasswordExpired); + if (result.IsPasswordExpired) { + // alert("dont forget to handelpresentPasswordExpiredDialog() "); + // this.presentPasswordExpiredDialog(); ***** + } + } + }); +} + +checkAccess(el:any){ + let data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); + + this.loginType=el; + if(this.accessFromOutSide){ + // alert("this.accessFromOutSide" + this.accessFromOutSide); + this.checkUserAuthentication(); + } + else{ + // alert("this.accessFromOutSide" + this.accessFromOutSide); + if(!data == undefined ){ + // alert("data.LogInTokenID" + data.LogInTokenID); + + this.confirm(this.loginType); + } + else{ + this.checkUserAuthentication(); + + } +} +}//end checkAccess }​ \ No newline at end of file diff --git a/Mohem/src/app/authentication/forgot/forgot.component.html b/Mohem/src/app/authentication/forgot/forgot.component.html index 9e46cdb7..07be7169 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.html +++ b/Mohem/src/app/authentication/forgot/forgot.component.html @@ -10,20 +10,30 @@ - + + - + + + + + + +
+
+ + - + @@ -35,6 +45,6 @@
- {{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 96a05ce2..95c8789f 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.ts +++ b/Mohem/src/app/authentication/forgot/forgot.component.ts @@ -21,6 +21,8 @@ export class ForgotComponent implements OnInit { public P_NEW_PASSWORD: string; public P_Confirm_NEW_PASSWORD : string; public P_USER_NAME : string; + public logo = "assets/icon/login/lock.png"; + constructor( public cs: CommonService, public authService: AuthenticationService, diff --git a/Mohem/src/app/authentication/login/login.component.html b/Mohem/src/app/authentication/login/login.component.html index 70e2c0ad..9ff9fb26 100644 --- a/Mohem/src/app/authentication/login/login.component.html +++ b/Mohem/src/app/authentication/login/login.component.html @@ -1,28 +1,57 @@ - + + + +
+ + +
+
+
+ + + +
+ + + + + + + + + + + - +

{{ts.trPK('login','login')}}

- - +
+ - + + {{ts.trPK('login','remeber-me')}} @@ -39,13 +68,33 @@
+ +
+ + + + + + + + + + + +
- +
- {{ts.trPK('login','login')}} +

-
+ + + + + + + \ No newline at end of file diff --git a/Mohem/src/app/authentication/login/login.component.scss b/Mohem/src/app/authentication/login/login.component.scss index 8b4cbf03..da05689e 100644 --- a/Mohem/src/app/authentication/login/login.component.scss +++ b/Mohem/src/app/authentication/login/login.component.scss @@ -110,3 +110,121 @@ img.centerDiv { } +.login-input { + border: none; +} + +.item-input{ + --min-height: 1.0cm !important; + --border-radius: 12px; + --ion-color-base: white !important; + // --background: color: var(--darkgray) !important; + // background: #7f8c8d !important; + border-radius: 33px; + --border: solid #9999992b !important; + border: solid #9999992b !important; + margin-bottom :12px; + margin-left: 12px; + margin-right: 12px; +} + +.button-login{ + + --background: var(--newgreen) !important; + background: var(--newgreen) !important; + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 1.0cm; + --border-radius: 33px !important; + border-radius: 33px !important; + --min-height: 1.6cm !important; + width: 315px; +} +.content { + width: 500px; + margin-left: auto; + margin-right: auto; +} +.first-circle { + background: var(--newgreen) !important; + border-radius: 50%; + height: 292px; + width: 288px; + float: left; + margin-left: -55px; + margin-top: -140px; + +} +.middle-circle { + position: relative; + background:var(--darkblue) !important; + border-radius: 50%; + height: 160px; + width: 170px; + margin: -115px 0px 0px 179px; +} +.last-circle { + position: inherit; + background: var(--lightblue) !important; + border-radius: 50%; + height: 166px; + width: 140px; + margin: -147px 0px 0px 274px; +} + +.logoFotor { + width: 45px !important; + height: 45px !important; + +} + +.welcomeText{ + justify-content: center; + align-items: center; + text-align: left; + font-size: 26px; + font-weight: bold; + color: #f2f2f2; + margin-top: 178px; + margin-left: 48px; +} + +.forgetText{ + background: transparent; + color: var(--darkblue) !important; +} + + +@media only screen and (max-width: 980px) { + .content{width:100%;} +} + + +.circle1{ + width: 15%; + padding-top: 15%; + margin:0 42%; + background-color: black; + border-radius: 50%; + display:inline-block; + } + .circle2{ + width: 15%; + padding-top: 15%; + margin-left: 20%; + background-color:darkred; + border-radius: 50%; + display:inline-block; + margin-top:20px; + } + .circle3{ + width: 15%; + padding-top: 15%; + margin-left: 26%; + background-color:gold; + border-radius: 50%; + display:inline-block; + margin-top:20px; + margin-right: 15%; + } \ No newline at end of file diff --git a/Mohem/src/app/authentication/login/login.component.ts b/Mohem/src/app/authentication/login/login.component.ts index 3af15059..24456221 100644 --- a/Mohem/src/app/authentication/login/login.component.ts +++ b/Mohem/src/app/authentication/login/login.component.ts @@ -40,6 +40,12 @@ export class LoginComponent implements OnInit, OnDestroy { private isMobileFingerPrint: boolean; private FingerPrintPatientIdentificationID: string; private loginData = new LoginModel(); + private empname:any; + private logintype:any; + public loginDiv:boolean =true; + public welcomeBack:boolean =false; + public logo = "assets/icon/login/password.png"; + constructor( public cs: CommonService, @@ -58,11 +64,21 @@ export class LoginComponent implements OnInit, OnDestroy { ) { } ngOnInit() { - + this.username = localStorage.getItem("user"); this.password = localStorage.getItem("password"); let remember = localStorage.getItem("remember"); + this.empname= localStorage.getItem("emp-name"); + this.logintype= localStorage.getItem("login-type"); if (remember == "true") { this.remeberMe = true } else { this.remeberMe = false } + if(this.username || this.empname){ + this.loginDiv=false; + this.welcomeBack=true; + + }else{ + this.loginDiv=true; + this.welcomeBack=false; + } // alert("user>>" + this.username); // alert("pass>>>" + this.password); // alert("remember>>>" + this.remeberMe); @@ -93,22 +109,26 @@ export class LoginComponent implements OnInit, OnDestroy { public addValue(e): void { // console.log(e.currentTarget.checked); - this.remeberMe = e.currentTarget.checked; + this.remeberMe = true;//e.currentTarget.checked; this.remeberMyInfo(); } public remeberMyInfo() { - if (this.remeberMe) { + // if (this.remeberMe) { if(this.username){localStorage.setItem("user", this.username);} if(this.password){localStorage.setItem("password", this.password);} localStorage.setItem("remember", "true"); - } else { - localStorage.setItem("user", ""); - localStorage.setItem("password", ""); - localStorage.setItem("remember", "false"); - } + // } else { + // localStorage.setItem("user", ""); + // localStorage.setItem("password", ""); + // localStorage.setItem("remember", "false"); + // } } public onLogin() { + // console.log("onLogin"); + // this.checkAppUpdated(); + // this.checkUserAuthentication(); + let deviceToken = localStorage.getItem('deviceToken'); if (deviceToken) { console.log('login enabled first time: ' + deviceToken); @@ -153,6 +173,10 @@ export class LoginComponent implements OnInit, OnDestroy { private checkUserAuthentication() { console.log("debug Here!!"); + console.log(this.username); + console.log(this.language); + console.log(this.password); + this.cs.startLoading(); const request = new LoginRequest(); request.P_USER_NAME = this.username; @@ -177,7 +201,9 @@ export class LoginComponent implements OnInit, OnDestroy { this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA); this.remeberMyInfo(); //this.cs.openSMSPage(); phase#1 one type of OTP + // if(!this.welcomeBack){ this.cs.openConfirmLoginPage();//phase#2 add 4 types for OTP + // } } else { @@ -262,4 +288,18 @@ export class LoginComponent implements OnInit, OnDestroy { }); } + login() { + console.log("login emit"); + console.log("login"); + // this.checkUserAuthentication(); + this.loginDiv=true; + this.welcomeBack=false; + } + + + loginWithUser() { + console.log("loginWithUser") + this.cs.openConfirmLoginPage(); + } + } diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.html b/Mohem/src/app/authentication/sms-page/sms-page.page.html index 5eca319e..c3a81c18 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.html +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.html @@ -10,13 +10,19 @@ - - + + + + +
+
-

{{'verificationcode,title' | translate}}{{'verificationcode,verificationcode' | translate}} {{'verificationcode,by' | translate}}{{'verificationcode,sms' | translate}}{{'verificationcode,instruct' | translate}}{{'general,submit' | translate}}

+

{{'verificationcode,verificationcode' | translate}}

+
+

{{'verificationcode,title' | translate}}{{'verificationcode,verificationcode' | translate}} {{'verificationcode,by' | translate}}{{'verificationcode,sms' | translate}}{{'verificationcode,instruct' | translate}}{{'general,submit' | translate}}

@@ -25,15 +31,34 @@

{{displayTime}}



- - - + + + + + + + + + + + + + + + +
+
- {{'general,submit' | translate}} +
\ No newline at end of file diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.scss b/Mohem/src/app/authentication/sms-page/sms-page.page.scss index 5f1c67eb..78c9db1f 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.scss +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.scss @@ -18,4 +18,51 @@ h1{ span{ font-weight: bold; -} \ No newline at end of file +} +.button-login{ + + --background: var(--newgreen) !important; + background: var(--newgreen) !important; + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 1.0cm; + --border-radius: 33px !important; + border-radius: 33px !important; + --min-height: 1.6cm !important; + width: 315px; +} + +.leftDiv { + margin: auto; + text-align: left; + display: block; +} + +.sms_code{ + margin: 0px; + text-align: center; +} + +ion-input { + margin: 0 5px; + text-align: center; + line-height: 0; + font-size: 32px; + //border: solid 1px #ccc; + border: solid 0.01cm #000000; + //box-shadow: 0 0 5px #ccc inset; + outline: none; + width: 20%; + transition: all .2s ease-in-out; + border-radius: 3px; + display: inline-block; + &:focus { + border-color:var(--ion-color-secondary) !important; + box-shadow: 0 0 5px var(--ion-color-secondary) !important inset; + } + + &::selection { + background: transparent; + } + } \ 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 825f64fd..cfd88aac 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts @@ -75,6 +75,12 @@ export class SmsPageComponent implements OnInit { public loginTypeData:any; + public logo = "assets/icon/login/password.png"; + + public smc_code: any = []; + code: any; + + constructor( public navCtrl: NavController, @@ -131,7 +137,7 @@ export class SmsPageComponent implements OnInit { this.loginTypeData= this.common.sharedService.getSharedData(SMSCheckRequest.SHARED_DATA, false); - console.log("loginType :"+this.loginTypeData.loginType); + // console.log("loginType :"+this.loginTypeData.loginType); @@ -258,16 +264,17 @@ export class SmsPageComponent implements OnInit { } checkVerificationCode() { + this.code=this.smc_code.join(''); if (this.count < 3) { if ( - this.activationCode == undefined || + this.code == undefined || - this.activationCode == null || + this.code == null || - this.activationCode == "" + this.code == "" ) { @@ -282,7 +289,7 @@ export class SmsPageComponent implements OnInit { this.checkForgetPwdSMS(); } else { - + console.log("checkSMS"); this.checkSMS(); } @@ -304,7 +311,7 @@ export class SmsPageComponent implements OnInit { public checkSMS() { // alert("checkSMS in page") - + console.log("code" + this.code); const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); const request = new SMSCheckRequest(); @@ -313,7 +320,7 @@ export class SmsPageComponent implements OnInit { request.LogInTokenID = data.LogInTokenID; - request.activationCode = this.activationCode; + request.activationCode = this.code; //code;this.activationCode; request.P_USER_NAME = data.P_USER_NAME; @@ -336,15 +343,17 @@ export class SmsPageComponent implements OnInit { this.authService.setAuthenticatedUser(result).subscribe(() => { //call insert Mobile Login - - + console.log("insert"); + localStorage.setItem("emp-name",result.MemberInformationList[0].EMPLOYEE_NAME); + console.log("empnmae: "+ localStorage.getItem("emp-name")); if (this.platform.is("cordova")) { + // localStorage.setItem("full-name", result.P_USER_NAME); this.insertMobileLogin(); } - + this.common.openHome(); @@ -417,7 +426,7 @@ console.log("successful insertMobileLogin" ); request.LogInTokenID = data.LogInTokenID; - request.activationCode = this.activationCode; + request.activationCode =this.code;// this.activationCode; request.P_USER_NAME = data.P_USER_NAME; @@ -457,6 +466,53 @@ console.log("successful insertMobileLogin" ); }); + } + onChange() { + const filtered = this.smc_code.filter(function (el) { + if (el) { + return el; + } + }); + if (filtered.length === 4) { + //this.validate(); + console.log("validate"); + this.checkVerificationCode(); + } + } + + goToNextInput(e) { + // let value = e.target.value; + // if (value.length === 1) { + const key = e.which; + const t = e.target; + let sib = t.nextElementSibling; + + if (key !== 9 && (key < 48 || key > 57)) { + if (key === 8 || key === 46) { + return true; + } else { + e.preventDefault(); + return false; + } + } + + if (key === 9) { + return true; + } + + if (sib) { + //sib = document.querySelector('input'); + if (e.target.value) { + sib.setFocus(); + } + } + // } else { + // e.target.value = value.substring(0, value.length - 1); + // } + + + + } } \ No newline at end of file diff --git a/Mohem/src/app/authentication/welcome/welcome.component.html b/Mohem/src/app/authentication/welcome/welcome.component.html new file mode 100644 index 00000000..77efcb65 --- /dev/null +++ b/Mohem/src/app/authentication/welcome/welcome.component.html @@ -0,0 +1,3 @@ +

+ welcome works! +

diff --git a/Mohem/src/app/authentication/welcome/welcome.component.scss b/Mohem/src/app/authentication/welcome/welcome.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/authentication/welcome/welcome.component.spec.ts b/Mohem/src/app/authentication/welcome/welcome.component.spec.ts new file mode 100644 index 00000000..908ca625 --- /dev/null +++ b/Mohem/src/app/authentication/welcome/welcome.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WelcomeComponent } from './welcome.component'; + +describe('WelcomeComponent', () => { + let component: WelcomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WelcomeComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WelcomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/authentication/welcome/welcome.component.ts b/Mohem/src/app/authentication/welcome/welcome.component.ts new file mode 100644 index 00000000..a6048d5b --- /dev/null +++ b/Mohem/src/app/authentication/welcome/welcome.component.ts @@ -0,0 +1,14 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-welcome', + templateUrl: './welcome.component.html', + styleUrls: ['./welcome.component.scss'], +}) +export class WelcomeComponent implements OnInit { + + constructor() { } + + ngOnInit() {} + +} diff --git a/Mohem/src/app/hmg-common/hmg-common.module.ts b/Mohem/src/app/hmg-common/hmg-common.module.ts index fad1c4e1..8a9169e3 100644 --- a/Mohem/src/app/hmg-common/hmg-common.module.ts +++ b/Mohem/src/app/hmg-common/hmg-common.module.ts @@ -99,7 +99,9 @@ import {File} from '@ionic-native/file/ngx'; import {FileUploderProfileComponent} from './ui/file-uploder-profile/file-uploder-profile.component' import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx'; import { AccordinCustomComponent } from './ui/accordin-custom/accordin-custom.component'; -import { AccordinTabCustomComponent} from './ui/accordin-custom/accordin-tab-custom/accordin-tab-custom.component' +import { AccordinTabCustomComponent} from './ui/accordin-custom/accordin-tab-custom/accordin-tab-custom.component'; +import{ConfirmLoginComponent} from '../authentication/confirm-login/confirm-login.component' +import{WelcomeComponent} from './ui/welcome-login/welcome.component' import {DashboredService} from './services/dashbored/dashbored.service' import {FabButtonComponent} from './ui/fab-button/fab-button.component' @NgModule({ @@ -115,6 +117,7 @@ import {FabButtonComponent} from './ui/fab-button/fab-button.component' ], declarations: [ FabButtonComponent, + WelcomeComponent, NumberRangeComponent, SSpacerComponent, MSpacerComponent, @@ -168,10 +171,13 @@ import {FabButtonComponent} from './ui/fab-button/fab-button.component' WorkListAttachViewComponent, FileUploderProfileComponent, AccordinTabCustomComponent, - AccordinCustomComponent + AccordinCustomComponent, + ConfirmLoginComponent + ], exports: [ FabButtonComponent, + WelcomeComponent, NumberRangeComponent, SSpacerComponent, MSpacerComponent, @@ -222,7 +228,9 @@ import {FabButtonComponent} from './ui/fab-button/fab-button.component' WorkListAttachViewComponent, FileUploderProfileComponent, AccordinTabCustomComponent, - AccordinCustomComponent + AccordinCustomComponent, + ConfirmLoginComponent + ], providers: [ DashboredService, 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 c6a5352f..660b8a28 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 @@ -16,5 +16,6 @@ export class SMSCheckResponse extends Response { public CompanyImageDescription:string; public CompanyImageURL:string; public EMPLOYEE_MOBILE_NUMBER:string; + public EMPLOYEE_NAME:string; } diff --git a/Mohem/src/app/hmg-common/ui/button/button.component.scss b/Mohem/src/app/hmg-common/ui/button/button.component.scss index f62e14ac..5fc4ac29 100644 --- a/Mohem/src/app/hmg-common/ui/button/button.component.scss +++ b/Mohem/src/app/hmg-common/ui/button/button.component.scss @@ -6,7 +6,7 @@ box-shadow: 0px 0px 8px 2px #d5d5d5ab; background: white; margin-bottom: 0.3cm; - border-color: #ececec; + // border-color: #ececec; border-style: solid; border-width: 0.02cm; } diff --git a/Mohem/src/app/hmg-common/ui/button/button.component.ts b/Mohem/src/app/hmg-common/ui/button/button.component.ts index a88d0184..9f6305b2 100644 --- a/Mohem/src/app/hmg-common/ui/button/button.component.ts +++ b/Mohem/src/app/hmg-common/ui/button/button.component.ts @@ -13,6 +13,8 @@ export class ButtonComponent implements OnInit { @Input() class: any = ''; @Input() icon: string; @Input() title: string; + @Input() buttonClass: any = ''; + @Input() pClass: any = ''; @Output() trigger = new EventEmitter(); @Input() settings: ButtonSettings; public direction: string; diff --git a/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.html b/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.html index 4cabc97c..6f53759d 100644 --- a/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.html +++ b/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.html @@ -1,10 +1,28 @@ -
+ + {{'userProfile,changeImg' | translate}} -
+
--> + + +
+ + +
+ + + + + + diff --git a/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.scss b/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.scss index e3f037ce..da5d7c33 100644 --- a/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.scss +++ b/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.scss @@ -8,13 +8,24 @@ transform: translate(-50%, -50%); } .btnImge{ - button{ - border-color:transparent !important; - } + // button{ + border-color:transparent !important; + --background: #22C6B3 !important; + background: #22C6B3 !important; + + height: 57px !important; + width: 60px !important; + border-radius: 50% !important; + // } + } //test .changeIcon{ - background: #19a163; - width: 15px; - height: 15px; + background: #22C6B3 !important; + border-radius: 50% !important; + width: 73px; + height: 55px; + color: white !important; + width: 80px; + height: 71px; } \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.html b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.html new file mode 100644 index 00000000..b58e0af1 --- /dev/null +++ b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.html @@ -0,0 +1,69 @@ + + + + + +

{{'home,welcome-back' | translate}}

+

{{empname}}

+

{{welcome_txt}}

+

{{txt_account}}

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + {{'rate,yes' | translate}} + + + + + + + \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.scss b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.scss new file mode 100644 index 00000000..2f287ba3 --- /dev/null +++ b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.scss @@ -0,0 +1,68 @@ +.logo-en { + text-align: left; +} + +.logo-ar { + text-align: right; +} + +.welcome { + margin: 10px; + display: inline-block; + font-weight: bold; + font-size: 0.55cm; +} + +.description { + margin-top: .5cm; +} + +.last-login { + margin: 0; + font-size: 12px; + text-align: center; +} + +.row-border { + margin-top: 20px; + border: 1px solid #bbbbbb; + border-radius: 10px; + padding: 5px; + background: #dddddd; +} + + +.fadein { + -webkit-animation-name: fadeIn; + animation-name: fadeIn; +} + +.small-font-size { + font-size: 14px; + ; +} + +.bottom-buttons { + margin-bottom: 0; +} + +@-webkit-keyframes fadeIn { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } +} + +.welcome-footer { + position: fixed; + bottom: 10px; + left: 0; + right: 0; +} + +.text1 { + line-height: 1.5; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.spec.ts b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.spec.ts new file mode 100644 index 00000000..908ca625 --- /dev/null +++ b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WelcomeComponent } from './welcome.component'; + +describe('WelcomeComponent', () => { + let component: WelcomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WelcomeComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WelcomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.ts b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.ts new file mode 100644 index 00000000..df42e2cb --- /dev/null +++ b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.ts @@ -0,0 +1,182 @@ +import { + Component, + OnInit, + Output, + EventEmitter, + AfterViewInit, + ViewChild, + OnDestroy +} from "@angular/core"; +import { TranslatorService } from "../../services/translator/translator.service"; +import { CommonService } from "../../services/common/common.service"; +import { AuthenticationService } from "../../services/authentication/authentication.service"; +import { ConfirmLoginComponent } from 'src/app/authentication/confirm-login/confirm-login.component'; + +import * as moment from 'moment' +import { ButtonSettings } from '../button/models/button-settingsl'; +import { Events } from '@ionic/angular'; + +@Component({ + selector: "welcome-login", + templateUrl: "./welcome.component.html", + styleUrls: ["./welcome.component.scss"] +}) +export class WelcomeComponent implements OnInit, AfterViewInit, OnDestroy { + @ViewChild(ConfirmLoginComponent, {read: ConfirmLoginComponent }) confimLogin: ConfirmLoginComponent; + + // @ViewChild(ConfirmLoginComponent, { static: false, read: ConfirmLoginComponent }) confimLogin: ConfirmLoginComponent; + public logo = "assets/imgs/bell.png"; + public direction: any; + public user: any; + public count: number = 0; + public count2: number = 0; + public txt_account: any; + public isLastLogin: any; + public welcome: string; + public userName: string; + public lastLoginTime: any; + public welcome_txt: any; + + // public loginTypeDef = { + // 1: this.ts.trPK("sms", "title"), + // 2: this.ts.trPK("sms", "fingerprint"), + // 3: this.ts.trPK("sms", "face-recognition"), + // 4: this.ts.trPK("sms", "whatsapp") + // }; + public loginTypeDef = { + 1: this.ts.trPK("sms", "title"), + 2: this.ts.trPK("sms", "fingerprint"), + 3: this.ts.trPK("sms", "face-recognition"), + 4: this.ts.trPK("sms", "whatsapp") + }; + @Output() onLogin = new EventEmitter(); + @Output() loginWithUser = new EventEmitter(); + + public button = + { + title: "login, more-verify", + url: null, + icon: "assets/imgs/more.png", + settings: new ButtonSettings(true, true, true, true), + value: 2, + txt: 'More', + disabled: false, + buttonClass: 'buttonClassWhite', + pClass: 'pClassMyFileIconBlack', + class: 'nationalIdIcon', + visible: true + }; + password: string; + empname: string; + logintype: any; + + constructor( + public ts: TranslatorService, + public cs: CommonService, + public authservice: AuthenticationService, + public events: Events + ) { } + + ngOnInit() { + // retrive user info ** + + this.userName = localStorage.getItem("user"); + this.password = localStorage.getItem("password"); + let remember = localStorage.getItem("remember"); + this.empname= localStorage.getItem("emp-name"); + this.logintype= localStorage.getItem("login-type"); + this.logintype = parseInt(this.logintype) + + this.welcome_txt = this.ts.trPK("home", "welcome-txt"); + + this.txt_account = this.user + ? this.ts.trPK("home", "account-info") + : ""; + + + + this.setWelcomeMessage(); + this.setDescription(); + //later to fix below code + if (this.user) { + // this.lastLoginTime = moment(this.cs.evaluteDateAsObject(this.user.EditedOn)).format("HH:mm"); + } + } + + ngOnDestroy(): void { + + } + + private setWelcomeMessage() { + console.log(this.userName + "this.userName"); + + if (this.userName) { + this.welcome = this.ts.trPK("home", "welcome-back"); + console.log(this.welcome + "this.welcome"); + + this.welcome += " " + this.empname || ''; + this.isLastLogin = true; + console.log(this.isLastLogin + "this.isLastLogin"); + } else { + this.welcome = this.ts.trPK("home", "welcome-head"); + + } + } + + private setDescription() { + this.txt_account = this.userName ? + this.ts.trPK("home", "account-info") :""; + } + + ngAfterViewInit() { + console.log("this.confimLogin.buttons[0]" + this.confimLogin.buttons[0]); + setTimeout(() => { + if (this.userName && this.confimLogin.buttons[0]) { + + console.log(this.userName ); + console.log(this.confimLogin.buttons[0]); + + this.confimLogin.buttons[0].forEach(element => { + if (this.logintype === element.value) { + console.log(this.logintype ); + console.log(element.value); + console.log("this.logintype === element.value"); + + element.visible = true; + } else { + console.log("this.logintype != element.value"); + + element.visible = false; + } + + }); + } + }, 200); + } + + public moreLoginOptions() {} + + + + login() { + this.onLogin.emit(); + } + loginwithuser() { + this.loginWithUser.emit(); + } + + + + // getDate(date: string) { + // return this.cs.getDateTimeISOFromString(date); + // } + getLoginType(type: any) { + return this.loginTypeDef[type]; + } + + convertTime(time) { + // alert(time) + return time; + } + +} diff --git a/Mohem/src/app/profile/profile-image/profile-image.component.html b/Mohem/src/app/profile/profile-image/profile-image.component.html index 0544d51b..04bfb165 100644 --- a/Mohem/src/app/profile/profile-image/profile-image.component.html +++ b/Mohem/src/app/profile/profile-image/profile-image.component.html @@ -3,7 +3,7 @@ - {{ts.trPK('userProfile','title')}} + {{ts.trPK('userProfile','changepicture')}}