import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
import { RestorePage } from "@mui/icons-material";
import HistoryContent from "./HistoryContent";
import { useState } from "react";

const History = ({ rowId }) => {
    const [openReferReasonDialog, setOpenReferReasonDialog] = useState(false);

    return (
        <>
            <Tooltip title="تاریخچه">
                <IconButton color="warning" onClick={() => setOpenReferReasonDialog(true)}>
                    <RestorePage />
                </IconButton>
            </Tooltip>
            <Dialog
                fullWidth
                maxWidth={"md"}
                open={openReferReasonDialog}
                PaperProps={{
                    sx: {
                        boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
                    },
                }}
            >
                <DialogTitle>تاریخچه</DialogTitle>
                <HistoryContent rowId={rowId} setOpenReferReasonDialog={setOpenReferReasonDialog} />
            </Dialog>
        </>
    );
};

export default History;
