|
|
@@ -3,9 +3,7 @@ import { |
|
|
|
Grid, |
|
|
|
Typography, |
|
|
|
Button, |
|
|
|
Radio, |
|
|
|
RadioGroup, |
|
|
|
FormControlLabel |
|
|
|
} from '@mui/material'; |
|
|
|
import { useFormik } from 'formik'; |
|
|
|
import * as yup from 'yup'; |
|
|
@@ -13,20 +11,20 @@ import * as React from "react"; |
|
|
|
import * as HttpUtils from "utils/HttpUtils"; |
|
|
|
import * as UrlUtils from "utils/ApiPathConst"; |
|
|
|
import * as FieldUtils from "utils/FieldUtils"; |
|
|
|
import * as DateUtils from "utils/DateUtils"; |
|
|
|
|
|
|
|
|
|
|
|
import {useNavigate} from "react-router-dom"; |
|
|
|
|
|
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
|
|
|
|
|
const PublicNoticeApplyForm = ({loadedData}) => { |
|
|
|
const [formData, setFormData] = React.useState([]); |
|
|
|
const PublicNoticeApplyForm = ({loadedData, selections}) => { |
|
|
|
//const [formData, setFormData] = React.useState([]); |
|
|
|
const [attachment, setAttachment] = React.useState({}); |
|
|
|
const navigate=useNavigate(); |
|
|
|
|
|
|
|
React.useEffect(()=>{ |
|
|
|
setFormData(loadedData); |
|
|
|
},[]); |
|
|
|
// React.useEffect(()=>{ |
|
|
|
// setFormData(loadedData); |
|
|
|
// },[]); |
|
|
|
|
|
|
|
const formik = useFormik({ |
|
|
|
enableReinitialize:true, |
|
|
@@ -72,23 +70,6 @@ const PublicNoticeApplyForm = ({loadedData}) => { |
|
|
|
setAttachment(event.target.files[0]); |
|
|
|
} |
|
|
|
|
|
|
|
const getIssueSelection=()=>{ |
|
|
|
var selection = []; |
|
|
|
for (var i = 0; i < formData?.gazetteIssueList?.length; i++) { |
|
|
|
let data = formData.gazetteIssueList[i]; |
|
|
|
let label = data.year |
|
|
|
+" Vol. "+zeroPad(data.volume,3) |
|
|
|
+", No. "+zeroPad(data.issueNo,2) |
|
|
|
+", "+DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); |
|
|
|
selection.push(<FormControlLabel value={data.id} control={<Radio />} label={label} />); |
|
|
|
} |
|
|
|
return selection; |
|
|
|
} |
|
|
|
|
|
|
|
function zeroPad(num, places) { |
|
|
|
var zero = places - num.toString().length + 1; |
|
|
|
return Array(+(zero > 0 && zero)).join("0") + num; |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
<Grid container style={{ padding: 24}} rowSpacing={16} columnSpacing={2.75}> |
|
|
@@ -140,7 +121,7 @@ const PublicNoticeApplyForm = ({loadedData}) => { |
|
|
|
defaultValue={formik.values.issueId} |
|
|
|
> |
|
|
|
{ |
|
|
|
getIssueSelection() |
|
|
|
selections |
|
|
|
} |
|
|
|
</RadioGroup> |
|
|
|
</Grid> |
|
|
|