| @@ -39,7 +39,7 @@ import DownloadIcon from '@mui/icons-material/Download'; | |||||
| const ApplicationDetailCard = ( | const ApplicationDetailCard = ( | ||||
| { applicationDetailData, | { applicationDetailData, | ||||
| setStatus, | setStatus, | ||||
| setReload, | |||||
| // setReload, | |||||
| isEditMode, | isEditMode, | ||||
| setUpdateApplicationObject, | setUpdateApplicationObject, | ||||
| setiIsSave, | setiIsSave, | ||||
| @@ -52,6 +52,8 @@ const ApplicationDetailCard = ( | |||||
| const [verified, setVerified] = useState(null); | const [verified, setVerified] = useState(null); | ||||
| const [fileDetail, setfileDetail] = useState({}); | const [fileDetail, setfileDetail] = useState({}); | ||||
| const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
| const [reload, setReload] = useState(false); | |||||
| // const navigate = useNavigate() | // const navigate = useNavigate() | ||||
| // const params = useParams(); | // const params = useParams(); | ||||
| @@ -72,20 +74,18 @@ const ApplicationDetailCard = ( | |||||
| }; | }; | ||||
| const { register, | const { register, | ||||
| getValues | |||||
| getValues, | |||||
| // setValue | |||||
| } = useForm() | } = useForm() | ||||
| useEffect(() => { | useEffect(() => { | ||||
| //if user data from parent are not null | //if user data from parent are not null | ||||
| // console.log(applicationDetailData) | // console.log(applicationDetailData) | ||||
| if (Object.keys(applicationDetailData).length > 0) { | if (Object.keys(applicationDetailData).length > 0) { | ||||
| setCurrentApplicationDetailData(applicationDetailData.data); | |||||
| setCompanyName(applicationDetailData.companyName); | |||||
| setVerified(applicationDetailData.userData.verifiedBy ? true : false) | |||||
| setfileDetail(applicationDetailData.fileDetail); | |||||
| loadApplicationDetail() | |||||
| } | } | ||||
| }, [applicationDetailData]); | }, [applicationDetailData]); | ||||
| useEffect(() => { | useEffect(() => { | ||||
| //if state data are ready and assign to different field | //if state data are ready and assign to different field | ||||
| // console.log(currentApplicationDetailData) | // console.log(currentApplicationDetailData) | ||||
| @@ -94,6 +94,14 @@ const ApplicationDetailCard = ( | |||||
| } | } | ||||
| }, [currentApplicationDetailData]); | }, [currentApplicationDetailData]); | ||||
| const loadApplicationDetail = () => { | |||||
| setCurrentApplicationDetailData(applicationDetailData.data); | |||||
| setCompanyName(applicationDetailData.companyName); | |||||
| setVerified(applicationDetailData.userData.verifiedBy ? true : false) | |||||
| setfileDetail(applicationDetailData.fileDetail); | |||||
| setReload(false) | |||||
| } | |||||
| const onDownloadClick = () => () => { | const onDownloadClick = () => () => { | ||||
| HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
| fileId: fileDetail.id, | fileId: fileDetail.id, | ||||
| @@ -102,6 +110,12 @@ const ApplicationDetailCard = ( | |||||
| }); | }); | ||||
| }; | }; | ||||
| useEffect(() => { | |||||
| if (Object.keys(applicationDetailData).length > 0) { | |||||
| loadApplicationDetail() | |||||
| } | |||||
| }, [reload]); | |||||
| const reloadHandle = () => () => { | const reloadHandle = () => () => { | ||||
| setReload(true) | setReload(true) | ||||
| setEditMode(false) | setEditMode(false) | ||||
| @@ -183,9 +197,8 @@ const ApplicationDetailCard = ( | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| : | : | ||||
| <div></div> | |||||
| null | |||||
| } | } | ||||
| </> | </> | ||||
| } | } | ||||
| @@ -393,6 +406,18 @@ const ApplicationDetailCard = ( | |||||
| background: "#f8f8f8", | background: "#f8f8f8", | ||||
| }, | }, | ||||
| }} | }} | ||||
| onChange={(event) => { | |||||
| const value = event.target.value; | |||||
| console.log(event) | |||||
| if (value.match(/[^0-9]/)) { | |||||
| return event.preventDefault(); | |||||
| } | |||||
| console.log("321") | |||||
| // setValue(value); | |||||
| }} | |||||
| inputProps={{ | |||||
| maxLength: 3, | |||||
| }} | |||||
| /> | /> | ||||
| </FormControl> | </FormControl> | ||||
| <FormControl variant="outlined" sx={{ width: '100%' }} disabled={!editMode} > | <FormControl variant="outlined" sx={{ width: '100%' }} disabled={!editMode} > | ||||
| @@ -409,6 +434,9 @@ const ApplicationDetailCard = ( | |||||
| background: "#f8f8f8", | background: "#f8f8f8", | ||||
| }, | }, | ||||
| }} | }} | ||||
| inputProps={{ | |||||
| maxLength: 11, | |||||
| }} | |||||
| /> | /> | ||||
| </FormControl> | </FormControl> | ||||
| </Stack> | </Stack> | ||||
| @@ -469,6 +497,9 @@ const ApplicationDetailCard = ( | |||||
| background: "#f8f8f8", | background: "#f8f8f8", | ||||
| }, | }, | ||||
| }} | }} | ||||
| inputProps={{ | |||||
| maxLength: 3, | |||||
| }} | |||||
| /> | /> | ||||
| </FormControl> | </FormControl> | ||||
| <FormControl variant="outlined" sx={{ width: '100%' }} disabled={!editMode}> | <FormControl variant="outlined" sx={{ width: '100%' }} disabled={!editMode}> | ||||
| @@ -485,6 +516,9 @@ const ApplicationDetailCard = ( | |||||
| background: "#f8f8f8", | background: "#f8f8f8", | ||||
| }, | }, | ||||
| }} | }} | ||||
| inputProps={{ | |||||
| maxLength: 8, | |||||
| }} | |||||
| /> | /> | ||||
| </FormControl> | </FormControl> | ||||
| </Stack> | </Stack> | ||||
| @@ -507,7 +541,7 @@ const ApplicationDetailCard = ( | |||||
| <Grid item xs={12} md={5} lg={5} sx={{ display: 'flex', alignItems: 'center' }}> | <Grid item xs={12} md={5} lg={5} sx={{ display: 'flex', alignItems: 'center' }}> | ||||
| <FormControl variant="outlined" fullWidth > | <FormControl variant="outlined" fullWidth > | ||||
| <Typography | <Typography | ||||
| fullWidth | |||||
| // fullWidth | |||||
| id='fileName' | id='fileName' | ||||
| > | > | ||||
| {fileDetail.filename} | {fileDetail.filename} | ||||
| @@ -549,8 +583,8 @@ const ApplicationDetailCard = ( | |||||
| <OutlinedInput | <OutlinedInput | ||||
| fullWidth | fullWidth | ||||
| multiline={true} | multiline={true} | ||||
| maxRows={4} | |||||
| minRows={4} | |||||
| // maxRows={4} | |||||
| // minRows={4} | |||||
| rows={4} | rows={4} | ||||
| size="small" | size="small" | ||||
| {...register("remarks", | {...register("remarks", | ||||