worklist main page added
parent
fe054b8ab6
commit
faad878c87
@ -1,28 +1,29 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
|
||||
{
|
||||
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
|
||||
data: { preload: true, delay: 1000 }
|
||||
},
|
||||
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
|
||||
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
|
||||
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
|
||||
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' },
|
||||
{ path: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' },
|
||||
{ path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' },
|
||||
{ path: 'eit', loadChildren: './eit/eit.module#EITPageModule' },
{ path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' },
|
||||
import { NgModule } from '@angular/core';
|
||||
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
|
||||
{
|
||||
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
|
||||
data: { preload: true, delay: 1000 }
|
||||
},
|
||||
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
|
||||
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
|
||||
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
|
||||
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' },
|
||||
{ path: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' },
|
||||
{ path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' },
|
||||
{ path: 'eit', loadChildren: './eit/eit.module#EITPageModule' },
|
||||
{ path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' },
|
||||
{ path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' }
|
||||
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
|
||||
],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules}),
|
||||
],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
|
||||
@ -1,28 +1,323 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
import {WorkListBodyRequest} from '../models/NotificationBodyReq';
|
||||
import {EITNotificatonBodyResponse} from '../models/EITNotificationBodyRes';
|
||||
import {AbsenceNotificatonBodyResponse} from '../models/AbsenceNotificationBodyRes';
|
||||
import {NotificatonButtonResponse} from '../models/NotificationButtonRes';
|
||||
import {WorkListActionRequest} from '../models/NotificationActionReq';
|
||||
import { WorkListButtonRequest } from '../models/NotificationButtonReq';
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { CommonService } from "src/app/hmg-common/services/common/common.service";
|
||||
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
|
||||
import { WorkListBodyRequest } from "../models/NotificationBodyReq";
|
||||
import { EITNotificatonBodyResponse } from "../models/EITNotificationBodyRes";
|
||||
import { AbsenceNotificatonBodyResponse } from "../models/AbsenceNotificationBodyRes";
|
||||
import { NotificatonButtonResponse } from "../models/NotificationButtonRes";
|
||||
import { WorkListActionRequest } from "../models/NotificationActionReq";
|
||||
import { WorkListButtonRequest } from "../models/NotificationButtonReq";
|
||||
// import { isDate } from 'angular6-json-schema-form';
|
||||
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
|
||||
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
|
||||
import { WorklistMainService } from '../service/work-list.main.service';
|
||||
import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response";
|
||||
import { LoginRequest } from "src/app/hmg-common/services/authentication/models/login.request";
|
||||
import { WorklistMainService } from "../service/work-list.main.service";
|
||||
import { HomeComponent } from 'src/app/notification/home/home.component';
|
||||
@Component({
|
||||
selector: 'app-worklist-main',
|
||||
templateUrl: './worklist-main.component.html',
|
||||
styleUrls: ['./worklist-main.component.scss'],
|
||||
selector: "app-worklist-main",
|
||||
templateUrl: "./worklist-main.component.html",
|
||||
styleUrls: ["./worklist-main.component.scss"]
|
||||
})
|
||||
export class WorklistMainComponent implements OnInit {
|
||||
|
||||
private WorkListBodyObj: WorkListBodyRequest;
|
||||
private WorkListButtonsObj: WorkListButtonRequest;
|
||||
private WorkListActionObj: WorkListActionRequest;
|
||||
getPassNotificationDetails: any;
|
||||
TransactionID: number = -999;
|
||||
notificationBodyRes: any;
|
||||
actionHistoryRes: any;
|
||||
notificationButtonRes: any;
|
||||
actionMode: any;
|
||||
pInformation: string = "";
|
||||
pQuestion: string = "";
|
||||
RespondAttributesListRes: any;
|
||||
schemaNotific: any;
|
||||
NotRespondAttributeList: any;
|
||||
Resp2_val: any;
|
||||
notExampleJsonObject: any;
|
||||
hideForwordEmployee: any;
|
||||
exampleJsonObject: any;
|
||||
dataOfAttr: any;
|
||||
P_RESPOND_ATTRIBUTES_TBL: any;
|
||||
selEmployeeID: any;
|
||||
actionType: string = "";
|
||||
constructor(
|
||||
public common: CommonService,
|
||||
public ts: TranslatorService,
|
||||
) { }
|
||||
public worklistMainService: WorklistMainService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.getPassNotificationDetails = this.common.sharedService.getSharedData(HomeComponent.NOTIFICATION_DATA, false);
|
||||
this.WorkListBodyObj = new WorkListBodyRequest();
|
||||
this.WorkListButtonsObj = new WorkListButtonRequest();
|
||||
|
||||
this.WorkListActionObj = new WorkListActionRequest();
|
||||
|
||||
this.WorkListBodyObj.P_TRANSACTION_ID = this.TransactionID;
|
||||
this.WorkListBodyObj.P_NOTIFICATION_ID = this.getPassNotificationDetails.NOTIFICATION_ID;
|
||||
|
||||
this.WorkListButtonsObj.P_NOTIFICATION_ID = this.getPassNotificationDetails.NOTIFICATION_ID;
|
||||
|
||||
this.WorkListActionObj.P_NOTIFICATION_ID = this.getPassNotificationDetails.NOTIFICATION_ID;
|
||||
this.WorkListActionObj.P_FORWARD_TO_USER_NAME = "";
|
||||
this.WorkListActionObj.P_ACTION_MODE = "";
|
||||
this.WorkListActionObj.P_COMMENTS = "";
|
||||
this.WorkListActionObj.P_APPROVER_INDEX = null;
|
||||
this.getNotificationButtons(this.WorkListButtonsObj);
|
||||
this.getNotificationResAttr(this.WorkListButtonsObj);
|
||||
|
||||
if (this.getPassNotificationDetails.REQUEST_TYPE == "EIT") {
|
||||
this.getEITNotificationDetails(this.WorkListBodyObj);
|
||||
} else if (this.getPassNotificationDetails.REQUEST_TYPE == "ABSENCE") {
|
||||
this.getAbsenceNotificationDetails(this.WorkListBodyObj);
|
||||
}
|
||||
}
|
||||
|
||||
getEITNotificationDetails(notificationBodyObj) {
|
||||
this.worklistMainService.getEITNotificationBody(
|
||||
notificationBodyObj
|
||||
).subscribe((result: EITNotificatonBodyResponse) => {
|
||||
this.handleWorkListBodyResult(result, "EIT");
|
||||
});
|
||||
}
|
||||
|
||||
getAbsenceNotificationDetails(notificationBodyObj) {
|
||||
this.worklistMainService.getAbsencesNotificationBody(
|
||||
notificationBodyObj
|
||||
).subscribe((result: AbsenceNotificatonBodyResponse) => {
|
||||
this.handleWorkListBodyResult(result, "ABSENCE");
|
||||
});
|
||||
}
|
||||
|
||||
handleWorkListBodyResult(result, Type) {
|
||||
this.notificationBodyRes = {};
|
||||
if (this.common.validResponse(result)) {
|
||||
this.pInformation = result.P_INFORMATION;
|
||||
this.pQuestion = result.P_QUESTION;
|
||||
if (Type == "EIT") {
|
||||
if (result.GetEITCollectionNotificationBodyList) {
|
||||
this.notificationBodyRes =
|
||||
result.GetEITCollectionNotificationBodyList;
|
||||
}
|
||||
} else if (Type == "ABSENCE") {
|
||||
if (result.GetAbsenceCollectionNotificationBodyList) {
|
||||
this.notificationBodyRes =
|
||||
result.GetAbsenceCollectionNotificationBodyList;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //End handleWorkListBodyResult
|
||||
|
||||
getNotificationButtons(notificationButtonsObj) {
|
||||
this.worklistMainService.getNotificationButtons(
|
||||
notificationButtonsObj
|
||||
).subscribe((result: NotificatonButtonResponse) => {
|
||||
this.handleWorkListButtonsResult(result);
|
||||
});
|
||||
}
|
||||
|
||||
handleWorkListButtonsResult(result) {
|
||||
if (this.common.validResponse(result)) {
|
||||
// this.sharedData.setSharedData(result, WorKListResponse.SHARED_DATA);
|
||||
if (result.GetNotificationButtonsList != null) {
|
||||
this.notificationButtonRes = result.GetNotificationButtonsList;
|
||||
} // if result == null
|
||||
} // valid it
|
||||
} // End handleWorkListButtonsResult
|
||||
|
||||
|
||||
applyAction(WorkListActionObj) {
|
||||
this.worklistMainService.actionButton(WorkListActionObj).subscribe(
|
||||
(result: any) => {
|
||||
this.handleApplayActionResult(result);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
handleApplayActionResult(result) {
|
||||
if (this.common.validResponse(result)) {
|
||||
if (result.MessageStatus == 1) {
|
||||
|
||||
// this.navCtrl.push("HomePage");
|
||||
}
|
||||
} // valid it
|
||||
}
|
||||
|
||||
actionButton() {
|
||||
let ButtonAction: string = this.actionType;
|
||||
var responseAttrDic = this.notExampleJsonObject;
|
||||
this.P_RESPOND_ATTRIBUTES_TBL = [];
|
||||
for (let key in responseAttrDic) {
|
||||
// let obj: any = {};
|
||||
// obj.ATTRIBUTE_NAME = key;
|
||||
// if (typeof responseAttrDic[key] === "number") {
|
||||
// obj.ATTRIBUTE_NUMBER_VALUE = responseAttrDic[key];
|
||||
// } else if (isDate(responseAttrDic[key])) {
|
||||
// obj.ATTRIBUTE_DATE_VALUE = responseAttrDic[key];
|
||||
// } else {
|
||||
// obj.ATTRIBUTE_TEXT_VALUE = responseAttrDic[key];
|
||||
// }
|
||||
// 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);
|
||||
}
|
||||
if (
|
||||
ButtonAction == "APPROVED" ||
|
||||
ButtonAction == "REJECTED" ||
|
||||
ButtonAction == "DEL" ||
|
||||
ButtonAction == "CLOSE"
|
||||
) {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (ButtonAction == "RFC") {
|
||||
// alert("Return For Correction");
|
||||
this.WorkListActionObj.P_ACTION_MODE = ButtonAction;
|
||||
// this.navCtrl.push("WorkListRfcPage", {
|
||||
// passNotificationInfo: this.getPassNotificationDetails,
|
||||
// passActionMode: ButtonAction,
|
||||
// passResAttr: this.P_RESPOND_ATTRIBUTES_TBL
|
||||
// });
|
||||
} else if (ButtonAction == "ANSWER_INFO") {
|
||||
// this.navCtrl.push("WorkListReplacmentRollPage", {
|
||||
// pQuestion: this.pQuestion,
|
||||
// passNotificationInfo: this.getPassNotificationDetails,
|
||||
// passActionMode: ButtonAction,
|
||||
// passResAttr: this.P_RESPOND_ATTRIBUTES_TBL
|
||||
// });
|
||||
} else if (
|
||||
ButtonAction == "DELEGATE" ||
|
||||
ButtonAction == "REQUEST_INFO" ||
|
||||
ButtonAction == "TRANSFER" ||
|
||||
ButtonAction == "TRANSFER_INFO"
|
||||
) {
|
||||
// alert("multi option: "+ ButtonAction);
|
||||
this.WorkListActionObj.P_ACTION_MODE = ButtonAction;
|
||||
// this.navCtrl.push("WorkListReplacmentRollPage", {
|
||||
// passNotificationInfo: this.getPassNotificationDetails,
|
||||
// passActionMode: ButtonAction,
|
||||
// passResAttr: this.P_RESPOND_ATTRIBUTES_TBL
|
||||
// });
|
||||
} else if (
|
||||
ButtonAction == "UPDATE_ACTION" ||
|
||||
ButtonAction == "CONTINUE_ACTION"
|
||||
) {
|
||||
|
||||
|
||||
if (this.getPassNotificationDetails.REQUEST_TYPE == "EIT") {
|
||||
this.common.sharedService.setSharedData(
|
||||
this.notificationBodyRes,
|
||||
EITNotificatonBodyResponse.SHARED_DATA
|
||||
);
|
||||
this.common.sharedService.setSharedData(
|
||||
this.getPassNotificationDetails,
|
||||
EITNotificatonBodyResponse.NOT_WORKLIST
|
||||
);
|
||||
// this.navCtrl.push("EitUpdateListPage");
|
||||
} else if (this.getPassNotificationDetails.REQUEST_TYPE == "ABSENCE") {
|
||||
this.common.sharedService.setSharedData(
|
||||
this.notificationBodyRes,
|
||||
AbsenceNotificatonBodyResponse.SHARED_DATA
|
||||
);
|
||||
this.common.sharedService.setSharedData(
|
||||
this.getPassNotificationDetails,
|
||||
AbsenceNotificatonBodyResponse.NOT_WORKLIST
|
||||
);
|
||||
// this.navCtrl.push("SubmitAbsencePage", {
|
||||
// dirfromNotificationPage: true,
|
||||
// submitAbsObjList: this.notificationBodyRes[0].Collection_Notification
|
||||
// });
|
||||
|
||||
}
|
||||
}
|
||||
// else if (this.notificationButtonRes.length > 0 && !ButtonAction) {
|
||||
// (this.elementRef.nativeElement.querySelectorAll(
|
||||
// "ion-item"
|
||||
// ) as HTMLElement[]).forEach(x => {
|
||||
// if (x.classList.contains("requiredItem")) {
|
||||
// x.classList.add("ng-touched");
|
||||
// x.classList.remove("ng-untouched");
|
||||
// }
|
||||
// });
|
||||
// this.common.showAlert(
|
||||
// this.translate.translate("worklistMain.actionRequird")
|
||||
// );
|
||||
// } else {
|
||||
// this.navCtrl.pop();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
openActionHistory() {
|
||||
// this.navCtrl.push("WorkListActionHistoryPage", {
|
||||
// passNotificationInfo: this.getPassNotificationDetails
|
||||
// });
|
||||
}
|
||||
|
||||
openSupportDocuments() {
|
||||
// this.navCtrl.push("WorkListAttachPage", {
|
||||
// passNotificationInfo: this.getPassNotificationDetails
|
||||
// });
|
||||
}
|
||||
|
||||
getNotificationResAttr(notificationButtonsObj) {
|
||||
this.worklistMainService.notificationResponseAttr(
|
||||
notificationButtonsObj
|
||||
).subscribe((result: NotificatonButtonResponse) => {
|
||||
this.handleNotificationResAttrResult(result);
|
||||
});
|
||||
}
|
||||
|
||||
handleNotificationResAttrResult(result) {
|
||||
if (this.common.validResponse(result)) {
|
||||
// this.sharedData.setSharedData(result, WorKListResponse.SHARED_DATA);
|
||||
this.NotRespondAttributeList =
|
||||
result.NotificationGetRespondAttributesList;
|
||||
if (
|
||||
result.NotificationRespondRolesList != "" &&
|
||||
result.NotificationRespondRolesList[0].ATTRIBUTE_NAME != null &&
|
||||
result.NotificationRespondRolesList[0].ATTRIBUTE_NAME != undefined
|
||||
) {
|
||||
this.Resp2_val = result.NotificationRespondRolesList[0].ATTRIBUTE_NAME;
|
||||
this.hideForwordEmployee = result.NotificationRespondRolesList[0];
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
if (result.P_Schema) this.schemaNotific = JSON.parse(result.P_Schema);
|
||||
} // valid it
|
||||
} // End handleWorkListButtonsResult
|
||||
|
||||
openNotificationBody() {
|
||||
if (this.getPassNotificationDetails.REQUEST_TYPE == "EIT") {
|
||||
this.common.sharedService.setSharedData(
|
||||
this.notificationBodyRes,
|
||||
EITNotificatonBodyResponse.SHARED_DATA
|
||||
);
|
||||
this.common.sharedService.setSharedData(
|
||||
this.getPassNotificationDetails,
|
||||
EITNotificatonBodyResponse.NOT_WORKLIST
|
||||
);
|
||||
// this.navCtrl.push("WorkListDetailsPage", { NotBodyType: "EIT" });
|
||||
} else if (this.getPassNotificationDetails.REQUEST_TYPE == "ABSENCE") {
|
||||
this.common.sharedService.setSharedData(
|
||||
this.notificationBodyRes,
|
||||
AbsenceNotificatonBodyResponse.SHARED_DATA
|
||||
);
|
||||
this.common.sharedService.setSharedData(
|
||||
this.getPassNotificationDetails,
|
||||
AbsenceNotificatonBodyResponse.NOT_WORKLIST
|
||||
);
|
||||
//this.navCtrl.push("WorkListDetailsPage", { NotBodyType: "ABSENCE" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue