diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index d15a6cec..2e4030e2 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1569,4 +1569,120 @@ export class CommonService { return this.activeType; } + public totalCounter = 0; + getTotalNumberOfWorklistRequest() { + this.totalCounter = parseInt(this.sharedService.getSharedData('total-count')); + return this.totalCounter; + } + setTotalNumberOfWorklistRequest() { + this.totalCounter -= 1; + this.sharedService.setSharedData(this.totalCounter, 'total-count'); + } + + public filters = [ + { + value: 0, + name: 'HR', + active: false, + color: '#18a169', + key: 'HRSSA', + disable: false + }, + { + value: 0, + name: 'MR', + active: false, + color: '#3cb9d5', + key: 'INVMOA', + disable: false + }, + { + value: 0, + name: 'PR', + active: false, + color: '#114475', + key: 'REQAPPRV', + disable: false + }, + { + value: 0, + name: 'PO', + active: false, + color: '#38c9b3', + key: 'POAPPRV', + disable: false + }, + { + value: 0, + name: 'ITG', + active: false, + color: '#cc3232', + key: 'ITG', + disable: false + }, + { + value: 0, + name: 'IC', + active: false, + color: '#9e7e97', + key: 'INVITEM', + disable: false + }, + { + value: 0, + name: 'STAMP', + active: false, + color: '#ff9800', + key: 'STAMP', + disable: false + } + ]; + + public data = { + datasets: [ + { + data: [0, 0, 0, 0, 0, 0, 0], + backgroundColor: [ + '#18a169', + '#3cb9d5', + '#114475', + '#38c9b3', + '#cc3232', + '#9e7e97', + '#ff9800' + ], + borderWidth: 6 + }] + }; + + 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; + } + } + let val = {'filters': [], 'data': {}}; + val.filters = this.filters; + val.data = this.data; + return val; + } + } diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index cd57c27f..1828171a 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -773,6 +773,7 @@ export class HomePage implements OnInit { this.showAttendanceOptions(); // tslint:disable-next-line: triple-equals } else if (link == '1') { + this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count'); this.common.startLoading(); this.common.openNotificationPage(); // tslint:disable-next-line: triple-equals diff --git a/Mohem/src/app/notification/home/home.component.html b/Mohem/src/app/notification/home/home.component.html index 1d54a0ec..31eda5f2 100644 --- a/Mohem/src/app/notification/home/home.component.html +++ b/Mohem/src/app/notification/home/home.component.html @@ -11,15 +11,15 @@