diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js
index aa555cc..83235ed 100644
--- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js
+++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js
@@ -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(} label={label} />);
- }
- return selection;
- }
-
- function zeroPad(num, places) {
- var zero = places - num.toString().length + 1;
- return Array(+(zero > 0 && zero)).join("0") + num;
- }
return (
@@ -140,7 +121,7 @@ const PublicNoticeApplyForm = ({loadedData}) => {
defaultValue={formik.values.issueId}
>
{
- getIssueSelection()
+ selections
}
diff --git a/src/pages/PublicNotice/ApplyForm/index.js b/src/pages/PublicNotice/ApplyForm/index.js
index f93c96f..0bfdbbd 100644
--- a/src/pages/PublicNotice/ApplyForm/index.js
+++ b/src/pages/PublicNotice/ApplyForm/index.js
@@ -2,6 +2,12 @@
import * as React from "react";
import * as HttpUtils from "utils/HttpUtils";
import * as UrlUtils from "utils/ApiPathConst";
+import * as DateUtils from "utils/DateUtils";
+
+import {
+ Radio,
+ FormControlLabel
+} from '@mui/material';
import Loadable from 'components/Loadable';
import { lazy } from 'react';
@@ -13,6 +19,7 @@ const PublicNoticeApplyForm = Loadable(lazy(() => import('./PublicNoticeApplyFor
const ApplyForm = () => {
const [userData, setUserData] = React.useState([]);
+ const [selections, setSelection] = React.useState([]);
const [isLoading, setLoding] = React.useState(true);
React.useEffect(()=>{
@@ -29,11 +36,29 @@ const ApplyForm = () => {
response["fax_countryCode"] = response?.contactFaxNo?.countryCode;
response["faxNumber"] = response?.contactFaxNo?.faxNumber;
response["issueId"] = response?.gazetteIssueList[0].id;
+
+ var selection = [];
+ for (var i = 0; i < response?.gazetteIssueList?.length; i++) {
+ let data = response.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(} label={label} />);
+ }
+ setSelection(selection);
+
setUserData(response);
}
});
};
+ function zeroPad(num, places) {
+ var zero = places - num.toString().length + 1;
+ return Array(+(zero > 0 && zero)).join("0") + num;
+ }
+
+
React.useEffect(() => {
setLoding(false);
}, [userData]);
@@ -44,6 +69,7 @@ const ApplyForm = () => {
:
);
};