import { api } from "../utils/axiosClient"; import { DirectoryRepository } from "./DirectoryRepository"; export const CollectionRepository = { createNewCollection: (data) => api.post(`/api/Collection/invoice/create`, data), updateCollection: (id, data) => { api.put(`/api/Collection/invoice/edit/${id}`, data); }, // getCollections: (pageSize, pageNumber,fromDate,toDate, isPending,isActive,projectId, searchString) => { // let url = `/api/Collection/invoice/list?pageSize=${pageSize}&pageNumber=${pageNumber}&isPending=${isPending}&isActive=${isActive}&searchString=${searchString}`; // const params = []; // if (fromDate) params.push(`fromDate=${fromDate}`); // if (toDate) params.push(`toDate=${toDate}`); // if(projectId) params.push(`projectId=${projectId}`) // if (params.length > 0) { // url += `&${params.join("&")}`; // } // return api.get(url); // }, getCollections: ( projectId, searchString, fromDate, toDate, pageSize, pageNumber, isActive, isPending, filter ) => { let url = `/api/Collection/invoice/list`; const params = []; if (projectId) params.push(`projectId=${projectId}`); if (searchString) params.push(`search=${searchString}`); if (fromDate) params.push(`dateFrom=${fromDate}`); if (toDate) params.push(`dateTo=${toDate}`); if (pageSize) params.push(`pageSize=${pageSize}`); if (pageNumber) params.push(`pageNumber=${pageNumber}`); if (isActive) params.push(`isActive=${isActive}`); if (isPending) params.push(`isPending=${isPending}`); if (filter) params.push(`filter=${filter}`); if (params.length > 0) { url += "?" + params.join("&"); } return api.get(url); }, makeReceivePayment: (data) => api.post(`/api/Collection/invoice/payment/received`, data), markPaymentReceived: (invoiceId) => api.put(`/api/Collection/invoice/marked/completed/${invoiceId}`), getCollection: (id) => api.get(`/api/Collection/invoice/details/${id}`), addComment: (data) => api.post(`/api/Collection/invoice/add/comment`, data), };