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.
 
 

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