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> {
// return this.httpClient
// .post<any>(
@ -170,7 +195,10 @@ public static host = 'https://uat.hmgwebservices.com/';
this.cs.stopLoading();
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
this.cs.sharedService.clearAll();
// this.cs.setIsTimeSessionOut(result.IsAuthenticated);
this.cs.openLogin();
});
return false;
} else if (result.ErrorType === 2 || result.ErrorType === 4) {
@ -183,10 +211,48 @@ public static host = 'https://uat.hmgwebservices.com/';
errorLabel,
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(
url: string,
onError: any,

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

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

@ -208,6 +208,8 @@ export class WorkListMainItgComponent implements OnInit {
actionService(action, comments?, grantRequests?) {
console.log("hello actionService");
let url: string;
let request = new itgRequest();
request.RequestType = this.request_name;
@ -223,17 +225,32 @@ export class WorkListMainItgComponent implements OnInit {
url = WorkListMainItgComponent.APPROVAL;
this.workListService.getITGActionRequest(request, url)
.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.common.openNotificationPage();
this.skip();
}
});
} else if (action == 2) {//reject
url = WorkListMainItgComponent.REJECT;
this.workListService.getITGActionRequest(request, url)
.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.common.openNotificationPage();
this.skip();
}
});
} else if (action == 3) {//request more info
request.NewUserEMPId = this.replcamentID;
@ -244,9 +261,18 @@ export class WorkListMainItgComponent implements OnInit {
request.Comments = comments;
this.workListService.getITGActionRequest(request, url)
.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.skip();
}
});
}
} else if (action == 4) {//delegate
@ -254,9 +280,16 @@ export class WorkListMainItgComponent implements OnInit {
url = WorkListMainItgComponent.DELEGATE;
this.workListService.getITGActionRequest(request, url)
.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.common.openNotificationPage();
this.skip();
}
});
} else if (action == 5) { //answer
url = WorkListMainItgComponent.ANSWER;
@ -265,9 +298,16 @@ export class WorkListMainItgComponent implements OnInit {
} else {
this.workListService.getITGActionRequest(request, url)
.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.common.openNotificationPage();
this.skip();
}
});
}
} else if (action == 6) { //grant
@ -280,9 +320,15 @@ export class WorkListMainItgComponent implements OnInit {
request.AdditionalFields = this.grantRequest;
this.workListService.getITGActionRequest(request, url)
.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.common.openNotificationPage();
this.skip();
}
});
} else {
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
@ -299,6 +345,7 @@ export class WorkListMainItgComponent implements OnInit {
}
confirmMsg(action) {
console.log("confirmMsg");
if (action === 1) {
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!",
"ar": " انتهت مهلة الاتصال بسبب خطأ في الشبكة أو الخوادم قد تكون مشغولة!"
},
"error-itg": {
"en": "Dear, this service is not available now, please try again later",
"ar": " هذه الخدمة غير متاحة الآن ، يرجى المحاولة مرة أخرى في وقت لاحق"
},
"details": {
"en": "Details",
"ar": "التفاصيل"

Loading…
Cancel
Save