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 { Heads } from "./setting.class"; import { Observable } from "rxjs/Observable"; @Injectable() export class SettingServices { 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()); } public savePrehead(obj: Heads) { return this.http.post(`${Config.getControllerUrl('Setting', 'SaveHeads')}`, obj); } public RemoveHead(obj: number) { return this.http.post(`${Config.getControllerUrl('Setting', 'RemoveHead')}`, { Id: obj }); } public getHeaderFooter() { return this.http.get(`${Config.getControllerUrl('Setting', 'GetHeaderFooter')}`); } public saveHeaderFootrer(obj: any) { const formData = new FormData(); formData.append('file', obj.file); formData.append('Obj', JSON.stringify(obj)); return this.http.post(`${Config.getControllerUrl('Setting', 'SaveHeaderFootrer')}`, formData); } public removeHeaderFootrerLetterHead(id: any) { return this.http.post(`${Config.getControllerUrl('Setting', 'RemoveHeaderFootrerLetterHead')}`, { Id: id }); } public saveVisaExpenseHead(obj: any) { return this.http.post(`${Config.getControllerUrl('VisaExpenseHead', 'SaveVisaExpenseHead')}`, obj); } public getVisaExpenseHeadList(): Observable { return this.http.get(`${Config.getControllerUrl('VisaExpenseHead', 'GetVisaExpenseHeadList')}`); } public removeVisaExpenseHead(obj: any) { return this.http.post(`${Config.getControllerUrl('VisaExpenseHead', 'DeleteVisaExpenseHead')}`, obj); } }