// src/pages/followups/followUpApi.js import { get, post } from "../../../apiUtil"; import { API_URL } from "../../../constants"; export const fetchFollowUpsPaged = async ({ search = "", page = 1, pageSize = 12, status = "Open" }) => { const res = await get( `${API_URL}/FollowUp/GetFollowUpList?search=${encodeURIComponent( search )}&page=${page}&pageSize=${pageSize}&status=${status}` ); const rows = (res?.data || res?.Data || []).map(x => ({ id: x.id ?? x.Id, reason: x.reason ?? x.Reason ?? "", scheduleDate: x.scheduleDate ?? x.ScheduleDate ?? "", scheduleTime: x.scheduleStartTime ?? x.ScheduleStartTime ?? "", account: x.accountName ?? x.AccountName ?? "", assignedTo: x.employeeName ?? x.EmployeeName ?? "", locationNumber: x.locationNumber ?? x.LocationNumber ?? "", locationName: x.locationName ?? x.LocationName ?? "", workOrderCode: x.workOrderCode ?? x.WorkOrderCode ?? "", status: x.status ?? x.Status ?? "" })); return { rows, page: res?.pageNumber ?? res?.PageNumber ?? 1, pageSize: res?.pageSize ?? res?.PageSize ?? pageSize, totalCount: res?.totalCount ?? res?.TotalCount ?? rows.length, totalPages: res?.totalPages ?? res?.TotalPages ?? 1 }; }; export const createFollowUp = data => post(`${API_URL}/FollowUp/Create`, data); export const updateFollowUp = data => post(`${API_URL}/FollowUp/Update`, data); export const completeFollowUp = id => post(`${API_URL}/FollowUp/Complete?id=${id}`); export const cancelFollowUp = id => post(`${API_URL}/FollowUp/Cancel?id=${id}`);