import React, { useEffect, useState } from "react"; import { useNavigate, useParams } from "react-router-dom"; import { getFollowUpById, saveFollowUp } from "../new/api"; export default function FollowUpFormPage() { const navigate = useNavigate(); const { id } = useParams(); const [form, setForm] = useState({ id: 0, followUpTypeId: 0, workOrderId: null, scheduleDate: "", scheduleTime: "", employeeId: "", reason: "", completeFollowUp: false, }); useEffect(() => { if (id) { getFollowUpById(id).then((res) => { setForm(res); }); } }, [id]); const handleChange = (e) => { const { name, value, type, checked } = e.target; setForm({ ...form, [name]: type === "checkbox" ? checked : value, }); }; const handleSubmit = async (e) => { e.preventDefault(); await saveFollowUp(form); navigate("/followups"); }; return (