|
|
|
|
@ -4,6 +4,7 @@ import { CommonService } from 'src/app/hmg-common/services/common/common.service
|
|
|
|
|
import { WorklistMainService } from '../service/work-list.main.service';
|
|
|
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
|
import { TextAreaInput } from 'src/app/uI-elements/text-area.input';
|
|
|
|
|
import { WorkListActionRequest } from '../models/NotificationActionReq';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-apply-action-modal',
|
|
|
|
|
@ -15,51 +16,57 @@ export class ApplyActionModalComponent implements OnInit {
|
|
|
|
|
getpassResAttr: any;
|
|
|
|
|
getPassNotificationDetails: any;
|
|
|
|
|
getPassNotification: any;
|
|
|
|
|
confirmMsg: string;
|
|
|
|
|
getPassActionMode: any;
|
|
|
|
|
P_RESPOND_ATTRIBUTES_TBL: any;
|
|
|
|
|
selEmployeeID: any;
|
|
|
|
|
hideForwordEmployee: any;
|
|
|
|
|
private WorkListActionObj: WorkListActionRequest;
|
|
|
|
|
messageSuccess: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor( private ts: TranslatorService,private modalCtrl: ModalController, private cs: CommonService,public worklistMainService: WorklistMainService,
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo',false);
|
|
|
|
|
this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr' ,false);
|
|
|
|
|
this.getpassResAttr = this.cs.sharedService.getSharedData('notificationDynamicAttributeArr' ,false);
|
|
|
|
|
this.getPassNotification = this.cs.sharedService.getSharedData('ApplyActionModalPage',false);
|
|
|
|
|
this.getPassActionMode = this.cs.sharedService.getSharedData('passActionMode',false);
|
|
|
|
|
this.WorkListActionObj = new WorkListActionRequest();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
document.getElementById("notificationDynamicFields").innerHTML="";
|
|
|
|
|
document.getElementById("notificationDynamicFieldsModal").innerHTML="";
|
|
|
|
|
console.log(this.getPassNotificationDetails);
|
|
|
|
|
//this.applyAction(this.getPassNotificationDetails);
|
|
|
|
|
this.notificationDynamicFields(this.getpassResAttr);
|
|
|
|
|
}
|
|
|
|
|
console.log("confirmMsg" + this.confirmMsg)
|
|
|
|
|
if (this.getPassActionMode === "APPROVED") {
|
|
|
|
|
this.confirmMsg = this.ts.trPK('worklistMain', 'approveMsg')
|
|
|
|
|
}
|
|
|
|
|
else if (this.getPassActionMode === "REJECTED") {
|
|
|
|
|
this.confirmMsg = this.ts.trPK('worklistMain', 'rejectMsg')
|
|
|
|
|
|
|
|
|
|
applyAction() {
|
|
|
|
|
this.worklistMainService
|
|
|
|
|
.actionButton(this.getPassNotification)
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
this.handleApplayActionResult(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (this.getPassActionMode === "DEL") {
|
|
|
|
|
this.confirmMsg = this.ts.trPK('worklistMain', 'delMsg')
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (this.getPassActionMode === "CLOSE") {
|
|
|
|
|
this.confirmMsg = this.ts.trPK('worklistMain', 'closeMsg')
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleApplayActionResult(result) {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
if (result.MessageStatus == 1) {
|
|
|
|
|
// this.navCtrl.push("HomePage");
|
|
|
|
|
//this.common.openHome();
|
|
|
|
|
//this.common.openNotificationPage();
|
|
|
|
|
// for( var i = 0; i < this.notificationArray.length; i++){
|
|
|
|
|
// if ( this.notificationArray[i].ROW_NUM === this.getPassNotificationDetails.ROW_NUM) {
|
|
|
|
|
// this.notificationArray.splice(i, 1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
////////////// this.getNotificationCountAfterSubmit();
|
|
|
|
|
///////////// this.nextNotfification();
|
|
|
|
|
}
|
|
|
|
|
} // valid it
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notificationDynamicFields(notificationAttr){
|
|
|
|
|
const containerId = 'notificationDynamicFields';
|
|
|
|
|
const containerId = 'notificationDynamicFieldsModal';
|
|
|
|
|
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,"","","");
|
|
|
|
|
@ -78,4 +85,80 @@ export class ApplyActionModalComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
actionButton() {
|
|
|
|
|
|
|
|
|
|
let ButtonAction: string = this.getPassActionMode;
|
|
|
|
|
this.P_RESPOND_ATTRIBUTES_TBL = [];
|
|
|
|
|
for (let i = 0; i < this.getpassResAttr.length; i++) {
|
|
|
|
|
let obj: any = {};
|
|
|
|
|
obj.ATTRIBUTE_NAME = this.getpassResAttr[i].ATTRIBUTE_NAME;
|
|
|
|
|
if (this.getpassResAttr[i].ATTRIBUTE_TYPE === "number") {
|
|
|
|
|
obj.ATTRIBUTE_NUMBER_VALUE = (document.getElementById(this.getpassResAttr[i].ATTRIBUTE_NAME) as HTMLInputElement).value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (this.getpassResAttr[i].ATTRIBUTE_TYPE == "VARCHAR2") {
|
|
|
|
|
obj.ATTRIBUTE_TEXT_VALUE = (document.getElementById(this.getpassResAttr[i].ATTRIBUTE_NAME) as HTMLInputElement).value;
|
|
|
|
|
}
|
|
|
|
|
this.P_RESPOND_ATTRIBUTES_TBL.push(obj);
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.WorkListActionObj.P_FORWARD_TO_USER_NAME = "";
|
|
|
|
|
this.WorkListActionObj.P_ACTION_MODE = ButtonAction;
|
|
|
|
|
this.WorkListActionObj.P_COMMENTS = "";
|
|
|
|
|
this.WorkListActionObj.RespondAttributeList = this.P_RESPOND_ATTRIBUTES_TBL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.applyAction(this.WorkListActionObj);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
applyAction(WorkListActionObj) {
|
|
|
|
|
this.worklistMainService
|
|
|
|
|
.actionButton(WorkListActionObj)
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
this.handleApplayActionResult(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleApplayActionResult(result) {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
if (result.MessageStatus == 1) {
|
|
|
|
|
// this.navCtrl.push("HomePage");
|
|
|
|
|
//this.common.openHome();
|
|
|
|
|
//this.common.openNotificationPage();
|
|
|
|
|
// for( var i = 0; i < this.notificationArray.length; i++){
|
|
|
|
|
// if ( this.notificationArray[i].ROW_NUM === this.getPassNotificationDetails.ROW_NUM) {
|
|
|
|
|
// this.notificationArray.splice(i, 1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
this.messageSuccess = true;
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.messageSuccess = false;
|
|
|
|
|
}, 5000);
|
|
|
|
|
this.cs.openNotificationPage();
|
|
|
|
|
|
|
|
|
|
// this.getNotificationCountAfterSubmit();
|
|
|
|
|
//this.nextNotfification();
|
|
|
|
|
}
|
|
|
|
|
} // valid it
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|