From 39c45d840cb979b5293b9be562452e11c76552bb Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 1 Jun 2022 16:15:32 +0300 Subject: [PATCH] worklist count changes --- .../confirm-add-eit.component.ts | 4 ++-- .../services/common/common.service.ts | 6 ++---- .../services/connector/connector.service.ts | 4 ++-- Mohem/src/app/home/home.page.ts | 8 +++++--- .../worklist-main-ic.component.ts | 18 ++++++++++-------- .../worklist-main-mr.component.ts | 8 ++++---- .../worklist-main-po.component.ts | 8 ++++---- .../worklist-main-pr.component.ts | 8 ++++---- .../worklist-main/worklist-main.component.ts | 15 +++++++-------- .../confirm-address.component.ts | 4 ++-- 10 files changed, 42 insertions(+), 41 deletions(-) diff --git a/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts index daa44eb4..35abae8a 100644 --- a/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts +++ b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts @@ -236,8 +236,8 @@ export class ConfirmAddEitComponent implements OnInit { // this.navCtrl.popToRoot(); // this.cs.openHome(); - //this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); - this.cs.setTotalNumberOfWorklistRequest(true); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.cs.setTotalNumberOfWorklistRequest(true); this.cs.openNotificationPage(); } } 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 f61bd8a2..4bfffd47 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1587,11 +1587,9 @@ export class CommonService { this.totalCounter = parseInt(this.sharedService.getSharedData('total-count', false)); return this.totalCounter ? this.totalCounter : 0; } - setTotalNumberOfWorklistRequest(isAdd: boolean = false) { - if (this.totalCounter > 0 && !isAdd) { + setTotalNumberOfWorklistRequest() { + if (this.totalCounter > 0) { this.totalCounter -= 1; - } else if (this.totalCounter >= 0 && isAdd) { - this.totalCounter++; } this.sharedService.setSharedData(this.totalCounter, 'total-count'); } diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index 5a1959c6..f472cb49 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -27,8 +27,8 @@ export class ConnectorService { public static retryTimes = 0; public static timeOut = 180 * 1000; - // public static host = 'https://uat.hmgwebservices.com/'; - public static host = 'https://hmgwebservices.com/'; + public static host = 'https://uat.hmgwebservices.com/'; + // public static host = 'https://hmgwebservices.com/'; constructor(public httpClient: HttpClient, public cs: CommonService, diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 9a3a8ff7..0c528134 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -44,6 +44,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; import { BusinessCardComponent } from "src/app/authentication/business-card/business-card.component"; import * as moment from "moment"; import { count } from 'console'; +import { HomeComponent } from "src/app/notification/home/home.component"; @Component({ selector: 'app-home', templateUrl: './home.page.html', @@ -371,6 +372,7 @@ export class HomePage implements OnInit { callDashboardServices() { this.getMenu(); this.setServicesPrivilage(); + var isWorklistChanged = this.common.sharedService.getSharedData(HomeComponent.COUNT_CHANGED); if (this.common.getTotalNumberOfWorklistRequest()) { this.statsButtons[1].statsValue = this.common.getTotalNumberOfWorklistRequest(); } else { @@ -677,7 +679,7 @@ export class HomePage implements OnInit { this.common.sharedService.setSharedData(result, MenuResponse.ITG_COUNTS); this.common.filterKeys['ITG'] = result.TotalCount; this.statsButtons[1].statsValue = Math.floor(this.countAllNotification + result.TotalCount); - this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count');​ + this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count'); this.getCOCNotificationCount(); this.common.stopLoading(); }); @@ -686,7 +688,7 @@ export class HomePage implements OnInit { getCOCNotificationCount() { const request = new COCRequest(); request.ItgPageSize = 1; - request.ItgPageNo = 1; + request.ItgPageNo = 1; request.Date = moment(new Date()).format("YYYY-MM-DD"); this.workListService.getCOCCount(request, '', '', this.isPostNoLoad).subscribe((result: any) => { @@ -698,7 +700,7 @@ export class HomePage implements OnInit { this.statsButtons[1].statsValue = Math.floor(this.statsButtons[1].statsValue + totalCount); - this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count');​ + this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count'); this.common.stopLoading(); }); diff --git a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts index 07d23505..ee81051b 100644 --- a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts +++ b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts @@ -429,10 +429,11 @@ export class WorklistMainIcComponent implements OnInit { this.common.sharedService.setSharedData(true, 'loadWorkList'); // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { - this.common.setTotalNumberOfWorklistRequest(); + this.nextNotfification(); - }, 5000); + }, 300); } else { this.common.redToastPK('worklist', 'save-error'); } @@ -482,13 +483,13 @@ export class WorklistMainIcComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { - this.common.setTotalNumberOfWorklistRequest(true); - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { - this.common.setTotalNumberOfWorklistRequest(true); - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1221,10 +1222,11 @@ export class WorklistMainIcComponent implements OnInit { // this.openNotificationsDashboard(); // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { - this.common.setTotalNumberOfWorklistRequest(); + this.nextNotfification(); - }, 100); + }, 300); // this.nextNotfification(); } else { 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 e51d496f..2eca280e 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 @@ -430,13 +430,13 @@ export class WorklistMainMRComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { - this.common.setTotalNumberOfWorklistRequest(true); - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { - this.common.setTotalNumberOfWorklistRequest(true); - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } 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 51b55d8f..4d51258f 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 @@ -460,13 +460,13 @@ export class WorklistMainPoComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { - this.common.setTotalNumberOfWorklistRequest(true); - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { - this.common.setTotalNumberOfWorklistRequest(true); - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } 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 241ed4de..76749312 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 @@ -451,13 +451,13 @@ export class WorklistMainPRComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { - this.common.setTotalNumberOfWorklistRequest(true); - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { - this.common.setTotalNumberOfWorklistRequest(true); - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } 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 aedb0ac0..66434456 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts @@ -561,11 +561,10 @@ export class WorklistMainComponent implements OnInit { // } // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); - + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { - this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 100); + }, 300); } else { this.common.redToastPK('worklist', 'save-error'); } @@ -631,15 +630,15 @@ export class WorklistMainComponent implements OnInit { this.common.sharedService.setSharedData(this.arr_hr_req_only[requestIndex], HomeComponent.NOTIFICATION_DATA); this.intializeNotificationDetail(); } else { - // this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); - this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); this.common.openNotificationPage(); } } } } else { - //this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); - this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); this.common.openNotificationPage(); } @@ -1161,7 +1160,7 @@ export class WorklistMainComponent implements OnInit { setTimeout(() => { // this.messageSuccess = false; this.nextNotfification(); - }, 100); + }, 300); // this.nextNotfification(); } else { this.common.redToastPK('worklist', 'save-error'); diff --git a/Mohem/src/app/profile/confirm-address/confirm-address.component.ts b/Mohem/src/app/profile/confirm-address/confirm-address.component.ts index 44555d0c..fb51f580 100644 --- a/Mohem/src/app/profile/confirm-address/confirm-address.component.ts +++ b/Mohem/src/app/profile/confirm-address/confirm-address.component.ts @@ -270,9 +270,9 @@ export class ConfirmAddressComponent implements OnInit { this.cs.greenToastPK("eit", "approval-message-success") // } // this.navCtrl.popToRoot(); - //this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); // this.cs.openHome(); - this.cs.setTotalNumberOfWorklistRequest(true); + //this.cs.setTotalNumberOfWorklistRequest(true); this.cs.openNotificationPage(); } }