import { NotificationGetAttachResponse } from './../models/NotificationGetAttachRes'; import { EITTransactionsRequest } from './../models/EITTransactionsReq'; import { Observable } from 'rxjs'; 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 { AddEitResponse } from '../models/add.eit.response'; import { ApproversList } from 'src/app/absence/models/approvers'; import { WorkListButtonRequest } from '../models/NotificationButtonReq'; @Injectable({ providedIn: 'root' }) export class EitService { /* EIT Services URLs */ public static getMenuEntries = 'Services/ERP.svc/REST/GET_MENU_ENTRIES'; public static getEITTransctions = 'Services/ERP.svc/REST/GET_EIT_TRANSACTIONS'; public static getCEITransctions = 'Services/ERP.svc/REST/GET_CEI_TRANSACTIONS'; public static getEITDFFStrutre = 'Services/ERP.svc/REST/GET_EIT_DFF_STRUCTURE'; public static getSetValue = 'Services/ERP.svc/REST/GET_VALUE_SET_VALUES'; public static getDefaultValue = 'Services/ERP.svc/REST/GET_DEFAULT_VALUE'; public static validateEITTransctions = 'Services/ERP.svc/REST/VALIDATE_EIT_TRANSACTION'; public static submitEit = 'Services/ERP.svc/REST/SUBMIT_EIT_TRANSACTION'; public static resubmitEit = 'Services/ERP.svc/REST/RESUBMIT_EIT_TRANSACTION'; public static startEitProcess = 'Services/ERP.svc/REST/START_EIT_APPROVAL_PROCESS'; public static updateAttach = 'Services/ERP.svc/REST/UPDATE_ATTACHMENT'; public static deleteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT'; public static getApproversList = 'Services/ERP.svc/REST/GET_APPROVERS_LIST'; public static addAttachment = 'Services/ERP.svc/REST/ADD_ATTACHMENT'; public static cancelHRTransaction = 'Services/ERP.svc/REST/CANCEL_HR_TRANSACTION'; public static getAttach = 'Services/ERP.svc/REST/GET_ATTACHMENTS'; public static getContactInfo = 'Services/ERP.svc/REST/GET_EMPLOYEE_CONTACTS'; constructor(public authService: AuthenticationService, public con: ConnectorService) { } public getMenuEntries(menuEntries: any, onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { const request = menuEntries; this.authService.authenticateRequest(request); if (isPostNoLoad) { return this.con.postNoLoad(EitService.getMenuEntries, request, onError, errorLabel); } else { return this.con.post(EitService.getMenuEntries, request, onError, errorLabel); } } // tslint:disable-next-line: no-shadowed-variable public getEITTransactionsList(EITTransactionsRequest: EITTransactionsRequest, onError?: any, errorLabel?: string): Observable { const request = EITTransactionsRequest; this.authService.authenticateRequest(request); return this.con.post(EitService.getEITTransctions, request, onError, errorLabel); } // tslint:disable-next-line: no-shadowed-variable public getCEITransactionsList(EITTransactionsRequest: EITTransactionsRequest, onError?: any, errorLabel?: string): Observable { const request = EITTransactionsRequest; this.authService.authenticateRequest(request); return this.con.post(EitService.getCEITransctions, request, onError, errorLabel); } public submitEit(eit: any, onError?: any, errorLabel?: string): Observable { const request = eit; request.EITTransactionTBLModel = eit.EITTransactionTBL; this.authService.authenticateRequest(request); return this.con.post(EitService.submitEit, request, onError, errorLabel); } public validateEITTransaction(validateEITTransactionReq: any, onError?: any, errorLabel?: string): Observable { const request = validateEITTransactionReq; this.authService.authenticateRequest(request); return this.con.post(EitService.validateEITTransctions, request, onError, errorLabel); } public getEITDFFStrutre(EITDFFStrutreReq: any, onError?: any, errorLabel?: string): Observable { const request = EITDFFStrutreReq; this.authService.authenticateRequest(request); return this.con.post(EitService.getEITDFFStrutre, request, onError, errorLabel); } public getSetValue(SetValueReq: any, onError?: any, errorLabel?: string): Observable { const request = SetValueReq; this.authService.authenticateRequest(request); return this.con.post(EitService.getSetValue, request, onError, errorLabel); } public getDefaultValue(DefaultValueReq: any, onError?: any, errorLabel?: string): Observable { const request = DefaultValueReq; this.authService.authenticateRequest(request); return this.con.post(EitService.getDefaultValue, request, onError, errorLabel); } public getApproversList(abProcess: any, onError?: any, errorLabel?: string): Observable { const request = abProcess; request.P_AME_TRANSACTION_TYPE = 'SSHRMS'; request.P_PAGE_NUM = 1; request.P_PAGE_LIMIT = 1000; // check later on this.authService.authenticateRequest(request); return this.con.post(EitService.getApproversList, request, onError, errorLabel); } public addAttachment(addAttachrequest: any, onError?: any, errorLabel?: string): Observable { const request = addAttachrequest; this.authService.authenticateRequest(request); return this.con.post(EitService.addAttachment, request, onError, errorLabel); } public startEitApprovalProcess(eitProcess: any, onError?: any, errorLabel?: string): Observable { const request = eitProcess; this.authService.authenticateRequest(request); return this.con.post(EitService.startEitProcess, request, onError, errorLabel); } public cancelHRTransaction(transactionID: any, onError?: any, errorLabel?: string): Observable { const request = transactionID; this.authService.authenticateRequest(request); return this.con.post(EitService.cancelHRTransaction, request, onError, errorLabel); } public getAttach(getAttachReq: WorkListButtonRequest, onError?: any, errorLabel?: string): Observable { const request = getAttachReq; this.authService.authenticateRequest(request); return this.con.post(EitService.getAttach, request, onError, errorLabel); } public deleteAttach(delteAttachReq: any, onError?: any, errorLabel?: string): Observable { const request = delteAttachReq; this.authService.authenticateRequest(request); return this.con.post(EitService.deleteAttach, request, onError, errorLabel); } public updateAttach(updateAttachReq: any, onError?: any, errorLabel?: string): Observable { const request = updateAttachReq; this.authService.authenticateRequest(request); return this.con.post(EitService.updateAttach, request, onError, errorLabel); } public reSubmitEit(eit: any, onError?: any, errorLabel?: string): Observable { const request = eit; this.authService.authenticateRequest(request); return this.con.post(EitService.resubmitEit, request, onError, errorLabel); } public getContactInfo(request: any, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(request); request.P_SELECTED_EMPLOYEE_NUMBER = request.P_USER_NAME; return this.con.post(EitService.getContactInfo, request, onError, errorLabel); } }