offers and discount

MOHEMM-Q3-DEV-LATEST
Sultan Khan 5 years ago
parent ea93212ad1
commit 6f4f998700

@ -11,6 +11,7 @@ import { DomSanitizer } from '@angular/platform-browser';
import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { DigitalIdComponent } from './authentication/digital-id/digital-id.component'; import { DigitalIdComponent } from './authentication/digital-id/digital-id.component';
import { checkAndUpdatePureExpressionInline } from '@angular/core/src/view/pure_expression';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -132,6 +133,17 @@ export class AppComponent implements OnInit {
this.companyUrl = user.CompanyImageURL ? user.CompanyImageURL : '../assets/imgs/CSLogo.png'; this.companyUrl = user.CompanyImageURL ? user.CompanyImageURL : '../assets/imgs/CSLogo.png';
this.companyDesc = user.CompanyImageDescription ? user.CompanyImageDescription : 'Powered By Cloud Solutions'; this.companyDesc = user.CompanyImageDescription ? user.CompanyImageDescription : 'Powered By Cloud Solutions';
this.User_name_Emp = user.EMPLOYEE_DISPLAY_NAME; this.User_name_Emp = user.EMPLOYEE_DISPLAY_NAME;
this.authService.checkAds({
EmployeeNumber: '',
ItgEnableAt: "Before Service Initiation",
ItgServiceName: "Ticket"
}, () => { }, this.ts.trPK('general', 'ok')).subscribe(res => {
console.log("Check Ads")
console.log(res);
});
if (this.cs.getUpdateImage().status) { if (this.cs.getUpdateImage().status) {
this.user_image = this.sanitizer.bypassSecurityTrustUrl('data:image/png;base64,' + this.cs.getUpdateImage().img); this.user_image = this.sanitizer.bypassSecurityTrustUrl('data:image/png;base64,' + this.cs.getUpdateImage().img);
} else { } else {

@ -27,19 +27,19 @@
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row class="faces-row"> <ion-row class="faces-row">
<ion-col [ngClass]="select2"> <ion-col [ngClass]="{'select2' : satisfied=='1'}">
<img class="face" src="assets/icon/rate/bad.svg" (click)="select(1)"> <img class="face" src="assets/icon/rate/bad.svg" (click)="select(1)">
</ion-col> </ion-col>
<ion-col [ngClass]="select2"> <ion-col [ngClass]="{'select2' : satisfied=='2'}">
<img class="face" src="assets/icon/rate/poor.svg" (click)="select(2)"> <img class="face" src="assets/icon/rate/poor.svg" (click)="select(2)">
</ion-col> </ion-col>
<ion-col [ngClass]="select3"> <ion-col [ngClass]="{'select2' : satisfied=='3'}">
<img class="face" src="assets/icon/rate/normal.svg" (click)="select(3)"> <img class="face" src="assets/icon/rate/normal.svg" (click)="select(3)">
</ion-col> </ion-col>
<ion-col [ngClass]="select4"> <ion-col [ngClass]="{'select2' : satisfied=='4'}">
<img class="face" src="assets/icon/rate/good.svg" (click)="select(4)"> <img class="face" src="assets/icon/rate/good.svg" (click)="select(4)">
</ion-col> </ion-col>
<ion-col [ngClass]="select5"> <ion-col [ngClass]="{'select2' : satisfied=='5'}">
<img class="face" src="assets/icon/rate/xcellent.svg" (click)="select(5)"> <img class="face" src="assets/icon/rate/xcellent.svg" (click)="select(5)">
</ion-col> </ion-col>
@ -65,7 +65,7 @@
</ion-content> </ion-content>
<ion-footer > <ion-footer >
<div class="centerDiv"> <div class="centerDiv">
<ion-button class="footer-button" ion-button (click)="submit()"> <ion-button class="footer-button" ion-button (click)="submit()" [disabled]="!rate || (rate==1 && !Note)">
{{'general,submit' | translate}} </ion-button> {{'general,submit' | translate}} </ion-button>
</div> </div>

@ -38,6 +38,8 @@ margin-right:20px;
ion-footer .footer-button{ ion-footer .footer-button{
--background: #259CB8; --background: #259CB8;
width: 80%; width: 80%;
background: #259CB8;
border-radius: 10px;
} }
.skip-btn{ .skip-btn{
position: absolute; position: absolute;
@ -48,3 +50,6 @@ ion-footer .footer-button{
padding: 5px; padding: 5px;
border-radius: 5px; border-radius: 5px;
} }
.select2{
border:1px solid #000;
}

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NavController } from '@ionic/angular'; import { NavController } from '@ionic/angular';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@ -12,7 +13,9 @@ export class SurveyComponent implements OnInit {
rate: any; rate: any;
isSkip: boolean = false; isSkip: boolean = false;
setTime: number = 5; setTime: number = 5;
constructor(public ts: TranslatorService, public cs: CommonService, public nav: NavController) { } satisfied: any = '5';
constructor(public ts: TranslatorService, public cs: CommonService, public nav: NavController, public authService: AuthenticationService) { }
ngOnInit() { ngOnInit() {
this.setTimer(); this.setTimer();
@ -31,4 +34,15 @@ export class SurveyComponent implements OnInit {
} }
}, 1000); }, 1000);
} }
saveSruvey() {
var request = {}
this.authService.saveAdsStatus(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
})
}
select(rating) {
this.satisfied = rating;
}
} }

