import PhotoLibraryIcon from "@mui/icons-material/PhotoLibrary";
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Tooltip } from "@mui/material";
import { useState } from "react";
import ImageFormContent from "./ImageFormContent";

const ImageDialog = ({ image_before, image_after }) => {
    const [openImageDialog, setOpenImageDialog] = useState(false);

    return (
        <>
            <Tooltip title="تصاویر">
                <IconButton color="primary" onClick={() => setOpenImageDialog(true)}>
                    <PhotoLibraryIcon />
                </IconButton>
            </Tooltip>
            <Dialog
                fullWidth
                open={openImageDialog}
                onClose={() => setOpenImageDialog(false)}
                PaperProps={{
                    sx: {
                        boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
                    },
                }}
                maxWidth={"sm"}
                scroll="paper"
            >
                <DialogTitle sx={{ fontSize: "large" }}>تصاویر</DialogTitle>
                <DialogContent>
                    {openImageDialog && (
                        <>
                            <ImageFormContent image={image_before} title={"عکس قبل از اقدام"} />
                            <ImageFormContent image={image_after} title={"عکس بعد از اقدام"} />
                        </>
                    )}
                </DialogContent>
                <DialogActions>
                    <Button onClick={() => setOpenImageDialog(false)} variant="outlined" color="secondary">
                        بستن
                    </Button>
                </DialogActions>
            </Dialog>
        </>
    );
};
export default ImageDialog;
