@@ -39,8 +39,10 @@ import DownloadIcon from '@mui/icons-material/Download'; | |||||
const ApplicationDetailCard = ( | const ApplicationDetailCard = ( | ||||
{ applicationDetailData, | { applicationDetailData, | ||||
setStatus, | setStatus, | ||||
// isCollectData, | |||||
// updateUserObject, | |||||
setReload, | |||||
isEditMode, | |||||
setUpdateApplicationObject, | |||||
setiIsSave, | |||||
// isNewRecord | // isNewRecord | ||||
} | } | ||||
) => { | ) => { | ||||
@@ -53,8 +55,24 @@ const ApplicationDetailCard = ( | |||||
// const navigate = useNavigate() | // const navigate = useNavigate() | ||||
// const params = useParams(); | // const params = useParams(); | ||||
const [editMode, setEditMode] = useState(false); | |||||
const onEditClick = () => () => { | |||||
setEditMode(true); | |||||
isEditMode(true); | |||||
}; | |||||
const onSaveClick = () => () => { | |||||
//upload latest data to parent | |||||
const values = getValues(); | |||||
const objectData ={ | |||||
...values, | |||||
} | |||||
setUpdateApplicationObject({objectData}); | |||||
setiIsSave(true) | |||||
}; | |||||
const {register, | const {register, | ||||
// getValues | |||||
getValues | |||||
} = useForm() | } = useForm() | ||||
useEffect(() => { | useEffect(() => { | ||||
@@ -84,8 +102,13 @@ const ApplicationDetailCard = ( | |||||
}); | }); | ||||
}; | }; | ||||
const reloadHandle = () => () => { | |||||
setReload(true) | |||||
setEditMode(false) | |||||
}; | |||||
const acceptedClick = () => () =>{ | const acceptedClick = () => () =>{ | ||||
setStatus("accepted") | |||||
setStatus("accept") | |||||
}; | }; | ||||
const rejectedClick = () => () =>{ | const rejectedClick = () => () =>{ | ||||
@@ -108,7 +131,7 @@ const ApplicationDetailCard = ( | |||||
border={false} | border={false} | ||||
content={false} | content={false} | ||||
> | > | ||||
{verified? | |||||
{verified && currentApplicationDetailData.status != "rejected"? | |||||
<Grid container spacing={4} direction="row"> | <Grid container spacing={4} direction="row"> | ||||
<Grid item xs={12} md={4} > | <Grid item xs={12} md={4} > | ||||
<Stack | <Stack | ||||
@@ -118,17 +141,49 @@ const ApplicationDetailCard = ( | |||||
spacing={2} | spacing={2} | ||||
mb={2} | mb={2} | ||||
> | > | ||||
<Button | |||||
// size="large" | |||||
variant="contained" | |||||
// onClick={handleNewUserClick} | |||||
sx={{ | |||||
textTransform: 'capitalize', | |||||
alignItems: 'end', | |||||
}}> | |||||
<BorderColorOutlinedIcon/> | |||||
<Typography ml={1}> Edit</Typography> | |||||
</Button> | |||||
{editMode? | |||||
<> | |||||
<Button | |||||
size="large" | |||||
variant="contained" | |||||
onClick={reloadHandle()} | |||||
sx={{ | |||||
textTransform: 'capitalize', | |||||
alignItems: 'end' | |||||
}} | |||||
> | |||||
Reset & Back | |||||
</Button> | |||||
<Button | |||||
size="large" | |||||
variant="contained" | |||||
onClick={onSaveClick()} | |||||
color="success" | |||||
sx={{ | |||||
textTransform: 'capitalize', | |||||
alignItems: 'end' | |||||
}} | |||||
> | |||||
Save | |||||
</Button> | |||||
</>: | |||||
<> | |||||
<Grid item sx={{ml: 3, mr: 3}}> | |||||
<Button | |||||
// size="large" | |||||
variant="contained" | |||||
onClick={onEditClick()} | |||||
sx={{ | |||||
textTransform: 'capitalize', | |||||
alignItems: 'end', | |||||
}}> | |||||
<BorderColorOutlinedIcon/> | |||||
<Typography ml={1}> Edit</Typography> | |||||
</Button> | |||||
</Grid> | |||||
</> | |||||
} | |||||
{currentApplicationDetailData.status =="accepted"? | {currentApplicationDetailData.status =="accepted"? | ||||
<Button | <Button | ||||
// size="large" | // size="large" | ||||
@@ -228,7 +283,7 @@ const ApplicationDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={9} lg={9}> | <Grid item xs={12} md={9} lg={9}> | ||||
<FormControl variant="outlined" fullWidth > | |||||
<FormControl variant="outlined" fullWidth disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
fullWidth | fullWidth | ||||
size="small" | size="small" | ||||
@@ -267,7 +322,7 @@ const ApplicationDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={9} lg={9}> | <Grid item xs={12} md={9} lg={9}> | ||||
<FormControl variant="outlined" fullWidth > | |||||
<FormControl variant="outlined" fullWidth disabled > | |||||
{ currentApplicationDetailData.orgId===null? | { currentApplicationDetailData.orgId===null? | ||||
<OutlinedInput | <OutlinedInput | ||||
fullWidth | fullWidth | ||||
@@ -301,20 +356,20 @@ const ApplicationDetailCard = ( | |||||
<Grid item xs={12} md={8} lg={8}> | <Grid item xs={12} md={8} lg={8}> | ||||
<Stack direction="row"> | <Stack direction="row"> | ||||
<FormControl variant="outlined" sx={{width:'25%'}}> | |||||
<FormControl variant="outlined" sx={{width:'25%'}} disabled={!editMode} > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("countryCode", | |||||
{...register("contactTelNo.countryCode", | |||||
{ | { | ||||
value: currentApplicationDetailData.contactTelNo.countryCode, | value: currentApplicationDetailData.contactTelNo.countryCode, | ||||
})} | })} | ||||
id='countryCode' | id='countryCode' | ||||
/> | /> | ||||
</FormControl> | </FormControl> | ||||
<FormControl variant="outlined" sx={{width:'100%'}}> | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled={!editMode} > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("phoneNumber", | |||||
{...register("contactTelNo.phoneNumber", | |||||
{ | { | ||||
value: currentApplicationDetailData.contactTelNo.phoneNumber, | value: currentApplicationDetailData.contactTelNo.phoneNumber, | ||||
})} | })} | ||||
@@ -336,7 +391,7 @@ const ApplicationDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={9} lg={9}> | <Grid item xs={12} md={9} lg={9}> | ||||
<FormControl variant="outlined" fullWidth > | |||||
<FormControl variant="outlined" fullWidth disabled={!editMode}> | |||||
<OutlinedInput | <OutlinedInput | ||||
fullWidth | fullWidth | ||||
size="small" | size="small" | ||||
@@ -359,20 +414,20 @@ const ApplicationDetailCard = ( | |||||
<Grid item xs={12} md={8} lg={8}> | <Grid item xs={12} md={8} lg={8}> | ||||
<Stack direction="row"> | <Stack direction="row"> | ||||
<FormControl variant="outlined" sx={{width:'25%'}}> | |||||
<FormControl variant="outlined" sx={{width:'25%'}} disabled={!editMode}> | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("countryCode", | |||||
{...register("contactFaxNo.countryCode", | |||||
{ | { | ||||
value: currentApplicationDetailData.contactFaxNo.countryCode, | value: currentApplicationDetailData.contactFaxNo.countryCode, | ||||
})} | })} | ||||
id='countryCode' | id='countryCode' | ||||
/> | /> | ||||
</FormControl> | </FormControl> | ||||
<FormControl variant="outlined" sx={{width:'100%'}}> | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled={!editMode}> | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("faxNumber", | |||||
{...register("contactFaxNo.faxNumber", | |||||
{ | { | ||||
value: currentApplicationDetailData.contactFaxNo.faxNumber, | value: currentApplicationDetailData.contactFaxNo.faxNumber, | ||||
})} | })} | ||||
@@ -137,7 +137,7 @@ const ClientDetailCard = ( | |||||
<FormLabel>Client Type:</FormLabel> | <FormLabel>Client Type:</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<FormControl variant="outlined" sx={{width:'100%'}} > | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled> | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("type", | {...register("type", | ||||
@@ -158,7 +158,7 @@ const ClientDetailCard = ( | |||||
<FormLabel>Company Name (English):</FormLabel> | <FormLabel>Company Name (English):</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<FormControl variant="outlined" sx={{width:'100%'}} > | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("enCompanyName", | {...register("enCompanyName", | ||||
@@ -177,7 +177,7 @@ const ClientDetailCard = ( | |||||
<FormLabel>Company Name (Chinese):</FormLabel> | <FormLabel>Company Name (Chinese):</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<FormControl variant="outlined" sx={{width:'100%'}} > | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("chCompanyName", | {...register("chCompanyName", | ||||
@@ -196,7 +196,7 @@ const ClientDetailCard = ( | |||||
<FormLabel>English Name:</FormLabel> | <FormLabel>English Name:</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<FormControl variant="outlined" sx={{width:'100%'}} > | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("contactPerson", | {...register("contactPerson", | ||||
@@ -216,7 +216,7 @@ const ClientDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} > | <Grid item xs={12} md={12} lg={12} mb={1} > | ||||
<Stack direction="row"> | <Stack direction="row"> | ||||
<FormControl variant="outlined" sx={{width:'40%'}}> | |||||
<FormControl variant="outlined" sx={{width:'40%'}} disabled> | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("countryCode", | {...register("countryCode", | ||||
@@ -226,7 +226,7 @@ const ClientDetailCard = ( | |||||
id='countryCode' | id='countryCode' | ||||
/> | /> | ||||
</FormControl> | </FormControl> | ||||
<FormControl variant="outlined" sx={{width:'100%'}}> | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled> | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("phoneNumber", | {...register("phoneNumber", | ||||
@@ -246,7 +246,7 @@ const ClientDetailCard = ( | |||||
<FormLabel>Email:</FormLabel> | <FormLabel>Email:</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<FormControl variant="outlined" sx={{width:'100%'}} > | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("emailBus", | {...register("emailBus", | ||||
@@ -267,7 +267,7 @@ const ClientDetailCard = ( | |||||
<FormLabel>English Name:</FormLabel> | <FormLabel>English Name:</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<FormControl variant="outlined" sx={{width:'100%'}} > | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("enName", | {...register("enName", | ||||
@@ -286,7 +286,7 @@ const ClientDetailCard = ( | |||||
<FormLabel>Chinese Name:</FormLabel> | <FormLabel>Chinese Name:</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<FormControl variant="outlined" sx={{width:'100%'}} > | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("chName", | {...register("chName", | ||||
@@ -306,7 +306,7 @@ const ClientDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<Stack direction="row"> | <Stack direction="row"> | ||||
<FormControl variant="outlined" sx={{width:'40%'}}> | |||||
<FormControl variant="outlined" sx={{width:'40%'}} disabled> | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("countryCode", | {...register("countryCode", | ||||
@@ -316,7 +316,7 @@ const ClientDetailCard = ( | |||||
id='countryCode' | id='countryCode' | ||||
/> | /> | ||||
</FormControl> | </FormControl> | ||||
<FormControl variant="outlined" sx={{width:'100%'}}> | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled> | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("phoneNumber", | {...register("phoneNumber", | ||||
@@ -336,7 +336,7 @@ const ClientDetailCard = ( | |||||
<FormLabel>Email:</FormLabel> | <FormLabel>Email:</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | <Grid item xs={12} md={12} lg={12} mb={1} sx={{width:'100%'}} > | ||||
<FormControl variant="outlined" sx={{width:'100%'}} > | |||||
<FormControl variant="outlined" sx={{width:'100%'}} disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
size="small" | size="small" | ||||
{...register("emailAddress", | {...register("emailAddress", | ||||
@@ -95,7 +95,7 @@ const GazetteDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={9} lg={9}> | <Grid item xs={12} md={9} lg={9}> | ||||
<FormControl variant="outlined" fullWidth > | |||||
<FormControl variant="outlined" fullWidth disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
fullWidth | fullWidth | ||||
size="small" | size="small" | ||||
@@ -117,7 +117,7 @@ const GazetteDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={9} lg={9}> | <Grid item xs={12} md={9} lg={9}> | ||||
<FormControl variant="outlined" fullWidth > | |||||
<FormControl variant="outlined" fullWidth disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
fullWidth | fullWidth | ||||
size="small" | size="small" | ||||
@@ -142,7 +142,7 @@ const GazetteDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={9} lg={9}> | <Grid item xs={12} md={9} lg={9}> | ||||
<FormControl variant="outlined" fullWidth > | |||||
<FormControl variant="outlined" fullWidth disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
fullWidth | fullWidth | ||||
size="small" | size="small" | ||||
@@ -158,13 +158,13 @@ const GazetteDetailCard = ( | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={5} lg={5} sx={{mb: 1, ml:1}}> | <Grid item xs={12} md={5} lg={5} sx={{mb: 1, ml:1}}> | ||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={12} md={4} lg={4} | |||||
<Grid item xs={12} md={3} lg={3} | |||||
sx={{display: 'flex', alignItems: 'center'}}> | sx={{display: 'flex', alignItems: 'center'}}> | ||||
<FormLabel>Group Title:</FormLabel> | <FormLabel>Group Title:</FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={8} lg={8}> | |||||
<FormControl variant="outlined" fullWidth > | |||||
<Grid item xs={12} md={9} lg={9}> | |||||
<FormControl variant="outlined" fullWidth disabled > | |||||
<OutlinedInput | <OutlinedInput | ||||
fullWidth | fullWidth | ||||
size="small" | size="small" | ||||
@@ -1,6 +1,6 @@ | |||||
import { | import { | ||||
useEffect, | useEffect, | ||||
// useState | |||||
useState | |||||
} from "react"; | } from "react"; | ||||
// material-ui | // material-ui | ||||
@@ -25,19 +25,20 @@ import * as yup from 'yup'; | |||||
const StatusChangeDialog = (props) => { | const StatusChangeDialog = (props) => { | ||||
// const [selectedGazetteGroup, setSelectedGazetteGroup] = useState({}); | |||||
const [status, setStatus] = useState(""); | |||||
// const [selectedGazetteGroupInputType, setSelectedGazetteGroupInputType] = useState(""); | // const [selectedGazetteGroupInputType, setSelectedGazetteGroupInputType] = useState(""); | ||||
const groupTitleComboList = ComboData.groupTitle; | const groupTitleComboList = ComboData.groupTitle; | ||||
useEffect(() => { | useEffect(() => { | ||||
if(props.getStatus == "accepted"){ | |||||
onAcceptedClick() | |||||
console.log(Object.keys(!props.selectedGazetteGroup).length) | |||||
if(props.getStatus == "accept"){ | |||||
setStatus("Accept") | |||||
}else if (props.getStatus == "reject"){ | }else if (props.getStatus == "reject"){ | ||||
onRejectedClick() | |||||
setStatus("Reject") | |||||
}else if (props.getStatus == "complete"){ | }else if (props.getStatus == "complete"){ | ||||
onComplatedClick() | |||||
setStatus("Complete") | |||||
}else if (props.getStatus == "withdraw"){ | }else if (props.getStatus == "withdraw"){ | ||||
onWithdrawnClick() | |||||
setStatus("Withdraw") | |||||
} | } | ||||
}, [props.getStatus]); | }, [props.getStatus]); | ||||
@@ -47,12 +48,12 @@ const StatusChangeDialog = (props) => { | |||||
}; | }; | ||||
const formik = useFormik({ | |||||
initialValues:({ | |||||
username:'', | |||||
}), | |||||
validationSchema:yup.object().shape({ | |||||
}), | |||||
const formik = useFormik({ | |||||
initialValues:({ | |||||
username:'', | |||||
}), | |||||
validationSchema:yup.object().shape({ | |||||
}), | |||||
}); | }); | ||||
// const handleReset = () => { | // const handleReset = () => { | ||||
@@ -72,7 +73,7 @@ const StatusChangeDialog = (props) => { | |||||
<Grid item> | <Grid item> | ||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
<Typography variant="h4"> | <Typography variant="h4"> | ||||
Accept Application | |||||
{status} Application | |||||
</Typography> | </Typography> | ||||
</Stack> | </Stack> | ||||
</Grid> | </Grid> | ||||
@@ -82,6 +83,7 @@ const StatusChangeDialog = (props) => { | |||||
<form> | <form> | ||||
<DialogContent> | <DialogContent> | ||||
<DialogContentText> | <DialogContentText> | ||||
{props.getStatus == "accept"? | |||||
<Grid container direction="row" justifyContent="center" alignItems="center"> | <Grid container direction="row" justifyContent="center" alignItems="center"> | ||||
<Grid item xs={12} md={8} lg={8} sx={{mb: 1,}}> | <Grid item xs={12} md={8} lg={8} sx={{mb: 1,}}> | ||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
@@ -113,7 +115,7 @@ const StatusChangeDialog = (props) => { | |||||
if (newValue!=null && newValue != {}){ | if (newValue!=null && newValue != {}){ | ||||
props.setSelectedGazetteGroupInputType(newValue.label); | props.setSelectedGazetteGroupInputType(newValue.label); | ||||
props.setSelectedGazetteGroup(newValue); | props.setSelectedGazetteGroup(newValue); | ||||
formik.setFieldValue("checkDigit","") | |||||
formik.setFieldValue("gazetteGroup","") | |||||
}else{ | }else{ | ||||
props.setSelectedGazetteGroupInputType(""); | props.setSelectedGazetteGroupInputType(""); | ||||
} | } | ||||
@@ -124,19 +126,27 @@ const StatusChangeDialog = (props) => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | |||||
</Grid>: | |||||
<Grid container direction="row" justifyContent="center" alignItems="center"> | |||||
<Grid item xs={12} md={5} lg={5} sx={{mb: 5,}}> | |||||
<FormLabel sx={{fontSize: "20px", color:"#000000",textAlign:"center"}}> | |||||
Are you really {status} the Application? | |||||
</FormLabel> | |||||
</Grid> | |||||
</Grid> | |||||
} | |||||
</DialogContentText> | </DialogContentText> | ||||
</DialogContent> | </DialogContent> | ||||
</form> | </form> | ||||
</FormikProvider> | </FormikProvider> | ||||
<Stack direction="row" justifyContent="space-around"> | <Stack direction="row" justifyContent="space-around"> | ||||
<DialogActions> | <DialogActions> | ||||
<Button variant="contained" color="success" onClick={acceptedHandle()} autoFocus> | |||||
Accept | |||||
<Button variant="contained" color="success" onClick={acceptedHandle()} autoFocus disabled={Object.keys(props.selectedGazetteGroup).length === 0}> | |||||
{status} | |||||
</Button> | </Button> | ||||
</DialogActions> | </DialogActions> | ||||
<DialogActions> | <DialogActions> | ||||
<Button variant="contained" onClick={props.handleClose} autoFocus> | |||||
<Button variant="contained" onClick={props.handleClose} autoFocus > | |||||
Cancel | Cancel | ||||
</Button> | </Button> | ||||
</DialogActions> | </DialogActions> | ||||
@@ -25,7 +25,11 @@ const ClientDetailCard = Loadable(lazy(() => import('./ClientDetailCard'))); | |||||
const TabTableDetail = Loadable(lazy(() => import('./tabTableDetail/TabTable'))); | const TabTableDetail = Loadable(lazy(() => import('./tabTableDetail/TabTable'))); | ||||
import { | import { | ||||
GET_PUBLIC_NOTICE_APPLY_DETAIL, | GET_PUBLIC_NOTICE_APPLY_DETAIL, | ||||
SET_PUBLIC_NOTICE_STATUS_ACCEPTED | |||||
UPDATE_PUBLIC_NOTICE_APPLY_DETAIL, | |||||
SET_PUBLIC_NOTICE_STATUS_ACCEPTED, | |||||
SET_PUBLIC_NOTICE_STATUS_REJRCTED, | |||||
SET_PUBLIC_NOTICE_STATUS_COMPLATED, | |||||
SET_PUBLIC_NOTICE_STATUS_WITHDRAW | |||||
} from "utils/ApiPathConst"; | } from "utils/ApiPathConst"; | ||||
const StatusChangeDialog = Loadable(lazy(() => import('./StatusChangeDialog'))); | const StatusChangeDialog = Loadable(lazy(() => import('./StatusChangeDialog'))); | ||||
import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
@@ -38,18 +42,31 @@ const PublicNoticeDetail_GLD = () => { | |||||
// const navigate = useNavigate() | // const navigate = useNavigate() | ||||
const [applicationDetailData, setApplicationDetailData] = useState({}); | const [applicationDetailData, setApplicationDetailData] = useState({}); | ||||
// const [refApplicationDetailData, setRefApplicationDetailData] = React.useState({}); | // const [refApplicationDetailData, setRefApplicationDetailData] = React.useState({}); | ||||
const [reload, setReload] = useState(false); | |||||
const [isLoading,setLoading] = useState(false); | |||||
const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); | |||||
//pageTitle | |||||
const [appNo, setAapNo] = useState(""); | const [appNo, setAapNo] = useState(""); | ||||
const [gazetteIssue, setGazetteIssue] = useState(""); | const [gazetteIssue, setGazetteIssue] = useState(""); | ||||
const [issueDate,setIssueDate] = useState(""); | const [issueDate,setIssueDate] = useState(""); | ||||
const [issueNum,setIssueNum] = useState(""); | const [issueNum,setIssueNum] = useState(""); | ||||
const [groupNo, setGroupNo] = useState(""); | const [groupNo, setGroupNo] = useState(""); | ||||
const [groupTitle, setGroupTitle] = useState(""); | |||||
// const [groupTitle, setGroupTitle] = useState(""); | |||||
//statusWindow | |||||
const [open, setOpen] = useState(false); | const [open, setOpen] = useState(false); | ||||
const [getStatus, setStatus] = useState(""); | const [getStatus, setStatus] = useState(""); | ||||
const [statusWindowAccepted, setStatusWindowAccepted] = useState(false); | const [statusWindowAccepted, setStatusWindowAccepted] = useState(false); | ||||
const [selectedGazetteGroup, setSelectedGazetteGroup] = useState({}); | const [selectedGazetteGroup, setSelectedGazetteGroup] = useState({}); | ||||
const [selectedGazetteGroupInputType, setSelectedGazetteGroupInputType] = useState(""); | const [selectedGazetteGroupInputType, setSelectedGazetteGroupInputType] = useState(""); | ||||
//editMode | |||||
const [updateApplicationObject, setUpdateApplicationObject] = useState({}); | |||||
const [editMode, isEditMode] = useState(false); | |||||
const [isSave, setiIsSave] = useState(false); | |||||
const BackgroundHead = { | const BackgroundHead = { | ||||
backgroundImage: `url(${titleBackgroundImg})`, | backgroundImage: `url(${titleBackgroundImg})`, | ||||
width: '100%', | width: '100%', | ||||
@@ -57,14 +74,26 @@ const PublicNoticeDetail_GLD = () => { | |||||
backgroundSize:'cover' | backgroundSize:'cover' | ||||
} | } | ||||
const title = groupNo!=""?("Application / "+appNo+", "+gazetteIssue+", "+groupNo+" , "+groupTitle):("Application / "+appNo+", "+gazetteIssue) | |||||
const title = groupNo!=null?("Application / "+appNo+", "+gazetteIssue+", "+issueNum+" , "+groupNo):("Application / "+appNo+", "+gazetteIssue+", "+issueNum) | |||||
useEffect(() => { | useEffect(() => { | ||||
loadApplicationDetail() | |||||
loadApplicationDetail() | |||||
}, []); | }, []); | ||||
useEffect(() => { | |||||
if (reload){ | |||||
loadApplicationDetail() | |||||
} | |||||
}, [reload]); | |||||
useEffect(() => { | |||||
if(editMode&&isSave){ | |||||
onUpdateClick(updateApplicationObject) | |||||
} | |||||
}, [updateApplicationObject]); | |||||
const loadApplicationDetail = () => { | const loadApplicationDetail = () => { | ||||
if(params.id > 0 ){ | |||||
if(params.id > 0){ | |||||
axios.get(`${GET_PUBLIC_NOTICE_APPLY_DETAIL}/${params.id}`) | axios.get(`${GET_PUBLIC_NOTICE_APPLY_DETAIL}/${params.id}`) | ||||
.then((response) => { | .then((response) => { | ||||
if (response.status === 200) { | if (response.status === 200) { | ||||
@@ -74,10 +103,8 @@ const PublicNoticeDetail_GLD = () => { | |||||
setGazetteIssue(gazetteIssueDetail.year +" Vol "+gazetteIssueDetail.volume); | setGazetteIssue(gazetteIssueDetail.year +" Vol "+gazetteIssueDetail.volume); | ||||
setIssueNum(" No. "+gazetteIssueDetail.issueNo); | setIssueNum(" No. "+gazetteIssueDetail.issueNo); | ||||
setIssueDate(DateUtils.dateFormat(gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); | setIssueDate(DateUtils.dateFormat(gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); | ||||
if (gazetteIssueDetail.data!==null&&gazetteIssueDetail.data!==undefined){ | |||||
setGroupNo("No. "+gazetteIssueDetail.data.groupNo); | |||||
setGroupTitle("No. "+gazetteIssueDetail.data.groupTitle); | |||||
} | |||||
setGroupNo(response.data.data.groupNo); | |||||
setLoading(false); | |||||
} | } | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
@@ -87,6 +114,29 @@ const PublicNoticeDetail_GLD = () => { | |||||
} | } | ||||
} | } | ||||
const onUpdateClick = (updateApplicationObject) => { | |||||
const data = updateApplicationObject.objectData | |||||
if(params.id > 0 ){ | |||||
setLoading(true); | |||||
axios.post(`${UPDATE_PUBLIC_NOTICE_APPLY_DETAIL}/${params.id}`, | |||||
{ | |||||
contactPerson:data.contactPerson, | |||||
contactFaxNo:data.contactFaxNo, | |||||
contactTelNo:data.contactTelNo, | |||||
} | |||||
) | |||||
.then((response) => { | |||||
if (response.status === 200) { | |||||
loadApplicationDetail() | |||||
} | |||||
}) | |||||
.catch(error => { | |||||
console.log(error); | |||||
return false; | |||||
}); | |||||
} | |||||
}; | |||||
useEffect(() => { | useEffect(() => { | ||||
// console.log(getStatus) | // console.log(getStatus) | ||||
if(getStatus!==""){ | if(getStatus!==""){ | ||||
@@ -108,8 +158,7 @@ const PublicNoticeDetail_GLD = () => { | |||||
useEffect(() => { | useEffect(() => { | ||||
if(statusWindowAccepted){ | if(statusWindowAccepted){ | ||||
console.log(selectedGazetteGroup) | |||||
if(getStatus == "accepted"){ | |||||
if(getStatus == "accept"){ | |||||
onAcceptedClick() | onAcceptedClick() | ||||
}else if (getStatus== "reject"){ | }else if (getStatus== "reject"){ | ||||
onRejectedClick() | onRejectedClick() | ||||
@@ -123,7 +172,12 @@ const PublicNoticeDetail_GLD = () => { | |||||
const onAcceptedClick = () => { | const onAcceptedClick = () => { | ||||
if(params.id > 0 ){ | if(params.id > 0 ){ | ||||
axios.get(`${SET_PUBLIC_NOTICE_STATUS_ACCEPTED}/${params.id}`) | |||||
axios.post(`${SET_PUBLIC_NOTICE_STATUS_ACCEPTED}/${params.id}`, | |||||
{ | |||||
"groupTitle": selectedGazetteGroup.title, | |||||
"groupNo": selectedGazetteGroup.type, | |||||
} | |||||
) | |||||
.then((response) => { | .then((response) => { | ||||
if (response.status === 204) { | if (response.status === 204) { | ||||
setOpen(false); | setOpen(false); | ||||
@@ -138,7 +192,7 @@ const PublicNoticeDetail_GLD = () => { | |||||
} | } | ||||
}; | }; | ||||
const onRejectedClick = () => () => { | |||||
const onRejectedClick = () => { | |||||
if(params.id > 0 ){ | if(params.id > 0 ){ | ||||
axios.get(`${SET_PUBLIC_NOTICE_STATUS_REJRCTED}/${params.id}`) | axios.get(`${SET_PUBLIC_NOTICE_STATUS_REJRCTED}/${params.id}`) | ||||
.then((response) => { | .then((response) => { | ||||
@@ -155,7 +209,7 @@ const PublicNoticeDetail_GLD = () => { | |||||
} | } | ||||
}; | }; | ||||
const onComplatedClick = () => () => { | |||||
const onComplatedClick = () => { | |||||
if(params.id > 0 ){ | if(params.id > 0 ){ | ||||
axios.get(`${SET_PUBLIC_NOTICE_STATUS_COMPLATED}/${params.id}`) | axios.get(`${SET_PUBLIC_NOTICE_STATUS_COMPLATED}/${params.id}`) | ||||
.then((response) => { | .then((response) => { | ||||
@@ -172,7 +226,7 @@ const PublicNoticeDetail_GLD = () => { | |||||
} | } | ||||
}; | }; | ||||
const onWithdrawnClick = () => () => { | |||||
const onWithdrawnClick = () => { | |||||
if(params.id > 0 ){ | if(params.id > 0 ){ | ||||
axios.get(`${SET_PUBLIC_NOTICE_STATUS_WITHDRAW}/${params.id}`) | axios.get(`${SET_PUBLIC_NOTICE_STATUS_WITHDRAW}/${params.id}`) | ||||
.then((response) => { | .then((response) => { | ||||
@@ -192,7 +246,7 @@ const PublicNoticeDetail_GLD = () => { | |||||
return ( | return ( | ||||
<Grid container sx={{maxnHeight: '500vh',backgroundColor:'#ffffff'}} direction="column"> | <Grid container sx={{maxnHeight: '500vh',backgroundColor:'#ffffff'}} direction="column"> | ||||
<StatusChangeDialog open={open} handleClose={handleClose} setStatusWindowAccepted={setStatusWindowAccepted} | <StatusChangeDialog open={open} handleClose={handleClose} setStatusWindowAccepted={setStatusWindowAccepted} | ||||
issueDate={issueDate} issueNum={issueNum} gazetteIssue={gazetteIssue} | |||||
getStatus={getStatus} issueDate={issueDate} issueNum={issueNum} gazetteIssue={gazetteIssue} | |||||
selectedGazetteGroup={selectedGazetteGroup} setSelectedGazetteGroup={setSelectedGazetteGroup} | selectedGazetteGroup={selectedGazetteGroup} setSelectedGazetteGroup={setSelectedGazetteGroup} | ||||
selectedGazetteGroupInputType={selectedGazetteGroupInputType} setSelectedGazetteGroupInputType={setSelectedGazetteGroupInputType} | selectedGazetteGroupInputType={selectedGazetteGroupInputType} setSelectedGazetteGroupInputType={setSelectedGazetteGroupInputType} | ||||
/> | /> | ||||
@@ -214,13 +268,18 @@ const PublicNoticeDetail_GLD = () => { | |||||
<Grid container direction="column"> | <Grid container direction="column"> | ||||
<Grid item xs={12} md={10}> | <Grid item xs={12} md={10}> | ||||
<Box xs={12} ml={4} mt={3} sx={{ p: 2, border: '3px groove grey', borderRadius: '10px'}}> | <Box xs={12} ml={4} mt={3} sx={{ p: 2, border: '3px groove grey', borderRadius: '10px'}}> | ||||
<ApplicationDetailCard | |||||
// updateUserObject={updateUserObject} | |||||
{isLoading&&editMode? | |||||
<LoadingComponent/>: | |||||
<ApplicationDetailCard | |||||
applicationDetailData={applicationDetailData} | applicationDetailData={applicationDetailData} | ||||
setStatus = {setStatus} | setStatus = {setStatus} | ||||
// isCollectData={isCollectData} | |||||
setReload = {setReload} | |||||
setUpdateApplicationObject={setUpdateApplicationObject} | |||||
isEditMode = {isEditMode} | |||||
setiIsSave={setiIsSave} | |||||
// isNewRecord={isNewRecord} | // isNewRecord={isNewRecord} | ||||
/> | |||||
/> | |||||
} | |||||
</Box> | </Box> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={10}> | <Grid item xs={12} md={10}> | ||||
@@ -63,6 +63,7 @@ export const SET_PUBLIC_NOTICE_STATUS_REJRCTED = apiPath+'/application/applicati | |||||
export const SET_PUBLIC_NOTICE_STATUS_CANCELLED = apiPath+'/application/application-detail-status-cancelled'; | export const SET_PUBLIC_NOTICE_STATUS_CANCELLED = apiPath+'/application/application-detail-status-cancelled'; | ||||
export const SET_PUBLIC_NOTICE_STATUS_COMPLATED = apiPath+'/application/application-detail-status-complated'; | export const SET_PUBLIC_NOTICE_STATUS_COMPLATED = apiPath+'/application/application-detail-status-complated'; | ||||
export const SET_PUBLIC_NOTICE_STATUS_WITHDRAW = apiPath+'/application/application-detail-status-withdrawn'; | export const SET_PUBLIC_NOTICE_STATUS_WITHDRAW = apiPath+'/application/application-detail-status-withdrawn'; | ||||
export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save'; | |||||
//User Group | //User Group | ||||
export const POST_AND_UPDATE_USER_GROUP = apiPath+'/group/save'; | export const POST_AND_UPDATE_USER_GROUP = apiPath+'/group/save'; |
@@ -34,9 +34,9 @@ export const publicNoticeStaticEng = [ | |||||
]; | ]; | ||||
export const groupTitle = [ | export const groupTitle = [ | ||||
{ key: 1, label: 'Private Bill', type: 'A' }, | |||||
{ key: 2, label: 'Companies Ordinance', type: 'B' }, | |||||
{ key: 3, label: 'High Court', type: 'C' }, | |||||
{ key: 4, label: 'Notices', type: 'D' }, | |||||
{ key: 5, label: 'Miscellaneous (Companies)', type: 'E' }, | |||||
{ key: 1, label: 'A - Private Bill', title: 'Private Bill', type: 'A'}, | |||||
{ key: 2, label: 'B - Companies Ordinance', title: 'Companies Ordinance', type: 'B' }, | |||||
{ key: 3, label: 'C - High Court', title: 'High Court', type: 'C' }, | |||||
{ key: 4, label: 'D - Notices', title: 'Notices', type: 'D' }, | |||||
{ key: 5, label: 'E - Miscellaneous (Companies)', title: 'Miscellaneous (Companies)', type: 'E' }, | |||||
]; | ]; |