@ -38,87 +38,96 @@ import { SendActivationByType } from 'src/app/authentication/models/sendActivati
}) })
export class AuthenticationService { export class AuthenticationService {
/* login methods */ /* login methods */
public static loginURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication'; public static loginURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
public static checkUserAuthURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication'; public static checkUserAuthURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
public static login = 'Services/ERP.svc/REST/MemberLogin'; public static login = 'Services/ERP.svc/REST/MemberLogin';
public static activationCodeURL = 'Services/Authentication.svc/REST/CheckActivationCode'; public static activationCodeURL = 'Services/Authentication.svc/REST/CheckActivationCode';
public static getLoginInfoURL = 'Services/Authentication.svc/REST/GetMobileLoginInfo'; public static getLoginInfoURL = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
public static smsCheck='Services/ERP.svc/REST/CheckActivationCode'; public static smsCheck = 'Services/ERP.svc/REST/CheckActivationCode';
public static smsCheckForget='Services/ERP.svc/REST/CheckPublicActivationCode'; public static smsCheckForget = 'Services/ERP.svc/REST/CheckPublicActivationCode';
public static smsSendCode='Services/ERP.svc/REST/SendPublicActivationCode'; public static smsSendCode = 'Services/ERP.svc/REST/SendPublicActivationCode';
public static sendActivationCodeByType = 'Services/ERP.svc/REST/Mohemm_SendActivationCodebyOTPNotificationType'; public static sendActivationCodeByType = 'Services/ERP.svc/REST/Mohemm_SendActivationCodebyOTPNotificationType';
public static getMobileLoginInfo ='Services/ERP.svc/REST/Mohemm_GetMobileLoginInfo_NEW';//Mohemm_GetMobileLoginInfo public static getMobileLoginInfo = 'Services/ERP.svc/REST/Mohemm_GetMobileLoginInfo_NEW';//Mohemm_GetMobileLoginInfo
public static insertMobileLoginInfo ='Services/ERP.svc/REST/Mohemm_InsertMobileLoginInfo'; public static insertMobileLoginInfo = 'Services/ERP.svc/REST/Mohemm_InsertMobileLoginInfo';
/* register methods */ /* register methods */
public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration'; public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration';
public static sendSmsForRegisterURL = 'Services/Authentication.svc/REST/SendSMSForPatientRegisteration'; public static sendSmsForRegisterURL = 'Services/Authentication.svc/REST/SendSMSForPatientRegisteration';
public static registerTempUserURL = 'Services/Authentication.svc/REST/RegisterTempPatientWithoutSMS'; public static registerTempUserURL = 'Services/Authentication.svc/REST/RegisterTempPatientWithoutSMS';
public static sendSMSForgotFileNoURL = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber'; public static sendSMSForgotFileNoURL = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
public static forgotFileIDURL = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo'; public static forgotFileIDURL = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
public static user: AuthenticatedUser; public static user: AuthenticatedUser;
public static servicePrivilage : PrivilageModel[]; public static servicePrivilage: PrivilageModel[];
/*user checking methods */ /*user checking methods */
public static userChecking = 'Services/ERP.svc/REST/Get_BasicUserInformation'; public static userChecking = 'Services/ERP.svc/REST/Get_BasicUserInformation';
public static changePasswordForget ='Services/ERP.svc/REST/ChangePassword_Forget'; public static changePasswordForget = 'Services/ERP.svc/REST/ChangePassword_Forget';
public static changePassword ='Services/ERP.svc/REST/ChangePassword_FromActiveSession'; public static changePassword = 'Services/ERP.svc/REST/ChangePassword_FromActiveSession';
public static expiredPassword = 'Services/ERP.svc/REST/ChangePassword_Expired'; public static expiredPassword = 'Services/ERP.svc/REST/ChangePassword_Expired';
public static checkAppVersion = 'Services/Utilities.svc/REST/CheckMobileAppVersion'; public static checkAppVersion = 'Services/Utilities.svc/REST/CheckMobileAppVersion';
public static LOGIN_EVENT = 'user-login-event';
public static FAMILY_LOGIN_EVENT = 'family-login-event'; /* check survey or ads */
public static AUTHENTICATED_USER_KEY = 'save-authenticated-user';
public static LOGIN_DATA="logindata"; public static getITGPageNotification = 'Services/COCWS.svc/REST/Mohemm_ITG_GetPageNotification';
public static DEVICE_TOKEN = "device_token"; public static getITGPageNotificationDetails = 'Services/COCWS.svc/REST/Mohemm_ITG_GetPageNotificationDetails';
public static LAST_LOGIN = 'last-login'; public static saveSurveyAds = 'Services/COCWS.svc/REST/Mohemm_ITG_Survey_Response';
public static IMEI_USER_DATA = "imei-user-data";
// private static user: AuthenticatedUser; public static LOGIN_EVENT = 'user-login-event';
constructor( public static FAMILY_LOGIN_EVENT = 'family-login-event';
public con: ConnectorService, public static AUTHENTICATED_USER_KEY = 'save-authenticated-user';
public cs: CommonService, public static LOGIN_DATA = "logindata";
public ts: TranslatorService, public static DEVICE_TOKEN = "device_token";
public nativeStorage: NativeStorage, public static LAST_LOGIN = 'last-login';
// public localNotifications: UserLocalNotificationService, public static IMEI_USER_DATA = "imei-user-data";
private events: Events,
private menu: MenuController,
public platform: Platform // private static user: AuthenticatedUser;
) { } constructor(
public con: ConnectorService,
public authenticateRequest(request: Request, automaticLogin = true): Request { public cs: CommonService,
public ts: TranslatorService,
this.setPublicFields(request); public nativeStorage: NativeStorage,
const user = this.getAuthenticatedUser(); // public localNotifications: UserLocalNotificationService,
if (user) { private events: Events,
request.P_SESSION_ID = user.P_SESSION_ID; private menu: MenuController,
request.MobileNumber = user.EMPLOYEE_MOBILE_NUMBER; public platform: Platform
request.LogInTokenID = user.LogInTokenID; ) { }
request.TokenID = user.TokenID;
request.P_USER_NAME = user.EMPLOYEE_NUMBER; public authenticateRequest(request: Request, automaticLogin = true): Request {
request.UserName = user.EMPLOYEE_NUMBER;
request.P_EMAIL_ADDRESS = user.EMPLOYEE_EMAIL_ADDRESS; this.setPublicFields(request);
if (AuthenticationService.requireRelogin) { const user = this.getAuthenticatedUser();
this.sessionTimeOutDialog(); if (user) {
} request.P_SESSION_ID = user.P_SESSION_ID;
} else { request.MobileNumber = user.EMPLOYEE_MOBILE_NUMBER;
this.cs.userNeedToReLogin(); request.LogInTokenID = user.LogInTokenID;
} request.TokenID = user.TokenID;
/* request.P_USER_NAME = user.EMPLOYEE_NUMBER;
else { request.UserName = user.EMPLOYEE_NUMBER;
if (automaticLogin) { request.P_EMAIL_ADDRESS = user.EMPLOYEE_EMAIL_ADDRESS;
this.cs.openUserLogin(); if (AuthenticationService.requireRelogin) {
} this.sessionTimeOutDialog();
}
} else {
this.cs.userNeedToReLogin();
}
/*
else {
if (automaticLogin) {
this.cs.openUserLogin();
} }
*/ }
*/
return request; return request;
} }
@ -127,11 +136,11 @@ export class AuthenticationService {
const isIOS = this.platform.is('ios'); const isIOS = this.platform.is('ios');
let mobileType = ''; let mobileType = '';
if (isAndroid) { if (isAndroid) {
mobileType = 'android'; mobileType = 'android';
} else if (isIOS) { } else if (isIOS) {
mobileType = 'ios'; mobileType = 'ios';
}else{ } else {
mobileType = 'android'; mobileType = 'android';
} }
request.VersionID = 2.9; request.VersionID = 2.9;
request.Channel = 31; request.Channel = 31;
@ -194,63 +203,63 @@ export class AuthenticationService {
public getPublicRequest(): Request { public getPublicRequest(): Request {
const request = new Request(); const request = new Request();
this.setPublicFields(request); this.setPublicFields(request);
return request; return request;
} }
public checkApplicationVersion(onError: any): Observable<CheckAppVersionResponse> { public checkApplicationVersion(onError: any): Observable<CheckAppVersionResponse> {
const request = new Request(); const request = new Request();
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.checkAppVersion, request, onError); return this.con.post(AuthenticationService.checkAppVersion, request, onError);
} }
public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> { public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> {
this.setPublicFields(request); this.setPublicFields(request);
request.P_APP_VERSION="CS"; request.P_APP_VERSION = "CS";
return this.con.post(AuthenticationService.login, request, onError, errorLabel); return this.con.post(AuthenticationService.login, request, onError, errorLabel);
} }
public isAuthenticated(): boolean { public isAuthenticated(): boolean {
return AuthenticationService.user != null; return AuthenticationService.user != null;
} }
/** /**
* this fucntion load from user information if he logged in before * this fucntion load from user information if he logged in before
* and save user into memory and local storage * and save user into memory and local storage
* disable notifications for previous user if new user logged in with different user * disable notifications for previous user if new user logged in with different user
* *
* *
* info: * info:
* 1- user stored in local storage without token * 1- user stored in local storage without token
* @param result check activation code result * @param result check activation code result
*/ */
public setAuthenticatedUser( public setAuthenticatedUser(
result: SMSCheckResponse result: SMSCheckResponse
): Observable<boolean> { ): Observable<boolean> {
return Observable.create(observer => { return Observable.create(observer => {
this.loadAuthenticatedUser().subscribe( this.loadAuthenticatedUser().subscribe(
(loadedUser: AuthenticatedUser) => { (loadedUser: AuthenticatedUser) => {
AuthenticationService.requireRelogin = false; AuthenticationService.requireRelogin = false;
this.startIdleMonitoring(); this.startIdleMonitoring();
const user = this.updateAuthenticatedUser(result, loadedUser); const user = this.updateAuthenticatedUser(result, loadedUser);
/* we store in hd without token but with token in memory*/ /* we store in hd without token but with token in memory*/
this.saveUserInStorage(user).subscribe((success: boolean) => { this.saveUserInStorage(user).subscribe((success: boolean) => {
AuthenticationService.user = user; AuthenticationService.user = user;
this.publishUserChangeEvent(); this.publishUserChangeEvent();
observer.next(true); observer.next(true);
observer.complete(); observer.complete();
}); });
} }
); );
}); });
} }
public resetAuthenticatedUser(user: AuthenticatedUser) { public resetAuthenticatedUser(user: AuthenticatedUser) {
@ -334,8 +343,8 @@ export class AuthenticationService {
user.P_SESSION_ID = result.P_SESSION_ID; user.P_SESSION_ID = result.P_SESSION_ID;
user.MobileNumber = result.EMPLOYEE_MOBILE_NUMBER; user.MobileNumber = result.EMPLOYEE_MOBILE_NUMBER;
user.TokenID = result.TokenID; user.TokenID = result.TokenID;
user.CompanyImageDescription=result.CompanyImageDescription; user.CompanyImageDescription = result.CompanyImageDescription;
user.CompanyImageURL=result.CompanyImageURL; user.CompanyImageURL = result.CompanyImageURL;
user.CompanyBadge = result.CompanyBadge; user.CompanyBadge = result.CompanyBadge;
user.CompanyMainCompany = result.CompanyMainCompany; user.CompanyMainCompany = result.CompanyMainCompany;
user.LogInTokenID = this.cs.sharedService.getSharedData( user.LogInTokenID = this.cs.sharedService.getSharedData(
@ -455,162 +464,162 @@ export class AuthenticationService {
return AuthenticationService.user; return AuthenticationService.user;
} }
*/ */
if(AuthenticationService.user){ if (AuthenticationService.user) {
return AuthenticationService.user; return AuthenticationService.user;
}else{ } else {
this.cs.openLogin(); this.cs.openLogin();
}
} }
}
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string) public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> { : Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request); this.setPublicFields(request);
request.P_APP_VERSION="CS"; request.P_APP_VERSION = "CS";
return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel); return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel);
} }
public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string) public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
: Observable<CheckActivationCodeResponse> { : Observable<CheckActivationCodeResponse> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel); return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
} }
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string) public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<SMSCheckResponse> { : Observable<SMSCheckResponse> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel); return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel);
} }
public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string) public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<SMSCheckResponse> { : Observable<SMSCheckResponse> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheckForget, request, onError, errorLabel); return this.con.post(AuthenticationService.smsCheckForget, request, onError, errorLabel);
} }
public sendPublicSMS(request: SMSCheckRequest, onError: any, errorLabel: string) public sendPublicSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> { : Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel); return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel);
} }
/* /*
client side: client side:
id no , mobile no , zip code id no , mobile no , zip code
*/ */
/* /*
client side: client side:
id no , mobile no , zip code id no , mobile no , zip code
*/ */
// public sendSmsForPatientRegisteration(request: CheckPatientRegisterationRequest, onError: any, errorLabel: string) // public sendSmsForPatientRegisteration(request: CheckPatientRegisterationRequest, onError: any, errorLabel: string)
// : Observable<CheckUserAuthenticationResponse> { // : Observable<CheckUserAuthenticationResponse> {
// this.setPublicFields(request); // this.setPublicFields(request);
// request.TokenID = ''; // request.TokenID = '';
// request.isRegister = false; // request.isRegister = false;
// return this.con.post(AuthenticationService.sendSmsForRegisterURL, request, onError, errorLabel); // return this.con.post(AuthenticationService.sendSmsForRegisterURL, request, onError, errorLabel);
// } // }
public checkRegisterationActivationCode(request: CheckRegisterationCodeRequest, onError: any, errorLabel: string)
: Observable<Response> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
}
public sendForgetPassword(request: ForgetPassword, onError: any, errorLabel: string) public checkRegisterationActivationCode(request: CheckRegisterationCodeRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> { : Observable<Response> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel); return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
} }
public submitForgetPassword(request: ForgetPassword, onError: any, errorLabel: string) public sendForgetPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> { : Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.changePasswordForget, request, onError, errorLabel); return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel);
} }
public submitChangePassword(request: ForgetPassword, onError: any, errorLabel: string) public submitForgetPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> { : Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request); this.setPublicFields(request);
this.authenticateRequest(request); return this.con.post(AuthenticationService.changePasswordForget, request, onError, errorLabel);
return this.con.post(AuthenticationService.changePassword, request, onError, errorLabel); }
}
public submitExpiredPassword(request: ForgetPassword, onError: any, errorLabel: string) public submitChangePassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> { : Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.expiredPassword, request, onError, errorLabel); this.authenticateRequest(request);
} return this.con.post(AuthenticationService.changePassword, request, onError, errorLabel);
}
public submitExpiredPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.expiredPassword, request, onError, errorLabel);
}
public sendSMSForForgotFileNumber(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string) public sendSMSForForgotFileNumber(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> { : Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request); this.setPublicFields(request);
request.TokenID = ''; request.TokenID = '';
//request.SearchType = 2; //request.SearchType = 2;
//request.isRegister = false; //request.isRegister = false;
return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel); return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel);
} }
public forgotFileIdActivation(request: CheckActivationCodeRequest, onError: any, errorLabel: string) public forgotFileIdActivation(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
: Observable<ForgotFileIDResponse> { : Observable<ForgotFileIDResponse> {
this.setPublicFields(request); this.setPublicFields(request);
request.TokenID = ''; request.TokenID = '';
request.SearchType = 2; request.SearchType = 2;
request.isRegister = false; request.isRegister = false;
return this.con.post(AuthenticationService.forgotFileIDURL, request, onError, errorLabel); return this.con.post(AuthenticationService.forgotFileIDURL, request, onError, errorLabel);
} }
// tslint:disable-next-line: max-line-length // tslint:disable-next-line: max-line-length
public insertMobileLoginInfo(request: GetLoginInfoRequest, onError: any, errorLabel: string, isPostNoLoad = false): Observable<GetLoginInfoResponse> { public insertMobileLoginInfo(request: GetLoginInfoRequest, onError: any, errorLabel: string, isPostNoLoad = false): Observable<GetLoginInfoResponse> {
this.authenticateRequest(request); this.authenticateRequest(request);
if (isPostNoLoad) { if (isPostNoLoad) {
return this.con.postNoLoad(AuthenticationService.insertMobileLoginInfo, request, onError, errorLabel); return this.con.postNoLoad(AuthenticationService.insertMobileLoginInfo, request, onError, errorLabel);
} else { } else {
return this.con.post(AuthenticationService.insertMobileLoginInfo, request, onError, errorLabel); return this.con.post(AuthenticationService.insertMobileLoginInfo, request, onError, errorLabel);
}
} }
}
public isSAUDIIDValid(id: string): boolean { public isSAUDIIDValid(id: string): boolean {
if (!id) { if (!id) {
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; 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++) { for (let i = 0; i < 10; i++) {
if (i % 2 === 0) { if (i % 2 === 0) {
const a = id.charAt(i); const a = id.charAt(i);
const x = Number(a) * 2; const x = Number(a) * 2;
let b = x.toString(); let b = x.toString();
if (b.length === 1) { if (b.length === 1) {
b = "0" + b; b = "0" + b;
}
sum += Number(b.charAt(0)) + Number(b.charAt(1));
} else {
sum += Number(id.charAt(i));
}
} }
return sum % 10 === 0; sum += Number(b.charAt(0)) + Number(b.charAt(1));
} else {
sum += Number(id.charAt(i));
} }
} catch (err) {} }
return false; return sum % 10 === 0;
} }
} catch (err) { }
return false;
}
public checkUserHasEmailDialog(): Observable<void> { public checkUserHasEmailDialog(): Observable<void> {
return Observable.create(observer => { return Observable.create(observer => {
@ -662,26 +671,26 @@ export class AuthenticationService {
public getLastLoginInfo() { public getLastLoginInfo() {
let deviceToken = localStorage.getItem('deviceToken'); let deviceToken = localStorage.getItem('deviceToken');
const requestGetLoginInfo = { const requestGetLoginInfo = {
DeviceType: this.cs.getDeviceType(), DeviceType: this.cs.getDeviceType(),
DeviceToken: deviceToken DeviceToken: deviceToken
}; };
this.getLoginInfo(requestGetLoginInfo, () => {}, this.ts.trPK('general', 'ok')).subscribe(res => { this.getLoginInfo(requestGetLoginInfo, () => { }, this.ts.trPK('general', 'ok')).subscribe(res => {
if (this.cs.validResponse(res)) { if (this.cs.validResponse(res)) {
if (res.Mohemm_GetMobileLoginInfoList.length > 0) { if (res.Mohemm_GetMobileLoginInfoList.length > 0) {
this.cs.sharedService.setSharedData(res.Mohemm_GetMobileLoginInfoList[0], AuthenticationService.IMEI_USER_DATA); this.cs.sharedService.setSharedData(res.Mohemm_GetMobileLoginInfoList[0], AuthenticationService.IMEI_USER_DATA);
const user = true; const user = true;
this.events.publish('user', user); this.events.publish('user', user);
this.cs.openLogin(); this.cs.openLogin();
} else { } else {
const user = false; const user = false;
this.events.publish('user', user); this.events.publish('user', user);
this.cs.openLogin(); this.cs.openLogin();
} }
} else {} } else { }
}); });
} }
@ -727,6 +736,27 @@ export class AuthenticationService {
); );
} }
} }
checkAds(request, onError, errorLabel) {
request = this.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.post(AuthenticationService.getITGPageNotification, request, onError, errorLabel);
}
adsDetails(request, onError, errorLabel) {
request = this.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.post(AuthenticationService.getITGPageNotificationDetails, request, onError, errorLabel);
}
saveAdsStatus(request, onError, errorLabel) {
request = this.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.post(AuthenticationService.saveSurveyAds, request, onError, errorLabel);
}
//**************************// //**************************//
public sendActivationCodeByType( public sendActivationCodeByType(
@ -744,4 +774,5 @@ export class AuthenticationService {
onError, onError,
errorLabel errorLabel
); );
}} }
}

