diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index ed68d94e..717d8e8f 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -9,6 +9,8 @@ import { IonInfiniteScroll } from '@ionic/angular'; import { WorklistMainService } from '../service/work-list.main.service'; import { WorklistAdvancedSearchComponent } from '../worklist-advanced-search/worklist-advanced-search.component'; 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'; @Component({ selector: 'app-home', @@ -146,9 +148,11 @@ export class HomeComponent implements OnInit { constructor( public common: CommonService, public ts: TranslatorService, + // tslint:disable-next-line: no-shadowed-variable public WorklistService: WorklistService, public workListService: WorklistMainService, - public modalController: ModalController + public modalController: ModalController, + public DS: DashboredService ) { this.WorkListObj = new WorkListRequest(); this.WorkListObj.P_NOTIFICATION_TYPE = '1'; @@ -161,11 +165,24 @@ export class HomeComponent implements OnInit { } ngOnInit() { - this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false); + this.openNotificationsDashboard(); + } + + callWorkListServices() { this.Details(); this.Count(); this.getAllPushNotificationFun(); - this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER; + } + + openNotificationsDashboard() { + this.DS.getOpenNotifications().subscribe((result: GetOpenNotificationsResponse) => { + if (this.common.validResponse(result)) { + this.worklistNotifications = result; + this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER; + this.common.sharedService.setSharedData(result, 'worklistNotifications'); + this.callWorkListServices(); + } + }); } assignDataToFilters() {