|
|
|
|
@ -24,14 +24,21 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
public dateTo: any = new Date();
|
|
|
|
|
public selMenu: MenuResponse = new MenuResponse();
|
|
|
|
|
public respID: number;
|
|
|
|
|
public timeCardSummaryData: any;
|
|
|
|
|
public dayHoursData: any;
|
|
|
|
|
public timeCardSummaryData: any = [];
|
|
|
|
|
public dayHoursData: any = [];
|
|
|
|
|
public selectedShift: any;
|
|
|
|
|
public rightIconActive = false;
|
|
|
|
|
public leftIconActive = false;
|
|
|
|
|
public loadMore = false;
|
|
|
|
|
public dayAndHoursPageNumber = 1;
|
|
|
|
|
public selectedFilters: any = {};
|
|
|
|
|
public selectedShiftFilter: any;
|
|
|
|
|
public loadMoreDateHoursData = false;
|
|
|
|
|
constructor(
|
|
|
|
|
public timeCardService: TimeCardService,
|
|
|
|
|
public common: CommonService,
|
|
|
|
|
public modalController: ModalController,
|
|
|
|
|
public sharedData: SharedDataService,
|
|
|
|
|
public sharedData: SharedDataService
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
@ -40,8 +47,11 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
public segmentChanged(event: any) {
|
|
|
|
|
this.activeSegment = event.detail.value;
|
|
|
|
|
if (this.activeSegment === 'time-card-details' && !this.dayHoursData) {
|
|
|
|
|
if (this.activeSegment === 'time-card-details' && this.dayHoursData.length === 0) {
|
|
|
|
|
this.getDayHoursTypeDetails();
|
|
|
|
|
} else {
|
|
|
|
|
this.rightIconActive = true;
|
|
|
|
|
this.leftIconActive = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -63,12 +73,39 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
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.P_PAGE_NUM = 1;
|
|
|
|
|
dayAndHoursReqObj.P_PAGE_NUM = this.dayAndHoursPageNumber;
|
|
|
|
|
dayAndHoursReqObj.P_PAGE_LIMIT = 10;
|
|
|
|
|
|
|
|
|
|
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.dayHoursData = result.GetDayHoursTypeDetailsList;
|
|
|
|
|
this.loadMoreDateHoursData = false;
|
|
|
|
|
const daysDataLength = result.GetDayHoursTypeDetailsList.length;
|
|
|
|
|
this.loadMore = daysDataLength === 10 ? true : false;
|
|
|
|
|
if (this.dayAndHoursPageNumber > 1 && daysDataLength !== 0) {
|
|
|
|
|
this.rightIconActive = true;
|
|
|
|
|
this.dayHoursData = this.dayHoursData.concat(result.GetDayHoursTypeDetailsList);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.nextSlide();
|
|
|
|
|
}, 1000);
|
|
|
|
|
} else if (this.dayAndHoursPageNumber === 1 && daysDataLength <= 10 && daysDataLength !== 0) {
|
|
|
|
|
this.rightIconActive = true;
|
|
|
|
|
this.dayHoursData = result.GetDayHoursTypeDetailsList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -89,10 +126,23 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
timeCardSummaryReqObj.P_SCHEDULE_DATE_FROM = this.common.convertISODateToJsonDate(this.dateFrom);
|
|
|
|
|
timeCardSummaryReqObj.P_SCHEDULE_DATE_TO = this.common.convertISODateToJsonDate(this.dateTo);
|
|
|
|
|
|
|
|
|
|
if (Object.keys(this.selectedFilters).length !== 0) {
|
|
|
|
|
timeCardSummaryReqObj.P_SHT_TYPE = this.selectedShiftFilter;
|
|
|
|
|
timeCardSummaryReqObj.P_EXCESS_FLAG = this.selectedFilters['P_EXCESS_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_TIMEBACK_FLAG = this.selectedFilters['P_TIMEBACK_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_COMP_OFF_FLAG = this.selectedFilters['P_COMP_OFF_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_NON_SCHEDULED_FLAG = this.selectedFilters['P_NON_SCHEDULED_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_LATE_IN_FLAG = this.selectedFilters['P_LATE_IN_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_EARLY_OUT_FLAG = this.selectedFilters['P_EARLY_OUT_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_SHORTAGE_FLAG = this.selectedFilters['P_SHORTAGE_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_MISSING_SWIPE_FLAG = this.selectedFilters['P_MISSING_SWIPE_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_ACTUAL_WOB_SEC = this.selectedFilters['P_ACTUAL_WOB_SEC'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_ANALAYZED_FLAG = this.selectedFilters['P_ANALAYZED_FLAG'.toString()].value;
|
|
|
|
|
timeCardSummaryReqObj.P_APPR_TIMEBACK_FLAG = this.selectedFilters['P_APPR_TIMEBACK_FLAG'.toString()].value;
|
|
|
|
|
}
|
|
|
|
|
this.timeCardService.getTimeCardSummary(timeCardSummaryReqObj).subscribe((result) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.timeCardSummaryData = result.GetTimeCardSummaryList[0];
|
|
|
|
|
console.log(this.timeCardSummaryData);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -100,29 +150,72 @@ export class TimeCardDetailsComponent implements OnInit {
|
|
|
|
|
async openSelectPeriodModal() {
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: SelectPeriodComponent,
|
|
|
|
|
cssClass: 'select-period-custom-modal'
|
|
|
|
|
cssClass: 'select-period-custom-modal',
|
|
|
|
|
componentProps: {
|
|
|
|
|
dateFrom : this.dateFrom,
|
|
|
|
|
dateTo : this.dateTo
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
modal.onDidDismiss().then(result => {
|
|
|
|
|
console.log(result);
|
|
|
|
|
this.dateFrom = result.data.selectFromDate;
|
|
|
|
|
this.dateTo = result.data.selectToDate;
|
|
|
|
|
console.log(result.data);
|
|
|
|
|
this.loadMore = false;
|
|
|
|
|
this.rightIconActive = false;
|
|
|
|
|
this.leftIconActive = false;
|
|
|
|
|
this.dayHoursData = [];
|
|
|
|
|
this.timeCardSummaryData = [];
|
|
|
|
|
this.dayAndHoursPageNumber = 1;
|
|
|
|
|
this.loadMoreDateHoursData = false;
|
|
|
|
|
this.dateFrom = result.data.dateFrom;
|
|
|
|
|
this.dateTo = result.data.dateTo;
|
|
|
|
|
this.selectedFilters = result.data.keySelectedFilters;
|
|
|
|
|
this.selectedShiftFilter = result.data.selectedShiftType;
|
|
|
|
|
if (this.dateFrom && this.dateTo) {
|
|
|
|
|
this.getDayHoursTypeDetails();
|
|
|
|
|
this.getTimeCardSummaryDetails();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return await modal.present();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
slideChanged(ev: any) {}
|
|
|
|
|
slideChanged(ev: any) {
|
|
|
|
|
const prom1 = this.sliderRef.isBeginning();
|
|
|
|
|
const prom2 = this.sliderRef.isEnd();
|
|
|
|
|
|
|
|
|
|
Promise.all([prom1, prom2]).then((data) => {
|
|
|
|
|
data[0] ? this.leftIconActive = false : this.leftIconActive = true;
|
|
|
|
|
if (data[1]) {
|
|
|
|
|
if (!this.loadMore) {
|
|
|
|
|
this.rightIconActive = false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.rightIconActive = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showShiftDetails(origin: string) {
|
|
|
|
|
this.sliderRef.getActiveIndex().then((index: number) => {
|
|
|
|
|
console.log(index);
|
|
|
|
|
this.selectedShift = this.dayHoursData[index];
|
|
|
|
|
this.selectedShift.origin = origin;
|
|
|
|
|
console.log(this.selectedShift);
|
|
|
|
|
this.sharedData.setSharedData(this.selectedShift, 'selectedShift');
|
|
|
|
|
this.common.navigatePage('/time-card/shift-details');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nextSlide() {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
previousSlide() {
|
|
|
|
|
this.sliderRef.slidePrev();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|