import { Injectable } from "@angular/core"; import { HttpClient, HttpHeaders } from "@angular/common/http"; import { Config } from '../../_helpers/config.class'; import { AuthenticationService } from "../../_services/authentication.service"; import { AdvancesModule } from "./advances.module"; import { AdvanceViewModel, AdvanceInstallmentViewModel } from "./advances-class"; @Injectable() export class AdvancesService { headers: HttpHeaders = new HttpHeaders(); constructor(private http: HttpClient, _authenticationService: AuthenticationService) { this.headers.set('Content-Type', 'application/x-www-form-urlencoded'); this.headers.set('Authorization', 'Bearer ' + _authenticationService.getToken()); } getAdvanceList(): any { return this.http.post(`${Config.getControllerUrl('Advances', 'GetAdvanceList')}`, null); } getAdvanceBulkList(): any { return this.http.post(`${Config.getControllerUrl('Advances', 'GetAdvanceBulkList')}`, null); } public validateAdvanceCode(code: string) { return this.http.post(`${Config.getControllerUrl('Advances', 'ValidateAdvanceCode')}`, { Code: code }); } public validateAdvanceInstallmentCode(code: string) { return this.http.post(`${Config.getControllerUrl('Advances', 'ValidateAdvanceInstallmentCode')}`, { Code: code }); } public saveAdvanceMaster(obj: AdvanceViewModel) { let fd = new FormData(); fd.append('AdvanceViewModel', JSON.stringify(obj)); return this.http.post(`${Config.getControllerUrl('Advances', 'SaveAdvanceMaster')}`, fd); } public saveAdvanceInstallment(obj: AdvanceInstallmentViewModel) { let fd = new FormData(); fd.append('AdvanceInstallmentViewModel', JSON.stringify(obj)); return this.http.post(`${Config.getControllerUrl('Advances', 'SaveAdvanceInstallment')}`, fd); } public saveAdvanceInstallmentAuto(obj: any[]) { let fd = new FormData(); fd.append('AdvanceInstallmentViewModel', JSON.stringify(obj)); return this.http.post(`${Config.getControllerUrl('Advances', 'SaveAdvanceInstallmentAuto')}`, fd); } public deleteAdvanceMaster(id: number) { return this.http.post(`${Config.getControllerUrl('Advances', 'DeleteAdvanceMaster')}`, { Id: id }); } public GetAdvanceInstallmentList() { return this.http.post(`${Config.getControllerUrl('Advances', 'GetAdvanceInstallmentList')}`, { Id: null }); } public DeleteAdvanceInstallment(id: number) { return this.http.post(`${Config.getControllerUrl('Advances', 'DeleteAdvanceInstallment')}`, { Id: id }); } public GetAdvanceInstallmentListByMastId(id){ return this.http.post(`${Config.getControllerUrl('Advances', 'GetAdvanceInstallmentListByMastId')}`, { Id: id }); } // public getEmployeeList(skip: number, pageSize: number, query: string) { // return this.http.post(, { Skip: skip, PageSize: pageSize, Query: query, HfId: hfId, GeoLvlCode: geoLvlCode, HfType: hfType, StockId: stockId }); // } }