added changes for worklist

worklist-umar-Q3
umasoodch 4 years ago
parent e7755c1ef4
commit a22d3c64de

@ -12,15 +12,15 @@
<span>{{ts.trPK('work-list','open-analysis')}}</span>
</div>
<div class="result-text-container" [ngStyle]="showChart === false || receivedITGCount === false ? {'visibility': 'hidden'} : {}">
<span *ngIf="selectedFilter === 'ALL'">{{newWorkListResponse.length + ITGCount}} {{ts.trPK('work-list','of')}} </span>
<span *ngIf="showSearchButton && newWorkListResponse.length > 0 && selectedFilter !== 'ALL' && itemType !== ''">{{newWorkListResponse.length}} {{ts.trPK('work-list','of')}} </span>
<!-- <span *ngIf="selectedFilter === 'ALL'">{{newWorkListResponse.length + ITGCount}} {{ts.trPK('work-list','of')}} </span>
<span *ngIf="showSearchButton && newWorkListResponse.length > 0 && selectedFilter !== 'ALL' && itemType !== ''">{{newWorkListResponse.length}} {{ts.trPK('work-list','of')}} </span> -->
<h2 *ngIf="!showSearchButton">{{totalRequestCount}}</h2>
<h2 *ngIf="showSearchButton && newWorkListResponse.length > 0 && itemType === ''">{{newWorkListResponse[0].NO_OF_ROWS + ITGCount}}</h2>
<h2 *ngIf="showSearchButton && newWorkListResponse.length > 0 && selectedFilter !== 'ALL' && itemType !== ''">{{newWorkListResponse[0].NO_OF_ROWS}}</h2>
<span>{{ts.trPK('work-list','total')}} <br> {{ts.trPK('work-list','open-reqest')}}</span>
</div>
<p-chart *ngIf="!showChart || !receivedITGCount" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
<p-chart *ngIf="checkLoadingStatus()" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
<p-chart *ngIf="showChart && receivedITGCount" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
</div>
<ion-row class="filters-row" *ngIf="showChart && receivedITGCount">
@ -42,7 +42,7 @@
<span style="margin-left: 5px;">{{ts.trPK('work-list','clear-search')}}</span>
<ion-icon name="close" ></ion-icon>
</ion-col>
<ion-col style="float: right;" size=[6] (click)="openSearchModal()" *ngIf="selectedFilter === 'ALL'">
<ion-col style="float: right;" size=[6] (click)="openSearchModal()" *ngIf="selectedFilter !== 'ITG'">
<ion-icon name="search" ></ion-icon>
<span>{{ts.trPK('work-list','advanced-search')}}</span>
</ion-col>

