ohctechv3/.svn/pristine/27/275c8f7daf9bd109e986ae5f73c3c3ba1ac93ae2.svn-base

37 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-10-28 15:03:36 +05:30
import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from '@mui/material';
import CancelRoundedIcon from '@mui/icons-material/CancelRounded';
import PropTypes from "prop-types";
const Popup = ({showupdate,setShowupdate,id,handleUpdate, title, children, openPopup, setOpenPopup,resetForm,handleSubmit}) => {
// const { title, children, openPopup, setOpenPopup } = props;
Popup.propTypes = {
id : PropTypes.number.isRequired,
}
return (
<Dialog open={openPopup} maxWidth="md">
<DialogTitle>
<Box sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
<Typography variant='h6' component="div" sx={{ flexGrow: 1 }}>{title}</Typography>
<Button color='error' endIcon={<CancelRoundedIcon />} onClick={() => { setOpenPopup(false) }}>Close</Button>
</Box>
</DialogTitle>
<DialogContent dividers>
{children}
</DialogContent>
<DialogActions>
<Button type="submit" onClick={()=> handleUpdate(id)} variant="outlined" style={{display : showupdate ? "null" : "none" }}>Update</Button>
<Button type="submit" onClick={() => handleSubmit()} variant="outlined" style={{display : showupdate ? "none" : "null" }}>Save</Button>
<Button onClick={() => resetForm()} type="reset" color='warning' variant="outlined">Reset</Button>
</DialogActions>
</Dialog>
)
}
export default Popup;