You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

103 rivejä
2.7 KiB

  1. import {
  2. useEffect,
  3. useState
  4. } from "react";
  5. // material-ui
  6. import {
  7. Button,
  8. // Link,
  9. Stack,
  10. Typography,
  11. Dialog,
  12. DialogActions,
  13. DialogContent,
  14. DialogContentText,
  15. DialogTitle,
  16. FormLabel,
  17. } from '@mui/material';
  18. import { Grid } from "../../../../node_modules/@mui/material/index";
  19. import { useFormik,FormikProvider } from 'formik';
  20. import * as yup from 'yup';
  21. const StatusChangeDialog = (props) => {
  22. const [status, setStatus] = useState("");
  23. useEffect(() => {
  24. console.log(Object.keys(!props.selectedGazetteGroup).length)
  25. if(props.getStatus == "cancel"){
  26. setStatus("取消")
  27. }
  28. }, [props.getStatus]);
  29. const acceptedHandle = () => () =>{
  30. // console.log(selectedGazetteGroup)
  31. props.setStatusWindowAccepted(true)
  32. };
  33. const formik = useFormik({
  34. initialValues:({
  35. username:'',
  36. }),
  37. validationSchema:yup.object().shape({
  38. }),
  39. });
  40. // const handleReset = () => {
  41. // setSelectedGazetteGroupInputType("")
  42. // selectedGazetteGroup({});
  43. // };
  44. return (
  45. <Dialog
  46. open={props.open}
  47. onClose={props.handleClose}
  48. fullWidth={true}
  49. maxWidth={'xs'}
  50. >
  51. <DialogTitle >
  52. <Grid container>
  53. <Grid item>
  54. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  55. <Typography variant="h4" color="error">
  56. {status}公共啟事
  57. </Typography>
  58. </Stack>
  59. </Grid>
  60. </Grid>
  61. </DialogTitle>
  62. <FormikProvider value={formik}>
  63. <form>
  64. <DialogContent>
  65. <DialogContentText>
  66. <Grid container direction="row" justifyContent="center" alignItems="center">
  67. <Grid item xs={12} md={5} lg={5} sx={{mb: 5,}}>
  68. <FormLabel sx={{fontSize: "18px", color:"#000000",textAlign:"center"}}>
  69. 確定{status}公共啟事?
  70. </FormLabel>
  71. </Grid>
  72. </Grid>
  73. </DialogContentText>
  74. </DialogContent>
  75. </form>
  76. </FormikProvider>
  77. <Stack direction="row" justifyContent="space-around">
  78. <DialogActions>
  79. <Button variant="contained" onClick={props.handleClose} autoFocus>
  80. 取消
  81. </Button>
  82. </DialogActions>
  83. <DialogActions>
  84. <Button variant="contained" color="error" onClick={acceptedHandle()} autoFocus >
  85. 確定
  86. </Button>
  87. </DialogActions>
  88. </Stack>
  89. </Dialog>
  90. );
  91. };
  92. export default StatusChangeDialog;