You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.6 KiB
TypeScript
63 lines
2.6 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { TimeCardService } from 'src/app/time-card/service/time-card.service';
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
|
|
import { GetShiftDetailRequest } from 'src/app/time-card/service/models/get-shift-detail.request';
|
|
import { GetSwipesRequest } from 'src/app/time-card/service/models/get-swipes-request';
|
|
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
|
|
import * as moment from 'moment';
|
|
|
|
@Component({
|
|
selector: 'app-shift-details',
|
|
templateUrl: './shift-details.component.html',
|
|
styleUrls: ['./shift-details.component.scss'],
|
|
})
|
|
export class ShiftDetailsComponent implements OnInit {
|
|
public selectedShift: any;
|
|
public shiftDetailsData: any = [];
|
|
public swipeDetailsData: any = [];
|
|
constructor(
|
|
public timeCardService: TimeCardService,
|
|
public common: CommonService,
|
|
public sharedData: SharedDataService) { }
|
|
|
|
ngOnInit() {
|
|
this.selectedShift = this.sharedData.getSharedData('selectedShift', false);
|
|
console.log(this.selectedShift);
|
|
if (this.selectedShift.origin === 'shiftDetails') {
|
|
this.getScheduleShiftDetails();
|
|
} else if (this.selectedShift.origin === 'shiftSwipes') {
|
|
this.getSwipesDetails();
|
|
}
|
|
}
|
|
|
|
getScheduleShiftDetails() {
|
|
const GetShiftDetailRequestObject = new GetShiftDetailRequest();
|
|
GetShiftDetailRequestObject.P_RTP_ID = this.selectedShift.RTP_ID;
|
|
GetShiftDetailRequestObject.P_PAGE_NUM = 1;
|
|
GetShiftDetailRequestObject.P_PAGE_LIMIT = 10;
|
|
console.log(GetShiftDetailRequestObject);
|
|
this.timeCardService.getShiftDetail(GetShiftDetailRequestObject).subscribe((result) => {
|
|
if (this.common.validResponse(result)) {
|
|
console.log(result);
|
|
this.shiftDetailsData = result.GetScheduleShiftsDetailsList;
|
|
}
|
|
});
|
|
}
|
|
|
|
getSwipesDetails() {
|
|
const GetSwipesRequestObject = new GetSwipesRequest();
|
|
GetSwipesRequestObject.P_SELECTED_EMPLOYEE_NUMBER = this.common.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false);
|
|
GetSwipesRequestObject.P_SCHEDULE_DATE = this.common.convertISODateToJsonDate(this.selectedShift.SCHEDULE_DATE);
|
|
GetSwipesRequestObject.P_PAGE_NUM = 1;
|
|
GetSwipesRequestObject.P_PAGE_LIMIT = 10;
|
|
this.timeCardService.getSwipes(GetSwipesRequestObject).subscribe((result) => {
|
|
if (this.common.validResponse(result)) {
|
|
console.log(result);
|
|
this.swipeDetailsData = result.GetSwipesList;
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|