| @@ -5,7 +5,8 @@ import { | |||||
| Grid, | Grid, | ||||
| Typography, FormLabel, | Typography, FormLabel, | ||||
| OutlinedInput, | OutlinedInput, | ||||
| Stack | |||||
| Stack, | |||||
| Dialog, DialogTitle, DialogContent, DialogActions, | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| const MainCard = Loadable(lazy(() => import('components/MainCard'))); | const MainCard = Loadable(lazy(() => import('components/MainCard'))); | ||||
| import { useForm } from "react-hook-form"; | import { useForm } from "react-hook-form"; | ||||
| @@ -43,6 +44,9 @@ const ApplicationDetailCard = ( | |||||
| const { register } = useForm() | const { register } = useForm() | ||||
| const [isWarningPopUp, setIsWarningPopUp] = useState(false); | |||||
| const [warningText, setWarningText] = useState(""); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| //if user data from parent are not null | //if user data from parent are not null | ||||
| // console.log(applicationDetailData) | // console.log(applicationDetailData) | ||||
| @@ -94,8 +98,14 @@ const ApplicationDetailCard = ( | |||||
| }; | }; | ||||
| const onProofClick = () => { | const onProofClick = () => { | ||||
| window.open("/proof/create/" + currentApplicationDetailData.id, "_blank", "noreferrer"); | |||||
| window.addEventListener("focus", onFocus) | |||||
| if (applicationDetailData.data.groupNo) { | |||||
| window.open("/proof/create/" + currentApplicationDetailData.id, "_blank", "noreferrer"); | |||||
| window.addEventListener("focus", onFocus) | |||||
| }else{ | |||||
| setWarningText("Please generate Gazette Code before Create Proof."); | |||||
| setIsWarningPopUp(true); | |||||
| } | |||||
| } | } | ||||
| const onFocus = () => { | const onFocus = () => { | ||||
| @@ -145,14 +155,14 @@ const ApplicationDetailCard = ( | |||||
| spacing={2} | spacing={2} | ||||
| mb={2} | mb={2} | ||||
| > | > | ||||
| {currentApplicationDetailData.status == "submitted"||currentApplicationDetailData.status == "reviewed" ? | |||||
| {currentApplicationDetailData.status == "submitted" || currentApplicationDetailData.status == "reviewed" ? | |||||
| <> | <> | ||||
| <Button | <Button | ||||
| // size="large" | // size="large" | ||||
| variant="contained" | variant="contained" | ||||
| onClick={reSubmitClick()} | onClick={reSubmitClick()} | ||||
| color="orange" | color="orange" | ||||
| > | |||||
| > | |||||
| <ReplayIcon /> | <ReplayIcon /> | ||||
| <Typography ml={1}> Re-submit</Typography> | <Typography ml={1}> Re-submit</Typography> | ||||
| </Button> | </Button> | ||||
| @@ -481,6 +491,17 @@ const ApplicationDetailCard = ( | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| </form> | </form> | ||||
| <div> | |||||
| <Dialog open={isWarningPopUp} onClose={() => setIsWarningPopUp(false)} > | |||||
| <DialogTitle>Warning</DialogTitle> | |||||
| <DialogContent style={{ display: 'flex', }}> | |||||
| <Typography variant="h3" style={{ padding: '16px' }}>{warningText}</Typography> | |||||
| </DialogContent> | |||||
| <DialogActions> | |||||
| <Button onClick={() => setIsWarningPopUp(false)}>OK</Button> | |||||
| </DialogActions> | |||||
| </Dialog> | |||||
| </div> | |||||
| </MainCard> | </MainCard> | ||||
| ); | ); | ||||
| }; | }; | ||||