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 { CoustomerContrectViewMode, EmployeeAssiginingModel, CoustomerCashMastModel, CusCashReturn, DirectCashCollectionViewModel } from "./coustomer-class"; import { JsonPipe } from "@angular/common"; import { LocalService } from "../../_services/local.service"; @Injectable() export class CoustomerServices { headers: HttpHeaders = new HttpHeaders(); constructor(private http: HttpClient, _authenticationService: AuthenticationService, private _localService: LocalService) { this.headers.set('Content-Type', 'application/x-www-form-urlencoded'); this.headers.set('Authorization', 'Bearer ' + _authenticationService.getToken()) } public saveContrct(obj: CoustomerContrectViewMode) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'SaveContrect')}`, obj); } public getContrectList(skip: number, pageSize: number, query: string, hfId: string, geoLvlCode: string, hfType: string, stockId: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetContrectList')}`, { Skip: skip, PageSize: pageSize, Query: query, HfId: hfId, GeoLvlCode: geoLvlCode, HfType: hfType, StockId: stockId }); } public getContretcById(id: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetContretcById')}`, { Id: id }); } public getContrectListDDL(id: string, type: string) { debugger; return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetContrectListDDL')}`, { Code: id, Type: type }); } public getAvalibelEmployee(id: string, mode: string) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetAvalibelEmployee')}`, { Code: id, Type: mode }); } public getEmployeeDetail(id: number, cid: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetEmployeeDetail')}`, { Id: id, Cid: cid }); } public saveEmployForContrect(obj: EmployeeAssiginingModel) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'SaveEmployForContrect')}`, obj); } public getAssingedEmpDtl(id: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetAssingedEmpDtl')}`, { Id: id }); } public getAssingedEmployee(id: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetAssingedEmployee')}`, { Id: id }); } public ChangeCOntrectStatus(id: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'ChangeCOntrectStatus')}`, { Id: id }); } public saveCoustomerCash(obj: CoustomerCashMastModel) { console.log(obj); this._localService.dateTransFuckDatesInObject(obj); console.log(obj); return this.http.post(`${Config.getControllerUrl('Coustomer', 'SaveCoustomerCash')}`, obj); } public getRecevingList(skip: number, pageSize: number, query: string, hfId: string, geoLvlCode: string, hfType: string, stockId: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetRecevingList')}`, { Skip: skip, PageSize: pageSize, Query: query, HfId: hfId, GeoLvlCode: geoLvlCode, HfType: hfType, StockId: stockId }); } public getRetrutningList(skip: number, pageSize: number, query: string, hfId: string, geoLvlCode: string, hfType: string, stockId: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetRetrutningList')}`, { Skip: skip, PageSize: pageSize, Query: query, HfId: hfId, GeoLvlCode: geoLvlCode, HfType: hfType, StockId: stockId }); } public getRecevingDetail(id: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetRecevingDetail')}`, { Id: id }); } public saveEmpCahsReturnAdjustment(obj) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'SaveEmpCahsReturnAdjustment')}`, obj); } public saveEmpCahsReturn(obj: CusCashReturn) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'SaveEmpCahsReturn')}`, obj); } public getRetrutningById(id: number) { return this.http.post(`${Config.getControllerUrl('Coustomer', 'GetRetrutningById')}`, { Id: id }); } public saveUnassindEmployee(code: number, date: any, cid: number) { debugger; return this.http.post(`${Config.getControllerUrl('Coustomer', 'SaveUnassindEmployee')}`, { Id: code, Date: date, Cid: cid }); } public UnAssingEmployee() { debugger; return this.http.get(`${Config.getControllerUrl('Coustomer', 'UnAssingEmployee')}`); } // Direct cash collection public GetDCCList() { return this.http.post(`${Config.getControllerUrl('DirectCashCollection', 'GetDCCList')}`, { Id: 0 }); } public GetDCCById(id: number) { return this.http.post(`${Config.getControllerUrl('DirectCashCollection', 'GetDCCById')}`, { Id: id }); } public GetDCCListByEmployeId(id: number) { return this.http.post(`${Config.getControllerUrl('DirectCashCollection', 'GetDCCListByEmployeId')}`, { Id: id }); } public SaveDCC(obj: DirectCashCollectionViewModel) { this._localService.dateTransFuckDatesInObject(obj); let fd = new FormData(); fd.append('Attachment', obj.file); fd.append('Obj', JSON.stringify(obj)); return this.http.post(`${Config.getControllerUrl('DirectCashCollection', 'SaveDCC')}`, fd); } public DeleteDCC(id: number) { return this.http.post(`${Config.getControllerUrl('DirectCashCollection', 'DeleteDCC')}`, { Id: id }); } }