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 @@
{{ts.trPK('work-list','open-analysis')}}
-
+

{{totalRequestCount}}

{{ts.trPK('work-list','total')}}
{{ts.trPK('work-list','open-reqest')}}
-
+
diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index be30439d..24e820ef 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -86,22 +86,23 @@ export class HomeComponent implements OnInit { tooltips: { enabled: false }, legend: { display: false } }; - public data = { - datasets: [ - { - data: [0, 0, 0, 0, 0, 0, 0], - backgroundColor: [ - '#18a169', - '#3cb9d5', - '#114475', - '#38c9b3', - '#cc3232', - '#9e7e97', - '#ff9800' - ], - borderWidth: 6 - }] - }; + // public data = { + // datasets: [ + // { + // data: [0, 0, 0, 0, 0, 0, 0], + // backgroundColor: [ + // '#18a169', + // '#3cb9d5', + // '#114475', + // '#38c9b3', + // '#cc3232', + // '#9e7e97', + // '#ff9800' + // ], + // borderWidth: 6 + // }] + // }; + public data: any; public filters = [ { value: 0, @@ -197,6 +198,13 @@ export class HomeComponent implements OnInit { ionViewWillEnter() { + this.totalRequestCount = this.common.getTotalNumberOfWorklistRequest(); + const values = this.common.assignDataToFilters(this.common.sharedService.getSharedData('worklistNotifications', false)); + 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; diff --git a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts index f02e2fdf..caee4d46 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts @@ -560,6 +560,7 @@ export class WorklistMainComponent implements OnInit { // } // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { // this.messageSuccess = false; // this.openNotificationsDashboard(); @@ -1143,6 +1144,7 @@ export class WorklistMainComponent implements OnInit { } else if (data.data.data == "Success") { // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { // this.messageSuccess = false; this.nextNotfification();