|
|
|
|
@ -35,6 +35,8 @@ import { QuotationAnalysisRequest } from '../models/quotationAnalysisReq';
|
|
|
|
|
import { MoreActionModalComponent } from '../more-action-modal/more-action-modal.component'
|
|
|
|
|
import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component';
|
|
|
|
|
import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component';
|
|
|
|
|
import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service';
|
|
|
|
|
import { GetOpenNotificationsResponse } from 'src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-worklist-main-po',
|
|
|
|
|
@ -54,7 +56,9 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
public static PASS_PO_HEADER_ID = "passPOHeader";
|
|
|
|
|
public static PASS_ACTION_MODE = "passActionMode";
|
|
|
|
|
public static PASS_ACTION_MORE = "passActioMore";
|
|
|
|
|
|
|
|
|
|
public isPostNoLoad = true;
|
|
|
|
|
public worklistNotifications: any;
|
|
|
|
|
public totalRequestCount = 0;
|
|
|
|
|
getPassNotificationDetails: any;
|
|
|
|
|
public static PASS_RES_ATTR = "passResAttr";
|
|
|
|
|
TransactionID: number = -999;
|
|
|
|
|
@ -129,6 +133,8 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
public worklistAttachService: WorklistAttachService,
|
|
|
|
|
private modalCtrl: ModalController,
|
|
|
|
|
public worklistService: WorklistService,
|
|
|
|
|
public dashboredService: DashboredService,
|
|
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
this.direction = TranslatorService.getCurrentLanguageName()
|
|
|
|
|
this.WorkListActionHistoryObj = new WorkListActionHistoryRequest();
|
|
|
|
|
@ -147,7 +153,7 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
}//ngOn
|
|
|
|
|
intializeNotificationDetail() {
|
|
|
|
|
if (this.messageSuccess) {
|
|
|
|
|
document.getElementById("notificationDynamicFields").innerHTML = "";
|
|
|
|
|
document.getElementById("notificationDynamicFieldsPO").innerHTML = "";
|
|
|
|
|
}
|
|
|
|
|
console.log("intializeNotificationDetail");
|
|
|
|
|
this.getPassNotificationDetails = this.common.sharedService.getSharedData(
|
|
|
|
|
@ -340,7 +346,7 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.messageSuccess = false;
|
|
|
|
|
this.getNotificationCountAfterSubmit();
|
|
|
|
|
this.openNotificationsDashboard();
|
|
|
|
|
this.nextNotfification();
|
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
|
|
@ -349,24 +355,59 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
} // valid it
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public nextNotfification() {
|
|
|
|
|
// //let itemExist = false;
|
|
|
|
|
// let itemNo = this.getPassNotificationDetails.ROW_NUM;
|
|
|
|
|
// itemNo += 1;
|
|
|
|
|
// if (itemNo > this.notificationArray.length) {
|
|
|
|
|
// this.common.openNotificationPage();
|
|
|
|
|
// } else {
|
|
|
|
|
// for (let i = 0; i < this.notificationArray.length; i++) {
|
|
|
|
|
// if (this.notificationArray[i].ROW_NUM == itemNo) {
|
|
|
|
|
// this.common.sharedService.setSharedData(this.notificationArray[i], HomeComponent.NOTIFICATION_DATA);
|
|
|
|
|
// // itemExist = true;
|
|
|
|
|
// this.intializeNotificationDetail();
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// // if(itemExist==false){
|
|
|
|
|
// // this.nextNotfification();
|
|
|
|
|
// // }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
public nextNotfification() {
|
|
|
|
|
//let itemExist = false;
|
|
|
|
|
if( document.getElementById("notificationDynamicFieldsPO") != null){
|
|
|
|
|
|
|
|
|
|
document.getElementById("notificationDynamicFieldsPO").innerHTML = "";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
let itemNo = this.getPassNotificationDetails.ROW_NUM;
|
|
|
|
|
itemNo += 1;
|
|
|
|
|
if (itemNo > this.notificationArray.length) {
|
|
|
|
|
this.common.openNotificationPage();
|
|
|
|
|
} else {
|
|
|
|
|
for (let i = 0; i < this.notificationArray.length; i++) {
|
|
|
|
|
if (this.notificationArray[i].ROW_NUM == itemNo) {
|
|
|
|
|
this.common.sharedService.setSharedData(this.notificationArray[i], HomeComponent.NOTIFICATION_DATA);
|
|
|
|
|
// itemExist = true;
|
|
|
|
|
this.intializeNotificationDetail();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
console.log(itemNo);
|
|
|
|
|
let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo);
|
|
|
|
|
console.log(index);
|
|
|
|
|
console.log(this.notificationArray);
|
|
|
|
|
index += 1;
|
|
|
|
|
|
|
|
|
|
if (index < this.notificationArray.length) {
|
|
|
|
|
this.common.sharedService.setSharedData(this.notificationArray[index], HomeComponent.NOTIFICATION_DATA);
|
|
|
|
|
if(this.notificationArray[index].REQUEST_TYPE == "PO" ){
|
|
|
|
|
this.intializeNotificationDetail();
|
|
|
|
|
}else
|
|
|
|
|
if(this.notificationArray[index].REQUEST_TYPE == "PR" ){
|
|
|
|
|
this.common.openWorklistMainPRPage()
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if(this.notificationArray[index].REQUEST_TYPE == "MR" ){
|
|
|
|
|
this.common.openWorklistMainMRPage()
|
|
|
|
|
}else{
|
|
|
|
|
this.common.openWorklistMainPage();
|
|
|
|
|
}
|
|
|
|
|
// if(itemExist==false){
|
|
|
|
|
// this.nextNotfification();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.common.openNotificationPage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -393,14 +434,17 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
this.P_RESPOND_ATTRIBUTES_TBL.push(obj);
|
|
|
|
|
}
|
|
|
|
|
console.log("a"+ this.P_RESPOND_ATTRIBUTES_TBL);
|
|
|
|
|
|
|
|
|
|
let repUserName = this.selEmployeeID;
|
|
|
|
|
if (this.hideForwordEmployee && this.hideForwordEmployee.ATTRIBUTE_NAME) {
|
|
|
|
|
let obj: any = {};
|
|
|
|
|
repUserName = "";
|
|
|
|
|
obj.ATTRIBUTE_NAME = this.hideForwordEmployee.ATTRIBUTE_NAME;
|
|
|
|
|
obj.ATTRIBUTE_TEXT_VALUE = this.selEmployeeID;
|
|
|
|
|
this.P_RESPOND_ATTRIBUTES_TBL.push(obj);
|
|
|
|
|
}
|
|
|
|
|
// if (this.hideForwordEmployee && this.hideForwordEmployee.ATTRIBUTE_NAME) {
|
|
|
|
|
// let obj: any = {};
|
|
|
|
|
// repUserName = "";
|
|
|
|
|
// obj.ATTRIBUTE_NAME = this.hideForwordEmployee.ATTRIBUTE_NAME;
|
|
|
|
|
// obj.ATTRIBUTE_TEXT_VALUE = this.selEmployeeID;
|
|
|
|
|
// this.P_RESPOND_ATTRIBUTES_TBL.push(obj);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
ButtonAction == "APPROVE" ||
|
|
|
|
|
ButtonAction == "REJECT" ||
|
|
|
|
|
@ -411,6 +455,7 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
this.WorkListActionObj.P_ACTION_MODE = ButtonAction;
|
|
|
|
|
this.WorkListActionObj.P_COMMENTS = "";
|
|
|
|
|
this.WorkListActionObj.RespondAttributeList = this.P_RESPOND_ATTRIBUTES_TBL;
|
|
|
|
|
|
|
|
|
|
//sheardData
|
|
|
|
|
|
|
|
|
|
// this.common.sharedService.setSharedData(
|
|
|
|
|
@ -435,7 +480,7 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
this.common.confirmAlertDialogAction(
|
|
|
|
|
() => {
|
|
|
|
|
this.applyAction(this.WorkListActionObj);
|
|
|
|
|
// this.applyAction(this.WorkListActionObj);
|
|
|
|
|
}, this.ts.trPK('general', 'ok'),
|
|
|
|
|
() => { }, this.ts.trPK('general', 'cancel'),
|
|
|
|
|
this.ts.trPK('vacation-rule', 'confirmation'),
|
|
|
|
|
@ -500,6 +545,8 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
this.P_RESPOND_ATTRIBUTES_TBL,
|
|
|
|
|
WorklistMainPoComponent.PASS_RES_ATTR
|
|
|
|
|
);
|
|
|
|
|
console.log("c"+ this.P_RESPOND_ATTRIBUTES_TBL);
|
|
|
|
|
|
|
|
|
|
// this.common.openWorklistRollReplacement();
|
|
|
|
|
this.openRepRolModal();
|
|
|
|
|
} else if (
|
|
|
|
|
@ -603,6 +650,8 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getNotificationResAttr(notificationButtonsObj) {
|
|
|
|
|
console.log("getNotificationResAttr");
|
|
|
|
|
|
|
|
|
|
this.worklistMainService
|
|
|
|
|
.notificationResponseAttr(notificationButtonsObj)
|
|
|
|
|
.subscribe((result: NotificatonButtonResponse) => {
|
|
|
|
|
@ -637,10 +686,12 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
} // End handleWorkListButtonsResult
|
|
|
|
|
|
|
|
|
|
notificationDynamicFields(notificationAttr) {
|
|
|
|
|
const containerId = 'notificationDynamicFields';
|
|
|
|
|
const containerId = 'notificationDynamicFieldsPO';
|
|
|
|
|
for (let i = 0; i < notificationAttr.length; i++) {
|
|
|
|
|
if (notificationAttr[i].ATTRIBUTE_TYPE == "VARCHAR2") {
|
|
|
|
|
this.textArea = new TextAreaInput(notificationAttr[i].ATTRIBUTE_DISPLAY_NAME, notificationAttr[i].ATTRIBUTE_NAME, "", containerId, "", "", "");
|
|
|
|
|
console.log(this.textArea );
|
|
|
|
|
|
|
|
|
|
} else if (notificationAttr[i].ATTRIBUTE_TYPE == "ROLE") {
|
|
|
|
|
|
|
|
|
|
} else if (notificationAttr[i].ATTRIBUTE_TYPE == "DATE") {
|
|
|
|
|
@ -679,19 +730,19 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getNotificationCountAfterSubmit() {
|
|
|
|
|
const req: any = {};
|
|
|
|
|
this.menuService.getNotificationCount(req).subscribe((result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.notificationCount =
|
|
|
|
|
result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM;
|
|
|
|
|
if (this.notificationCount <= 0) {
|
|
|
|
|
this.notificationCount = null;
|
|
|
|
|
}
|
|
|
|
|
this.events.publish("getNotCount", this.notificationCount);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// getNotificationCountAfterSubmit() {
|
|
|
|
|
// const req: any = {};
|
|
|
|
|
// this.menuService.getNotificationCount(req).subscribe((result: any) => {
|
|
|
|
|
// if (this.common.validResponse(result)) {
|
|
|
|
|
// this.notificationCount =
|
|
|
|
|
// result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM;
|
|
|
|
|
// if (this.notificationCount <= 0) {
|
|
|
|
|
// this.notificationCount = null;
|
|
|
|
|
// }
|
|
|
|
|
// this.events.publish("getNotCount", this.notificationCount);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1068,7 +1119,7 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
if (data.data == "cancel" || data.data == undefined) {
|
|
|
|
|
return;
|
|
|
|
|
} else if (data.data == "Success") {
|
|
|
|
|
this.getNotificationCountAfterSubmit();
|
|
|
|
|
this.openNotificationsDashboard();
|
|
|
|
|
this.nextNotfification();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1112,4 +1163,15 @@ export class WorklistMainPoComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openNotificationsDashboard() {
|
|
|
|
|
this.dashboredService.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.worklistNotifications = result;
|
|
|
|
|
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
|
|
|
|
|
this.common.sharedService.setSharedData(result, 'worklistNotifications');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|