@ -68,7 +68,7 @@ export class HomeComponent implements OnInit {
public allFormattedData = [];
public selectedFilter = 'ALL';
public showSearchButton = false;
public itemType = '';
public itemType = 'HRSSA';
public receivedITGCount = false;
public totalHR = 0;
@ -103,14 +103,6 @@ export class HomeComponent implements OnInit {
}]
};
public filters = [
{
value: 0,
name: 'All',
active: true,
color: '#124375',
key: 'ALL',
disable: false
},
{
value: 0,
name: 'HR',
@ -194,7 +186,7 @@ export class HomeComponent implements OnInit {
this.WorkListObj.P_SEARCH_SENT_DATE = '';
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
this.WorkListObj.P_PAGE_NUM = 0;
this.WorkListObj.P_PAGE_LIMIT = 50;
this.WorkListObj.P_PAGE_LIMIT = 5;
}
ngOnInit() {
@ -203,7 +195,6 @@ export class HomeComponent implements OnInit {
}
ionViewWillEnter() {
console.log(this.filters);
const loadWorkList = this.common.sharedService.getSharedData('loadWorkList', false);
if (loadWorkList) {
this.receivedITGCount = false;
@ -215,10 +206,11 @@ export class HomeComponent implements OnInit {
}
this.currentActiveIndex = 0;
this.previousActiveIndex = 0;
this.itemType = '';
this.selectedFilter = 'ALL';
this.itemType = 'HRSSA';
this.selectedFilter = 'HR';
this.filters[0].active = true;
this.isPostNoLoad = true;
this.disableFilters();
// this.disableFilters();
this.resetData();
this.direction = TranslatorService.getCurrentLanguageName();
this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false);
@ -236,6 +228,7 @@ export class HomeComponent implements OnInit {
if (this.common.validResponse(result)) {
this.worklistNotifications = result;
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
this.assignDataToFilters();
this.common.sharedService.setSharedData(result, 'worklistNotifications');
this.Details();
this.callWorkListServices();
@ -244,66 +237,30 @@ export class HomeComponent implements OnInit {
}
assignDataToFilters() {
this.ngZone.run(() => {
this.filters[0].value = this.worklistNotifications.P_OPEN_NTF_NUMBER;
this.filters[1].value = this.totalHR;
this.filters[2].value = this.totalMR;
this.filters[3].value = this.totalPR;
this.filters[4].value = this.totalPO;
this.filters[6].value = this.totalIC;
});
if (this.totalHR === 0) {
this.data.datasets[0].data[0] = 0;
}
if (this.totalPO === 0) {
this.data.datasets[0].data[1] = 0;
}
if (this.totalPR === 0) {
this.data.datasets[0].data[2] = 0;
}
if (this.totalMR === 0) {
this.data.datasets[0].data[3] = 0;
}
if (this.totalIC === 0) {
this.data.datasets[0].data[5] = 0;
}
if (this.totalStamp === 0) {
this.data.datasets[0].data[6] = 0;
}
const openNotificationsArray = this.worklistNotifications.GetOpenNotificationsList;
for (const notification of openNotificationsArray) {
if (notification.ITEM_TYPE === 'HRSSA') {
this.filters[1].value = this.totalHR;
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[2].value = this.totalMR;
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[3].value = this.totalPR;
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[4].value = this.totalPO;
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[6].value = this.totalIC;
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[7].value = this.totalStamp;
this.filters[6].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[6] = notification.OPEN_NTF_NUMBER;
}
}
// this.data.datasets[0].data[4] = this.ITGCount;
this.showChart = true;
// this.common.stopLoading();
this.isLoading = false;
}
@ -316,7 +273,37 @@ export class HomeComponent implements OnInit {
}
}
public initiateNewWorklistData(selectedFilter: any, filterValue: any) {
this.WorkListObj = new WorkListRequest();
this.WorkListObj.P_NOTIFICATION_TYPE = '1';
this.WorkListObj.P_SEARCH_FROM_USER = '';
this.WorkListObj.P_SEARCH_SUBJECT = '';
this.WorkListObj.P_SEARCH_SENT_DATE = '';
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
this.WorkListObj.P_PAGE_NUM = 0;
this.WorkListObj.P_PAGE_LIMIT = 5;
if (this.infiniteScroll) {
this.infiniteScroll.complete();
}
this.itemType = this.selectedFilter;
this.newWorkListResponse = [];
this.showFormattedData = [];
this.allFormattedData = [];
if (filterValue > 0) {
this.getAllPushNotificationFun();
} else {
this.common.stopLoading();
}
}
activeFilter(index: number) {
if (index !== 4) {
this.common.startLoading();
}
console.log(this.filters);
if (this.currentActiveIndex !== index) {
this.previousActiveIndex = this.currentActiveIndex;
@ -324,8 +311,10 @@ export class HomeComponent implements OnInit {
this.filters[this.previousActiveIndex].active = false;
this.filters[this.currentActiveIndex].active = true;
this.selectedFilter = this.filters[this.currentActiveIndex].key;
const filterValue = this.filters[this.currentActiveIndex].value;
if (this.selectedFilter !== 'ITG') {
this.getFilteredData(this.selectedFilter);
// this.getFilteredData(this.selectedFilter);
this.initiateNewWorklistData(this.selectedFilter, filterValue);
}
}
}
@ -381,7 +370,7 @@ export class HomeComponent implements OnInit {
this.previousActiveIndex = 0;
this.filters[this.currentActiveIndex].active = true;
if (this.itemType !== '') {
this.disableFilters();
// this.disableFilters();
}
this.isPostNoLoad = false;
this.getAllPushNotificationFun();
@ -415,21 +404,6 @@ export class HomeComponent implements OnInit {
);
}
getFilteredData(filter: string) {
if (filter === 'ALL') {
this.showFormattedData = this.allFormattedData;
} else {
let arrayToFilter;
arrayToFilter = this.newWorkListResponse.filter((workList) => {
return workList.ITEM_TYPE === filter;
});
const categorizeData = this.categorizeData(arrayToFilter);
this.showFormattedData = this.sortArray(categorizeData);
// const sortData = this.sortArray(arrayToFilter);
// this.showFormattedData = this.categorizeData(sortData);
}
}
checkDateExistance(currentDate: any, formattedData: any) {
let existsBefore = false;
let index = 0;
@ -446,35 +420,10 @@ export class HomeComponent implements OnInit {
};
}
addCountInFilters(workList: any) {
if (workList.ITEM_TYPE === 'HRSSA') {
this.totalHR = this.totalHR + 1;
} else if (workList.ITEM_TYPE === 'POAPPRV') {
this.totalPO = this.totalPO + 1;
} else if (workList.ITEM_TYPE === 'REQAPPRV') {
this.totalPR = this.totalPR + 1;
} else if (workList.ITEM_TYPE === 'INVMOA') {
this.totalMR = this.totalMR + 1;
} else if (workList.ITEM_TYPE === 'INVITEM') {
this.totalIC = this.totalIC + 1;
} else if (workList.ITEM_TYPE === 'STAMP') {
this.totalStamp = this.totalStamp + 1;
}
}
categorizeData(arrayToCategorize: any) {
this.ngZone.run(() => {
this.totalHR = 0;
this.totalPO = 0;
this.totalPR = 0;
this.totalMR = 0;
this.totalIC = 0;
})
const datePipe = new DatePipe('en-US');
const formattedData = [];
for (const workList of arrayToCategorize) {
this.addCountInFilters(workList);
const currentDate = datePipe.transform(new Date(workList.BEGIN_DATE), 'MMMM dd, y');
const currentObject = {
date: '',
@ -505,6 +454,7 @@ export class HomeComponent implements OnInit {
}
private handleWorkListResult(result: any) {
this.common.stopLoading();
console.log(this.filters);
const lastItemIndex = result.length - 1;
const lastitem = result[lastItemIndex];
@ -534,13 +484,12 @@ export class HomeComponent implements OnInit {
this.showFormattedData = this.sortArray(categorizedWorkListResponse);
this.allFormattedData = this.showFormattedData;
this.common.sharedService.setSharedData(this.newWorkListResponse, HomeComponent.NOTIFICATION_ARR);
this.assignDataToFilters();
// this.assignDataToFilters();
}
} else {
this.newWorkListResponse = [];
// this.assignDataToFilters();
if (this.showFormattedData.length === 0) {
this.resetFiltersUI();
// this.resetFiltersUI();
}
this.data.datasets[0].data[4] = this.ITGCount;
this.showChart = true;
@ -555,7 +504,7 @@ export class HomeComponent implements OnInit {
this.filters[1].value = 0;
this.filters[2].value = 0;
this.filters[3].value = 0;
this.filters[4].value = 0;
this.filters[5].value = 0;
this.filters[6].value = 0;
this.data.datasets[0].data[0] = 0;
@ -601,24 +550,19 @@ export class HomeComponent implements OnInit {
this.WorkListObj.P_SEARCH_SUBJECT = '';
}
// initializeWorkList() {
// }
clearSearch() {
this.common.startLoading();
this.isLoading = true;
this.itemType = '';
this.selectedFilter = 'ALL';
this.isPostNoLoad = true;
this.disableFilters();
// this.disableFilters();
this.resetData();
this.getAllPushNotificationFun();
}
doInfinite(infiniteScroll) {
if (!this.isReachEnd && this.selectedFilter !== 'ITG') {
this.common.startLoading();
this.WorklistService.getWorkList(this.WorkListObj, '', '', this.isPostNoLoad).subscribe((result) => {
if (this.common.validResponse(result)) {
this.handleWorkListResult(result.GetWorkList);
@ -664,8 +608,6 @@ export class HomeComponent implements OnInit {
names[i] = result.RequestType[i].RequestTypeCode;
count++;
}
//this.sortArrayOfAll(this.ITGSegment[0].data)
console.log(this.ITGSegment);
}
});
@ -677,7 +619,7 @@ export class HomeComponent implements OnInit {
this.ITGCount = result.TotalCount;
this.totalRequestCount = this.totalRequestCount + result.TotalCount;
this.data.datasets[0].data[4] = this.ITGCount;
this.filters[5].value = result.TotalCount;
this.filters[4].value = result.TotalCount;
this.receivedITGCount = true;
});
}

Loading…
Cancel
Save