import { Injectable } from '@angular/core'; import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service'; import { Request } from 'src/app/hmg-common/services/models/request'; import { Observable } from 'rxjs'; import { GetShiftTypeResponse } from './models/get-shift-type.response'; import { GetDayAndHoursDetailsResponse } from './models/get-day-hours-type-details.response'; import { GetTimeCardSummaryResponse } from './models/get-time-card-summary.response'; import { GetShiftDetailResponse } from './models/get-shift-detail.response'; import { GetSwipesResponse } from './models/get-swipes-response'; @Injectable({ providedIn: 'root' }) export class TimeCardService { public static getShiftTypeUrl = 'Services/ERP.svc/REST/GET_SHIFT_TYPES'; public static getTimeCardSummaryUrl = 'Services/ERP.svc/REST/GET_TIME_CARD_SUMMARY'; public static getDayHourDetailsUrl = 'Services/ERP.svc/REST/GET_DAY_HOURS_TYPE_DETAILS'; public static getShiftDetailUrl = 'Services/ERP.svc/REST/GET_SCHEDULE_SHIFTS_DETAILS'; public static getSwipeUrl = 'Services/ERP.svc/REST/GET_SWIPES'; constructor( public con: ConnectorService, private authService: AuthenticationService ) {} public getShiftType( onError?: any, errorLabel?: string ): Observable { const request = new Request(); this.authService.authenticateRequest(request); return this.con.post( TimeCardService.getShiftTypeUrl, request, onError, errorLabel ); } public getTimeCardSummary( timeCardSummaryReq, onError?: any, errorLabel?: string ): Observable { const request = timeCardSummaryReq; this.authService.authenticateRequest(request); return this.con.post( TimeCardService.getTimeCardSummaryUrl, request, onError, errorLabel ); } public getDayHoursTypeDetails( dayHoursDetailsReq, onError?: any, errorLabel?: string ): Observable { const request = dayHoursDetailsReq; this.authService.authenticateRequest(request); return this.con.post( TimeCardService.getDayHourDetailsUrl, request, onError, errorLabel ); } public getShiftDetail( shiftDetailReq, onError?: any, errorLabel?: string ): Observable { const request = shiftDetailReq; this.authService.authenticateRequest(request); return this.con.post( TimeCardService.getShiftDetailUrl, request, onError, errorLabel ); } public getSwipes( getSwipeReq, onError?: any, errorLabel?: string ): Observable { const request = getSwipeReq; this.authService.authenticateRequest(request); return this.con.post( TimeCardService.getSwipeUrl, request, onError, errorLabel ); } }