fixed change password in welcome page and added CONTACT request type in worklist

MOHEMM-Q3-DEV-LATEST
enadhilal 4 years ago
parent 718ec53b2a
commit 57be247a0a

@ -12,7 +12,7 @@ import { GetLoginInfoResponse } from '../../hmg-common/services/authentication/m
import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request'; import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request';
import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response'; import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response';
import { PushService } from 'src/app/hmg-common/services/push/push.service'; import { PushService } from 'src/app/hmg-common/services/push/push.service';
import { ModalController, Platform } from '@ionic/angular'; import { ModalController, Platform, AlertController } from '@ionic/angular';
import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response'; import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response';
import { LoginModel } from '../models/LoginModel'; import { LoginModel } from '../models/LoginModel';
import * as moment from 'moment'; import * as moment from 'moment';
@ -20,6 +20,8 @@ import { CheckAppVersionResponse } from 'src/app/hmg-common/services/authenticat
import { NFC } from "@ionic-native/nfc/ngx"; import { NFC } from "@ionic-native/nfc/ngx";
import { DigitalIdComponent } from '../digital-id/digital-id.component'; import { DigitalIdComponent } from '../digital-id/digital-id.component';
import { AppUpdateComponent } from '../app-update/app-update.component'; import { AppUpdateComponent } from '../app-update/app-update.component';
import { Password } from '../models/password';
import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request';
@Component({ @Component({
selector: 'app-confirm-login', selector: 'app-confirm-login',
@ -54,7 +56,7 @@ export class ConfirmLoginComponent implements OnInit {
direction: string; direction: string;
userInfo: any; userInfo: any;
public businessInfo: object; public businessInfo: object;
private checkUserResult: CheckUserAuthenticationResponse;
constructor( constructor(
public ts: TranslatorService, public ts: TranslatorService,
public cs: CommonService, public cs: CommonService,
@ -64,6 +66,7 @@ export class ConfirmLoginComponent implements OnInit {
public pushService: PushService, public pushService: PushService,
public platform: Platform, public platform: Platform,
public modalController: ModalController, public modalController: ModalController,
public alertController: AlertController,
private nfc: NFC private nfc: NFC
) { ) {
this.loginData = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); this.loginData = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
@ -376,7 +379,7 @@ export class ConfirmLoginComponent implements OnInit {
job_ar: result.MemberInformationList[0].JOB_NAME_Ar, job_ar: result.MemberInformationList[0].JOB_NAME_Ar,
mobile: result.MemberInformationList[0].MobileNumberWithZipCode, mobile: result.MemberInformationList[0].MobileNumberWithZipCode,
qr: result.MemberInformationList[0].BusinessCardQR, qr: result.MemberInformationList[0].BusinessCardQR,
company_logo: result.BC_Logo ? result.BC_Logo: result.CompanyImageURL, company_logo: result.BC_Logo ? result.BC_Logo : result.CompanyImageURL,
company_url: result.BC_Domain, company_url: result.BC_Domain,
company_type: result.CompanyMainCompany, company_type: result.CompanyMainCompany,
email: result.MemberInformationList[0].EMPLOYEE_EMAIL_ADDRESS email: result.MemberInformationList[0].EMPLOYEE_EMAIL_ADDRESS
@ -446,13 +449,77 @@ export class ConfirmLoginComponent implements OnInit {
this.confirm(this.loginType); this.confirm(this.loginType);
} else { } else {
if (result.IsPasswordExpired) { if (result.IsPasswordExpired) {
// alert("dont forget to handelpresentPasswordExpiredDialog() "); this.presentPasswordExpiredDialog();
// this.presentPasswordExpiredDialog(); *****
} }
} }
}); });
} }
async presentPasswordExpiredDialog() {
const alert = await this.alertController.create({
header: this.ts.trPK('general', 'confirm'),
message: this.ts.trPK('login', 'password-expired'),
buttons: [
{
text: this.ts.trPK('general', 'ok'),
handler: () => {
console.log('Confirm Okay');
this.sharedData.setSharedData(true, Password.IS_EXPIRED_PSW);
this.userCheck();
}
}
]
});
await alert.present();
}
public userCheck() {
this.cs.startLoading();
const request = new CheckUserAuthenticationRequest();
request.P_USER_NAME = this.username;
this.authService.checkUserAuthentication(
request,
() => {
/* Write code for error */
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
this.checkUserResult = result;
this.cs.stopLoading();
this.sendSMSForForgotPassword();
}
});
}
private sendSMSForForgotPassword() {
this.cs.startLoading();
const changePwdObj = new LoginRequest();
changePwdObj.MobileNumber = this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;
changePwdObj.P_USER_NAME = this.username;
changePwdObj.P_MOBILE_NUMBER = this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;
this.authService.sendPublicSMS(
changePwdObj,
() => {
// this.sendSMSForForgotPassword();
/* Write code for error */
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
this.checkUserResult = result;
console.log('2');
console.log(result);
this.loginData.LogInTokenID = result.LogInTokenID;
this.loginData.P_USER_NAME = this.username;
// this.loginData.EmployeeName =result.MemberLoginList[0].EMPLOYEE_NAME;
this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA);
this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA);
this.sharedData.setSharedData(true, Password.IS_FORGET_PSW);
this.cs.stopLoading();
this.cs.openSMSPage();
}
});
}
private handleAppUpdate(result) { private handleAppUpdate(result) {
this.iosLink = result.IOSLink; this.iosLink = result.IOSLink;
this.androidLink = result.AndroidLink; this.androidLink = result.AndroidLink;
@ -478,14 +545,14 @@ export class ConfirmLoginComponent implements OnInit {
}); });
} }
async appUpdate(msg, result) { async appUpdate(msg, result) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AppUpdateComponent, component: AppUpdateComponent,
cssClass: 'app-update-modal-css', cssClass: 'app-update-modal-css',
componentProps: {'msg':msg} componentProps: { 'msg': msg }
}); });
modal.onDidDismiss().then((data) => { modal.onDidDismiss().then((data) => {
this.handleAppUpdate(result); this.handleAppUpdate(result);
}); });
return await modal.present(); return await modal.present();
} }
@ -517,9 +584,9 @@ export class ConfirmLoginComponent implements OnInit {
let buttonSelected; let buttonSelected;
this.buttons.forEach(element => { this.buttons.forEach(element => {
element.forEach(elementValue => { element.forEach(elementValue => {
if(typeNumber === elementValue.value){ if (typeNumber === elementValue.value) {
buttonSelected = elementValue; buttonSelected = elementValue;
}else{ } else {
elementValue.visible = false; elementValue.visible = false;
} }
}); });

@ -33,6 +33,7 @@ export class WorklistMainService {
public static getBasicDetailNotificationBody = "Services/ERP.svc/REST/GET_BASIC_DET_NTF_BODY"; public static getBasicDetailNotificationBody = "Services/ERP.svc/REST/GET_BASIC_DET_NTF_BODY";
public static getPhoneNotificationBody = "Services/ERP.svc/REST/GET_PHONES_NOTIFICATION_BODY"; public static getPhoneNotificationBody = "Services/ERP.svc/REST/GET_PHONES_NOTIFICATION_BODY";
public static getTerminationNotificationBody = "Services/ERP.svc/REST/GET_TERM_NOTIFICATION_BODY"; public static getTerminationNotificationBody = "Services/ERP.svc/REST/GET_TERM_NOTIFICATION_BODY";
public static getContactNotificationBody = "Services/ERP.svc/REST/GET_CONTACT_NOTIFICATION_BODY";
public static getStampMSNotificationBody = "Services/ERP.svc/REST/GET_STAMP_MS_NOTIFICATION_BODY"; public static getStampMSNotificationBody = "Services/ERP.svc/REST/GET_STAMP_MS_NOTIFICATION_BODY";
public static getStampNSNotificationBody = "Services/ERP.svc/REST/GET_STAMP_NS_NOTIFICATION_BODY"; public static getStampNSNotificationBody = "Services/ERP.svc/REST/GET_STAMP_NS_NOTIFICATION_BODY";
public static getAddressNotificationBody = "Services/ERP.svc/REST/GET_ADDRESS_NOTIFICATION_BODY"; public static getAddressNotificationBody = "Services/ERP.svc/REST/GET_ADDRESS_NOTIFICATION_BODY";
@ -222,6 +223,21 @@ export class WorklistMainService {
); );
} }
public getContactNotificationBody(
WorkListBodyRequest: any,
onError?: any,
errorLabel?: string
): Observable<any> {
const request = WorkListBodyRequest;
this.authService.authenticateRequest(request);
return this.api.post(
WorklistMainService.getContactNotificationBody,
request,
onError,
errorLabel
);
}
public getPOItemHistory( public getPOItemHistory(
POItemHistoryReq: any, POItemHistoryReq: any,
onError?: any, onError?: any,

@ -48,7 +48,8 @@
<ion-row> <ion-row>
<!-- NOT ADDRESS & BASIC_DETAILS --> <!-- NOT ADDRESS & BASIC_DETAILS -->
<ion-col *ngIf="getPassNotificationDetails?.REQUEST_TYPE != 'ADDRESS' && <ion-col *ngIf="getPassNotificationDetails?.REQUEST_TYPE != 'ADDRESS' &&
getPassNotificationDetails?.REQUEST_TYPE != 'BASIC_DETAILS' && getPassNotificationDetails?.REQUEST_TYPE != 'BASIC_DETAILS' &&
getPassNotificationDetails?.REQUEST_TYPE != 'CONTACT' &&
getPassNotificationDetails?.REQUEST_TYPE != 'PHONE_NUMBERS' && getPassNotificationDetails?.REQUEST_TYPE != 'PHONE_NUMBERS' &&
getPassNotificationDetails?.REQUEST_TYPE != 'TERMINATION'"> getPassNotificationDetails?.REQUEST_TYPE != 'TERMINATION'">
@ -293,9 +294,10 @@
</ion-item> </ion-item>
</ion-col> </ion-col>
<!-- IF BASIC_DETAILS --> <!-- IF BASIC_DETAILS OR ADDRESS OR CONTACT -->
<ion-col *ngIf="getPassNotificationDetails?.REQUEST_TYPE == 'BASIC_DETAILS' || <ion-col *ngIf="getPassNotificationDetails?.REQUEST_TYPE == 'BASIC_DETAILS' ||
getPassNotificationDetails?.REQUEST_TYPE == 'ADDRESS' && getPassNotificationDetails?.REQUEST_TYPE == 'ADDRESS' ||
getPassNotificationDetails?.REQUEST_TYPE == 'CONTACT' &&
getPassNotificationDetails?.REQUEST_TYPE != 'PHONE_NUMBERS' && getPassNotificationDetails?.REQUEST_TYPE != 'PHONE_NUMBERS' &&
getPassNotificationDetails?.REQUEST_TYPE != 'TERMINATION'"> getPassNotificationDetails?.REQUEST_TYPE != 'TERMINATION'">
<div *ngIf="showInformation"> <div *ngIf="showInformation">

@ -292,6 +292,8 @@ export class WorklistMainComponent implements OnInit {
this.getTerminationNotificationDetails(this.WorkListBodyObj); this.getTerminationNotificationDetails(this.WorkListBodyObj);
} else if (this.getPassNotificationDetails.REQUEST_TYPE === 'PHONE_NUMBERS') { } else if (this.getPassNotificationDetails.REQUEST_TYPE === 'PHONE_NUMBERS') {
this.getPhoneNotificationDetails(this.WorkListBodyObj); this.getPhoneNotificationDetails(this.WorkListBodyObj);
} else if (this.getPassNotificationDetails.REQUEST_TYPE === 'CONTACT') {
this.getContactNotificationDetails(this.WorkListBodyObj);
} }
} }
@ -327,6 +329,14 @@ export class WorklistMainComponent implements OnInit {
}); });
} }
getContactNotificationDetails(notificationBodyObj) {
this.worklistMainService
.getContactNotificationBody(notificationBodyObj)
.subscribe((result: PRNotificatonBodyResponse) => {
this.handleWorkListBodyResult(result, "CONTACT");
});
}
getBasicDetailsNotification(notificationBodyObj) { getBasicDetailsNotification(notificationBodyObj) {
this.worklistMainService this.worklistMainService
.getBasicDetailNotificationBody(notificationBodyObj) .getBasicDetailNotificationBody(notificationBodyObj)
@ -455,6 +465,13 @@ export class WorklistMainComponent implements OnInit {
console.log(result); console.log(result);
} }
} }
else if (Type === "CONTACT"){
if (result.GetContactNotificationBodyList) {
this.notificationBodyRes =
result.GetContactNotificationBodyList.ContactNotificationBody;
console.log(result);
}
}
} }
} //End handleWorkListBodyResult } //End handleWorkListBodyResult

@ -1176,7 +1176,7 @@ border:0px
} }
.logoHeader { .logoHeader {
max-width: 130%; max-width: 90%;
width: 130%; width: 130%;
border: 0px; border: 0px;
} }

Loading…
Cancel
Save