import {useTranslations} from "next-intl";
import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material";
import EditIcon from '@mui/icons-material/Edit';
import {useState} from "react";
import UpdateContent from "./UpdateContent";


const Update = ({row, mutate}) => {
    const t = useTranslations();
    const [openUpdateDialog, setOpenUpdateDialog] = useState(false);

    return (
        <>
            <Tooltip title={t("ExpertMangement.update_tooltip")}>
                <IconButton
                    color="primary"
                    onClick={() => {
                        setOpenUpdateDialog(true)
                    }}
                >
                    <EditIcon/>
                </IconButton>
            </Tooltip>
            <Dialog fullWidth maxWidth={'lg'} open={openUpdateDialog}
                    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("ExpertMangement.update")}</DialogTitle>
                <UpdateContent row={row} mutate={mutate} setOpenUpdateDialog={setOpenUpdateDialog}/>
            </Dialog>
        </>
    );
};
export default Update;