Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

159 Zeilen
6.0 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. Autocomplete,
  18. TextField
  19. } from '@mui/material';
  20. import { Grid } from "../../../node_modules/@mui/material/index";
  21. import * as ComboData from "utils/ComboData";
  22. import { useFormik,FormikProvider } from 'formik';
  23. import * as yup from 'yup';
  24. const StatusChangeDialog = (props) => {
  25. const [status, setStatus] = useState("");
  26. // const [selectedGazetteGroupInputType, setSelectedGazetteGroupInputType] = useState("");
  27. const groupTitleComboList = ComboData.groupTitle;
  28. useEffect(() => {
  29. // console.log(Object.keys(!props.selectedGazetteGroup).length)
  30. if(props.getStatus == "accept"){
  31. setStatus("Accept")
  32. }else if (props.getStatus == "reject"){
  33. setStatus("Reject")
  34. }else if (props.getStatus == "complete"){
  35. setStatus("Complete")
  36. }else if (props.getStatus == "withdraw"){
  37. setStatus("Withdraw")
  38. }
  39. }, [props.getStatus]);
  40. const acceptedHandle = () => () =>{
  41. // console.log(selectedGazetteGroup)
  42. props.setStatusWindowAccepted(true)
  43. };
  44. const formik = useFormik({
  45. initialValues:({
  46. username:'',
  47. }),
  48. validationSchema:yup.object().shape({
  49. }),
  50. });
  51. // const handleReset = () => {
  52. // setSelectedGazetteGroupInputType("")
  53. // selectedGazetteGroup({});
  54. // };
  55. return (
  56. <Dialog
  57. open={props.open}
  58. onClose={props.handleClose}
  59. fullWidth={true}
  60. maxWidth={'md'}
  61. >
  62. <DialogTitle >
  63. <Grid container>
  64. <Grid item>
  65. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  66. <Typography variant="h4">
  67. {status} Application
  68. </Typography>
  69. </Stack>
  70. </Grid>
  71. </Grid>
  72. </DialogTitle>
  73. <FormikProvider value={formik}>
  74. <form>
  75. <DialogContent>
  76. <DialogContentText>
  77. {props.getStatus == "accept"?
  78. <Grid container direction="row" justifyContent="center" alignItems="center">
  79. <Grid item xs={12} md={8} lg={8} sx={{mb: 1,}}>
  80. <Grid container alignItems={"center"}>
  81. <Grid item xs={12} md={2} lg={3}
  82. sx={{display: 'flex', alignItems: 'center'}}>
  83. <Typography>Target Issue:</Typography>
  84. </Grid>
  85. <Grid item xs={12} md={9} lg={9}>
  86. <FormLabel>
  87. {props.gazetteIssue+", "}{props.issueNum+", "}{props.issueDate}
  88. </FormLabel>
  89. </Grid>
  90. </Grid>
  91. </Grid>
  92. <Grid item xs={12} md={8} lg={8} sx={{mb: 1,height:"180px"}}>
  93. <Grid container alignItems={"center"}>
  94. <Grid item xs={12} md={3} lg={3}
  95. sx={{display: 'flex', alignItems: 'center'}}>
  96. <Typography>Grazette Group:</Typography>
  97. </Grid>
  98. <Grid item xs={12} md={9} lg={9}>
  99. <Autocomplete
  100. disablePortal
  101. id="gazetteGroup"
  102. options={groupTitleComboList}
  103. filterOptions={(options)=>options}
  104. inputValue={props.selectedGazetteGroupInputType}
  105. onChange={(event, newValue) => {
  106. if (newValue!=null && newValue != {}){
  107. props.setSelectedGazetteGroupInputType(newValue.label);
  108. props.setSelectedGazetteGroup(newValue);
  109. formik.setFieldValue("gazetteGroup","")
  110. }else{
  111. props.setSelectedGazetteGroupInputType("");
  112. }
  113. }}
  114. // sx={{"& .MuiInputBase-root": { height: "41px" },"#idDocType":{padding: "0px 0px 0px 0px"}, "& .MuiAutocomplete-endAdornment": { top: "auto" },}}
  115. renderInput={(params) => <TextField {...params} placeholder=""/>}
  116. />
  117. </Grid>
  118. </Grid>
  119. </Grid>
  120. </Grid>:
  121. <Grid container direction="row" justifyContent="center" alignItems="center">
  122. <Grid item xs={12} md={5} lg={5} sx={{mb: 5,}}>
  123. <FormLabel sx={{fontSize: "20px", color:"#000000",textAlign:"center"}}>
  124. Are you really {status} the Application?
  125. </FormLabel>
  126. </Grid>
  127. </Grid>
  128. }
  129. </DialogContentText>
  130. </DialogContent>
  131. </form>
  132. </FormikProvider>
  133. <Stack direction="row" justifyContent="space-around">
  134. <DialogActions>
  135. <Button variant="contained" onClick={props.handleClose} autoFocus >
  136. Cancel
  137. </Button>
  138. </DialogActions>
  139. <DialogActions>
  140. <Button variant="contained" color="success" onClick={acceptedHandle()} autoFocus disabled={Object.keys(props.selectedGazetteGroup).length === 0&&status==="Accept"}>
  141. {status==="Accept"?"Confirm":status}
  142. </Button>
  143. </DialogActions>
  144. </Stack>
  145. </Dialog>
  146. );
  147. };
  148. export default StatusChangeDialog;