diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index 91d0f40a..99ea0022 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -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 { timeout } from 'rxjs/operators'; @Component({ selector: 'app-home', @@ -175,9 +176,9 @@ export class HomeComponent implements OnInit { this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false); } ngOnInit() { + this.common.startLoading(); this.direction = TranslatorService.getCurrentLanguageName(); this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false); - this.common.startLoading(); this.openNotificationsDashboard(); } @@ -423,12 +424,15 @@ export class HomeComponent implements OnInit { } else { this.newWorkListResponse = this.newWorkListResponse.concat(result); } - 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); - this.common.stopLoading(); + let categorizedWorkListResponse = []; + categorizedWorkListResponse = this.categorizeData(this.newWorkListResponse); + if (categorizedWorkListResponse.length > 0) { + this.assignDataToFilters(); + this.showFormattedData = this.sortArray(categorizedWorkListResponse); + this.allFormattedData = this.showFormattedData; + this.common.sharedService.setSharedData(this.newWorkListResponse, HomeComponent.NOTIFICATION_ARR); + this.common.stopLoading(); + } } else { this.newWorkListResponse = []; } @@ -477,7 +481,8 @@ export class HomeComponent implements OnInit { doInfinite(infiniteScroll) { if (!this.isReachEnd && this.selectedFilter !== 'ITG') { - this.WorklistService.getWorkList(this.WorkListObj).subscribe((result) => { + this.common.startLoading(); + this.WorklistService.getWorkList(this.WorkListObj, '', '', this.isPostNoLoad).subscribe((result) => { if (this.common.validResponse(result)) { this.handleWorkListResult(result.GetWorkList); } @@ -498,7 +503,7 @@ export class HomeComponent implements OnInit { data: null, style: false }; - this.workListService.getITGCount() + this.workListService.getITGCount('', '', this.isPostNoLoad) .subscribe((result: any) => { for (let i = 1; i < result.RequestType.length; i++) { this.ITGSegment[i] = { @@ -517,7 +522,7 @@ export class HomeComponent implements OnInit { } Details() { - this.workListService.getITGDetails() + this.workListService.getITGDetails('', '', this.isPostNoLoad) .subscribe((result: any) => { this.totalRequestCount = this.totalRequestCount + result.TotalCount; this.filters[5].value = result.TotalCount;