@ -399,7 +399,7 @@
</ion-grid> </ion-grid>
</ion-card-content> </ion-card-content>
</ion-card> --> </ion-card> -->
<!--
<ion-card class="cardContent"> <ion-card class="cardContent">
<ion-card-content> <ion-card-content>
<ion-grid> <ion-grid>
@ -430,7 +430,7 @@
</ion-card> </ion-card>
<!-- if there is additional screen like in VIDA --> if there is additional screen like in VIDA -->
<!-- <ng-container> <!-- <ng-container>
<ion-card class="cardContent" *ngFor='let segmentContant of segmentDataTable'> <ion-card class="cardContent" *ngFor='let segmentContant of segmentDataTable'>
<ion-card-content *ngIf='activeSegment === segmentContant.name'> <ion-card-content *ngIf='activeSegment === segmentContant.name'>
@ -474,7 +474,7 @@
<img [src]="action.image"> <img [src]="action.image">
<ion-label style="font-size: 12px" *ngIf="action.name !== 'RequestInformation'">{{action.name}}</ion-label> <ion-label style="font-size: 12px" *ngIf="action.name !== 'RequestInformation'">{{action.name}}</ion-label>
<ion-label style="font-size: 12px; white-space: nowrap;" *ngIf="action.name === 'RequestInformation'">{{'worklistMain, worklistMain' | translate}}</ion-label> <ion-label style="font-size: 12px; white-space: nowrap;" *ngIf="action.name === 'RequestInformation'">{{'worklistMain, request' | translate}}</ion-label>
</ion-tab-button> </ion-tab-button>

