import { Button, Dialog, DialogActions, DialogTitle, IconButton, Tooltip } from "@mui/material";
import GroupsIcon from "@mui/icons-material/Groups";
import { useState } from "react";
import RahdaranContent from "./RahdaranContent";

const RahdaranDialog = ({ rowId }) => {
    const [openRahdaranDialog, setOpenRahdaranDialog] = useState(false);
    return (
        <>
            <Tooltip title="افراد">
                <IconButton color="primary" onClick={() => setOpenRahdaranDialog(true)}>
                    <GroupsIcon />
                </IconButton>
            </Tooltip>
            <Dialog
                fullWidth
                open={openRahdaranDialog}
                onClose={() => setOpenRahdaranDialog(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={"sm"}
            >
                <DialogTitle sx={{ fontSize: "large" }}>لیست افراد</DialogTitle>
                {openRahdaranDialog && <RahdaranContent rowId={rowId} />}
                <DialogActions>
                    <Button onClick={() => setOpenRahdaranDialog(false)} variant="outlined" color="secondary" autoFocus>
                        بستن
                    </Button>
                </DialogActions>
            </Dialog>
        </>
    );
};
export default RahdaranDialog;
