shoc-frontend-new/src/pages/followup/new/api.js
2026-01-11 17:35:46 -06:00

43 lines
1 KiB
JavaScript

import { get, post } from "../../../apiUtil";
import { API_URL } from "../../../constants";
export const fetchFollowUpsPaged = async ({
search = "",
page = 1,
pageSize = 12,
completed = false,
}) => {
const res = await get(
`${API_URL}/FollowUp/GetFollowUpList?search=${encodeURIComponent(
search
)}&page=${page}&pageSize=${pageSize}&completed=${completed}`
);
const rows = (res?.Data || []).map((x) => ({
id: x.Id,
reason: x.Reason,
scheduleDate: x.ScheduleDate,
account: x.Account,
assignedTo: x.AssignedTo,
locationName: x.LocationName,
workOrderNumber: x.WorkOrderNumber,
status: x.Status,
}));
return {
rows,
page: res.PageNumber,
pageSize: res.PageSize,
totalCount: res.TotalCount,
totalPages: res.TotalPages,
};
};
export const getFollowUpById = (id) =>
get(`${API_URL}/FollowUp/GetById?id=${id}`);
export const saveFollowUp = (payload) =>
post(`${API_URL}/FollowUp/Save`, payload);
export const deleteFollowUp = (id) =>
get(`${API_URL}/FollowUp/Delete?id=${id}`);