diff --git a/src/components/dashboard/Roles/DataTable.jsx b/src/components/dashboard/Roles/DataTable.jsx index 7dc50f6..7a1e3c6 100644 --- a/src/components/dashboard/Roles/DataTable.jsx +++ b/src/components/dashboard/Roles/DataTable.jsx @@ -6,7 +6,7 @@ import { useMemo } from "react"; // import RowActions from "./RowActions"; import Toolbar from "./Toolbar"; import moment from "jalali-moment"; -import RowActions from "@/components/dashboard/Users/RowActions"; +import RowActions from "@/components/dashboard/Roles/RowAcctions"; const DataTable = () => { const columns = useMemo( diff --git a/src/components/dashboard/Roles/RowAcctions/Delete/DeleteContent.jsx b/src/components/dashboard/Roles/RowAcctions/Delete/DeleteContent.jsx new file mode 100644 index 0000000..1225fed --- /dev/null +++ b/src/components/dashboard/Roles/RowAcctions/Delete/DeleteContent.jsx @@ -0,0 +1,39 @@ +import { DELETE_ROLE } from "@/core/utils/routes"; +import useRequest from "@/lib/hooks/useRequest"; +import { Button, DialogActions, DialogContent, Stack, Typography } from "@mui/material"; +import { useState } from "react"; + +const DeleteContent = ({ rowId, mutate, setOpenDeleteDialog }) => { + const [submitting, setSubmitting] = useState(false); + const requestServer = useRequest({ notificationSuccess: true }); + const handleClick = async () => { + setSubmitting(true); + try { + await requestServer(`${DELETE_ROLE}/${rowId}`, "delete"); + mutate(); + setOpenDeleteDialog(false); + } catch (error) { + } finally { + setSubmitting(false); + } + }; + return ( + <> + + + آیا از حذف کاربر اطمینان دارید؟ + + + + + + + + ); +}; + +export default DeleteContent; diff --git a/src/components/dashboard/Roles/RowAcctions/Delete/index.jsx b/src/components/dashboard/Roles/RowAcctions/Delete/index.jsx new file mode 100644 index 0000000..7d045bf --- /dev/null +++ b/src/components/dashboard/Roles/RowAcctions/Delete/index.jsx @@ -0,0 +1,32 @@ +import DeleteIcon from "@mui/icons-material/Delete"; +import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"; +import { useState } from "react"; +import DeleteContent from "./DeleteContent"; +const Delete = ({ rowId, mutate }) => { + const [openDeleteDialog, setOpenDeleteDialog] = useState(false); + + return ( + <> + + setOpenDeleteDialog(true)}> + + + + setOpenDeleteDialog(false)} + PaperProps={{ + sx: { + boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + }, + }} + dir="rtl" + maxWidth={"md"} + > + حذف + + + + ); +}; +export default Delete; diff --git a/src/components/dashboard/Roles/RowAcctions/index.jsx b/src/components/dashboard/Roles/RowAcctions/index.jsx index e69de29..e192a81 100644 --- a/src/components/dashboard/Roles/RowAcctions/index.jsx +++ b/src/components/dashboard/Roles/RowAcctions/index.jsx @@ -0,0 +1,12 @@ +import { Box } from "@mui/material"; +import Delete from "./Delete"; +// import UpdateUser from "./Edit"; +const RowActions = ({ row, mutate }) => { + return ( + + + {/**/} + + ); +}; +export default RowActions;