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.
88 lines
4.1 KiB
TypeScript
88 lines
4.1 KiB
TypeScript
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<any> {
|
|
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<any> {
|
|
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<any> {
|
|
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<WorkListActionHistoryResponse> {
|
|
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<WorkListActionHistoryResponse> {
|
|
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<WorkListActionHistoryResponse> {
|
|
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<any> {
|
|
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<WorkListActionHistoryResponse> {
|
|
this.authService.authenticateRequest(req);
|
|
return this.api.post(WorklistService.getFavoriteWithoutImage, req, onError, errorLabel);
|
|
}
|
|
|
|
public getFavoriteMyTeam(req: any, onError?: any, errorLabel?: string): Observable<any> {
|
|
this.authService.authenticateRequest(req);
|
|
return this.api.post(WorklistService.getFavorite, req, onError, errorLabel);
|
|
}
|
|
}
|
|
|