diff --git a/Mohem/src/app/attendance-tracking/home/home.component.ts b/Mohem/src/app/attendance-tracking/home/home.component.ts index a02ea816..aa8ca30b 100644 --- a/Mohem/src/app/attendance-tracking/home/home.component.ts +++ b/Mohem/src/app/attendance-tracking/home/home.component.ts @@ -25,6 +25,7 @@ export class HomeComponent implements OnInit { public isCheckedIn = undefined; public displayTime: any; public percent: any; + public spentHours: any; public userData = this.sharedData.getSharedData(AuthenticatedUser.SHARED_DATA, false); constructor( public cs: CommonService, @@ -96,9 +97,12 @@ export class HomeComponent implements OnInit { convertAndAssignTime(data) { this.remainingTime = this.convertInSeconds(data.P_REMAINING_HOURS.split(':')); this.scheduledTime = this.convertInSeconds(data.P_SCHEDULED_HOURS.split(':')); - this.isCheckedIn = this.remainingTime === this.scheduledTime ? false : true; - this.initTimer(); - } + this.spentHours = this.convertInSeconds(data.P_SPENT_HOURS.split(':')); + this.isCheckedIn = this.spentHours === 0 ? false : true; + if (this.isCheckedIn) { + this.initTimer(); + } +} showAttendanceTracking() { const request = { diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 2ae0e2b3..f628722b 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -121,26 +121,16 @@ export class HomePage implements OnInit { public hasFinished = false; public remainingTime: any; public scheduledTime: any; + public spentHours: any; public isCheckedIn = undefined; public displayTime: any; public menuEntries: any; public percent: any; -///////////////////////////////// TIME AND DATE VALUES/////////////////////////////// -public monthName: any; -public yearDate: any; -public selEmp: string; -public selMenu: MenuResponse = new MenuResponse(); -public respID: number; -public menuType: any; -public dayAndHoursPageNumber = 1; -public selectedFilters: any = {}; -public selectedShiftFilter: any; -public arrDaysAttendance: any = []; -public arrDaysAbsent: any = []; -public arrDaysOff: any = []; -public arrFutrueDays: any = []; - -/////////////////////////////// END////////////////////////////////////////////////// + public selEmp: string; + public selMenu: MenuResponse = new MenuResponse(); + public respID: number; + public menuType: any; + constructor( public ts: TranslatorService, public menu: MenuController, @@ -524,8 +514,11 @@ convertAndAssignTime(data) { console.log(data); this.remainingTime = this.convertInSeconds(data.P_REMAINING_HOURS.split(':')); this.scheduledTime = this.convertInSeconds(data.P_SCHEDULED_HOURS.split(':')); - this.isCheckedIn = this.remainingTime === this.scheduledTime ? false : true; - this.initTimer(); + this.spentHours = this.convertInSeconds(data.P_SPENT_HOURS.split(':')); + this.isCheckedIn = this.spentHours === 0 ? false : true; + if (this.isCheckedIn) { + this.initTimer(); + } } showAttendanceTracking() { @@ -597,7 +590,7 @@ openPage(subMenu) { this.common.openPayslipPage(); } if (subMenu.REQUEST_TYPE === 'TIME_CARD') { - this.getDayHoursTypeDetails(); + this.common.openTimeCardPage(); } } @@ -631,98 +624,16 @@ getAccrualBalance() { openattentracking() { this.common.openAttenTrackingpage(); - } +} openProfilePage() { this.common.openEditProfile(); - } +} openStatsButton(link: string) { console.log(link); this.common.openPage(link); - } - - public getDayHoursTypeDetails() { - const dayAndHoursReqObj = new GetDayAndHoursDetailsRequest(); - this.monthName = moment().format('MMMM'); - this.yearDate = moment().format('YYYY'); - this.selEmp = this.common.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); - this.respID = this.common.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); - this.selMenu = this.common.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); - this.menuType = this.selMenu.List_Menu.MENU_TYPE; - - dayAndHoursReqObj.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; - dayAndHoursReqObj.P_MENU_TYPE = this.menuType; - dayAndHoursReqObj.P_SELECTED_RESP_ID = this.respID; - dayAndHoursReqObj.SearchMonth = this.monthName; - dayAndHoursReqObj.SearchYear = this.yearDate; - dayAndHoursReqObj.P_PAGE_NUM = this.dayAndHoursPageNumber; - dayAndHoursReqObj.P_PAGE_LIMIT = 100; - - if (Object.keys(this.selectedFilters).length !== 0) { - dayAndHoursReqObj.P_SHT_TYPE = this.selectedShiftFilter; - dayAndHoursReqObj.P_EXCESS_FLAG = this.selectedFilters['P_EXCESS_FLAG'.toString()].value; - dayAndHoursReqObj.P_TIMEBACK_FLAG = this.selectedFilters['P_TIMEBACK_FLAG'.toString()].value; - dayAndHoursReqObj.P_COMP_OFF_FLAG = this.selectedFilters['P_COMP_OFF_FLAG'.toString()].value; - dayAndHoursReqObj.P_NON_SCHEDULED_FLAG = this.selectedFilters['P_NON_SCHEDULED_FLAG'.toString()].value; - dayAndHoursReqObj.P_LATE_IN_FLAG = this.selectedFilters['P_LATE_IN_FLAG'.toString()].value; - dayAndHoursReqObj.P_EARLY_OUT_FLAG = this.selectedFilters['P_EARLY_OUT_FLAG'.toString()].value; - dayAndHoursReqObj.P_SHORTAGE_FLAG = this.selectedFilters['P_SHORTAGE_FLAG'.toString()].value; - dayAndHoursReqObj.P_MISSING_SWIPE_FLAG = this.selectedFilters['P_MISSING_SWIPE_FLAG'.toString()].value; - dayAndHoursReqObj.P_ACTUAL_WOB_SEC = this.selectedFilters['P_ACTUAL_WOB_SEC'.toString()].value; - dayAndHoursReqObj.P_ANALAYZED_FLAG = this.selectedFilters['P_ANALAYZED_FLAG'.toString()].value; - dayAndHoursReqObj.P_APPR_TIMEBACK_FLAG = this.selectedFilters['P_APPR_TIMEBACK_FLAG'.toString()].value; - } - - this.timeCardService.getDayHoursTypeDetails(dayAndHoursReqObj).subscribe((result) => { - if (this.common.validResponse(result)) { - this.countAllAttendDays(result.GetDayHoursTypeDetailsList); - // this.common.sharedService.setSharedData(result.GetDayHoursTypeDetailsList, 'calendarDateValue'); - this.common.openTimeCardPage(); - } - }); - - } - - - - -countAllAttendDays(allDays) { - for (let i = 0; i < allDays.length; i++) { - if (allDays[i].DAY_TYPE == 'OFF') { - // offDay - this.arrDaysOff.push({startTime: new Date(allDays[i].SCHEDULE_DATE), - endTime: new Date(allDays[i].SCHEDULE_DATE)}); - } else if (allDays[i].DAY_TYPE == 'SCHEDULED' && !allDays[i].REMARKS) { - // attendace - this.arrDaysAttendance.push({startTime: new Date(allDays[i].SCHEDULE_DATE), - endTime: new Date(allDays[i].SCHEDULE_DATE)}); - } else if (allDays[i].DAY_TYPE == 'SCHEDULED' && allDays[i].REMARKS) { - // absent - this.arrDaysAbsent.push( - { - startTime: new Date(allDays[i].SCHEDULE_DATE), - endTime: new Date(allDays[i].SCHEDULE_DATE), - isoTime: '09:00:00', - allDay: false - } - ); - } else { - this.arrFutrueDays.push( - { - startTime: new Date(allDays[i].SCHEDULE_DATE), - endTime: new Date(allDays[i].SCHEDULE_DATE), - isoTime: '09:00:00', - allDay: false - } - ); - } - } - this.common.sharedService.setSharedData(this.arrDaysOff, 'calendarDayOffDateValue'); - this.common.sharedService.setSharedData(this.arrDaysAttendance, 'calendarAttendanceDateValue'); - this.common.sharedService.setSharedData( this.arrDaysAbsent, 'calendarDaysAbsentDateValue'); - this.common.sharedService.setSharedData( this.arrFutrueDays, 'calendarDaysFutrueDateValue'); - } +} } diff --git a/Mohem/src/app/my-team/details/details.component.html b/Mohem/src/app/my-team/details/details.component.html index d62bae40..f439d8df 100644 --- a/Mohem/src/app/my-team/details/details.component.html +++ b/Mohem/src/app/my-team/details/details.component.html @@ -90,7 +90,7 @@ @@ -183,7 +183,7 @@
- +

{{ts.trPK('attendance','monthly-attendance-calendar')}}

diff --git a/Mohem/src/app/my-team/details/details.component.scss b/Mohem/src/app/my-team/details/details.component.scss index 38dc8e1f..18ec325b 100644 --- a/Mohem/src/app/my-team/details/details.component.scss +++ b/Mohem/src/app/my-team/details/details.component.scss @@ -217,31 +217,28 @@ ion-title{ margin-top: 20px; } -///////////////////////////////here .slidPrev{ - // margin-top: 8px; margin-left: 10px; background: transparent; - } +} - .slidNext{ +.slidNext{ background: transparent; margin-top: -1px; margin-left: 43px; - } - .activeArrow{ +} +.activeArrow{ height: 20px; width: 20px; - color: white; - } - .disabledArrow{ + color: #22c6b3; +} +.disabledArrow{ height: 20px; width: 20px; - color: gray; - // margin-right: 5px; - } + color: gray; +} - .request-heading { +.request-heading { span { display: block; text-align: left; @@ -270,7 +267,7 @@ ion-title{ color: black !important; margin: 0 auto; line-height: 36px; - } + } span { width: 125px; display: block; diff --git a/Mohem/src/app/my-team/details/details.component.ts b/Mohem/src/app/my-team/details/details.component.ts index 97da76d7..36763fee 100644 --- a/Mohem/src/app/my-team/details/details.component.ts +++ b/Mohem/src/app/my-team/details/details.component.ts @@ -68,6 +68,9 @@ export class DetailsComponent implements OnInit { public yearTitle: string; public isChange = false; public activeMonth: any; + public currentMonthName = this.getMonthName(new Date().getMonth() + 1); + public showData = false; + public currentYear = new Date().getFullYear(); month: any; year: any; @@ -154,6 +157,7 @@ export class DetailsComponent implements OnInit { } initAttendance() { + this.showData = false; this.nextMonth = new Date().getMonth() + 2; this.preMonth = new Date().getMonth() - 2; if (this.preMonth < 0) { @@ -165,12 +169,11 @@ export class DetailsComponent implements OnInit { } calendarConfig(month?, year?) { - console.log('ngOnInit'); + this.arrDaysOff = []; + this.arrDaysAttendance = []; + this.arrDaysAbsent = []; this.month = month; this.year = year; - this.arrDaysOff = this.common.sharedService.getSharedData('calendarDayOffDateValue', false); - this.arrDaysAttendance = this.common.sharedService.getSharedData('calendarAttendanceDateValue', false); - this.arrDaysAbsent = this.common.sharedService.getSharedData('calendarDaysAbsentDateValue', false); this.getTimeCardSummaryDetails(month, year); this.getDayHoursTypeDetails(month, year); } @@ -178,10 +181,8 @@ export class DetailsComponent implements OnInit { public getDayHoursTypeDetails(month?, year?) { console.log('getDayHoursTypeDetails'); const dayAndHoursReqObj = new GetDayAndHoursDetailsRequest(); - // this.dateFrom = moment(this.dateFrom).format('YYYY-MM-DDTHH:mm:ssZ'); - // this.dateTo = moment(this.dateTo).format('YYYY-MM-DDTHH:mm:ssZ'); - this.monthName = month; // moment().format('MMMM'); - this.yearDate = year; // moment().format('YYYY'); + this.monthName = month; + this.yearDate = year; this.selEmp = this.common.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); this.respID = this.common.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); this.selMenu = this.common.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); @@ -190,8 +191,6 @@ export class DetailsComponent implements OnInit { dayAndHoursReqObj.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; dayAndHoursReqObj.P_MENU_TYPE = this.menuType; dayAndHoursReqObj.P_SELECTED_RESP_ID = this.respID; - // dayAndHoursReqObj.P_SCHEDULE_DATE_FROM = this.common.convertISODateToJsonDate(this.dateFrom); - // dayAndHoursReqObj.P_SCHEDULE_DATE_TO = this.common.convertISODateToJsonDate(this.dateTo); dayAndHoursReqObj.SearchMonth = this.monthName; dayAndHoursReqObj.SearchYear = this.yearDate; dayAndHoursReqObj.P_PAGE_NUM = this.dayAndHoursPageNumber; @@ -236,27 +235,30 @@ export class DetailsComponent implements OnInit { } nextSlide() { - let currentYear = new Date().getFullYear(); - if (this.nextMonth > 12) { - currentYear = currentYear + 1; - this.nextMonth = 1; + if (this.currentMonthName !== this.month) { + this.showData = false; + if (this.nextMonth > 12) { + this.currentYear = this.currentYear + 1; + this.nextMonth = 1; + } + this.calendarConfig(this.getMonthName(this.nextMonth) , this.currentYear); + this.nextMonth = this.nextMonth + 1; + this.preMonth = this.nextMonth - 2; } - this.calendarConfig(this.getMonthName(this.nextMonth) , currentYear); - this.nextMonth = this.nextMonth + 1; - this.preMonth = this.preMonth + 1; } previousSlide() { - let currentYear = new Date().getFullYear(); + this.showData = false; if (this.preMonth === 0) { - currentYear = currentYear - 1; + this.currentYear = this.currentYear - 1; this.preMonth = 12; } - this.calendarConfig(this.getMonthName(this.preMonth) , currentYear); + this.calendarConfig(this.getMonthName(this.preMonth) , this.currentYear); this.preMonth = this.preMonth - 1; - this.nextMonth = this.nextMonth - 1; + this.nextMonth = this.preMonth + 2; } + changeMonthTitle(title) { console.log('changeMonthTitle'); this.monthTitle = title; @@ -271,45 +273,34 @@ export class DetailsComponent implements OnInit { countAllAttendDays(allDays) { - console.log('countAllAttendDays'); - // tslint:disable-next-line: prefer-for-of + // tslint:disable-next-line:prefer-for-of for (let i = 0; i < allDays.length; i++) { if (allDays[i].DAY_TYPE === 'Off') { - // offDay this.arrDaysOff.push({startTime: new Date(allDays[i].SCHEDULE_DATE), endTime: new Date(allDays[i].SCHEDULE_DATE)}); } else if (allDays[i].DAY_TYPE === 'SCHEDULED') { - // attendace this.arrDaysAttendance.push({startTime: new Date(allDays[i].SCHEDULE_DATE), endTime: new Date(allDays[i].SCHEDULE_DATE)}); } else { - // absent - this.arrDaysAbsent.push( - {startTime: new Date(allDays[i].SCHEDULE_DATE), + this.arrDaysAbsent.push({ + startTime: new Date(allDays[i].SCHEDULE_DATE), endTime: new Date(allDays[i].SCHEDULE_DATE), isoTime: '09:00:00', allDay: false - } - - ); + }); } } + this.showData = true; } public getTimeCardSummaryDetails(month?, year?) { - console.log('getTimeCardSummaryDetails'); const timeCardSummaryReqObj = new GetTimeCardSummaryRequest(); if (this.isChange) { - // this.monthName = this.monthTitle; - // this.yearDate = this.yearTitle; this.monthName = month; - console.log('' + this.monthName); this.yearDate = year; - console.log('' + this.yearDate); - } else { - this.monthName = month; // moment().format('MMMM'); - this.yearDate = year; // moment().format('YYYY'); + this.monthName = month; + this.yearDate = year; } this.selEmp = this.common.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); @@ -320,8 +311,6 @@ export class DetailsComponent implements OnInit { timeCardSummaryReqObj.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; timeCardSummaryReqObj.P_MENU_TYPE = this.menuType; timeCardSummaryReqObj.P_SELECTED_RESP_ID = this.respID; - // timeCardSummaryReqObj.P_SCHEDULE_DATE_FROM = this.common.convertISODateToJsonDate(this.dateFrom); - // timeCardSummaryReqObj.P_SCHEDULE_DATE_TO = this.common.convertISODateToJsonDate(this.dateTo); timeCardSummaryReqObj.SearchMonth = this.monthName; timeCardSummaryReqObj.SearchYear = this.yearDate; @@ -341,12 +330,10 @@ export class DetailsComponent implements OnInit { } this.timeCardService.getTimeCardSummary(timeCardSummaryReqObj).subscribe((result) => { if (this.common.validResponse(result)) { + this.timeCardSummaryData = result.GetTimeCardSummaryList[0]; this.absentDays = this.timeCardSummaryData.ABSENT_DAYS; - // console.log("absent: "+ this.absentDays); - this.attendedDays = this.timeCardSummaryData.ATTENDED_DAYS; - // console.log("attendedDays: "+ this.attendedDays); this.totalAttendancePrecentage = this.timeCardSummaryData.PERIOD_DAYS - this.timeCardSummaryData.OFF_DAYS; this.options = { @@ -357,13 +344,6 @@ export class DetailsComponent implements OnInit { if (this.absentDays === 0 && this.attendedDays === 0) { this.futrueDays = this.totalAttendancePrecentage; } -////////////////////////////////////////////// - // console.log("absent: "+ this.absentDays); - // console.log("attend: "+ this.attendedDays); - // console.log("future"+ this.futrueDays); - // in chart "this.futrueDays" - // in calender "this.futrueDays == white" - // timecard sumery return not match data with GET_DAY_HOURS_TYPE_DETAILS this.data = { datasets: [ { diff --git a/Mohem/src/app/time-card/time-card-details/time-card-details.component.html b/Mohem/src/app/time-card/time-card-details/time-card-details.component.html index 8e104463..2facc4b4 100644 --- a/Mohem/src/app/time-card/time-card-details/time-card-details.component.html +++ b/Mohem/src/app/time-card/time-card-details/time-card-details.component.html @@ -1,388 +1,3 @@ - - - - - - - - - -
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 d972cb90..67150982 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 @@ -82,8 +82,6 @@ export class TimeCardDetailsComponent implements OnInit { legend: { display: false } }; - - public data = { datasets: [ { @@ -113,17 +111,10 @@ export class TimeCardDetailsComponent implements OnInit { this.arrDaysAbsent = []; this.month = month; this.year = year; - // this.arrDaysOff = this.common.sharedService.getSharedData('calendarDayOffDateValue', false); - // this.arrDaysAttendance = this.common.sharedService.getSharedData('calendarAttendanceDateValue', false); - // this.arrDaysAbsent = this.common.sharedService.getSharedData('calendarDaysAbsentDateValue', false); this.getTimeCardSummaryDetails(month, year); this.getDayHoursTypeDetails(month, year); } - - - - public segmentChanged(event: any) { console.log('segmentChanged'); this.activeSegment = event.detail.value; @@ -400,11 +391,8 @@ export class TimeCardDetailsComponent implements OnInit { } - ///////////////////////////////////////////////////////////////////////// here getHeaderMonth(date: any) { - return this.getMonthName(date.getMonth() + 1) + ' ' + date.getFullYear(); - } public getMonthName(value: any): any { @@ -436,42 +424,4 @@ export class TimeCardDetailsComponent implements OnInit { } } - - // getHeaderMonth(date: any) { - // if (monthName = "December") { - // } - // return monthName; - // else - // return this.getMonthName(date.getMonth() + 1) + " " + date.getFullYear(); - - // } - // public getMonthName(value: any): any { - // switch (value) { - // case "Januray": - // return "February"; - // case "February": - // return "March"; - // case "March": - // return "April"; - // case "April": - // return "May"; - // case "May": - // return "June"; - // case "June": - // return "July"; - // case "July": - // return "August"; - // case "August": - // return "September" ; - // case "September" : - // return "October"; - // case "October": - // return "November"; - // case "November": - // return "December"; - // case "December": - // return "January"; - - // } - // } }