@ -476,7 +476,7 @@ export class WorkListMainItgComponent implements OnInit {
modal.onDidDismiss() modal.onDidDismiss()
.then((data) => { .then((data) => {
this.replcamentID = data.data.empData.USER_NAME; this.replcamentID = data.data.empData.USER_NAME;
this.commentText = data.data.comments;
if (actionNumber == 3) { if (actionNumber == 3) {
this.actionService(3, this.commentText); this.actionService(3, this.commentText);
} else if (actionNumber == 4) { } else if (actionNumber == 4) {

@ -86,7 +86,7 @@
</ion-item> </ion-item>
</ion-radio-group> </ion-radio-group>
</ion-list> --> </ion-list> -->
<div *ngIf="!userSelected">
<div *ngIf="ReplacementList.length>0" class="uk-margin"> <div *ngIf="ReplacementList.length>0" class="uk-margin">
{{'replacementRoll, search-result' | translate}} {{'replacementRoll, search-result' | translate}}
</div> </div>
@ -95,8 +95,8 @@
<ion-item lines="none"> <ion-item lines="none">
<div class="square-container"> <div class="square-container" >
<div (click)="select(employee,i)" *ngFor="let employee of ReplacementList;let i=index;" class="square"> <div *ngFor="let employee of ReplacementList;let i=index;" class="square">
<div class="profileImageDiv"> <div class="profileImageDiv">
<!-- <img class="profileImage" src="../assets/imgs/profile.png"> --> <!-- <img class="profileImage" src="../assets/imgs/profile.png"> -->
@ -104,31 +104,81 @@
<img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImgeRep" src="../assets/imgs/profile.png"> <img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImgeRep" src="../assets/imgs/profile.png">
<ion-label class="employee-details"> <ion-label class="employee-details">
<span>{{employee.EMPLOYEE_DISPLAY_NAME}}</span> <span (click)="select(employee,i)">{{employee.EMPLOYEE_DISPLAY_NAME}}</span>
<!-- <br>{{employee.USER_NAME}}<br> <!-- <br>{{employee.USER_NAME}}<br>
{{employee.EMAIL_ADDRESS}} --> {{employee.EMAIL_ADDRESS}} -->
</ion-label> </ion-label>
<div [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'" (click)="setFavorite()"> <div [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'" (click)="setFavorite(employee)">
<img src="assets/imgs/fav.svg" /> <img src="assets/imgs/fav.svg" />
</div> </div>
</div> </div>
<!-- <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll> -->
</div> </div>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</div> </div>
</ion-item> </ion-item>
</div>
<div [hidden]="isAnswer==true" *ngIf="favoriteUserList.length> 0 && !userSelected && ReplacementList.length ==0">
<div class="uk-margin">
{{'replacementRoll, favorite' | translate}}
</div>
<div class="square-container uk-padding" >
<div (click)="select(employee,i)" *ngFor="let employee of favoriteUserList;let i=index;" class="square">
<div class="profileImageDiv">
<img *ngIf="employee.EMPLOYEE_IMAGE" class="empImgeRep" [src]="'data:image/png;base64,'+employee.EMPLOYEE_IMAGE">
<img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImgeRep" src="../assets/imgs/profile.png">
<ion-label class="employee-details">
<span>{{employee.EMPLOYEE_DISPLAY_NAME}}</span>
</ion-label>
<div [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'">
<img src="assets/imgs/fav filled.svg" />
</div>
</div>
</div>
</div>
</div>
<div *ngIf="messageSuccess" class="succssfullMSG">
<ion-col size="12">
<ion-icon class="succssfullIcon" name="checkmark"></ion-icon>
<!--filled-->
</ion-col>
<ion-col size="12"> <div style="font-size: 30px !important"> Transaction Successful </div> </ion-col>
</div>
</ion-content>
<ion-footer *ngIf="!messageSuccess">
<div class="noteInput" *ngIf="isAnswer== false && userSelected ==true">
<!-- <ion-label class="boldTxtNav" padding>{{"replacementRoll, enterNote" | translate}}
</ion-label> -->
<ion-item>
<ion-textarea [(ngModel)]="userNote" [placeholder]="'replacementRoll, enterNote' | translate"></ion-textarea>
</ion-item>
</div>
<br/>
<!-- <div class="centerDiv">
<ion-button *ngIf="userSelected ==true" class="footer-button" style="background: var(--newgreen)!important;border-radius: 10px; --background: transparent; " ion-button (click)="submitAction()">
{{'general, submit' | translate}}</ion-button>
<ion-button class="footer-button" style="border-radius: 10px; --background: transparent; " ion-button (click)="closeModal()">
{{'general, cancel' | translate}}</ion-button>
</div> -->
</ion-footer>
</ion-content>
<ion-footer> <ion-footer *ngIf="userSelected ==true">
<div class="centerDiv"> <div class="centerDiv">
<ion-button (click)="closePage()" class="footer-button" color="customnavy">{{'general, save' | translate}} <ion-button (click)="closePage()" class="footer-button" color="customnavy">{{'general, save' | translate}}
</ion-button> </ion-button>

@ -4,6 +4,7 @@ import { ReplacementServiceRequest } from 'src/app/vacation-rule/model/replaceme
import { VacationRuleServiceService } from 'src/app/vacation-rule/service/vacation-rule-service.service'; import { VacationRuleServiceService } from 'src/app/vacation-rule/service/vacation-rule-service.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { WorklistService } from '../service/worklist.service';
@Component({ @Component({
@ -28,12 +29,20 @@ export class WorkListReplacementItgComponent implements OnInit {
isSave: boolean = false; isSave: boolean = false;
isSelect: boolean = false; isSelect: boolean = false;
typingTimer: any; typingTimer: any;
userSelected: any;
active: any;
isAnswer: boolean = false;
favoriteUserList: [] = [];
userNote: any;
constructor(public vacationRuleService: VacationRuleServiceService, constructor(public vacationRuleService: VacationRuleServiceService,
public ts: TranslatorService, public ts: TranslatorService,
public cs: CommonService, public cs: CommonService,
public worklistService: WorklistService,
public modalController: ModalController) { } public modalController: ModalController) { }
ngOnInit() { } ngOnInit() {
this.getFavruite();
}
SearchReplacementList() { SearchReplacementList() {
this.ReplacementList = []; this.ReplacementList = [];
@ -106,9 +115,9 @@ export class WorkListReplacementItgComponent implements OnInit {
} }
} }
doInfinite(infiniteScroll) { // doInfinite(infiniteScroll) {
} // }
closePage() { closePage() {
this.isSave = true; this.isSave = true;
@ -125,7 +134,8 @@ export class WorkListReplacementItgComponent implements OnInit {
this.modalController.dismiss({ this.modalController.dismiss({
'dismissed': true, 'dismissed': true,
empData: data empData: data,
comments: this.userNote
}); });
} }
} }
@ -157,9 +167,76 @@ export class WorkListReplacementItgComponent implements OnInit {
select(selectEmp, index) { select(selectEmp, index) {
console.log(selectEmp.EMPLOYEE_DISPLAY_NAME); console.log(selectEmp.EMPLOYEE_DISPLAY_NAME);
this.selEmp = selectEmp this.selEmp = selectEmp
// this.active = index; this.userSelected = true;
// this.userSelected = true; this.active = index;
this.searchKey = selectEmp.EMPLOYEE_DISPLAY_NAME ? selectEmp.EMPLOYEE_DISPLAY_NAME : selectEmp.NAME; this.searchKey = selectEmp.EMPLOYEE_DISPLAY_NAME ? selectEmp.EMPLOYEE_DISPLAY_NAME : selectEmp.NAME;
this.closePage(); //this.closePage();
}
setFavorite(selEmp) {
selEmp.EMPLOYEE_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME;
selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : '';
selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : '';
var confirmBoxhtml = `<div>
<h4>Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list </h4>
<br/>
<br/>
<div class="fav-profileImageDiv"><ion-row>`;
if (selEmp.EMPLOYEE_IMAGE)
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="data:image/png;base64,' + selEmp.EMPLOYEE_IMAGE + '"></div>';
if (!selEmp.EMPLOYEE_IMAGE)
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="../assets/imgs/profile.png"></div>';
confirmBoxhtml += ` <div class="name-box"><ion-label class="fav-employee-details">
<span>` + selEmp.EMPLOYEE_DISPLAY_NAME + `</span>
</ion-label>
</div></ion-row> </div>
</div>`
let userIndex = this.favoriteUserList.findIndex(x => x['USER_NAME'] == selEmp.USER_NAME)
if (userIndex == -1)
this.cs.presentConfirmDialog(
confirmBoxhtml
, () => {
var request =
[{ "USER_NAME": selEmp['USER_NAME'], "EMPLOYEE_DISPLAY_NAME": selEmp['EMPLOYEE_DISPLAY_NAME'], "EMAIL_ADDRESS": selEmp.EMAIL_ADDRESS, "EMPLOYEE_IMAGE": selEmp.EMPLOYEE_IMAGE, "IsFavorite": true }];
this.saveUserFavruiteList(request);
}, () => {
})
// if (selectValue == "1" || selectValue == "2" || selectValue == "3") {
// this.isSelect = true;
// }
// else {
// this.isSelect = false;
// }
}
saveUserFavruiteList(request) {
this.worklistService.saveFavoriteList(request, () => {
}).subscribe((result) => {
if (this.cs.validResponse(result)) {
this.cs.toastPK("replacementRoll", "favorite-saved");
}
})
}
getFavruite() {
this.cs.startLoading();
this.worklistService.getFavorite({}, () => {
}).subscribe((result) => {
if (this.cs.validResponse(result)) {
this.cs.stopLoading();
this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList'];
}
})
} }
} }

@ -65,14 +65,14 @@
</div> </div>
<div class="square-container uk-padding" > <div class="square-container uk-padding" >
<div (click)="select(employee,i)" *ngFor="let employee of actionHistory;let i=index;" class="square"> <div *ngFor="let employee of actionHistory;let i=index;" class="square">
<div class="profileImageDiv"> <div class="profileImageDiv">
<img *ngIf="employee.EMPLOYEE_IMAGE" class="empImgeRep" [src]="'data:image/png;base64,'+employee.EMPLOYEE_IMAGE"> <img *ngIf="employee.EMPLOYEE_IMAGE" class="empImgeRep" [src]="'data:image/png;base64,'+employee.EMPLOYEE_IMAGE">
<img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImgeRep" src="../assets/imgs/profile.png"> <img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImgeRep" src="../assets/imgs/profile.png">
<ion-label class="employee-details"> <ion-label class="employee-details">
<span>{{employee.NAME}}</span> <span (click)="select(employee,i)">{{employee.NAME}}</span>
</ion-label> </ion-label>
<div [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'" (click)="setFavorite(employee)"> <div [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'" (click)="setFavorite(employee)">
@ -90,14 +90,14 @@
</div> </div>
<div class="square-container uk-padding" > <div class="square-container uk-padding" >
<div (click)="select(employee,i)" *ngFor="let employee of favoriteUserList;let i=index;" class="square"> <div *ngFor="let employee of favoriteUserList;let i=index;" class="square">
<div class="profileImageDiv"> <div class="profileImageDiv">
<img *ngIf="employee.EMPLOYEE_IMAGE" class="empImgeRep" [src]="'data:image/png;base64,'+employee.EMPLOYEE_IMAGE"> <img *ngIf="employee.EMPLOYEE_IMAGE" class="empImgeRep" [src]="'data:image/png;base64,'+employee.EMPLOYEE_IMAGE">
<img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImgeRep" src="../assets/imgs/profile.png"> <img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImgeRep" src="../assets/imgs/profile.png">
<ion-label class="employee-details"> <ion-label class="employee-details">
<span>{{employee.EMPLOYEE_DISPLAY_NAME}}</span> <span (click)="select(employee,i)">{{employee.EMPLOYEE_DISPLAY_NAME}}</span>
</ion-label> </ion-label>
<div [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'"> <div [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'">

@ -17,7 +17,7 @@
<ion-col size="12"> <ion-col size="12">
<ion-item lines="none" class="SearchtextBox"> <ion-item lines="none" class="SearchtextBox">
<ion-input [placeholder]="'itemforsale,search-items'| translate"></ion-input> <ion-input [placeholder]="'itemforsale,search-items'| translate" [(ngModel)]="searchText" (ionInput)="search($event.target.value)"></ion-input>
</ion-item> </ion-item>
</ion-col> </ion-col>
</ion-row> </ion-row>
@ -31,111 +31,52 @@
</ion-row> </ion-row>
</ion-grid> </ion-grid>
<div class="container-icon"> <div class="container-icon" *ngIf="categories.length>0">
<div class="box-icon"> <div class="box-icon" *ngFor="let key of categories">
<div class="sale-icon"> <div class="sale-icon" (click)="filterOffers(key)" [ngClass]="{'active':activeClass==key }">
<div class="top"> <div class="top">
<ion-icon name="images"></ion-icon> <!-- <ion-icon name="images"></ion-icon> -->
</div> </div>
<div class="bottom-icon"> <div class="bottom-icon">
<p>Mobile & Tablets</p> <p>{{key}}</p>
</div>
</div>
</div>
<div class="box-icon">
<div class="sale-icon">
<div class="top">
<ion-icon name="images"></ion-icon>
</div>
<div class="bottom-icon">
<p>Mobile & Tablets</p>
</div>
</div>
</div>
<div class="box-icon">
<div class="sale-icon">
<div class="top">
<ion-icon name="images"></ion-icon>
</div>
<div class="bottom-icon">
<p>Mobile & Tablets</p>
</div>
</div>
</div>
<div class="box-icon">
<div class="sale-icon">
<div class="top">
<ion-icon name="images"></ion-icon>
</div>
<div class="bottom-icon">
<p>Mobile & Tablets</p>
</div>
</div>
</div>
<div class="box-icon">
<div class="sale-icon">
<div class="top">
<ion-icon name="images"></ion-icon>
</div>
<div class="bottom-icon">
<p>Mobile & Tablets</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<ion-row>
<ion-col size="6" (click)="openDetails()">
<ion-card>
<ion-card-header>
<img src="assets/imgs/itemsforsale/furniture.svg" />
<ion-card-title>Card Title</ion-card-title>
</ion-card-header>
<ion-card-content>
Keep close to Nature's heart... and break
<strong class="dark">
15% Off + Free Delivery
</strong>
<ion-row class="green">
<ion-col size="10">
Offer Valid
</ion-col>
<ion-col size="2">
<ion-icon name="arrow-round-forward"></ion-icon>
</ion-col>
</ion-row>
</ion-card-content> <ion-row>
</ion-card> <ion-col size="6" *ngFor="let item of offersData" (click)="openDetails(item)">
</ion-col>
<ion-col size="6" (click)="openDetails()">
<ion-card> <ion-card>
<ion-card-header> <ion-card-header>
<img src="assets/imgs/itemsforsale/furniture.svg" /> <img [src]="item.Banner_Image" />
<ion-card-title>Card Title</ion-card-title> <ion-card-title>{{item.Title}}</ion-card-title>
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
Keep close to Nature's heart... and break <div [innerHTML]="getDotted(item.Description)"></div>
<strong class="dark"> <strong class="dark">
15% Off + Free Delivery {{item.Discount}} {{ts.trPK('general','discount')}}
</strong> </strong>
<ion-row class="green"> <ion-row [class]="checkDate(item['End Date']) ==true ? 'green' : 'red'">
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==true">
<p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p>
</ion-col>
<ion-col size="10"> <ion-col size="10">
Offer Valid <p class="offer-valid"> {{ts.trPK('general','expired')}}</p>
</ion-col> </ion-col>
<ion-col size="2"> <ion-col size="2" *ngIf="checkDate(item['End Date']) ==false">
<ion-icon name="arrow-round-forward"></ion-icon> <ion-icon name="arrow-round-forward"></ion-icon>
</ion-col> </ion-col>
</ion-row> </ion-row>
</ion-card-content> </ion-card-content>
</ion-card> </ion-card>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div> </div>

@ -1,19 +1,80 @@
import { Component, OnInit } from '@angular/core'; import { AfterViewInit, Component, OnInit } from '@angular/core';
import { connectableObservableDescriptor } from 'rxjs/internal/observable/ConnectableObservable';
import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { OfferDiscountService } from '../services/service';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
templateUrl: './home.component.html', templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'], styleUrls: ['./home.component.scss'],
}) })
export class HomeComponent implements OnInit { export class HomeComponent implements AfterViewInit {
segment: any = '1'; segment: any = '1';
constructor(public ts: TranslatorService, public cs: CommonService,) { } categoriesObj: any;
ngOnInit() { } categories: any = [];
offersData: any = [];
activeClass: any;
tempSearch: any = [];
searchText: String;
constructor(public ts: TranslatorService, public cs: CommonService, public offersService: OfferDiscountService) { }
ngAfterViewInit(): void {
this.getOfferDiscount();
}
openDetails(offer) {
this.cs.sharedService.setSharedData(offer, OfferDiscountService.selected_offers);
var related = this.offersData.filter((res) => res.rowID != offer.rowID);
this.cs.sharedService.setSharedData(related, OfferDiscountService.related_offers);
openDetails() {
this.cs.navigateForward('/offersdiscount/offer-details'); this.cs.navigateForward('/offersdiscount/offer-details');
} }
getOfferDiscount() {
this.cs.startLoading();
this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((res) => {
var data = JSON.parse(res['Mohemm_ITG_ResponseItem']);
this.cs.stopLoading();
if (data['result'])
this.displayOffers(data['result']);
});
}
displayOffers(data) {
if (data['data']) {
var parseJSON = data['data'];
var offers = JSON.parse(parseJSON)
this.categoriesObj = this.groupBy(offers, 'categoryName');
this.categories = Object.keys(this.categoriesObj);
this.filterOffers(this.categories[0]);
}
}
groupBy(xs, key) {
return xs.reduce((rv, x) => {
(rv[x[key]] = rv[x[key]] || []).push(x);
return rv;
}, {});
};
filterOffers(key) {
this.activeClass = key;
this.offersData = this.categoriesObj[key];
this.tempSearch = JSON.parse(JSON.stringify(this.offersData));
}
checkDate(date) {
return new Date(date) >= new Date()
}
getDotted(temp) {
return temp.substring(0, 60) + " ...";
}
search(t) {
this.offersData = this.tempSearch.filter((post, index) => {
if (post.Title.toLowerCase().indexOf(t.toLowerCase()) > -1)
return true;
});
}
} }

@ -2,7 +2,7 @@
<div class="head-title"> <div class="head-title">
<ion-toolbar class="header-toolbar"> <ion-toolbar class="header-toolbar">
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" defaultHref="/home"></ion-back-button>
</ion-buttons> </ion-buttons>
<ion-title color="light" >{{ts.trPK('itemforsale','offersdiscount')}}</ion-title> <ion-title color="light" >{{ts.trPK('itemforsale','offersdiscount')}}</ion-title>
</ion-toolbar> </ion-toolbar>
@ -12,27 +12,73 @@
<div> <div>
<ion-card> <ion-card>
<ion-card-header> <ion-card-header>
<img src="assets/imgs/itemsforsale/furniture.svg" /> <img [src]="details.Banner_Image" />
<ion-card-title>Furniture Table</ion-card-title> <ion-card-title *ngIf="direction =='ltr'">{{details.Title}}</ion-card-title>
<ion-card-title *ngIf="direction =='rtl'">{{details.Title_AR}}</ion-card-title>
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
Keep close to Nature's heart... and break clear away, once in awhile, <div *ngIf="direction =='ltr'" [innerHTML]="details.Description"> </div>
and climb a mountain or spend a week in the woods. Wash your spirit clean. <div *ngIf="direction =='rtl'" [innerHTML]="details.Description_AR"> </div>
<div class="content-bottom"> <div class="content-bottom">
<p class="green">Offer Valid</p> <ion-row [class]="checkDate(details['End Date']) ==true ? 'green' : 'red'">
<h1>15% oFF + FREE HOME DELIVERY</h1> <ion-col size="10" *ngIf="checkDate(details['End Date']) ==true">
<p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p>
</ion-col>
<ion-col size="10">
<p class="offer-valid"> {{ts.trPK('general','expired')}}</p>
</ion-col>
<ion-col size="2" *ngIf="checkDate(details['End Date']) ==false">
</ion-col>
</ion-row>
<h1> {{details.Discount}} {{ts.trPK('general','discount')}}</h1>
</div> </div>
<ion-item-divider>
</ion-item-divider>
</ion-card-content> </ion-card-content>
</ion-card> </ion-card>
</div> </div>
<p class="related-offers">
<strong>
{{ts.trPK('itemforsale','related-offers')}}
</strong>
</p>
<ion-row *ngIf="related">
<ion-col size="6" *ngFor="let item of related">
<ion-card class="related-card">
<ion-card-header>
<img [src]="item.Banner_Image" />
<ion-card-title>{{item.Title}}</ion-card-title>
</ion-card-header>
<ion-card-content>
<div [innerHTML]="getDotted(item.Description)" class='description'></div>
<strong class="dark">
{{item.Discount}} {{ts.trPK('general','discount')}}
</strong>
<ion-row [class]="checkDate(item['End Date']) ==true ? 'green' : 'red'">
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==true">
<p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p>
</ion-col>
<ion-col size="10">
<p class="offer-valid"> {{ts.trPK('general','expired')}}</p>
</ion-col>
<ion-col size="2" *ngIf="checkDate(item['End Date']) ==false">
<ion-icon name="arrow-round-forward"></ion-icon>
</ion-col>
</ion-row>
</ion-card-content>
</ion-card>
</ion-col>
</ion-row>
</ion-content> </ion-content>

@ -18,10 +18,10 @@
} }
ion-card-header{ ion-card-header{
background-color: #fff; background-color: #fff;
padding: 15px !important; padding: 10px !important;
} }
.content-bottom{ .content-bottom{
padding: 15px; padding: 5px;
} }
.green{ .green{
color:green; color:green;
@ -35,3 +35,30 @@ ion-card-header{
.details-button ion-button{ .details-button ion-button{
--background: #565656; --background: #565656;
} }
ion-card-title{
margin:10px;
}
ion-card-content{
padding-top:0px;
}
.red{
color:rgb(172, 9, 9)
}
.green{
color:#00AE4D;
}
.related-card{
margin:5px;
}
.related-card ion-card-title{
font-size: 16px;
}
.related-offers{
position: relative;
margin-left: 20px;
font-size: 18px;
}
.description{
height: 55px;
overflow: hidden;
}

@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { OfferDiscountService } from '../services/service';
@Component({ @Component({
selector: 'app-offer-details', selector: 'app-offer-details',
@ -8,9 +9,21 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
styleUrls: ['./offer-details.component.scss'], styleUrls: ['./offer-details.component.scss'],
}) })
export class OfferDetailsComponent implements OnInit { export class OfferDetailsComponent implements OnInit {
public details: any;
public direction: String;
public related: any;
constructor(public ts: TranslatorService, public cs: CommonService, public offersService: OfferDiscountService) { }
constructor(public ts: TranslatorService, public cs: CommonService,) { } ngOnInit() {
this.direction = TranslatorService.getCurrentDirection();
ngOnInit() { } this.details = this.cs.sharedService.getSharedData(OfferDiscountService.selected_offers, false);
this.related = this.cs.sharedService.getSharedData(OfferDiscountService.related_offers, false);
}
checkDate(date) {
return new Date(date) >= new Date()
}
getDotted(temp) {
return temp.substring(0, 75) + " ...";
}
} }

@ -9,6 +9,7 @@ import { OffersdiscountPage } from './offersdiscount.page';
import { HomeComponent } from './home/home.component'; import { HomeComponent } from './home/home.component';
import { OfferDetailsComponent } from './offer-details/offer-details.component'; import { OfferDetailsComponent } from './offer-details/offer-details.component';
import { HmgCommonModule } from '../hmg-common/hmg-common.module'; import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { OfferDiscountService } from './services/service';
const routes: Routes = [ const routes: Routes = [
@ -38,6 +39,7 @@ const routes: Routes = [
HmgCommonModule, HmgCommonModule,
RouterModule.forChild(routes) RouterModule.forChild(routes)
], ],
declarations: [OffersdiscountPage, HomeComponent, OfferDetailsComponent] declarations: [OffersdiscountPage, HomeComponent, OfferDetailsComponent],
providers: [OfferDiscountService]
}) })
export class OffersdiscountPageModule { } export class OffersdiscountPageModule { }

@ -0,0 +1,30 @@
import { Injectable } from '@angular/core';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
@Injectable({
providedIn: 'root'
})
export class OfferDiscountService {
public static offersDiscountData = 'Services/COCWS.svc/REST/GetOfferDiscountsConfigData';
public static getSuborinateStatus = 'Services/ERP.svc/REST/GET_SUBORDINATES_ATTD_STATUS';
public static selected_offers = 'selected-offers';
public static related_offers = 'related-offers';
constructor(
public con: ConnectorService,
private authService: AuthenticationService,
public cs: CommonService
) {
this.cs.sharedService.getSharedData(OfferDiscountService.selected_offers, false);
}
getOffers(offer_request, onError, errorLabel) {
var request = this.authService.getAuthenticatedRequest();
request['EmployeeNumber'] = request.UserName;
return this.con.postNoLoad(OfferDiscountService.offersDiscountData, request, onError, errorLabel);
}
}

@ -225,6 +225,18 @@
"en": "Offers & Discount", "en": "Offers & Discount",
"ar": "العروض والخصومات" "ar": "العروض والخصومات"
}, },
"discount": {
"en": "Discount",
"ar": "خصم"
},
"offer-valid": {
"en": "Offer Valid",
"ar": "العرض صالح"
},
"expired": {
"en": "Offer Expired",
"ar": "انتهى العرض"
},
"not-now": { "not-now": {
"en": "not now", "en": "not now",
"ar": "لاحقاً" "ar": "لاحقاً"
@ -361,9 +373,9 @@
"en": "Nationality", "en": "Nationality",
"ar": "الجنسية" "ar": "الجنسية"
}, },
"religion":{ "religion": {
"en":"Religion", "en": "Religion",
"ar":"الديانة" "ar": "الديانة"
}, },
"empty": { "empty": {
"en": "Sorry no data avaiable", "en": "Sorry no data avaiable",
@ -961,49 +973,49 @@
"en": "We appreciate you for completing the service of", "en": "We appreciate you for completing the service of",
"ar": "نحن نقدر لك استكمال خدمة" "ar": "نحن نقدر لك استكمال خدمة"
}, },
"basic-details":{ "basic-details": {
"en":"Basic Details", "en": "Basic Details",
"ar":"المعلومات الاساسية" "ar": "المعلومات الاساسية"
}, },
"full-name":{ "full-name": {
"en":"Full Name", "en": "Full Name",
"ar":"الاسم كامل" "ar": "الاسم كامل"
}, },
"marital-status":{ "marital-status": {
"en":"Marital Status", "en": "Marital Status",
"ar":"الاحالة الاجتماعية" "ar": "الاحالة الاجتماعية"
}, },
"civil-identity-number":{ "civil-identity-number": {
"en":"Civil identity number", "en": "Civil identity number",
"ar":"رقم الهوية المدنية" "ar": "رقم الهوية المدنية"
}, },
"effective-date":{ "effective-date": {
"en":"Effective Date", "en": "Effective Date",
"ar":"تاريخ الفعالية " "ar": "تاريخ الفعالية "
}, },
"gender":{ "gender": {
"en":"Gender", "en": "Gender",
"ar":"النوع" "ar": "النوع"
}, },
"education-level":{ "education-level": {
"en":"Education Level", "en": "Education Level",
"ar":"المستوى التعليمي" "ar": "المستوى التعليمي"
}, },
"main-address":{ "main-address": {
"en":"Main Address", "en": "Main Address",
"ar":"العنوان الرئيسي" "ar": "العنوان الرئيسي"
}, },
"correct-or-complete":{ "correct-or-complete": {
"en":"correct or complete the current details", "en": "correct or complete the current details",
"ar":"تعديل او اكمال التفاصيل الحالية" "ar": "تعديل او اكمال التفاصيل الحالية"
}, },
"new-info":{ "new-info": {
"en":"enter new Information because of a real change to the current details (e.g because of a change in marital status)", "en": "enter new Information because of a real change to the current details (e.g because of a change in marital status)",
"ar":"أدخل معلومات جديدة بسبب تغيير حقيقي في التفاصيل الحالية (على سبيل المثال بسبب تغيير في الحالة الاجتماعية)" "ar": "أدخل معلومات جديدة بسبب تغيير حقيقي في التفاصيل الحالية (على سبيل المثال بسبب تغيير في الحالة الاجتماعية)"
}, },
"type-of-change":{ "type-of-change": {
"en":" Select the type of change you want to make.", "en": " Select the type of change you want to make.",
"ar":" حدد نوع التغيير الذي تريد القيام به." "ar": " حدد نوع التغيير الذي تريد القيام به."
} }
}, },
"home": { "home": {
@ -1291,61 +1303,61 @@
"en": "Profile Photo changed successfully ", "en": "Profile Photo changed successfully ",
"ar": "تم تغيير الصورة الشخصية بنجاح" "ar": "تم تغيير الصورة الشخصية بنجاح"
}, },
"personal-informaion":{ "personal-informaion": {
"en":"Personal Informaion", "en": "Personal Informaion",
"ar":"المعلومات الشخصية" "ar": "المعلومات الشخصية"
}, },
"family-name":{ "family-name": {
"en":"Family Name", "en": "Family Name",
"ar":"اسم العائلة" "ar": "اسم العائلة"
}, },
"preferred-name":{ "preferred-name": {
"en":"Preferred Name", "en": "Preferred Name",
"ar":"الاسم المفضل" "ar": "الاسم المفضل"
}, },
"previous-family-name":{ "previous-family-name": {
"en":"Previous Family Name", "en": "Previous Family Name",
"ar":"اسم العائلة السابق" "ar": "اسم العائلة السابق"
}, },
"father-name":{ "father-name": {
"en":"Father Name<", "en": "Father Name<",
"ar":"اسم الاب" "ar": "اسم الاب"
}, },
"grand-father-name":{ "grand-father-name": {
"en":"GrandFather Name", "en": "GrandFather Name",
"ar":"اسم الجد" "ar": "اسم الجد"
}, },
"arabic-first-name":{ "arabic-first-name": {
"en":"Arabic First Name", "en": "Arabic First Name",
"ar":"الاسم الاول بالعربي" "ar": "الاسم الاول بالعربي"
}, },
"arabic-father-name":{ "arabic-father-name": {
"en":"Arabic Father Name", "en": "Arabic Father Name",
"ar":"اسم الاب بالعربي" "ar": "اسم الاب بالعربي"
}, },
"arabic-grand-father-name":{ "arabic-grand-father-name": {
"en":"Arabic GrandFather Name", "en": "Arabic GrandFather Name",
"ar":"اسم الجد بالعربي" "ar": "اسم الجد بالعربي"
}, },
"street":{ "street": {
"en":"Street", "en": "Street",
"ar":"شارع" "ar": "شارع"
}, },
"area":{ "area": {
"en":"Area", "en": "Area",
"ar":"المنطقة" "ar": "المنطقة"
}, },
"p-o-box":{ "p-o-box": {
"en":"P.O Box", "en": "P.O Box",
"ar":"صندوق البريد" "ar": "صندوق البريد"
}, },
"city":{ "city": {
"en":"City", "en": "City",
"ar":"المدينة" "ar": "المدينة"
}, },
"postal-code":{ "postal-code": {
"en":"Postal Code", "en": "Postal Code",
"ar":"الرمز البريدي" "ar": "الرمز البريدي"
} }
}, },
"changePassword": { "changePassword": {
@ -2941,6 +2953,10 @@
"en": "Item for sale", "en": "Item for sale",
"ar": "سلعه للبيع" "ar": "سلعه للبيع"
}, },
"related-offers": {
"en": "Related offers",
"ar": "العروض ذات الصلة"
},
"my-posted-ad": { "my-posted-ad": {
"en": "My Posted Ads", "en": "My Posted Ads",
"ar": "إعلاناتي المنشورة" "ar": "إعلاناتي المنشورة"

Loading…
Cancel
Save