diff --git a/Mohem/src/app/attendance-tracking/home/home.component.html b/Mohem/src/app/attendance-tracking/home/home.component.html index 48d2c99c..1a4ae913 100644 --- a/Mohem/src/app/attendance-tracking/home/home.component.html +++ b/Mohem/src/app/attendance-tracking/home/home.component.html @@ -67,19 +67,19 @@ {{ts.trPK('attendance-tracking','check-in')}} - 08:00 + {{attendanceTrackingList.P_SWIPE_IN | slice:0:-3}} - + {{ts.trPK('attendance-tracking','check-out')}} - 08:00 + {{attendanceTrackingList.P_SWIPE_OUT | slice:0:-3}} {{ts.trPK('attendance-tracking','late-in')}} - 08:00 + {{attendanceTrackingList.P_LATE_IN_HOURS | slice:0:-3}} - + {{ts.trPK('attendance-tracking','regular')}} {{attendanceTrackingList.P_SCHEDULED_HOURS | slice:0:-3}} diff --git a/Mohem/src/app/hmg-common/ui/card-filter/card-filter.component.html b/Mohem/src/app/hmg-common/ui/card-filter/card-filter.component.html index fb3f1a49..3865efe3 100644 --- a/Mohem/src/app/hmg-common/ui/card-filter/card-filter.component.html +++ b/Mohem/src/app/hmg-common/ui/card-filter/card-filter.component.html @@ -1,5 +1,5 @@
- {{value}} + {{value}} {{text}}
diff --git a/Mohem/src/app/notification/home/home.component.html b/Mohem/src/app/notification/home/home.component.html index 3a4e61fb..37797f78 100644 --- a/Mohem/src/app/notification/home/home.component.html +++ b/Mohem/src/app/notification/home/home.component.html @@ -14,11 +14,16 @@
Open Request Analysis
-
-

{{totalRequestCount}}

+
+ {{newWorkListResponse.length + ITGCount}} of + {{newWorkListResponse.length}} of +

{{totalRequestCount}}

+

{{newWorkListResponse[0].NO_OF_ROWS + ITGCount}}

+

{{newWorkListResponse[0].NO_OF_ROWS}}

TOTAL
OPEN REQUEST
- + +
@@ -61,32 +66,35 @@
-
-
- {{data.key}} -
+
+
+
+ {{formattedData.date}} +

{{workList.SUBJECT}}

-
- +
-
-
- {{segmentInfo.ModifiedDate |date}} -
-

{{segmentInfo.Title}}

+
+
+ {{segmentInfo.ModifiedDate |date}} +
+

{{segmentInfo.Title}}

