From d9cc9db7c7e68be429a02603f25091983789119e Mon Sep 17 00:00:00 2001 From: umasoodch Date: Sun, 5 Jun 2022 15:51:36 +0300 Subject: [PATCH] fixed loading issue --- .../authentication/sms-page/sms-page.page.ts | 1 + .../authentication/authentication.service.ts | 10 +++ .../models/smscheck.response.ts | 1 + .../app/hmg-common/services/models/request.ts | 2 + .../stats-button/stats-button.component.scss | 10 +++ Mohem/src/app/home/home.page.html | 3 + Mohem/src/app/home/home.page.scss | 11 ++++ Mohem/src/app/home/home.page.ts | 63 +++++++++++++++++-- 8 files changed, 95 insertions(+), 6 deletions(-) diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.ts b/Mohem/src/app/authentication/sms-page/sms-page.page.ts index 350dcbdd..4db111ea 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts @@ -482,6 +482,7 @@ export class SmsPageComponent implements OnInit { } this.common.sharedService.setSharedData(result.MemberInformationList[0].PAYROLL_CODE, "projcet-code"); + this.common.sharedService.setSharedData(result.BasicMemberInformation.P_LEGISLATION_CODE, "legislation-code"); this.activeType = this.common.setActiveTypeLogin(0); diff --git a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts index 918a8153..7c6bdb82 100644 --- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts +++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts @@ -134,6 +134,9 @@ export class AuthenticationService { public setPublicFields(request: Request): Request { const isAndroid = this.platform.is('android'); const isIOS = this.platform.is('ios'); + // const userData = this.cs.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false); + const userPayrollCode = this.cs.sharedService.getSharedData("projcet-code", false); + const userLegislationCode = this.cs.sharedService.getSharedData("legislation-code", false); let mobileType = ''; if (isAndroid) { mobileType = 'android'; @@ -147,6 +150,13 @@ export class AuthenticationService { request.LanguageID = TranslatorService.getCurrentLanguageCode(); request.MobileType = mobileType; + if (userPayrollCode) { + request.PayrollCodeStr = userPayrollCode; + } + if (userLegislationCode) { + request.LegislationCodeStr = userLegislationCode + } + return request; } public authenticateAndSetPersonalInformation( diff --git a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts index 387a7d73..68ca3ab7 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts @@ -3,6 +3,7 @@ import { Response } from 'src/app/hmg-common/services/models/response'; import { AuthenticatedUser } from './authenticated-user'; import { PrivilageModel } from './privilage-model'; export class SMSCheckResponse extends Response { + BasicMemberInformation: any = {}; AuthenticationTokenID: string; MemberInformationList:AuthenticatedUser[]; Privilege_List:PrivilageModel[]; diff --git a/Mohem/src/app/hmg-common/services/models/request.ts b/Mohem/src/app/hmg-common/services/models/request.ts index 1a9e8fd2..6a16ec13 100644 --- a/Mohem/src/app/hmg-common/services/models/request.ts +++ b/Mohem/src/app/hmg-common/services/models/request.ts @@ -18,6 +18,8 @@ export class Request { public P_MOBILE_NUMBER: string; public P_EMAIL_ADDRESS: string; public P_NOTIFICATION_ID: number; + public PayrollCodeStr: string; + public LegislationCodeStr: string; // public P_LEGISLATION_CODE: string; // public OTP_SendType: number; diff --git a/Mohem/src/app/hmg-common/ui/stats-button/stats-button.component.scss b/Mohem/src/app/hmg-common/ui/stats-button/stats-button.component.scss index 0663997a..6895ceb4 100644 --- a/Mohem/src/app/hmg-common/ui/stats-button/stats-button.component.scss +++ b/Mohem/src/app/hmg-common/ui/stats-button/stats-button.component.scss @@ -53,3 +53,13 @@ width: 100px; height: 70px; } + +.loader { + position: absolute; + width: 100%; + top: 70px; + left: 2px; + img { + width: 25px; + } +} diff --git a/Mohem/src/app/home/home.page.html b/Mohem/src/app/home/home.page.html index 00f2cdef..f189e43a 100644 --- a/Mohem/src/app/home/home.page.html +++ b/Mohem/src/app/home/home.page.html @@ -10,6 +10,9 @@ +
+ +
{ + this.showLoader = false; + this.common.stopLoading(); }); } ITGCountAllNotification() { this.workListService.getITGDetails('', '', this.isPostNoLoad).subscribe((result: any) => { - 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'); + if (this.common.validResponse(result)) { + 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.getCOCNotificationCount(); + this.common.stopLoading(); + } else { + this.showLoader = false; + this.common.stopLoading(); + } + }, (error) => { + this.showLoader = false; + this.common.stopLoading(); + }); + } + + getCOCNotificationCount() { + const request = new COCRequest(); + request.ItgPageSize = 1; + request.ItgPageNo = 1; + request.Date = moment(new Date()).format("YYYY-MM-DD"); + + this.workListService.getCOCCount(request, '', '', this.isPostNoLoad).subscribe((result: any) => { + console.log(result); + if (this.common.validResponse(result)) { + const countResult = result.Mohemm_ITG_Pending_Task_ResponseItem; + const totalCount = countResult.escalation + countResult.waitingToClose + countResult.waitingForAcceptance + countResult.extendTATRequest; + this.common.filterKeys['COC'] = totalCount; + + + this.statsButtons[1].statsValue = Math.floor(this.statsButtons[1].statsValue + totalCount); + + this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count'); + + this.showLoader = false; + this.common.stopLoading(); + } else { + this.showLoader = false; + this.common.stopLoading(); + } + + + }, (error) => { + this.showLoader = false; this.common.stopLoading(); }); }