From 573941941fabaae56a849c09f573715a86efde22 Mon Sep 17 00:00:00 2001 From: "Fatimah.Alshammari" Date: Wed, 19 Feb 2020 09:32:13 +0300 Subject: [PATCH] edit monthly attendance --- .../circle-calendar.component.ts | 5 + .../date-info-modal.component.html | 4 + .../date-info-modal.component.scss | 17 ++- .../date-info-modal.component.ts | 4 + .../time-card-details.component.html | 14 +-- .../time-card-details.component.ts | 103 ++++++------------ Mohem/src/assets/localization/i18n.json | 8 ++ 7 files changed, 74 insertions(+), 81 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 8acfdf27..d3580c46 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 @@ -91,6 +91,7 @@ export class CircleCalendarComponent implements OnInit { ngOnInit() { this.isFirst = false; this.reRenderCalendar(); + console.log("1") } @@ -98,8 +99,12 @@ export class CircleCalendarComponent implements OnInit { setTimeout(() => { this.reRenderCalendar(); }, 1000); + console.log("2") } + // ngOnChanges(){ + // console.log("3") + // } getHeaderDay(date: any) { return this.weekDaysEnSort[date.getDay()]; diff --git a/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.html b/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.html index 03d27609..ca3d45aa 100644 --- a/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.html +++ b/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.html @@ -173,4 +173,8 @@ --> + diff --git a/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.scss b/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.scss index c0ca54c1..19132960 100644 --- a/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.scss +++ b/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.scss @@ -160,4 +160,19 @@ height: 360px !important; padding-bottom: 21px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; - } \ No newline at end of file + } + // .less{ background-color: #22C6B3; + // background-color: #22C6B3; + // border: none; + // color: white; + // text-align: center; + // text-decoration: none; + // display: inline-block; + // font-size: 12px; + // border-radius: 30px; + // height: 26px; + // padding: 6px 24px; + // margin-left: 123px; + // /* margin-top: -19px; */ + // margin-bottom: 17px; + // } \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.ts b/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.ts index 3f3fb1d8..11ccb02a 100644 --- a/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.ts +++ b/Mohem/src/app/hmg-common/ui/circle-calendar/date-info-modal/date-info-modal.component.ts @@ -195,6 +195,10 @@ export class DateInfoModalComponent implements OnInit { return this.weekDaysEn[date.getDay()]; } + + // hide(){ + // this.hideMe = true; + // } // @ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll; // public options = { // cutoutPercentage: 80, 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 71f0c3ef..8e104463 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 @@ -412,11 +412,9 @@

{{year}}

- + @@ -474,7 +472,7 @@ -->
- +

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

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 28a94ae6..d972cb90 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 @@ -73,37 +73,27 @@ export class TimeCardDetailsComponent 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(); public options = { - cutoutPercentage: 80, - tooltips: { enabled: false }, - legend: { display: false } - }; public data = { - datasets: [ - { - data: [120, 50], - backgroundColor: [ - '#22c6b3', - '#094875', ], - borderWidth: 2 - }] - }; ngOnInit() { @@ -117,17 +107,15 @@ export class TimeCardDetailsComponent implements OnInit { this.calendarConfig(this.getMonthName(new Date().getMonth() + 1) , new Date().getFullYear()); } - - - 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.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); } @@ -214,13 +202,10 @@ export class TimeCardDetailsComponent implements OnInit { } - // startTime:new Date(new Date().getTime() +( 60000*60 * 24)), - // endTime: new Date(new Date().getTime() +( 60000*60 * 24)), - // isoTime:"09:00:00", - // allDay: false countAllAttendDays(allDays) { console.log('countAllAttendDays'); + // tslint:disable-next-line:prefer-for-of for (let i = 0; i < allDays.length; i++) { if (allDays[i].DAY_TYPE === 'Off') { // offDay @@ -242,22 +227,21 @@ export class TimeCardDetailsComponent implements OnInit { ); } } + 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); @@ -268,8 +252,6 @@ export class TimeCardDetailsComponent 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; @@ -289,6 +271,7 @@ export class TimeCardDetailsComponent 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); @@ -305,13 +288,6 @@ export class TimeCardDetailsComponent 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: [ { @@ -375,8 +351,6 @@ export class TimeCardDetailsComponent implements OnInit { } showShiftDetails(origin: string) { - console.log('showShiftDetails'); - this.sliderRef.getActiveIndex().then((index: number) => { this.selectedShift = this.dayHoursData[index]; this.selectedShift.origin = origin; @@ -385,47 +359,32 @@ export class TimeCardDetailsComponent implements OnInit { }); } - - /////////////////////////////////////////////////// here -// slideNext(object, slideView) { -// if (this.loadMoreDateHoursData && this.loadMore) { -// this.dayAndHoursPageNumber++; -// this.getDayHoursTypeDetails(); -// } -// this.sliderRef.slideNext(); -// this.sliderRef.getActiveIndex().then((index: number) => { -// if (index === (this.dayHoursData.length - 1)) { -// this.loadMoreDateHoursData = true; -// } -// }); -// } - -// slidePrev(object, slideView) { -// this.sliderRef.slidePrev(); -// } -///////////////////////////////// - - 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; + } + console.log('preMonth: ' + this.nextMonth); + console.log('currentYear: ' + this.currentYear); + 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); + console.log('preMonth: ' + this.preMonth); + console.log('currentYear: ' + this.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) { diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 770bcea9..54fc3c89 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -2204,6 +2204,14 @@ "en": "Attendance Statistics", "ar":"" }, + "more":{ + "en": "MORE", + "ar":"" + }, + "less":{ + "en": "LESS", + "ar":"" + }, "confirm-alert1":{ "en": "Are you sure, you want to", "ar":"Are you sure, you want to"