import { Dialog, DialogTitle, IconButton, Stack, Tooltip } from "@mui/material";
import ReplyIcon from "@mui/icons-material/Reply";
import DialogTransition from "@/core/components/DialogTransition";
import ReferFormContext from "@/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/ReferFormContext";
import { useState } from "react";

const ReferForm = ({ rowId, mutate }) => {
    const [openReferDialog, setOpenReferDialog] = useState(false);
    return (
        <Stack>
            <Tooltip title="ارجاع به شهرستان دیگر" arrow placement="right">
                <IconButton
                    color="primary"
                    sx={{ textTransform: "unset", alignSelf: "center" }}
                    onClick={() => {
                        setOpenReferDialog(true);
                    }}
                >
                    <ReplyIcon />
                </IconButton>
            </Tooltip>
            <Dialog
                PaperProps={{
                    sx: {
                        transition: "all .3s",
                        boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
                    },
                }}
                open={openReferDialog}
                fullWidth
                TransitionComponent={DialogTransition}
            >
                <DialogTitle sx={{ m: 0, p: 2, borderBottom: 1, borderColor: "divider" }} id="create-dialog">
                    ارجاع به شهرستان دیگر
                </DialogTitle>
                <ReferFormContext rowId={rowId} mutate={mutate} setOpenReferDialog={setOpenReferDialog} />
            </Dialog>
        </Stack>
    );
};
export default ReferForm;
