import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
import { useTranslations } from "next-intl";
import { useState } from "react";
import CallReceivedIcon from "@mui/icons-material/CallReceived";
import RevertContent from "@/components/dashboard/navgan-province-manager/Form/RevertForm/RevertContent";

const Revert = ({ rowId, mutate }) => {
    const t = useTranslations();
    const [openRevertDialog, setOpenRevertDialog] = useState(false);
    return (
        <>
            <Tooltip title={t("RevertDialog.revert")}>
                <IconButton color="primary" onClick={() => setOpenRevertDialog(true)}>
                    <CallReceivedIcon />
                </IconButton>
            </Tooltip>
            <Dialog
                fullWidth
                open={openRevertDialog}
                PaperProps={{
                    sx: {
                        boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
                    },
                }}
            >
                <DialogTitle>{t("NavganProvinceManager.revert")}</DialogTitle>
                <RevertContent mutate={mutate} rowId={rowId} setOpenRevertDialog={setOpenRevertDialog} />
            </Dialog>
        </>
    );
};
export default Revert;
