itg error text

mekawy-issues
ashwaq 6 years ago
parent 983da59f1f
commit 098f81b3c8

@ -64,6 +64,31 @@ public static host = 'https://uat.hmgwebservices.com/';
); );
} }
public postItg(
service: string,
data: any,
onError: any,
errorLabel?: string
): Observable<any> {
this.cs.startLoading();
return this.httpClient
.post<any>(
ConnectorService.host + service,
data,
ConnectorService.httpOptions
)
.pipe(
timeout(ConnectorService.timeOut),
retry(ConnectorService.retryTimes),
tap(
res => this.handleResponseItg(res, onError, errorLabel),
error => this.handleError(error, onError, errorLabel)
)
);
}
// public postNoLoad(service: string, data: any, onError: any): Observable<any> { // public postNoLoad(service: string, data: any, onError: any): Observable<any> {
// return this.httpClient // return this.httpClient
// .post<any>( // .post<any>(
@ -170,7 +195,10 @@ public static host = 'https://uat.hmgwebservices.com/';
this.cs.stopLoading(); this.cs.stopLoading();
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => { this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
this.cs.sharedService.clearAll(); this.cs.sharedService.clearAll();
// this.cs.setIsTimeSessionOut(result.IsAuthenticated);
this.cs.openLogin(); this.cs.openLogin();
}); });
return false; return false;
} else if (result.ErrorType === 2 || result.ErrorType === 4) { } else if (result.ErrorType === 2 || result.ErrorType === 4) {
@ -183,10 +211,48 @@ public static host = 'https://uat.hmgwebservices.com/';
errorLabel, errorLabel,
result.ErrorEndUserMessage result.ErrorEndUserMessage
); );
//add flag if user not auth
} }
} }
} }
public handleResponseItg(result: Response, onError: any, errorLabel: string, isPostNoLoad = false) {
console.log("handleResponseItg");
if (!isPostNoLoad) {
this.cs.stopLoading();
}
if (!this.cs.validResponse(result)) {
if (result.IsAuthenticated === false) {
this.cs.stopLoading();
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
console.log("presentAcceptDialog");
this.cs.sharedService.clearAll();
// this.cs.setIsTimeSessionOut(result.IsAuthenticated);
this.cs.openLogin();
});
return false;
} else if (result.ErrorType === 2 || result.ErrorType === 4) {
console.log("ErrorType if");
// console.log("error expired");
this.cs.stopLoading();
} else {
console.log("ErrorType else");
this.cs.stopLoading();
// this.cs.showErrorMessageDialog(
// onError,
// errorLabel,
// result.Message
// );
//add flag if user not auth
}
}
}
public getURLText( public getURLText(
url: string, url: string,
onError: any, onError: any,

@ -13,5 +13,6 @@ export class Response {
*/ */
public MessageStatus: number; public MessageStatus: number;
public SuccessMsg; public SuccessMsg;
public Message;
} }

@ -301,7 +301,7 @@ export class WorklistMainService {
itgrequest.EmployeeNumber = itgrequest.P_USER_NAME; itgrequest.EmployeeNumber = itgrequest.P_USER_NAME;
console.log(itgrequest); console.log(itgrequest);
console.log(actionURL); console.log(actionURL);
return this.api.post( return this.api.postItg(
actionURL, actionURL,
itgrequest, itgrequest,
onError, onError,

@ -208,6 +208,8 @@ export class WorkListMainItgComponent implements OnInit {
actionService(action, comments?, grantRequests?) { actionService(action, comments?, grantRequests?) {
console.log("hello actionService");
let url: string; let url: string;
let request = new itgRequest(); let request = new itgRequest();
request.RequestType = this.request_name; request.RequestType = this.request_name;
@ -223,17 +225,32 @@ export class WorkListMainItgComponent implements OnInit {
url = WorkListMainItgComponent.APPROVAL; url = WorkListMainItgComponent.APPROVAL;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
if (result.MessageStatus != 1) {
this.common.presentAlert(result.Message);
} else if (result.MessageStatus == 1) {
console.log("hello action 1");
this.confirmMsg(1) this.confirmMsg(1)
// this.common.openNotificationPage(); // this.common.openNotificationPage();
this.skip(); this.skip();
}
}); });
} else if (action == 2) {//reject } else if (action == 2) {//reject
url = WorkListMainItgComponent.REJECT; url = WorkListMainItgComponent.REJECT;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
console.log("hello action 2");
if (result.MessageStatus != 1) {
this.common.presentAlert(result.Message);
} else if (result.MessageStatus == 1) {
this.confirmMsg(2) this.confirmMsg(2)
// this.common.openNotificationPage(); // this.common.openNotificationPage();
this.skip(); this.skip();
}
}); });
} else if (action == 3) {//request more info } else if (action == 3) {//request more info
request.NewUserEMPId = this.replcamentID; request.NewUserEMPId = this.replcamentID;
@ -244,9 +261,18 @@ export class WorkListMainItgComponent implements OnInit {
request.Comments = comments; request.Comments = comments;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
this.confirmMsg(3) console.log("hello action 3");
if (result.MessageStatus != 1) {
//this.common.presentAlert(result.Message);
this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
}
if (result.MessageStatus == 1) {
this.confirmMsg(3)
// this.common.openNotificationPage(); // this.common.openNotificationPage();
this.skip(); this.skip();
}
}); });
} }
} else if (action == 4) {//delegate } else if (action == 4) {//delegate
@ -254,9 +280,16 @@ export class WorkListMainItgComponent implements OnInit {
url = WorkListMainItgComponent.DELEGATE; url = WorkListMainItgComponent.DELEGATE;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
console.log("hello action 4");
if (result.MessageStatus != 1) {
this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} else if (result.MessageStatus == 1) {
this.confirmMsg(4) this.confirmMsg(4)
// this.common.openNotificationPage(); // this.common.openNotificationPage();
this.skip(); this.skip();
}
}); });
} else if (action == 5) { //answer } else if (action == 5) { //answer
url = WorkListMainItgComponent.ANSWER; url = WorkListMainItgComponent.ANSWER;
@ -265,9 +298,16 @@ export class WorkListMainItgComponent implements OnInit {
} else { } else {
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
console.log("hello action 5");
if (result.MessageStatus != 1) {
this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} else if (result.MessageStatus == 1) {
this.confirmMsg(5) this.confirmMsg(5)
// this.common.openNotificationPage(); // this.common.openNotificationPage();
this.skip(); this.skip();
}
}); });
} }
} else if (action == 6) { //grant } else if (action == 6) { //grant
@ -280,9 +320,15 @@ export class WorkListMainItgComponent implements OnInit {
request.AdditionalFields = this.grantRequest; request.AdditionalFields = this.grantRequest;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
console.log("hello action 6");
if (result.MessageStatus != 1) {
this.common.presentAlert(result.Message);
} else if (result.MessageStatus == 1) {
this.confirmMsg(6) this.confirmMsg(6)
// this.common.openNotificationPage(); // this.common.openNotificationPage();
this.skip(); this.skip();
}
}); });
} else { } else {
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment')); this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
@ -299,6 +345,7 @@ export class WorkListMainItgComponent implements OnInit {
} }
confirmMsg(action) { confirmMsg(action) {
console.log("confirmMsg");
if (action === 1) { if (action === 1) {
return this.ts.trPK('worklist', 'approveMsg'); return this.ts.trPK('worklist', 'approveMsg');
} }

@ -225,6 +225,11 @@
"en": " The connection timeout expired due to an error in the network or servers may be busy!", "en": " The connection timeout expired due to an error in the network or servers may be busy!",
"ar": " انتهت مهلة الاتصال بسبب خطأ في الشبكة أو الخوادم قد تكون مشغولة!" "ar": " انتهت مهلة الاتصال بسبب خطأ في الشبكة أو الخوادم قد تكون مشغولة!"
}, },
"error-itg": {
"en": "Dear, this service is not available now, please try again later",
"ar": " هذه الخدمة غير متاحة الآن ، يرجى المحاولة مرة أخرى في وقت لاحق"
},
"details": { "details": {
"en": "Details", "en": "Details",
"ar": "التفاصيل" "ar": "التفاصيل"

Loading…
Cancel
Save