import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
import {useState} from "react";
import EditIcon from '@mui/icons-material/Edit';
import EditContent from "@/components/dashboard/bank-management/Form/Edit/EditContent";

const EditForm = ({rowId, row, mutate, vehicle_type}) => {
    const t = useTranslations();
    const [openEditDialog, setOpenEditDialog] = useState(false);

    return (
        <>
            <Tooltip title={t("EditDialog.edit_approved_amount")}>
                <IconButton
                    color="primary"
                    onClick={() => {
                        setOpenEditDialog(true)
                    }}
                >
                    <EditIcon/>
                </IconButton>
            </Tooltip>
            <Dialog fullWidth open={openEditDialog}
                    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'
                        }
                    }} maxWidth="sm">
                <DialogTitle>{t("EditDialog.edit_approved_amount")}</DialogTitle>
                <EditContent
                    mutate={mutate} rowId={rowId} setOpenEditDialog={setOpenEditDialog} row={row}
                    vehicle_type={vehicle_type}
                />
            </Dialog>
        </>
    )

}
export default EditForm;