From 39ade4effe522ca6674aee7256ef966e1abb1f44 Mon Sep 17 00:00:00 2001 From: umasoodch Date: Sat, 11 Apr 2020 19:26:34 +0300 Subject: [PATCH] fixed refresh issue --- Mohem/src/app/home/home.page.ts | 1 + .../app/notification/home/home.component.ts | 31 +++++++++++++++++-- .../worklist-main-mr.component.ts | 11 +++---- .../worklist-main-po.component.ts | 13 +++----- .../worklist-main-pr.component.ts | 9 +++--- .../worklist-main/worklist-main.component.ts | 19 ++++++------ 6 files changed, 52 insertions(+), 32 deletions(-) diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index ced5f7a1..f7c64378 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -183,6 +183,7 @@ export class HomePage implements OnInit { ionViewWillEnter() { this.common.startLoading(); + this.common.sharedService.setSharedData(true, 'loadWorkList'); this.remainingTime = 0; this.displayTime = '00:00:00'; this.runTimer = false; diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index c21a2830..281e4308 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -175,9 +175,27 @@ export class HomeComponent implements OnInit { ngOnInit() { this.common.startLoading(); - this.direction = TranslatorService.getCurrentLanguageName(); - this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false); - this.openNotificationsDashboard(); + } + + ionViewWillEnter() { + console.log(this.filters); + const loadWorkList = this.common.sharedService.getSharedData('loadWorkList', false); + if (loadWorkList) { + this.common.startLoading(); + if (this.infiniteScroll) { + this.infiniteScroll.complete(); + } + this.currentActiveIndex = 0; + this.previousActiveIndex = 0; + this.itemType = ''; + this.selectedFilter = 'ALL'; + this.isPostNoLoad = true; + this.disableFilters(); + this.resetData(); + this.direction = TranslatorService.getCurrentLanguageName(); + this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false); + this.openNotificationsDashboard(); + } } callWorkListServices() { @@ -222,6 +240,7 @@ export class HomeComponent implements OnInit { } activeFilter(index: number) { + console.log(this.filters); if (this.currentActiveIndex !== index) { this.previousActiveIndex = this.currentActiveIndex; this.currentActiveIndex = index; @@ -399,6 +418,7 @@ export class HomeComponent implements OnInit { } private handleWorkListResult(result: any) { + console.log(this.filters); const lastItemIndex = result.length - 1; const lastitem = result[lastItemIndex]; if (lastitem) { @@ -438,6 +458,7 @@ export class HomeComponent implements OnInit { } openNotificationDetail(obj) { + this.common.sharedService.setSharedData(false, 'loadWorkList'); this.common.sharedService.setSharedData(obj, HomeComponent.NOTIFICATION_DATA); if (obj.REQUEST_TYPE === 'PR') { this.common.openWorklistMainPRPage(); @@ -468,6 +489,10 @@ export class HomeComponent implements OnInit { this.WorkListObj.P_SEARCH_SUBJECT = ''; } + // initializeWorkList() { + + // } + clearSearch() { this.common.startLoading(); this.itemType = ''; diff --git a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts index 437939a0..76ecc147 100644 --- a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts +++ b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts @@ -308,16 +308,15 @@ export class WorklistMainMRComponent implements OnInit { handleApplayActionResult(result) { if (this.common.validResponse(result)) { + // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { - + this.common.sharedService.setSharedData(true, 'loadWorkList'); this.messageSuccess = true; - setTimeout(() => { this.messageSuccess = false; - this.openNotificationsDashboard(); + // this.openNotificationsDashboard(); this.nextNotfification(); }, 5000); - } } // valid it } @@ -1049,7 +1048,7 @@ export class WorklistMainMRComponent implements OnInit { if (data.data == 'cancel' || data.data == undefined) { return; } else if (data.data == 'Success') { - this.openNotificationsDashboard(); + // this.openNotificationsDashboard(); this.nextNotfification(); } @@ -1081,7 +1080,7 @@ export class WorklistMainMRComponent implements OnInit { if (data.data == 'cancel' || data.data == undefined) { return; } else if (data.data == 'Success') { - this.openNotificationsDashboard(); + // this.openNotificationsDashboard(); this.nextNotfification(); } diff --git a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts index 874a4bd0..839a795d 100644 --- a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts +++ b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts @@ -339,18 +339,15 @@ export class WorklistMainPoComponent implements OnInit { handleApplayActionResult(result) { if (this.common.validResponse(result)) { + // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { - - + this.common.sharedService.setSharedData(true, 'loadWorkList'); this.messageSuccess = true; - setTimeout(() => { this.messageSuccess = false; - this.openNotificationsDashboard(); - this.nextNotfification(); + // this.openNotificationsDashboard(); + this.nextNotfification(); }, 5000); - - } } // valid it } @@ -1121,7 +1118,7 @@ export class WorklistMainPoComponent implements OnInit { if (data.data == "cancel" || data.data == undefined) { return; } else if (data.data == "Success") { - this.openNotificationsDashboard(); + // this.openNotificationsDashboard(); this.nextNotfification(); } diff --git a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts index c3f1febd..e776d04d 100644 --- a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts +++ b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts @@ -336,16 +336,15 @@ export class WorklistMainPRComponent implements OnInit { handleApplayActionResult(result) { if (this.common.validResponse(result)) { + // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { - + this.common.sharedService.setSharedData(true, 'loadWorkList'); // show succsfull popup this.messageSuccess = true; - setTimeout(() => { this.messageSuccess = false; }, 5000); - - this.openNotificationsDashboard(); + // this.openNotificationsDashboard(); this.nextNotfification(); } } // valid it @@ -1046,7 +1045,7 @@ export class WorklistMainPRComponent implements OnInit { if (data.data == 'cancel' || data.data == undefined) { return; } else if (data.data == 'Success') { - this.openNotificationsDashboard(); + // this.openNotificationsDashboard(); this.nextNotfification(); } 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 e083c6be..8f284ef6 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts @@ -361,22 +361,21 @@ export class WorklistMainComponent implements OnInit { handleApplayActionResult(result) { if (this.common.validResponse(result)) { + // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { + this.common.sharedService.setSharedData(true, 'loadWorkList'); // this.navCtrl.push("HomePage"); - //this.common.openHome(); - //this.common.openNotificationPage(); - // for( var i = 0; i < this.notificationArray.length; i++){ + // this.common.openHome(); + // this.common.openNotificationPage(); + // for( var i = 0; i < this.notificationArray.length; i++){ // if ( this.notificationArray[i].ROW_NUM === this.getPassNotificationDetails.ROW_NUM) { - // this.notificationArray.splice(i, 1); + // this.notificationArray.splice(i, 1); // } // } - this.messageSuccess = true; - setTimeout(() => { this.messageSuccess = false; - this.openNotificationsDashboard(); - + // this.openNotificationsDashboard(); this.nextNotfification(); }, 5000); @@ -991,7 +990,7 @@ export class WorklistMainComponent implements OnInit { if (data.data == "cancel" || data.data == undefined) { return; } else if (data.data == "Success") { - this.openNotificationsDashboard(); + // this.openNotificationsDashboard(); this.nextNotfification(); } @@ -1023,7 +1022,7 @@ export class WorklistMainComponent implements OnInit { if (data.data == "cancel" || data.data == undefined) { return; } else if (data.data == "Success") { - this.openNotificationsDashboard(); + // this.openNotificationsDashboard(); this.nextNotfification(); }