-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- {{ts.trPK('login','login')}}
+ {{ts.trPK('login','login')}}
-
-
-
-
-
-
+
diff --git a/Mohem/src/app/authentication/login/login.component.ts b/Mohem/src/app/authentication/login/login.component.ts
index 65e126aa..e85917ac 100644
--- a/Mohem/src/app/authentication/login/login.component.ts
+++ b/Mohem/src/app/authentication/login/login.component.ts
@@ -26,7 +26,6 @@ import { KeyboardStatusModel } from 'src/app/hmg-common/services/keyboard/keyboa
})
export class LoginComponent implements OnInit, OnDestroy {
deviceToken1: any;
-
constructor(
public cs: CommonService,
@@ -45,7 +44,6 @@ export class LoginComponent implements OnInit, OnDestroy {
public pushService: PushService,
public keyboardService: KeyboardService
) {
-
this.events.subscribe('logoutFlage', logoutFlage => {
console.log('login compont logoutFlage: ' + logoutFlage);
// tslint:disable-next-line: triple-equals
@@ -55,20 +53,18 @@ export class LoginComponent implements OnInit, OnDestroy {
localStorage.setItem('logoutFlage', logoutFlage);
}
});
-
this.getuser = this.cs.sharedService.getSharedData(
AuthenticationService.IMEI_USER_DATA,
false
);
- // alert(" this.getuser "+this.getuser);
if (this.getuser) {
this.user = true;
} else {
this.user = false;
-
}
}
+
appLang = 1;
isExpired = false;
isSupportAr = false;
@@ -99,17 +95,9 @@ export class LoginComponent implements OnInit, OnDestroy {
getuser: any = '';
getlastlogin: any;
public keyboardOpened = false;
-
private checkUserResult: CheckUserAuthenticationResponse;
ngOnInit() {
- // if(!this.cs.getIsTimeSessionOut()){
- // this.getlastlogin = this.cs.sharedService.getSharedData(
- // AuthenticationService.IMEI_USER_DATA,
- // false
- // );
- // console.log("this.getlastlogin"+ this.getlastlogin);
- // }
this.monitorKeyboardChange();
this.currentLang = TranslatorService.getCurrentLanguageCode();
console.log(TranslatorService.CURRENT_LANGUAGE)
@@ -121,38 +109,11 @@ export class LoginComponent implements OnInit, OnDestroy {
this.language = "AR";
this.changeLanguage('1')
}
- console.log("current lang: "+this.currentLang)
- //this.ts.switchLanguage();
- // this.deviceToken= this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false);
- // console.log("get deviceToken login"+ this.deviceToken)
-
-
- // this.getuser = this.cs.sharedService.getSharedData(
- // AuthenticationService.IMEI_USER_DATA,
- // false
- // );
-
- // if(this.getuser){
- // console.log("this.getuser"+this.getuser);
- // this.logoutFlage = true;
-
- // }
-
+ console.log("current lang: "+this.currentLang);
this.events.subscribe('user', user => {
this.user = user;
});
-
- //this.deviceToken = localStorage.getItem('devicyeToken');
- //this.deviceToken1 =this.cs.getDeviceToken();
-
- console.log(" this.user login in init" + this.user);
- //this.deviceToken = localStorage.getItem('devicyeToken');
this.deviceToken =this.cs.getDeviceToken();
-
-
- console.log('lngOnInit localStorage: ' + this.deviceToken1);
- console.log('lngOnInit getDeviceToken: ' + this.deviceToken);
-
if (this.deviceToken) {
console.log('login enabled first time: ' + this.deviceToken);
} else {
@@ -160,7 +121,7 @@ export class LoginComponent implements OnInit, OnDestroy {
this.pushService.startReceiving();
}
- // here will delete below part and depdding on user (response from getMobileInfo)
+ // here will delete below part and depdding on user (response from getMobileInfo)
this.username = localStorage.getItem('user');
this.password = localStorage.getItem('password'); // ****//
const remember = localStorage.getItem('remember'); // ****//
@@ -192,6 +153,7 @@ export class LoginComponent implements OnInit, OnDestroy {
}
this.currentLang = langNumber;
}
+
public forgetPasswordPage() {
this.cs.openUserForgot();
}
@@ -214,12 +176,12 @@ export class LoginComponent implements OnInit, OnDestroy {
}
public onLogin() {
- this.deviceToken = localStorage.getItem('deviceToken');
- if (this.deviceToken) {
+ this.deviceToken = localStorage.getItem('deviceToken');
+ if (this.deviceToken) {
this.checkAppUpdated();
- } else {
- this.pushService.startReceiving();
- setTimeout(() => {
+ } else {
+ this.pushService.startReceiving();
+ setTimeout(() => {
this.deviceToken = localStorage.getItem('deviceToken');
this.checkAppUpdated();
console.log('login enabled second time: ' + this.deviceToken);
@@ -228,10 +190,7 @@ export class LoginComponent implements OnInit, OnDestroy {
}
public checkAppUpdated() {
- this.authService.checkApplicationVersion(
- () => {
- /* Write code for error */
- }).subscribe((result: CheckAppVersionResponse) => {
+ this.authService.checkApplicationVersion(() => {}).subscribe((result: CheckAppVersionResponse) => {
// tslint:disable-next-line: triple-equals
if (result.MessageStatus == 2 && result.ErrorType == 4) {
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
@@ -258,12 +217,14 @@ export class LoginComponent implements OnInit, OnDestroy {
}
}
- private checkUserAuthentication() {
- console.log('debug Here!!');
- console.log(this.username);
- console.log(this.language);
- console.log(this.password);
+ public isValidForm(): boolean {
+ if (this.username && this.password) {
+ return false;
+ }
+ return true;
+ }
+ private checkUserAuthentication() {
this.cs.startLoading();
const request = new LoginRequest();
request.P_USER_NAME = this.username;
@@ -273,16 +234,12 @@ export class LoginComponent implements OnInit, OnDestroy {
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)) {
// alert("result.MemberLoginList.EMPLOYEE_NAME :" + result.MemberLoginList[0].EMPLOYEE_NAME);
-
this.loginData.LogInTokenID = result.LogInTokenID;
this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER;
this.loginData.P_USER_NAME = this.username;
@@ -294,8 +251,6 @@ export class LoginComponent implements OnInit, OnDestroy {
// if(!this.welcomeBack){
this.cs.openConfirmLoginPage(); // phase#2 add 4 types for OTP
// }
-
-
} else {
console.log('result.IsPasswordExpired');
console.log(result.IsPasswordExpired);
@@ -386,7 +341,6 @@ export class LoginComponent implements OnInit, OnDestroy {
}
console.log('login emit');
console.log('login');
- // this.checkUserAuthentication();
// this.loginDiv=true;
this.user = false;
}
@@ -397,9 +351,6 @@ export class LoginComponent implements OnInit, OnDestroy {
this.cs.openConfirmLoginPage();
}
-
- ///
-
getLastLoginInfo() {
this.requestGetLoginInfo = {
DeviceType: this.cs.getDeviceType(), // "Android",//this.cs.getDeviceType(),
@@ -419,7 +370,6 @@ export class LoginComponent implements OnInit, OnDestroy {
} else {
this.user = false;
-
}
}
});
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 a2bee59c..91213a0c 100644
--- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts
+++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts
@@ -24,7 +24,7 @@ import { EmailInput } from "../../ui/email/models/email-input";
import { GetLoginInfoRequest } from "./models/get-login-info.request";
import { GetLoginInfoResponse } from "./models/get-login-info.response";
import { analyzeAndValidateNgModules } from "@angular/compiler";
-import { Events, MenuController } from "@ionic/angular";
+import { Events, MenuController, Platform } 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";
@@ -94,6 +94,7 @@ export class AuthenticationService {
// public localNotifications: UserLocalNotificationService,
private events: Events,
private menu: MenuController,
+ public platform: Platform
) { }
public authenticateRequest(request: Request, automaticLogin = true): Request {
@@ -125,13 +126,18 @@ export class AuthenticationService {
}
public setPublicFields(request: Request): Request {
+ const isAndroid = this.platform.is('android');
+ const isIOS = this.platform.is('ios');
+ let mobileType = '';
+ if (isAndroid) {
+ mobileType = 'android';
+ } else if (isIOS) {
+ mobileType = 'ios';
+ }
request.VersionID = 2.3;
request.Channel = 33;
request.LanguageID = TranslatorService.getCurrentLanguageCode();
- //request.IPAdress = '10.10.10.10';
- //request.SessionID = "any thing"; // ??? required for not authorized login funny
- request.MobileType = "";
- //request.isDentalAllowedBackend = false;
+ request.MobileType = mobileType;
return request;
}
public authenticateAndSetPersonalInformation(
diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts
index e1733fd4..ae038d16 100644
--- a/Mohem/src/app/home/home.page.ts
+++ b/Mohem/src/app/home/home.page.ts
@@ -62,6 +62,7 @@ export class HomePage implements OnInit {
public isShow = false;
public showVcationRule = false;
public isFakeLocationUsed = false;
+ public intervalCountdown: any;
public statsButtons = [
{
title: this.ts.trPK('attendance-tracking', 'title'),
@@ -128,6 +129,7 @@ export class HomePage implements OnInit {
public vacationRuleIcon: string;
direction: string;
public isPostNoLoad = true;
+ public locationResponse: any;
constructor(
public ts: TranslatorService,
@@ -202,7 +204,7 @@ export class HomePage implements OnInit {
}
timerTick() {
- setTimeout(() => {
+ this.intervalCountdown = setTimeout(() => {
if (!this.runTimer) {
return;
}
@@ -248,6 +250,7 @@ export class HomePage implements OnInit {
if (this.platform.is('android')) {
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
if (resp && (resp.latitude && resp.longitude)) {
+ this.locationResponse = resp;
if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
this.isFakeLocationUsed = true;
}
@@ -614,6 +617,7 @@ showAttendanceTracking() {
};
this.DS.getAttendanceTracking(request, '', '', this.isPostNoLoad).subscribe((result: AttendanceTrackingResponse) => {
if (this.common.validResponse(result)) {
+ clearTimeout(this.intervalCountdown);
const key = 'GetAttendanceTrackingList';
this.convertAndAssignTime(result[key]);
}
diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss
index 983a2d04..8c27b149 100644
--- a/Mohem/src/theme/styles.scss
+++ b/Mohem/src/theme/styles.scss
@@ -1529,3 +1529,7 @@ table.monthview-datetable th small {
.alert-wrapper {
min-width: 80% !important;//what ever you like
}
+
+ .disable-button-opacity {
+ opacity: .5;
+}