+
-
+
+ +
+ No Data Available +
+ -
- No Data Available -
- + diff --git a/Mohem/src/app/notification/home/home.component.scss b/Mohem/src/app/notification/home/home.component.scss index 19ac087d..9c0e235d 100644 --- a/Mohem/src/app/notification/home/home.component.scss +++ b/Mohem/src/app/notification/home/home.component.scss @@ -333,6 +333,8 @@ ion-content { margin-top: 15px; display: block; padding: 0 20px; + position: relative; + z-index: 99; ion-col{ background: white; border-radius: 12px; @@ -382,9 +384,8 @@ ion-content { font-family: WorkSans-Regular; padding: 30px; position: absolute; - left: 50%; - margin-left: -100px; - margin-top: 100px; + left: 85px; + top: 50px; } .disable-filter { pointer-events: none; diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index 7b9e3d72..ed68d94e 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -58,10 +58,18 @@ export class HomeComponent implements OnInit { public worklistNotifications: any; public totalRequestCount = 0; public newWorkListResponse = []; - public showFormattedData = {}; + public showFormattedData = []; + public allFormattedData = []; public selectedFilter = 'ALL'; public showSearchButton = false; public itemType = ''; + + public totalHR = 0; + public totalPO = 0; + public totalPR = 0; + public totalMR = 0; + + public showChart = false; public options = { cutoutPercentage: 80, tooltips: { enabled: false }, @@ -153,11 +161,9 @@ export class HomeComponent implements OnInit { } ngOnInit() { - // this.direction = TranslatorService.getCurrentDirection(); this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false); this.Details(); this.Count(); - this.assignDataToFilters(); this.getAllPushNotificationFun(); this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER; } @@ -165,42 +171,38 @@ export class HomeComponent implements OnInit { assignDataToFilters() { this.filters[0].value = this.worklistNotifications.P_OPEN_NTF_NUMBER; const openNotificationsArray = this.worklistNotifications.GetOpenNotificationsList; + for (const notification of openNotificationsArray) { if (notification.ITEM_TYPE === 'HRSSA') { - this.filters[1].value = notification.OPEN_NTF_NUMBER; + this.filters[1].value = this.totalHR; this.data.datasets[0].data[0] = notification.OPEN_NTF_NUMBER; } else if (notification.ITEM_TYPE === 'POAPPRV') { - this.filters[2].value = notification.OPEN_NTF_NUMBER; + this.filters[2].value = this.totalPO; this.data.datasets[0].data[1] = notification.OPEN_NTF_NUMBER; } else if (notification.ITEM_TYPE === 'REQAPPRV') { - this.filters[3].value = notification.OPEN_NTF_NUMBER; + this.filters[3].value = this.totalPR; this.data.datasets[0].data[2] = notification.OPEN_NTF_NUMBER; } else if (notification.ITEM_TYPE === 'INVMOA') { - this.filters[4].value = notification.OPEN_NTF_NUMBER; + this.filters[4].value = this.totalMR; this.data.datasets[0].data[3] = notification.OPEN_NTF_NUMBER; } else if (notification.ITEM_TYPE === 'ITG') { this.filters[5].value = notification.OPEN_NTF_NUMBER; this.data.datasets[0].data[4] = notification.OPEN_NTF_NUMBER; + } } - } + this.showChart = true; } - - activeFilter(index: number) { if (this.currentActiveIndex !== index) { - this.showFormattedData = {}; this.previousActiveIndex = this.currentActiveIndex; this.currentActiveIndex = index; this.filters[this.previousActiveIndex].active = false; this.filters[this.currentActiveIndex].active = true; - if (this.filters[this.currentActiveIndex].value !== 0) { - const selectedKey = this.filters[this.currentActiveIndex].key; - this.resetData(); - this.itemType = (selectedKey !== 'ITG' && selectedKey !== 'ALL') ? this.filters[this.currentActiveIndex].key : ''; - this.getAllPushNotificationFun(); - } this.selectedFilter = this.filters[this.currentActiveIndex].key; + if (this.selectedFilter !== 'ITG') { + this.getFilteredData(this.selectedFilter); + } } } @@ -230,13 +232,13 @@ export class HomeComponent implements OnInit { async openSearchModal() { const modal = await this.modalController.create({ component: WorklistAdvancedSearchComponent, - cssClass: 'advanced-search-modal', + cssClass: 'advanced-search-modal-custom', backdropDismiss: false, componentProps: {} }); modal.onDidDismiss().then(result => { if (result.data) { - if (result.data.notificationType !== '' || result.data.selectedValue !== '' || result.data.itemType !== '') { + if (result.data.notificationType !== '' || result.data.selectedValue !== '' || result.data.itemType !== '') { this.showSearchButton = true; this.itemType = result.data.itemType; this.notificationType = result.data.notificationType; @@ -245,7 +247,7 @@ export class HomeComponent implements OnInit { this.inputSearch = result.data.inputSearch; this.WorkListObj.P_PAGE_NUM = 1; this.newWorkListResponse = []; - this.showFormattedData = {}; + this.showFormattedData = []; this.selectedFilter = 'ALL'; this.filters[this.currentActiveIndex].active = false; this.currentActiveIndex = 0; @@ -268,7 +270,7 @@ export class HomeComponent implements OnInit { this.WorkListObj.P_SEARCH_SUBJECT = this.selectedValue === '2' ? this.inputSearch : ''; this.WorkListObj.P_SEARCH_SENT_DATE = (this.inputDate && this.selectedValue === '3') ? moment(this.inputDate).format('DD-MMM-YYYY') : ''; - this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = this.selectedValue === '4' ? this.inputSearch : ''; ; + this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = this.selectedValue === '4' ? this.inputSearch : ''; this.WorkListObj.P_ITEM_TYPE = this.itemType !== '' ? this.itemType : ''; this.WorkListObj.P_NOTIFICATION_TYPE = this.notificationType !== '' ? this.notificationType : '1'; if (this.selectedValue === '5') { @@ -277,7 +279,6 @@ export class HomeComponent implements OnInit { this.WorkListObj.P_SEARCH_SENT_DATE = ''; this.WorkListObj.P_SEARCH_SUBJECT = ''; } - this.WorklistService.getWorkList(this.WorkListObj).subscribe((result) => { if (this.common.validResponse(result)) { this.handleWorkListResult(result.GetWorkList); @@ -286,24 +287,82 @@ export class HomeComponent implements OnInit { ); } - categorizeData(arrayToCategorize: any) { - const datePipe = new DatePipe('en-US'); - const formattedData = {}; - for (const workList of arrayToCategorize) { - workList.FORMATTED_DATE = datePipe.transform(new Date(workList.BEGIN_DATE), 'MMMM dd, y'); - if (!(workList.FORMATTED_DATE in formattedData)) { - formattedData[workList.FORMATTED_DATE] = new Array(); - formattedData[workList.FORMATTED_DATE].push(workList); - } else { - formattedData[workList.FORMATTED_DATE].push(workList); + getFilteredData(filter: string) { + if (filter === 'ALL') { + this.showFormattedData = this.allFormattedData; + } else { + let arrayToFilter; + arrayToFilter = this.newWorkListResponse.filter((workList) => { + return workList.ITEM_TYPE === filter; + }); + this.showFormattedData = this.categorizeData(arrayToFilter); + } + } + + checkDateExistance(currentDate: any, formattedData: any) { + let existsBefore = false; + let index = 0; + for (let i = 0; i < formattedData.length; i++) { + if (formattedData[i].date === currentDate) { + existsBefore = true; + index = i; + break; } + } + return { + exists: existsBefore, + indexNumber: index + }; + } + + 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; + } + } + + categorizeData(arrayToCategorize: any) { + this.totalHR = 0; + this.totalPO = 0; + this.totalPR = 0; + this.totalMR = 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: '', + data: [] + }; + if (formattedData.length === 0) { + currentObject.date = currentDate; + currentObject.data.push(workList); + formattedData.push(currentObject); + } else { + const existsBefore = this.checkDateExistance(currentDate, formattedData); + if (existsBefore.exists) { + formattedData[existsBefore.indexNumber].data.push(workList); + } else { + currentObject.date = currentDate; + currentObject.data.push(workList); + formattedData.push(currentObject); + } + } } - return formattedData; + return formattedData; } sortArray(arrayToSort: any) { return arrayToSort.sort((a: any, b: any) => - new Date(b.BEGIN_DATE).getTime() - new Date(a.BEGIN_DATE).getTime() + new Date(b.date).getTime() - new Date(a.date).getTime() ); } @@ -330,9 +389,10 @@ export class HomeComponent implements OnInit { } else { this.newWorkListResponse = this.newWorkListResponse.concat(result); } - this.newWorkListResponse = this.sortArray(this.newWorkListResponse); - console.log(this.newWorkListResponse); - this.showFormattedData = this.categorizeData(this.newWorkListResponse); + const categorizedWorkListResponse = this.categorizeData(this.newWorkListResponse); + this.assignDataToFilters(); + this.showFormattedData = this.sortArray(categorizedWorkListResponse); + this.allFormattedData = this.showFormattedData; this.common.sharedService.setSharedData(this.newWorkListResponse, HomeComponent.NOTIFICATION_ARR); } else { this.newWorkListResponse = []; @@ -352,10 +412,6 @@ export class HomeComponent implements OnInit { } } - isEmptyObject() { - return (this.showFormattedData && (Object.keys(this.showFormattedData).length > 0) || this.ITGItem.length > 0); - } - resetData() { if (this.infiniteScroll) { this.infiniteScroll.complete(); @@ -366,7 +422,8 @@ export class HomeComponent implements OnInit { this.inputDate = ''; this.inputSearch = ''; this.newWorkListResponse = []; - this.showFormattedData = {}; + this.showFormattedData = []; + this.allFormattedData = []; this.WorkListObj.P_SEARCH_FROM_USER = ''; this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = ''; this.WorkListObj.P_SEARCH_SENT_DATE = ''; @@ -413,13 +470,13 @@ export class HomeComponent implements OnInit { Details() { this.workListService.getITGDetails() .subscribe((result: any) => { + this.ITGCount = result.TotalCount; this.totalRequestCount = this.totalRequestCount + result.TotalCount; this.filters[5].value = result.TotalCount; }); } ITGNotification() { - // this.Details(); this.isAll = false; this.isPR = false; this.isPO = false; diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss index c3380444..5a57f192 100644 --- a/Mohem/src/theme/styles.scss +++ b/Mohem/src/theme/styles.scss @@ -1191,7 +1191,7 @@ border:0px // } .advanced-search-modal { - --height: 9cm !important; + --height: 12cm !important; --width: 88% !important; --border-radius: 0.6cm; } @@ -1277,8 +1277,8 @@ border:0px } -.advanced-search-modal { - --height: 12cm !important; +.advanced-search-modal-custom { + --height: 9cm !important; --width: 80% !important; --border-radius: 0.4cm; }