import { Dialog, DialogTitle, IconButton } from "@mui/material"; import CreateFormContent from "./CreateFormContent"; import CloseIcon from "@mui/icons-material/Close"; import useRequest from "@/lib/hooks/useRequest"; import { CREATE_USER_ACTIVITY } from "@/core/utils/routes"; import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog"; const CreateForm = ({ open, setOpen, mutate }) => { const requestServer = useRequest({ notificationSuccess: true }); const defaultValues = { title: "", log_unique_code: "", action_type: "", }; const onSubmit = async (result) => { const formData = new FormData(); formData.append("description", result.title); formData.append("log_unique_code", result.log_unique_code); formData.append("action_type", result.action_type); await requestServer(CREATE_USER_ACTIVITY, "post", { data: formData, }) .then(() => { mutate(); setOpen(false); }) .catch(() => {}); }; return ( setOpen(false)} sx={(theme) => ({ position: "absolute", right: 8, top: 8, zIndex: 50, color: theme.palette.grey[500], })} > ثبت فعالیت کاربران {open && ( )} ); }; export default CreateForm;