50 lines
1.7 KiB
JavaScript
50 lines
1.7 KiB
JavaScript
import { AddCircle, Close } from "@mui/icons-material";
|
|
import { Button, Dialog, IconButton, Tooltip } from "@mui/material";
|
|
import { useState } from "react";
|
|
import ViolationForm from "./Form";
|
|
|
|
const CreateViolation = ({ mutate }) => {
|
|
const [openMachinesDialog, setOpenMachinesDialog] = useState(false);
|
|
|
|
return (
|
|
<>
|
|
<Tooltip title="ثبت تخلف" arrow placement="left">
|
|
<Button
|
|
size={"small"}
|
|
variant="contained"
|
|
color="primary"
|
|
startIcon={<AddCircle />}
|
|
onClick={() => setOpenMachinesDialog(true)}
|
|
>
|
|
ثبت تخلف
|
|
</Button>
|
|
</Tooltip>
|
|
|
|
<Dialog open={openMachinesDialog} fullWidth maxWidth="sm">
|
|
<IconButton
|
|
aria-label="close"
|
|
onClick={() => setOpenMachinesDialog(false)}
|
|
sx={(theme) => ({
|
|
position: "absolute",
|
|
right: 8,
|
|
top: 8,
|
|
zIndex: 50,
|
|
color: theme.palette.grey[500],
|
|
})}
|
|
>
|
|
<Close />
|
|
</IconButton>
|
|
|
|
{openMachinesDialog && (
|
|
<ViolationForm
|
|
openMachinesDialog={openMachinesDialog}
|
|
setOpenMachinesDialog={setOpenMachinesDialog}
|
|
mutate={mutate}
|
|
/>
|
|
)}
|
|
</Dialog>
|
|
</>
|
|
);
|
|
};
|
|
export default CreateViolation;
|