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 { WorkListBodyRequest } from "../models/NotificationBodyReq"; import { EITNotificatonBodyResponse } from "../models/EITNotificationBodyRes"; import { AbsenceNotificatonBodyResponse } from "../models/AbsenceNotificationBodyRes"; import { WorkListButtonRequest } from "../models/NotificationButtonReq"; import { NotificatonButtonResponse } from "../models/NotificationButtonRes"; import { WorklistsubmitterInfoResponse } from "../models/WorklistsubmitterInfoRes"; import { WorkListSubmitterInfoRequest } from "../models/WorklistsubmitterInfoReq"; import { WorkListActionRequest } from "../models/NotificationActionReq"; @Injectable() export class WorklistMainService { public static getEITNotificationBody = "Services/ERP.svc/REST/GET_EIT_NOTIFICATION_BODY"; public static getAbsenceNotificationBody = "Services/ERP.svc/REST/GET_ABSENCE_NOTIFICATION_BODY"; public static getNotificationButtons = "Services/ERP.svc/REST/GET_NOTIFICATION_BUTTONS"; public static getUserInfo = "Services/ERP.svc/REST/Get_UserInformation"; public static getNotificationAction = "Services/ERP.svc/REST/NOTIFICATION_ACTIONS"; public static getNotificationRespondAtt = "Services/ERP.svc/REST/NOTIFICATION_GET_RESPOND_ATTRIBUTES"; constructor( public api: ConnectorService, public authService: AuthenticationService ) {} public getEITNotificationBody( WorkListBodyRequest: any, onError?: any, errorLabel?: string ): Observable { const request = WorkListBodyRequest; this.authService.authenticateRequest(request); return this.api.post( WorklistMainService.getEITNotificationBody, request, onError, errorLabel ); } public getAbsencesNotificationBody( WorkListBodyRequest: any, onError?: any, errorLabel?: string ): Observable { const request = WorkListBodyRequest; this.authService.authenticateRequest(request); return this.api.post( WorklistMainService.getAbsenceNotificationBody, request, onError, errorLabel ); } public getNotificationButtons( WorkListButtonRequest: any, onError?: any, errorLabel?: string ): Observable { const request = WorkListButtonRequest; this.authService.authenticateRequest(request); return this.api.post( WorklistMainService.getNotificationButtons, request, onError, errorLabel ); } public getSubmitterInfo( worklistsubmitterInfoObj: any, onError?: any, errorLabel?: string ): Observable { const request = worklistsubmitterInfoObj; this.authService.authenticateRequest(request); return this.api.post( WorklistMainService.getUserInfo, request, onError, errorLabel ); } public actionButton( WorkListActionRequest: any, onError?: any, errorLabel?: string ): Observable { const request = WorkListActionRequest; this.authService.authenticateRequest(request); return this.api.post( WorklistMainService.getNotificationAction, request, onError, errorLabel ); } public notificationResponseAttr( notifiResAttRequest: any, onError?: any, errorLabel?: string ): Observable { const request = notifiResAttRequest; this.authService.authenticateRequest(request); return this.api.post( WorklistMainService.getNotificationRespondAtt, request, onError, errorLabel ); } }