"use client";
import { Edit } from "@mui/icons-material";
import { Dialog, IconButton, Tooltip } from "@mui/material";
import { useState } from "react";
import UpdateUserForm from "./Form";

const UpdateUser = ({ values, mutate }) => {
  const [open, setOpen] = useState(false);

  const handleOpen = () => {
    setOpen(true);
  };

  return (
    <>
      <Tooltip title="ویرایش">
        <IconButton onClick={handleOpen}>
          <Edit />
        </IconButton>
      </Tooltip>
      <Dialog maxWidth="sm" fullWidth={true} open={open}>
        <UpdateUserForm
          open={open}
          setOpen={setOpen}
          mutate={mutate}
          values={values}
        />
      </Dialog>
    </>
  );
};
export default UpdateUser;
