|
|
|
|
@ -30,7 +30,6 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
public ts: TranslatorService
|
|
|
|
|
) {
|
|
|
|
|
this.direction = TranslatorService.getCurrentDirection();
|
|
|
|
|
console.log(this.direction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public showMore: any = true;
|
|
|
|
|
@ -60,7 +59,7 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
public yearTitle: string;
|
|
|
|
|
public isChange = false;
|
|
|
|
|
public activeMonth: any;
|
|
|
|
|
public currentMonthName = this.getMonthName(new Date().getMonth() + 1);
|
|
|
|
|
public currentMonthName = '';
|
|
|
|
|
public showData = false;
|
|
|
|
|
public currentYear = new Date().getFullYear();
|
|
|
|
|
public dayHoursTypeDetailsList = [];
|
|
|
|
|
@ -72,24 +71,29 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
legend: { display: false }
|
|
|
|
|
};
|
|
|
|
|
public data = {};
|
|
|
|
|
// tslint:disable-next-line: max-line-length
|
|
|
|
|
public monthsNameArray = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.common.startLoading();
|
|
|
|
|
this.showData = false;
|
|
|
|
|
this.nextMonth = new Date().getMonth() + 2;
|
|
|
|
|
this.preMonth = new Date().getMonth();
|
|
|
|
|
this.calendarConfig(this.getMonthName(new Date().getMonth() + 1) , new Date().getFullYear());
|
|
|
|
|
const monthIndex = new Date().getMonth() + 1;
|
|
|
|
|
this.currentMonthName = this.direction === 'ltr' ? this.common.getMonthName(monthIndex) : this.common.getMonthNameAr(monthIndex);
|
|
|
|
|
this.calendarConfig(this.common.getMonthName(new Date().getMonth() + 1) , new Date().getFullYear());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
calendarConfig(month?, year?) {
|
|
|
|
|
this.month = month;
|
|
|
|
|
const index = this.monthsNameArray.indexOf(month);
|
|
|
|
|
this.month = this.direction === 'ltr' ? month : this.common.getMonthNameAr(index + 1);
|
|
|
|
|
this.year = year;
|
|
|
|
|
this.getTimeCardSummaryDetails(month, year);
|
|
|
|
|
this.getDayHoursTypeDetails(month, year);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getDayHoursTypeDetails(month?, year?) {
|
|
|
|
|
console.log('getDayHoursTypeDetails');
|
|
|
|
|
const dayAndHoursReqObj = new GetDayAndHoursDetailsRequest();
|
|
|
|
|
this.monthName = month;
|
|
|
|
|
this.yearDate = year;
|
|
|
|
|
@ -108,7 +112,6 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
@ -192,15 +195,15 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nextSlide() {
|
|
|
|
|
this.common.startLoading();
|
|
|
|
|
if (this.currentMonthName !== this.month) {
|
|
|
|
|
this.common.startLoading();
|
|
|
|
|
this.showData = false;
|
|
|
|
|
if (this.nextMonth > 12) {
|
|
|
|
|
this.currentYear = this.currentYear + 1;
|
|
|
|
|
this.nextMonth = 1;
|
|
|
|
|
}
|
|
|
|
|
this.currentDate = new Date(this.currentYear, (this.nextMonth - 1), 1);
|
|
|
|
|
this.calendarConfig(this.getMonthName(this.nextMonth) , this.currentYear);
|
|
|
|
|
this.calendarConfig(this.common.getMonthName(this.nextMonth) , this.currentYear);
|
|
|
|
|
this.nextMonth = this.nextMonth + 1;
|
|
|
|
|
this.preMonth = this.nextMonth - 2;
|
|
|
|
|
}
|
|
|
|
|
@ -214,8 +217,7 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
this.preMonth = 12;
|
|
|
|
|
}
|
|
|
|
|
this.currentDate = new Date(this.currentYear, (this.preMonth - 1), 1);
|
|
|
|
|
console.log(this.currentDate);
|
|
|
|
|
this.calendarConfig(this.getMonthName(this.preMonth) , this.currentYear);
|
|
|
|
|
this.calendarConfig(this.common.getMonthName(this.preMonth) , this.currentYear);
|
|
|
|
|
this.preMonth = this.preMonth - 1;
|
|
|
|
|
this.nextMonth = this.preMonth + 2;
|
|
|
|
|
}
|
|
|
|
|
@ -228,34 +230,4 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
changeYear(year) {
|
|
|
|
|
this.yearTitle = year;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getMonthName(value: any): any {
|
|
|
|
|
switch (value) {
|
|
|
|
|
case 1:
|
|
|
|
|
return 'January';
|
|
|
|
|
case 2:
|
|
|
|
|
return 'February';
|
|
|
|
|
case 3:
|
|
|
|
|
return 'March';
|
|
|
|
|
case 4:
|
|
|
|
|
return 'April';
|
|
|
|
|
case 5:
|
|
|
|
|
return 'May';
|
|
|
|
|
case 6:
|
|
|
|
|
return 'June';
|
|
|
|
|
case 7:
|
|
|
|
|
return 'July';
|
|
|
|
|
case 8:
|
|
|
|
|
return 'August';
|
|
|
|
|
case 9 :
|
|
|
|
|
return 'September';
|
|
|
|
|
case 10:
|
|
|
|
|
return 'October';
|
|
|
|
|
case 11:
|
|
|
|
|
return 'November';
|
|
|
|
|
case 12:
|
|
|
|
|
return 'December';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|