|
|
|
|
@ -35,7 +35,7 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
public segmentsArray: { name: string, number: number }[] = [];
|
|
|
|
|
public segmentData: { name: string, data: any }[] = [];
|
|
|
|
|
public requestDetailsData: { name: string, data: any }[] = [];
|
|
|
|
|
public dataLabelAndValue =[];
|
|
|
|
|
public dataLabelAndValue = [];
|
|
|
|
|
public header: any = [];
|
|
|
|
|
public rows: any = [];
|
|
|
|
|
public workList: any;
|
|
|
|
|
@ -86,20 +86,15 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
this.request.Comments = this.request_info.Comments;
|
|
|
|
|
this.request.NewUserEMPId = this.request_info.NewUserEMPId;
|
|
|
|
|
this.workListService.getITGFormDetails(this.request).subscribe((result: any) => {
|
|
|
|
|
console.log(this.request);
|
|
|
|
|
console.log(result);
|
|
|
|
|
this.request_details = result.ITGRequest;
|
|
|
|
|
this.grantInfo = result.ITGRequest.GrantFields;
|
|
|
|
|
let count =0;
|
|
|
|
|
let count = 0;
|
|
|
|
|
for (let i = 0; i < result.ITGRequest.FieldGoups.length; i++) {
|
|
|
|
|
this.segmentsArray[i] = { name: result.ITGRequest.FieldGoups[i].Title, number: i };
|
|
|
|
|
this.segmentData[i] = { name: result.ITGRequest.FieldGoups[i].Title, data: result.ITGRequest.FieldGoups[i].Fields }
|
|
|
|
|
for (let j = 0; j < this.segmentData[i].data.length; j++) {
|
|
|
|
|
// console.log(this.segmentData[i].data[j])
|
|
|
|
|
if(this.segmentData[i].data[j].Type ==="table"){
|
|
|
|
|
// console.log(JSON.parse(this.segmentData[i].data[j].Value));
|
|
|
|
|
if (this.segmentData[i].data[j].Type === "table") {
|
|
|
|
|
this.dataLabelAndValue.push(JSON.parse(this.segmentData[i].data[j].Value))
|
|
|
|
|
console.log(this.dataLabelAndValue);
|
|
|
|
|
}
|
|
|
|
|
// if (this.segmentData[i].data[j].TableValue){
|
|
|
|
|
// this.requestDetailsData[count] ={ name:this.segmentData[i].data[j].TableValue.Header,
|
|
|
|
|
@ -108,9 +103,9 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(this.dataLabelAndValue)
|
|
|
|
|
//console.log(this.requestDetailsData)
|
|
|
|
|
this.segmentsArray[this.segmentsArray.length] = { name: 'Approval Level', number: this.segmentsArray.length }
|
|
|
|
|
this.segmentsArray[this.segmentsArray.length] = { name: 'Approval Level', number: this.segmentsArray.length };
|
|
|
|
|
this.segmentsArray = [this.segmentsArray[1], this.segmentsArray[2], this.segmentsArray[0]];
|
|
|
|
|
this.segmentData = [this.segmentData[1], this.segmentData[0]];
|
|
|
|
|
this.workList = this.request_details.WFHistory;
|
|
|
|
|
this.options = this.request_details.AllowedActions;
|
|
|
|
|
this.activeSegment = this.segmentsArray[0].name;
|
|
|
|
|
@ -164,12 +159,24 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public segmentChangedClick(event: any) {
|
|
|
|
|
for(let i=0; i< this.segmentsArray.length; i++){
|
|
|
|
|
if(this.segmentsArray[i].name === event.detail.value){
|
|
|
|
|
this.slides.slideTo(i);
|
|
|
|
|
this.activeSegment = event.detail.value;
|
|
|
|
|
}
|
|
|
|
|
if (event.detail.value === "Request Details") {
|
|
|
|
|
this.slides.slideTo(0);
|
|
|
|
|
this.activeSegment = event.detail.value;
|
|
|
|
|
}
|
|
|
|
|
else if (event.detail.value === "Approval Level") {
|
|
|
|
|
this.slides.slideTo(1);
|
|
|
|
|
this.activeSegment = event.detail.value;
|
|
|
|
|
}
|
|
|
|
|
else if (event.detail.value === "Requester Details") {
|
|
|
|
|
this.slides.slideTo(2);
|
|
|
|
|
this.activeSegment = event.detail.value;
|
|
|
|
|
}
|
|
|
|
|
// for(let i=0; i< this.segmentsArray.length; i++){
|
|
|
|
|
// if(this.segmentsArray[i].name === event.detail.value){
|
|
|
|
|
// this.slides.slideTo(i);
|
|
|
|
|
// this.activeSegment = event.detail.value;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
slideChanged(event: any) {
|
|
|
|
|
@ -179,7 +186,7 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
skip() {
|
|
|
|
|
//check if the user clicked on all type of request
|
|
|
|
|
// check if the user clicked on all type of request
|
|
|
|
|
if (this.is_all_items_sents) {
|
|
|
|
|
for (let i = 1; i < this.all_request_names.length; i++) {
|
|
|
|
|
for (let j = 0; j < this.all_request_names[i].data.length; j++) {
|
|
|
|
|
@ -193,49 +200,42 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
return false;
|
|
|
|
|
} else if (this.index !== this.all_request_names.length) { // if there is another deffernet type.
|
|
|
|
|
this.clearDataArray();
|
|
|
|
|
this.changeITGForm(this.all_request_names[this.index].data[j], this.all_request_names[this.index].code);
|
|
|
|
|
this.changeITGForm(this.all_request_names[this.index].data[0], this.all_request_names[this.index].code);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else if (this.index === this.all_request_names.length) { //if its the end request redirecte to worklist home
|
|
|
|
|
} else if (this.index === this.all_request_names.length) { // if its the end request redirecte to worklist home
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.openNotificationPage();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//if user clicked on spicific type of ITG request
|
|
|
|
|
else {
|
|
|
|
|
console.log(this.all_request);
|
|
|
|
|
for (let i = 0; i < this.all_request.length; i++) { // search for the request that clicked on all request
|
|
|
|
|
console.log("IF statment check the IDs:");
|
|
|
|
|
console.log(this.request_info.ID);
|
|
|
|
|
console.log(this.all_request[i].ID);
|
|
|
|
|
if (this.request_info.ID == this.all_request[i].ID) { // check if the ID for the request is found.
|
|
|
|
|
this.index = i + 1;
|
|
|
|
|
console.log("value of i: "+i);
|
|
|
|
|
console.log("value of index: "+this.index);
|
|
|
|
|
if (this.index !== this.all_request.length) { // check if its last one to redirecte to home otherwise to next request.
|
|
|
|
|
this.clearDataArray();
|
|
|
|
|
console.log(this.all_request[this.index]);
|
|
|
|
|
console.log(this.request_name)
|
|
|
|
|
this.changeITGForm(this.all_request[this.index], this.request_name);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
console.log("no 1");
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.openNotificationPage();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// else {
|
|
|
|
|
// console.log("no 2");
|
|
|
|
|
// this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.openNotificationPage();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clearDataArray() {
|
|
|
|
|
@ -269,34 +269,31 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
if (result.MessageStatus != 1) {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
|
|
|
|
|
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
console.log("hello action 1");
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
|
|
|
|
|
this.confirmMsg(1)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
|
|
|
|
|
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(this.ts.trPK('general', 'error-itg'));
|
|
|
|
|
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(2)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(2)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else if (action == 3) {//request more info
|
|
|
|
|
request.NewUserEMPId = this.replcamentID;
|
|
|
|
|
@ -307,21 +304,19 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
request.Comments = comments;
|
|
|
|
|
this.workListService.getITGActionRequest(request, url)
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
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.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(3)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
if (result.MessageStatus == 1) {
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(3)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (action == 4) {//delegate
|
|
|
|
|
@ -329,19 +324,17 @@ 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.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(4)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(4)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else if (action == 5) { //answer
|
|
|
|
|
url = WorkListMainItgComponent.ANSWER;
|
|
|
|
|
@ -350,19 +343,17 @@ 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.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(5)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(5)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (action == 6) { //grant
|
|
|
|
|
@ -375,18 +366,17 @@ 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(this.ts.trPK('general', 'error-itg'));
|
|
|
|
|
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(6)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
|
|
|
|
|
this.common.sharedService.setSharedData(true, 'loadWorkList');
|
|
|
|
|
this.confirmMsg(6)
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
this.skip();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
|
|
|
|
|
@ -406,7 +396,6 @@ export class WorkListMainItgComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confirmMsg(action) {
|
|
|
|
|
console.log("confirmMsg");
|
|
|
|
|
if (action === 1) {
|
|
|
|
|
return this.ts.trPK('worklist', 'approveMsg');
|
|
|
|
|
}
|
|
|
|
|
|