|
|
|
|
@ -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) {
|
|
|
|
|
|