worklist-done

enad-pre-live
Sultan Khan 4 years ago
parent 8587ba279f
commit 5eb2a68831

@ -78,6 +78,15 @@ export class CommonService {
'نوفمبر',
'ديسمبر'
];
public filterKeys = {
'HRSSA': 0,
'INVMOA': 0,
'REQAPPRV': 0,
'POAPPRV': 0,
'INVITEM': 0,
"STAMP": 0,
'ITG': 0
}
private progressLoaders: any[] = [];
private loadingProgress: any;
@ -1571,7 +1580,7 @@ export class CommonService {
public totalCounter = 0;
getTotalNumberOfWorklistRequest() {
this.totalCounter = parseInt(this.sharedService.getSharedData('total-count'));
this.totalCounter = parseInt(this.sharedService.getSharedData('total-count', false));
return this.totalCounter;
}
setTotalNumberOfWorklistRequest() {
@ -1579,6 +1588,14 @@ export class CommonService {
this.sharedService.setSharedData(this.totalCounter, 'total-count');
}
public setFilterValues(data) {
for (const notification of data) {
this.filterKeys[notification.ITEM_TYPE] = notification.OPEN_NTF_NUMBER
}
}
public filters = [
{
value: 0,
@ -1586,7 +1603,8 @@ export class CommonService {
active: false,
color: '#18a169',
key: 'HRSSA',
disable: false
disable: false,
total: 0
},
{
value: 0,
@ -1594,7 +1612,8 @@ export class CommonService {
active: false,
color: '#3cb9d5',
key: 'INVMOA',
disable: false
disable: false,
total: 0
},
{
value: 0,
@ -1602,7 +1621,8 @@ export class CommonService {
active: false,
color: '#114475',
key: 'REQAPPRV',
disable: false
disable: false,
total: 0
},
{
value: 0,
@ -1610,7 +1630,8 @@ export class CommonService {
active: false,
color: '#38c9b3',
key: 'POAPPRV',
disable: false
disable: false,
total: 0
},
{
value: 0,
@ -1618,7 +1639,8 @@ export class CommonService {
active: false,
color: '#cc3232',
key: 'ITG',
disable: false
disable: false,
total: 0
},
{
value: 0,
@ -1626,7 +1648,8 @@ export class CommonService {
active: false,
color: '#9e7e97',
key: 'INVITEM',
disable: false
disable: false,
total: 0
},
{
value: 0,
@ -1634,8 +1657,10 @@ export class CommonService {
active: false,
color: '#ff9800',
key: 'STAMP',
disable: false
}
disable: false,
total: 0,
},
];
public data = {
@ -1655,30 +1680,28 @@ export class CommonService {
}]
};
assignDataToFilters(result) {
const openNotificationsArray = result;
for (const notification of openNotificationsArray) {
if (notification.ITEM_TYPE === 'HRSSA') {
this.filters[0].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[0] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'INVMOA') {
this.filters[1].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[1] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'REQAPPRV') {
this.filters[2].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[2] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'POAPPRV') {
this.filters[3].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[3] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'INVITEM') {
this.filters[5].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[5] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'STAMP') {
this.filters[6].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[6] = notification.OPEN_NTF_NUMBER;
}
}
getFiltersData() {
// for (const notification of openNotificationsArray) {
// if (notification.ITEM_TYPE === 'HRSSA') {
this.filters[0].value = this.filterKeys['HRSSA'];
this.data.datasets[0].data[0] = this.filterKeys['HRSSA'];
// } else if (notification.ITEM_TYPE === 'INVMOA') {
this.filters[1].value = this.filterKeys['INVMOA'];
this.data.datasets[0].data[1] = this.filterKeys['INVMOA'];
// } else if (notification.ITEM_TYPE === 'REQAPPRV') {
this.filters[2].value = this.filterKeys['REQAPPRV'];
this.data.datasets[0].data[2] = this.filterKeys['REQAPPRV'];
// } else if (notification.ITEM_TYPE === 'POAPPRV') {
this.filters[3].value = this.filterKeys['POAPPRV'];
this.data.datasets[0].data[3] = this.filterKeys['POAPPRV'];
// } else if (notification.ITEM_TYPE === 'INVITEM') {
this.filters[5].value = this.filterKeys['INVITEM'];
this.data.datasets[0].data[5] = this.filterKeys['INVITEM'];
// } else if (notification.ITEM_TYPE === 'STAMP') {
this.filters[6].value = this.filterKeys['STAMP'];
this.data.datasets[0].data[6] = this.filterKeys['STAMP'];
let val = { 'filters': [], 'data': {} };
val.filters = this.filters;
val.data = this.data;

@ -6,6 +6,7 @@ export class MenuResponse {
public static SELECTED_MENU = 'selected_menu';
public static SHARED_SEL_EMP = 'sel_empolyee';
public static SHARED_SEL_RESP_ID = 'sel_resp_id';
public static ITG_COUNTS = 'itg-counts';
public userid: string;
public search: boolean;
public List_Menu: ListMenu;

@ -369,7 +369,12 @@ export class HomePage implements OnInit {
callDashboardServices() {
this.getMenu();
this.setServicesPrivilage();
if (this.common.getTotalNumberOfWorklistRequest()) {
this.statsButtons[1].statsValue = this.common.getTotalNumberOfWorklistRequest();
} else {
this.openNotificationsDashbored();
}
this.showOpenMissingSwipes();
this.showAttendanceTracking();
var accrualBalance = this.common.sharedService.getSharedData('leaveAccrualBalance', false);
@ -660,12 +665,15 @@ export class HomePage implements OnInit {
result,
'worklistNotifications'
);
this.common.setFilterValues(result['GetOpenNotificationsList']);
}
});
}
ITGCountAllNotification() {
this.workListService.getITGDetails('', '', this.isPostNoLoad).subscribe((result: any) => {
this.common.sharedService.setSharedData(result, MenuResponse.ITG_COUNTS);
this.common.filterKeys['ITG'] = result.TotalCount;
this.statsButtons[1].statsValue =
Math.floor(this.countAllNotification + result.TotalCount);
this.common.stopLoading();

@ -11,6 +11,7 @@ import { WorklistAdvancedSearchComponent } from '../worklist-advanced-search/wor
import { DatePipe } from '@angular/common';
import { GetOpenNotificationsResponse } from 'src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse';
import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service';
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
@Component({
selector: 'app-home',
@ -22,6 +23,7 @@ export class HomeComponent implements OnInit {
public static REQUSET_INFO = 'requset_info';
public static ALL_REQUEST = 'all_request';
public static NOTIFICATION_DATA = 'notification_data';
public static COUNT_CHANGED = 'count_changed';
public static NOTIFICATION_ARR = 'notification_arr';
public static NAMES_ALL_iTEMS = 'names-all-items';
public static IS_ALL_NAME = 'is_all_names';
@ -70,7 +72,7 @@ export class HomeComponent implements OnInit {
public showSearchButton = false;
public itemType = 'HRSSA';
public receivedITGCount = false;
public countChanged: any = false;
public totalHR = 0;
public totalPO = 0;
public totalPR = 0;
@ -199,12 +201,10 @@ export class HomeComponent implements OnInit {
ionViewWillEnter() {
this.totalRequestCount = this.common.getTotalNumberOfWorklistRequest();
const values = this.common.assignDataToFilters(this.common.sharedService.getSharedData('worklistNotifications', false));
const values = this.common.getFiltersData();
this.data = values.data;
this.filters = values.filters;
console.log(this.filters);
console.log(this.data);
console.log(this.totalRequestCount);
const loadWorkList = this.common.sharedService.getSharedData('loadWorkList', false);
if (loadWorkList) {
this.receivedITGCount = false;
@ -229,22 +229,34 @@ export class HomeComponent implements OnInit {
}
callWorkListServices() {
// if (this.countChanged) {
this.Count();
// }
this.getAllPushNotificationFun();
}
openNotificationsDashboard() {
this.DS.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) {
this.worklistNotifications = result;
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
this.resetFiltersUI();
this.assignDataToFilters();
this.common.sharedService.setSharedData(result, 'worklistNotifications');
// if (this.countChanged) {
// this.DS.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => {
// if (this.common.validResponse(result)) {
// this.countChanged = false;
// this.worklistNotifications = result;
// this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
//this.resetFiltersUI();
// this.assignDataToFilters();
// this.common.sharedService.setSharedData(result, 'worklistNotifications');
this.Details();
this.callWorkListServices();
}
});
// }
// });
// } else {
// this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
// this.resetFiltersUI();
// this.assignDataToFilters();
// this.Details();
// this.callWorkListServices();
// }
}
assignDataToFilters() {
@ -608,6 +620,7 @@ export class HomeComponent implements OnInit {
.subscribe((result: any) => {
if (result.RequestType) {
if (result.RequestType.length > 0) {
this.countChanged = false;
this.ITGSegment[0] = {
name: 'All',
code: 'All',
@ -638,14 +651,30 @@ export class HomeComponent implements OnInit {
}
Details() {
this.workListService.getITGDetails('', '', this.isPostNoLoad)
.subscribe((result: any) => {
this.ITGCount = result.TotalCount;
this.totalRequestCount = this.totalRequestCount + result.TotalCount;
this.data.datasets[0].data[4] = this.ITGCount;
this.filters[4].value = result.TotalCount;
// var result = this.common.sharedService.getSharedData(MenuResponse.ITG_COUNTS, false);
// if (this.countChanged) {
// this.workListService.getITGDetails('', '', this.isPostNoLoad)
// .subscribe((result: any) => {
// this.countChanged = false;
// this.ITGCount = result.TotalCount;
// // this.totalRequestCount = this.totalRequestCount + result.TotalCount;
// this.data.datasets[0].data[4] = this.ITGCount;
// this.filters[4].value = result.TotalCount;
// this.receivedITGCount = true;
// })
// } else {
//this.workListService.getITGDetails('', '', this.isPostNoLoad)
//.subscribe((result: any) => {
this.ITGCount = this.common.filterKeys['ITG'];//result.TotalCount;
// this.totalRequestCount = this.totalRequestCount + result.TotalCount;
this.data.datasets[0].data[4] = this.common.filterKeys['ITG'];//this.ITGCount;
this.filters[4].value = this.common.filterKeys['ITG'];
this.receivedITGCount = true;
});
//});
//}
}
searchBtn() {

@ -195,6 +195,10 @@ export class WorkListMainItgComponent implements OnInit {
skip() {
// check if the user clicked on all type of request
this.common.setTotalNumberOfWorklistRequest();
// this.common.assignDataToFilters(this.common.sharedService.getSharedData('worklistNotifications', false), 'ITG');
if (this.common.filterKeys['ITG'] != 0)
this.common.filterKeys['ITG'] = (this.common.filterKeys['ITG'] - 1)
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++) {
@ -277,6 +281,7 @@ export class WorkListMainItgComponent implements OnInit {
setTimeout(() => {
// this.messageSuccess = false;
this.common.sharedService.setSharedData(true, 'loadWorkList');
this.confirmMsg(1);
this.skip();
}, 2000);

@ -430,8 +430,7 @@ export class WorklistMainIcComponent implements OnInit {
// this.messageSuccess = true;
this.common.greenToastPK('worklist', 'done-successfully');
setTimeout(() => {
// this.messageSuccess = false;
// this.openNotificationsDashboard();
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}, 5000);
} else {
@ -470,6 +469,9 @@ export class WorklistMainIcComponent implements OnInit {
let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo);
let previousRequest = this.notificationArray[index].REQUEST_TYPE;
let previousRequestType = this.notificationArray[index].ITEM_TYPE;
if (this.common.filterKeys[previousRequestType] != 0)
this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1)
index += 1;
if (index < this.notificationArray.length) {
@ -480,9 +482,11 @@ export class WorklistMainIcComponent implements OnInit {
} else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) {
this.checkRequestType(index);
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
}
@ -1216,9 +1220,9 @@ export class WorklistMainIcComponent implements OnInit {
// this.messageSuccess = true;
this.common.greenToastPK('worklist', 'done-successfully');
setTimeout(() => {
// this.messageSuccess = false;
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}, 2000);
}, 1000);
// this.nextNotfification();
} else {

@ -373,6 +373,7 @@ export class WorklistMainMRComponent implements OnInit {
setTimeout(() => {
// this.messageSuccess = false;
// this.openNotificationsDashboard();
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}, 5000);
} else {
@ -414,7 +415,11 @@ export class WorklistMainMRComponent implements OnInit {
let itemNo = this.getPassNotificationDetails.ROW_NUM;
let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo);
let previousRequest = this.notificationArray[index].REQUEST_TYPE;
let previousRequestType = this.notificationArray[index].ITEM_TYPE;
if (this.common.filterKeys[previousRequestType] != 0)
this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1)
index += 1;
if (index < this.notificationArray.length) {
@ -425,9 +430,11 @@ export class WorklistMainMRComponent implements OnInit {
} else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) {
this.checkRequestType(index);
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
}
@ -1117,9 +1124,9 @@ export class WorklistMainMRComponent implements OnInit {
// this.messageSuccess = true;
this.common.greenToastPK('worklist', 'done-successfully');
setTimeout(() => {
// this.messageSuccess = false;
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}, 2000);
}, 1000);
// this.nextNotfification();
} else {
@ -1153,7 +1160,7 @@ export class WorklistMainMRComponent implements OnInit {
if (data.data == 'cancel' || data.data == undefined) {
return;
} else if (data.data == 'Success') {
// this.openNotificationsDashboard();
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}

@ -407,8 +407,7 @@ export class WorklistMainPoComponent implements OnInit {
// this.messageSuccess = true;
this.common.greenToastPK('worklist', 'done-successfully');
setTimeout(() => {
// this.messageSuccess = false;
// this.openNotificationsDashboard();
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}, 5000);
} else {
@ -446,7 +445,11 @@ export class WorklistMainPoComponent implements OnInit {
let itemNo = this.getPassNotificationDetails.ROW_NUM;
let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo);
let previousRequest = this.notificationArray[index].REQUEST_TYPE;
let previousRequestType = this.notificationArray[index].ITEM_TYPE;
if (this.common.filterKeys[previousRequestType] != 0)
this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1)
index += 1;
if (index < this.notificationArray.length) {
@ -457,9 +460,11 @@ export class WorklistMainPoComponent implements OnInit {
} else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) {
this.checkRequestType(index);
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
}
@ -1184,8 +1189,9 @@ export class WorklistMainPoComponent implements OnInit {
} else if (data.data.data === 'Success') {
this.common.greenToastPK('worklist', 'done-successfully');
setTimeout(() => {
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}, 2000);
}, 1000);
} else {
this.common.redToastPK('worklist', 'save-error');
}

@ -395,12 +395,7 @@ export class WorklistMainPRComponent implements OnInit {
if (result.MessageStatus == 1) {
this.common.sharedService.setSharedData(true, 'loadWorkList');
this.common.greenToastPK('worklist', 'done-successfully');
// show succsfull popup
// this.messageSuccess = true;
// setTimeout(() => {
// this.messageSuccess = false;
// }, 5000);
// this.openNotificationsDashboard();
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
} else {
this.common.redToastPK('worklist', 'save-error');
@ -440,9 +435,12 @@ export class WorklistMainPRComponent implements OnInit {
let itemNo = this.getPassNotificationDetails.ROW_NUM;
console.log(itemNo);
let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo);
console.log(index);
console.log(this.notificationArray);
let previousRequest = this.notificationArray[index].REQUEST_TYPE;
let previousRequestType = this.notificationArray[index].ITEM_TYPE;
if (this.common.filterKeys[previousRequestType] != 0)
this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1)
index += 1;
if (index < this.notificationArray.length) {
@ -453,9 +451,11 @@ export class WorklistMainPRComponent implements OnInit {
} else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) {
this.checkRequestType(index);
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
}
@ -1117,9 +1117,9 @@ export class WorklistMainPRComponent implements OnInit {
// this.messageSuccess = true;
this.common.greenToastPK('worklist', 'done-successfully');
setTimeout(() => {
// this.messageSuccess = false;
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}, 2000);
}, 1000);
// this.nextNotfification();
} else {

@ -560,10 +560,9 @@ export class WorklistMainComponent implements OnInit {
// }
// this.messageSuccess = true;
this.common.greenToastPK('worklist', 'done-successfully');
this.common.setTotalNumberOfWorklistRequest();
setTimeout(() => {
// this.messageSuccess = false;
// this.openNotificationsDashboard();
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}, 2000);
} else {
@ -601,14 +600,20 @@ export class WorklistMainComponent implements OnInit {
if (document.getElementById("notificationDynamicFields") != null) {
document.getElementById("notificationDynamicFields").innerHTML = "";
}
let itemNo = this.getPassNotificationDetails.ROW_NUM;
console.log(itemNo);
let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo);
console.log(index);
console.log(this.notificationArray);
let previousRequest = this.notificationArray[index].REQUEST_TYPE;
index += 1;
if (previousRequest == 'STAMP_MS' || previousRequest == 'STAMP_NS') {
previousRequest = 'STAMP';
}
if (this.common.filterKeys[previousRequest] != 0)
this.common.filterKeys[previousRequest] = (this.common.filterKeys[previousRequest] - 1)
index += 1;
if (index < this.notificationArray.length) {
this.activeSegment = 'info';
if (this.selectedFilter === 'ALL') {
@ -622,11 +627,15 @@ export class WorklistMainComponent implements OnInit {
this.common.sharedService.setSharedData(this.arr_hr_req_only[requestIndex], HomeComponent.NOTIFICATION_DATA);
this.intializeNotificationDetail();
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
}
}
} else {
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
this.common.openNotificationPage();
}
@ -1019,7 +1028,7 @@ export class WorklistMainComponent implements OnInit {
let jobTitle = title.split('.');
if (jobTitle && jobTitle.length > 1) {
jobName = jobTitle[0] + " " + jobTitle[1];
}
}
} else {
jobName = '';
}
@ -1148,7 +1157,7 @@ export class WorklistMainComponent implements OnInit {
setTimeout(() => {
// this.messageSuccess = false;
this.nextNotfification();
}, 2000);
}, 1000);
// this.nextNotfification();
} else {
this.common.redToastPK('worklist', 'save-error');
@ -1170,6 +1179,7 @@ export class WorklistMainComponent implements OnInit {
return;
} else if (data.data == "Success") {
// this.openNotificationsDashboard();
this.common.setTotalNumberOfWorklistRequest();
this.nextNotfification();
}
});

Loading…
Cancel
Save