|
|
|
|
@ -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: [
|
|
|
|
|
{
|
|
|
|
|
|