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 { Observable } from 'rxjs'; import { WorkListReplacmentEmployeeRequest } from '../models/ReplacmentEmployeeReq'; import { WorkListActionHistoryRequest } from '../models/ActionHistoryReq'; import { WorKListRFCEmployeeResponse } from '../models/RFC-EmployeeRes'; import { WorkListActionHistoryResponse } from '../models/ActionHistoryRes'; import { Request } from 'src/app/hmg-common/services/models/request'; @Injectable() export class WorklistService { public static getWorkList = 'Services/ERP.svc/REST/GET_WORKLIST'; public static getReplacmentEmployeeList = 'Services/ERP.svc/REST/GET_REPLACEMENT_LIST'; public static getRFCEmployeeList = 'Services/ERP.svc/REST/GET_RFC_EMPLOYEE_LIST'; public static getActionHistory = 'Services/ERP.svc/REST/GET_ACTION_HISTORY'; public static getFavorite = 'Services/ERP.svc/REST/Mohemm_GetFavoriteReplacements'; public static getFavoriteWithoutImage = 'Services/ERP.svc/REST/Mohemm_GetFavoriteReplacementsWithoutImage'; public static saveFavorite = 'Services/ERP.svc/REST/Mohemm_ChangeFavoriteReplacements'; constructor( public api: ConnectorService, public authService: AuthenticationService, ) { } public getWorkList(WorkListReq: any, onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { const request = WorkListReq; this.authService.authenticateRequest(request); if (isPostNoLoad) { return this.api.postNoLoad(WorklistService.getWorkList, request, onError, errorLabel); } else { return this.api.post(WorklistService.getWorkList, request, onError, errorLabel); } } public getReplacmentEmployeeList(ReplacmentEmployeeRequest: any, onError?: any, errorLabel?: string): Observable { const request = ReplacmentEmployeeRequest; this.authService.authenticateRequest(request); return this.api.post(WorklistService.getReplacmentEmployeeList, request, onError, errorLabel); } public getRFCEmployeeList(ActionHistoryRequest: any, onError?: any, errorLabel?: string): Observable { const request = ActionHistoryRequest; this.authService.authenticateRequest(request); return this.api.post(WorklistService.getRFCEmployeeList, request, onError, errorLabel); } public getActionHistory(historyActionReq: any, onError?: any, errorLabel?: string): Observable { const request = historyActionReq; this.authService.authenticateRequest(request); return this.api.post(WorklistService.getActionHistory, request, onError, errorLabel); } public getFavorite(req: any, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(req); console.log(req); return this.api.post(WorklistService.getFavorite, req, onError, errorLabel); } public getFavoriteByLetter(letter: string, onError?: any, errorLabel?: string): Observable { const req = new Request(); this.authService.authenticateRequest(req); req['ItgFilter'] = letter; console.log(letter); return this.api.post(WorklistService.getFavorite, req, onError, errorLabel); } public saveFavoriteList(request: any, onError?: any, errorLabel?: string): Observable { var req: any = {}; req['Mohemm_ChangeReplacementsInputList'] = request; this.authService.authenticateRequest(req); console.log(req); return this.api.post(WorklistService.saveFavorite, req, onError, errorLabel); } public getFavoriteWithoutImage(req: any, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(req); return this.api.post(WorklistService.getFavoriteWithoutImage, req, onError, errorLabel); } public getFavoriteMyTeam(req: any, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(req); return this.api.post(WorklistService.getFavorite, req, onError, errorLabel); } }