| @@ -6,6 +6,7 @@ import { | |||||
| Stack, | Stack, | ||||
| Typography, FormLabel, | Typography, FormLabel, | ||||
| OutlinedInput, | OutlinedInput, | ||||
| Dialog, DialogTitle, DialogContent, DialogActions, | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import MainCard from "../../components/MainCard"; | import MainCard from "../../components/MainCard"; | ||||
| import * as React from "react"; | import * as React from "react"; | ||||
| @@ -41,6 +42,9 @@ const GazetteDetailCard = ( | |||||
| const [verified, setVerified] = useState(null); | const [verified, setVerified] = useState(null); | ||||
| const [currentStatus, setCurrentStatus] = useState({}); | const [currentStatus, setCurrentStatus] = useState({}); | ||||
| const [isWarningPopUp, setIsWarningPopUp] = useState(false); | |||||
| const [warningText, setWarningText] = useState(""); | |||||
| const {register, | const {register, | ||||
| // getValues | // getValues | ||||
| } = useForm() | } = useForm() | ||||
| @@ -68,9 +72,19 @@ const GazetteDetailCard = ( | |||||
| }, [issueNum]); | }, [issueNum]); | ||||
| const groupDetailClick = () => () => { | const groupDetailClick = () => () => { | ||||
| setStatus("genGazetteCode") | |||||
| if(gazetteCode==null){ | |||||
| setStatus("genGazetteCode"); | |||||
| return; | |||||
| } | |||||
| setWarningText("Gazette Code is already generated, are you sure to re-generate?"); | |||||
| setIsWarningPopUp(true); | |||||
| }; | }; | ||||
| const callback =()=>{ | |||||
| setIsWarningPopUp(false); | |||||
| setStatus("genGazetteCode"); | |||||
| } | |||||
| // useEffect(() => { | // useEffect(() => { | ||||
| // //upload latest data to parent | // //upload latest data to parent | ||||
| // const values = getValues(); | // const values = getValues(); | ||||
| @@ -242,6 +256,18 @@ const GazetteDetailCard = ( | |||||
| </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)}>No</Button> | |||||
| <Button color="success" onClick={()=>callback()}>Yes</Button> | |||||
| </DialogActions> | |||||
| </Dialog> | |||||
| </div> | |||||
| </MainCard> | </MainCard> | ||||
| ); | ); | ||||
| }; | }; | ||||