From 6db87b693017d43d6d40c015269c859d0a0be93f Mon Sep 17 00:00:00 2001 From: umasoodch Date: Tue, 10 Mar 2020 17:52:16 +0300 Subject: [PATCH] fixed issue MM-46 --- .../circle-calendar.component.ts | 4 +-- .../app/my-team/details/details.component.ts | 19 +++++----- .../time-card/service/time-card.service.ts | 36 ++++++++++++++----- .../time-card-details.component.ts | 15 ++++---- 4 files changed, 44 insertions(+), 30 deletions(-) diff --git a/Mohem/src/app/hmg-common/ui/circle-calendar/circle-calendar.component.ts b/Mohem/src/app/hmg-common/ui/circle-calendar/circle-calendar.component.ts index 842cbd83..03f29490 100644 --- a/Mohem/src/app/hmg-common/ui/circle-calendar/circle-calendar.component.ts +++ b/Mohem/src/app/hmg-common/ui/circle-calendar/circle-calendar.component.ts @@ -69,8 +69,7 @@ export class CircleCalendarComponent implements OnInit { @ViewChild('slider') slides: ElementRef; ngOnInit() { - this.reRenderCalendar(); - console.log(this.currentDateParent); + // this.reRenderCalendar(); } // tslint:disable-next-line: use-life-cycle-interface @@ -118,6 +117,7 @@ export class CircleCalendarComponent implements OnInit { } }); }); + this.common.stopLoading(); } onDayClicked(event) { diff --git a/Mohem/src/app/my-team/details/details.component.ts b/Mohem/src/app/my-team/details/details.component.ts index a5e58229..087df5da 100644 --- a/Mohem/src/app/my-team/details/details.component.ts +++ b/Mohem/src/app/my-team/details/details.component.ts @@ -75,7 +75,7 @@ export class DetailsComponent implements OnInit { }; public data = {}; - + public isPostNoLoad = true; public previousActiveIndex = 0; public currentActiveIndex = 0; public searchNameOrUserName = ''; @@ -96,11 +96,13 @@ export class DetailsComponent implements OnInit { ) { } ngOnInit() { + this.common.startLoading(); this.intializeMemberDetail(); this.showAttendanceTracking(); } showAttendanceTracking() { + this.common.startLoading(); this.employee = this.common.sharedService.getSharedData(MyTeamService.EMPLOYEE_SHARED_DATA, false); const request = { P_SELECTED_EMPLOYEE_NUMBER: this.employee.EMPLOYEE_NUMBER @@ -116,6 +118,7 @@ export class DetailsComponent implements OnInit { public segmentChanged(event: any) { this.activeSegment = event.detail.value; if (this.activeSegment === 'Attendance') { + this.common.startLoading(); this.initAttendance(); } } @@ -139,7 +142,6 @@ export class DetailsComponent implements OnInit { } public getDayHoursTypeDetails(month?, year?) { - console.log('getDayHoursTypeDetails'); const dayAndHoursReqObj = new GetDayAndHoursDetailsRequest(); this.monthName = month; this.yearDate = year; @@ -156,17 +158,17 @@ export class DetailsComponent implements OnInit { dayAndHoursReqObj.P_PAGE_NUM = this.dayAndHoursPageNumber; dayAndHoursReqObj.P_PAGE_LIMIT = 100; - this.timeCardService.getDayHoursTypeDetails(dayAndHoursReqObj).subscribe((result) => { + this.timeCardService.getDayHoursTypeDetails(dayAndHoursReqObj, '', '', this.isPostNoLoad).subscribe((result) => { if (this.common.validResponse(result)) { console.log(result.GetDayHoursTypeDetailsList); this.common.sharedService.setSharedData(result.GetDayHoursTypeDetailsList, 'RTP_IDs'); this.countAllAttendDays(result.GetDayHoursTypeDetailsList); } }); - } nextSlide() { + this.common.startLoading(); if (this.currentMonthName !== this.month) { this.showData = false; if (this.nextMonth > 12) { @@ -181,6 +183,7 @@ export class DetailsComponent implements OnInit { } previousSlide() { + this.common.startLoading(); this.showData = false; if (this.preMonth === 0) { this.currentYear = this.currentYear - 1; @@ -255,17 +258,11 @@ export class DetailsComponent implements OnInit { timeCardSummaryReqObj.SearchMonth = this.monthName; timeCardSummaryReqObj.SearchYear = this.yearDate; - this.timeCardService.getTimeCardSummary(timeCardSummaryReqObj).subscribe((result) => { + this.timeCardService.getTimeCardSummary(timeCardSummaryReqObj, '', '', this.isPostNoLoad).subscribe((result) => { if (this.common.validResponse(result)) { - this.timeCardSummaryData = result.GetTimeCardSummaryList[0]; this.absentDays = this.timeCardSummaryData.ABSENT_DAYS; this.attendedDays = this.timeCardSummaryData.ATTENDED_DAYS; - - // this.totalAttendancePrecentage = this.timeCardSummaryData.PERIOD_DAYS - this.timeCardSummaryData.OFF_DAYS; - // if (this.absentDays === 0 && this.attendedDays === 0) { - // this.futrueDays = this.totalAttendancePrecentage; - // } this.totalAttendancePrecentage = this.absentDays + this.attendedDays; if (this.totalAttendancePrecentage > 0) { this.data = { diff --git a/Mohem/src/app/time-card/service/time-card.service.ts b/Mohem/src/app/time-card/service/time-card.service.ts index b4fba9fe..d42b10db 100644 --- a/Mohem/src/app/time-card/service/time-card.service.ts +++ b/Mohem/src/app/time-card/service/time-card.service.ts @@ -45,31 +45,51 @@ export class TimeCardService { public getTimeCardSummary( timeCardSummaryReq, onError?: any, - errorLabel?: string + errorLabel?: string, + isPostNoLoad = false ): Observable { const request = timeCardSummaryReq; this.authService.authenticateRequest(request); + if (isPostNoLoad) { + return this.con.postNoLoad( + TimeCardService.getTimeCardSummaryUrl, + request, + onError, + errorLabel + ); + } else { return this.con.post( TimeCardService.getTimeCardSummaryUrl, request, onError, errorLabel ); + } } public getDayHoursTypeDetails( dayHoursDetailsReq, onError?: any, - errorLabel?: string + errorLabel?: string, + isPostNoLoad = false ): Observable { const request = dayHoursDetailsReq; this.authService.authenticateRequest(request); - return this.con.post( - TimeCardService.getDayHourDetailsUrl, - request, - onError, - errorLabel - ); + if (isPostNoLoad) { + return this.con.postNoLoad( + TimeCardService.getDayHourDetailsUrl, + request, + onError, + errorLabel + ); + } else { + return this.con.post( + TimeCardService.getDayHourDetailsUrl, + request, + onError, + errorLabel + ); + } } public getShiftDetail( diff --git a/Mohem/src/app/time-card/time-card-details/time-card-details.component.ts b/Mohem/src/app/time-card/time-card-details/time-card-details.component.ts index 377dfbd3..d8078337 100644 --- a/Mohem/src/app/time-card/time-card-details/time-card-details.component.ts +++ b/Mohem/src/app/time-card/time-card-details/time-card-details.component.ts @@ -3,7 +3,6 @@ import { TimeCardService } from 'src/app/time-card/service/time-card.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; import { ModalController, IonSlides } from '@ionic/angular'; -import { SelectPeriodComponent } from '../select-period/select-period.component'; import { GetDayAndHoursDetailsRequest } from 'src/app/time-card/service/models/get-day-hours-type-details.request'; import { GetTimeCardSummaryRequest } from 'src/app/time-card/service/models/get-time-card-summary.request'; import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; @@ -62,6 +61,7 @@ export class TimeCardDetailsComponent implements OnInit { public currentYear = new Date().getFullYear(); public dayHoursTypeDetailsList = []; public currentDate = new Date(); + public isPostNoLoad = true; public options = { cutoutPercentage: 80, tooltips: { enabled: false }, @@ -70,6 +70,7 @@ export class TimeCardDetailsComponent implements OnInit { public data = {}; ngOnInit() { + this.common.startLoading(); this.showData = false; this.nextMonth = new Date().getMonth() + 2; this.preMonth = new Date().getMonth(); @@ -101,7 +102,7 @@ export class TimeCardDetailsComponent implements OnInit { dayAndHoursReqObj.P_PAGE_NUM = this.dayAndHoursPageNumber; dayAndHoursReqObj.P_PAGE_LIMIT = 100; - this.timeCardService.getDayHoursTypeDetails(dayAndHoursReqObj).subscribe((result) => { + this.timeCardService.getDayHoursTypeDetails(dayAndHoursReqObj, '', '', this.isPostNoLoad).subscribe((result) => { if (this.common.validResponse(result)) { console.log(result.GetDayHoursTypeDetailsList); this.common.sharedService.setSharedData(result.GetDayHoursTypeDetailsList, 'RTP_IDs'); @@ -163,17 +164,11 @@ export class TimeCardDetailsComponent implements OnInit { timeCardSummaryReqObj.SearchMonth = this.monthName; timeCardSummaryReqObj.SearchYear = this.yearDate; - this.timeCardService.getTimeCardSummary(timeCardSummaryReqObj).subscribe((result) => { + this.timeCardService.getTimeCardSummary(timeCardSummaryReqObj, '', '', this.isPostNoLoad).subscribe((result) => { if (this.common.validResponse(result)) { - this.timeCardSummaryData = result.GetTimeCardSummaryList[0]; this.absentDays = this.timeCardSummaryData.ABSENT_DAYS; this.attendedDays = this.timeCardSummaryData.ATTENDED_DAYS; - - // this.totalAttendancePrecentage = this.timeCardSummaryData.PERIOD_DAYS - this.timeCardSummaryData.OFF_DAYS; - // if (this.absentDays === 0 && this.attendedDays === 0) { - // this.futrueDays = this.totalAttendancePrecentage; - // } this.totalAttendancePrecentage = this.absentDays + this.attendedDays; if (this.totalAttendancePrecentage > 0) { this.data = { @@ -193,6 +188,7 @@ export class TimeCardDetailsComponent implements OnInit { } nextSlide() { + this.common.startLoading(); if (this.currentMonthName !== this.month) { this.showData = false; if (this.nextMonth > 12) { @@ -207,6 +203,7 @@ export class TimeCardDetailsComponent implements OnInit { } previousSlide() { + this.common.startLoading(); this.showData = false; if (this.preMonth === 0) { this.currentYear = this.currentYear - 1;