| @@ -40,9 +40,9 @@ export function getStatusEng(params) { | |||
| export function getStatusByTextEng(status) { | |||
| switch (status) { | |||
| case "submitted": | |||
| return getStatusTag({ color: "#f5a83d", text: "Processing" }) | |||
| return getStatusTag({ color: "#f5a83d", text: "Submitted" }) | |||
| case "reviewed": | |||
| return getStatusTag({ color: "#f5a83d", text: "Processing" }) | |||
| return getStatusTag({ color: "#0C489E", text: "Reviewed" }) | |||
| case "confirmed": | |||
| if (localStorage.getItem('userData').creditor) | |||
| return getStatusTag({ color: "#22a13f", text: "Pending Publish" }) | |||
| @@ -175,11 +175,20 @@ const ApplicationDetailCard = ( | |||
| <FormLabel>申請狀態:</FormLabel> | |||
| </Grid> | |||
| <Grid item xs={12} md={9} lg={9}> | |||
| <FormControl variant="outlined" fullWidth > | |||
| <Grid item xs={12} md={2} lg={2}> | |||
| <FormControl variant="outlined"> | |||
| {StatusUtils.getStatusByText(currentApplicationDetailData.status)} | |||
| </FormControl> | |||
| </Grid> | |||
| <Grid item xs={12} md={7} lg={7}> | |||
| <Stack direction="row" justifyContent="flex-start" alignItems="center"> | |||
| <FormControl variant="outlined" fullWidth disabled> | |||
| <Typography id='reason'> | |||
| {currentApplicationDetailData.reason} | |||
| </Typography> | |||
| </FormControl> | |||
| </Stack> | |||
| </Grid> | |||
| </Grid> | |||
| </Grid> | |||
| </Grid> | |||
| @@ -31,6 +31,7 @@ import ReplayIcon from '@mui/icons-material/Replay'; | |||
| const ApplicationDetailCard = ( | |||
| { applicationDetailData, | |||
| setStatus, | |||
| setUploadStatus | |||
| } | |||
| ) => { | |||
| @@ -72,6 +73,7 @@ const ApplicationDetailCard = ( | |||
| skey: fileDetail.skey, | |||
| filename: fileDetail.filename, | |||
| }); | |||
| setUploadStatus(true) | |||
| }; | |||
| @@ -109,7 +111,7 @@ const ApplicationDetailCard = ( | |||
| border={false} | |||
| content={false} | |||
| > | |||
| {verified && currentApplicationDetailData.status != "rejected" ? | |||
| {verified && currentApplicationDetailData.status != "notAccepted" ? | |||
| <Grid container spacing={4} direction="row"> | |||
| <Grid item xs={12} md={4} > | |||
| <Stack | |||
| @@ -119,7 +121,7 @@ const ApplicationDetailCard = ( | |||
| spacing={2} | |||
| mb={2} | |||
| > | |||
| {currentApplicationDetailData.status == "accepted" ? | |||
| {currentApplicationDetailData.status == "reviewed" ? | |||
| <Button | |||
| // size="large" | |||
| variant="contained" | |||
| @@ -143,7 +145,7 @@ const ApplicationDetailCard = ( | |||
| spacing={2} | |||
| mb={2} | |||
| > | |||
| {currentApplicationDetailData.status == "submitted" ? | |||
| {currentApplicationDetailData.status == "submitted"||currentApplicationDetailData.status == "reviewed" ? | |||
| <> | |||
| <Button | |||
| // size="large" | |||
| @@ -243,7 +245,7 @@ const ApplicationDetailCard = ( | |||
| </Grid> | |||
| <Grid item xs={12} md={9} lg={9}> | |||
| <FormControl variant="outlined" fullWidth > | |||
| <FormControl variant="outlined"> | |||
| {StatusUtils.getStatusByTextEng(currentApplicationDetailData.status)} | |||
| </FormControl> | |||
| </Grid> | |||
| @@ -1,9 +1,9 @@ | |||
| // material-ui | |||
| import { | |||
| FormControl, | |||
| // Button, | |||
| Button, | |||
| Grid, | |||
| // InputAdornment, | |||
| Stack, | |||
| Typography, FormLabel, | |||
| OutlinedInput, | |||
| } from '@mui/material'; | |||
| @@ -20,10 +20,12 @@ import { lazy } from 'react'; | |||
| const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); | |||
| //import {useParams} from "react-router-dom"; | |||
| import * as DateUtils from "utils/DateUtils"; | |||
| import EditNoteIcon from '@mui/icons-material/EditNote'; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| const GazetteDetailCard = ( | |||
| { applicationDetailData, | |||
| setStatus | |||
| // isCollectData, | |||
| // updateUserObject, | |||
| // isNewRecord | |||
| @@ -36,6 +38,9 @@ const GazetteDetailCard = ( | |||
| const [issueDate,setIssueDate] = useState(""); | |||
| const [gazetteCode,setGazetteCode] = useState(""); | |||
| const [groupTitle,setGroupTitle] = useState(""); | |||
| const [verified, setVerified] = useState(null); | |||
| const [currentStatus, setCurrentStatus] = useState({}); | |||
| const {register, | |||
| // getValues | |||
| } = useForm() | |||
| @@ -44,6 +49,8 @@ const GazetteDetailCard = ( | |||
| //if user data from parent are not null | |||
| // console.log(applicationDetailData) | |||
| if (Object.keys(applicationDetailData).length > 0) { | |||
| setCurrentStatus(applicationDetailData.data.status); | |||
| setVerified(applicationDetailData.userData.verifiedBy ? true : false); | |||
| setIssueNum(applicationDetailData.gazetteIssueDetail.volume+"/"+applicationDetailData.gazetteIssueDetail.year | |||
| +" No. "+applicationDetailData.gazetteIssueDetail.issueNo); | |||
| setIssueDate(DateUtils.dateFormat(applicationDetailData.gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); | |||
| @@ -60,6 +67,10 @@ const GazetteDetailCard = ( | |||
| } | |||
| }, [issueNum]); | |||
| const groupDetailClick = () => () => { | |||
| setStatus("genGazetteCode") | |||
| }; | |||
| // useEffect(() => { | |||
| // //upload latest data to parent | |||
| // const values = getValues(); | |||
| @@ -79,6 +90,31 @@ const GazetteDetailCard = ( | |||
| border={false} | |||
| content={false} | |||
| > | |||
| {verified && currentStatus != "notAccepted" ? | |||
| <Grid container spacing={4} direction="row"> | |||
| <Grid item xs={12} md={4} > | |||
| <Stack | |||
| direction="row" | |||
| justifyContent="space-between" | |||
| alignItems="center" | |||
| spacing={2} | |||
| mb={2} | |||
| > | |||
| <Button | |||
| // size="large" | |||
| variant="contained" | |||
| onClick={groupDetailClick()} | |||
| sx={{ | |||
| textTransform: 'capitalize', | |||
| alignItems: 'end' | |||
| }}> | |||
| <EditNoteIcon /> | |||
| <Typography ml={1}> Gen Gazette Code</Typography> | |||
| </Button> | |||
| </Stack> | |||
| </Grid> | |||
| </Grid> | |||
| :null} | |||
| <Typography variant="h5" sx={{mb: 2, borderBottom: "1px solid black"}}> | |||
| Gazette Details | |||
| </Typography> | |||
| @@ -30,21 +30,10 @@ const StatusChangeDialog = (props) => { | |||
| const [prositiveBtnText, setPrositiveBtnText] = useState("Confirm"); | |||
| const [remarks, setRemarks] = useState(""); | |||
| const [helperText, setHelperText] = useState(""); | |||
| // const [selectedGazetteGroupInputType, setSelectedGazetteGroupInputType] = useState(""); | |||
| const [comboInputValue, setComboInputValue] = useState(""); | |||
| const groupTitleComboList = ComboData.groupTitle; | |||
| useEffect(() => { | |||
| // console.log(Object.keys(!props.selectedGazetteGroup).length) | |||
| // if (props.getStatus == "resubmit") { | |||
| // setStatus("Accept") | |||
| // } else if (props.getStatus == "reject") { | |||
| // setStatus("Reject") | |||
| // } else if (props.getStatus == "complete") { | |||
| // setStatus("Complete") | |||
| // } else if (props.getStatus == "withdraw") { | |||
| // setStatus("Withdraw") | |||
| // } | |||
| if (props.getStatus == "genGazetteCode") { | |||
| setDialogTitle("Gen Gazette Code"); | |||
| setPrositiveBtnText("Gen"); | |||
| @@ -59,21 +48,24 @@ const StatusChangeDialog = (props) => { | |||
| let str = "Are you sure you want to "+props.getStatus+" this application?" | |||
| return getConfirmContent(str); | |||
| } | |||
| }, [props.getStatus]); | |||
| const acceptedHandle = () => () => { | |||
| // console.log(selectedGazetteGroup) | |||
| if(props.getStatus == "notAccepted"){ | |||
| const getStatus = props.getStatus.status; | |||
| if(getStatus == "notAccepted"){ | |||
| if(!remarks || remarks=="" ) | |||
| setHelperText("Please enter reason"); | |||
| } | |||
| if(!helperText){ | |||
| props.onWindowCallback(props.getStatus,{"reason": remarks}); | |||
| props.setReason({"reason": remarks}); | |||
| if (remarks!=null&&remarks!=""){ | |||
| console.log(remarks) | |||
| // props.setStatusWindowAccepted(true); | |||
| } | |||
| } | |||
| if(getStatus != "notAccepted"){ | |||
| props.setStatusWindowAccepted(true); | |||
| } | |||
| }; | |||
| @@ -107,7 +99,7 @@ const StatusChangeDialog = (props) => { | |||
| placeholder="Please enter reason" | |||
| helperText={helperText} | |||
| onChange={(newValues)=>{ | |||
| setRemarks(newValues); | |||
| setRemarks(newValues.target.value); | |||
| setHelperText(""); | |||
| }} | |||
| > | |||
| @@ -144,10 +136,12 @@ const StatusChangeDialog = (props) => { | |||
| id="gazetteGroup" | |||
| options={groupTitleComboList} | |||
| filterOptions={(options) => options} | |||
| inputValue={props.selectedGazetteGroupInputType} | |||
| inputValue={comboInputValue.label} | |||
| onChange={(event, newValue) => { | |||
| if (newValue != null && newValue != {}) { | |||
| console.log(comboInputValue) | |||
| props.setSelectedGazetteGroupInputType(newValue.label); | |||
| setComboInputValue(newValue); | |||
| props.setSelectedGazetteGroup(newValue); | |||
| formik.setFieldValue("gazetteGroup", "") | |||
| } else { | |||
| @@ -198,7 +192,7 @@ const StatusChangeDialog = (props) => { | |||
| </Button> | |||
| </DialogActions> | |||
| <DialogActions> | |||
| <Button variant="contained" color="success" onClick={acceptedHandle()} autoFocus disabled={Object.keys(props.selectedGazetteGroup).length === 0 && status === "Accept"}> | |||
| <Button variant="contained" color="success" onClick={acceptedHandle()} autoFocus disabled={Object.keys(props.selectedGazetteGroup).length === 0 && props.getStatus === "genGazetteCode"}> | |||
| {prositiveBtnText} | |||
| </Button> | |||
| </DialogActions> | |||
| @@ -26,10 +26,12 @@ const TabTableDetail = Loadable(lazy(() => import('./tabTableDetail/TabTable'))) | |||
| import { | |||
| GET_PUBLIC_NOTICE_APPLY_DETAIL, | |||
| UPDATE_PUBLIC_NOTICE_APPLY_DETAIL, | |||
| SET_PUBLIC_NOTICE_STATUS_ACCEPTED, | |||
| SET_PUBLIC_NOTICE_GROUP_DETAIL, | |||
| SET_PUBLIC_NOTICE_STATUS_NOT_ACCEPT, | |||
| SET_PUBLIC_NOTICE_STATUS_COMPLATED, | |||
| SET_PUBLIC_NOTICE_STATUS_WITHDRAW | |||
| SET_PUBLIC_NOTICE_STATUS_WITHDRAW, | |||
| SET_PUBLIC_NOTICE_STATUS_RESUBMIT, | |||
| SET_PUBLIC_NOTICE_STATUS_REVIEWED | |||
| } from "utils/ApiPathConst"; | |||
| const StatusChangeDialog = Loadable(lazy(() => import('./StatusChangeDialog'))); | |||
| import * as DateUtils from "utils/DateUtils"; | |||
| @@ -44,6 +46,7 @@ const PublicNoticeDetail_GLD = () => { | |||
| // const [refApplicationDetailData, setRefApplicationDetailData] = React.useState({}); | |||
| const [isLoading, setLoading] = useState(false); | |||
| const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); | |||
| const [getUploadStatus, setUploadStatus] = useState(false); | |||
| //pageTitle | |||
| const [appNo, setAapNo] = useState(""); | |||
| @@ -59,6 +62,7 @@ const PublicNoticeDetail_GLD = () => { | |||
| const [statusWindowAccepted, setStatusWindowAccepted] = useState(false); | |||
| const [selectedGazetteGroup, setSelectedGazetteGroup] = useState({}); | |||
| const [selectedGazetteGroupInputType, setSelectedGazetteGroupInputType] = useState(""); | |||
| const [getReason, setReason] = useState({}); | |||
| //editMode | |||
| const [updateApplicationObject, setUpdateApplicationObject] = useState({}); | |||
| @@ -156,37 +160,28 @@ const PublicNoticeDetail_GLD = () => { | |||
| const handleReset = () => { | |||
| setSelectedGazetteGroupInputType("") | |||
| setSelectedGazetteGroup({}); | |||
| setReason({}); | |||
| }; | |||
| useEffect(() => { | |||
| if (statusWindowAccepted) { | |||
| if (getStatus == "accept") { | |||
| if (getStatus == "genGazetteCode") { | |||
| onAcceptedClick() | |||
| } else if (getStatus == "reject") { | |||
| onNotAcceptClick() | |||
| } else if (getStatus == "complete") { | |||
| onComplatedClick() | |||
| } else if (getStatus == "withdraw") { | |||
| onWithdrawnClick() | |||
| } else if (getStatus == "notAccepted"){ | |||
| onNotAcceptClick(getReason); | |||
| } else if (getStatus == "resubmit"){ | |||
| onReSubmitClick(); | |||
| } | |||
| } | |||
| }, [statusWindowAccepted]); | |||
| const onWindowCallback = (status, data) => { | |||
| if (status == "genGazetteCode") { | |||
| onAcceptedClick() | |||
| } else if (getStatus == "notAccepted") { | |||
| onNotAcceptClick(data.reason); | |||
| } else if (getStatus == "complete") { | |||
| onComplatedClick() | |||
| } else if (getStatus == "withdraw") { | |||
| onWithdrawnClick() | |||
| } | |||
| } | |||
| const onAcceptedClick = () => { | |||
| if (params.id > 0) { | |||
| axios.post(`${SET_PUBLIC_NOTICE_STATUS_ACCEPTED}/${params.id}`, | |||
| axios.post(`${SET_PUBLIC_NOTICE_GROUP_DETAIL}/${params.id}`, | |||
| { | |||
| "groupTitle": selectedGazetteGroup.title, | |||
| "groupNo": selectedGazetteGroup.type, | |||
| @@ -210,26 +205,13 @@ const PublicNoticeDetail_GLD = () => { | |||
| if (params.id <= 0) return; | |||
| HttpUtils.post({ | |||
| url: `${SET_PUBLIC_NOTICE_STATUS_NOT_ACCEPT}/${params.id}`, | |||
| params: { | |||
| reason: reason | |||
| }, | |||
| params: reason, | |||
| onSuccess: function () { | |||
| setOpen(false); | |||
| handleClose(); | |||
| location.reload(); | |||
| } | |||
| }); | |||
| // axios.get(`${SET_PUBLIC_NOTICE_STATUS_REJRCTED}/${params.id}`) | |||
| // .then((response) => { | |||
| // if (response.status === 204) { | |||
| // setOpen(false); | |||
| // handleClose(); | |||
| // location.reload(); | |||
| // } | |||
| // }) | |||
| // .catch(error => { | |||
| // console.log(error); | |||
| // return false; | |||
| // }); | |||
| // } | |||
| } | |||
| const onComplatedClick = () => { | |||
| @@ -266,16 +248,53 @@ const PublicNoticeDetail_GLD = () => { | |||
| } | |||
| }; | |||
| const onReSubmitClick = () => { | |||
| if (params.id > 0) { | |||
| axios.get(`${SET_PUBLIC_NOTICE_STATUS_RESUBMIT}/${params.id}`) | |||
| .then((response) => { | |||
| if (response.status === 204) { | |||
| setOpen(false); | |||
| handleClose(); | |||
| location.reload(); | |||
| } | |||
| }) | |||
| .catch(error => { | |||
| console.log(error); | |||
| return false; | |||
| }); | |||
| } | |||
| }; | |||
| useEffect(() => { | |||
| const status = applicationDetailData.data!=undefined?applicationDetailData.data.status:"" | |||
| if(status === "submitted" && params.id > 0 && getUploadStatus){ | |||
| axios.get(`${SET_PUBLIC_NOTICE_STATUS_REVIEWED}/${params.id}`) | |||
| .then((response) => { | |||
| if (response.status === 204) { | |||
| setUploadStatus(false); | |||
| location.reload(); | |||
| } | |||
| }) | |||
| .catch(error => { | |||
| console.log(error); | |||
| return false; | |||
| }); | |||
| }else{ | |||
| setUploadStatus(false); | |||
| } | |||
| }, [getUploadStatus]); | |||
| return ( | |||
| <Grid container sx={{ maxnHeight: '500vh', backgroundColor: '#ffffff' }} direction="column"> | |||
| <StatusChangeDialog open={open} | |||
| handleClose={handleClose} | |||
| onWindowCallback={onWindowCallback} | |||
| setReason={setReason} | |||
| setStatusWindowAccepted={setStatusWindowAccepted} | |||
| getStatus={getStatus} | |||
| issueDate={issueDate} | |||
| issueNum={issueNum} | |||
| gazetteIssue={gazetteIssue} | |||
| //combo value | |||
| selectedGazetteGroup={selectedGazetteGroup} | |||
| setSelectedGazetteGroup={setSelectedGazetteGroup} | |||
| selectedGazetteGroupInputType={selectedGazetteGroupInputType} | |||
| @@ -305,6 +324,7 @@ const PublicNoticeDetail_GLD = () => { | |||
| applicationDetailData={applicationDetailData} | |||
| setStatus={setStatus} | |||
| // setReload = {setReload} | |||
| setUploadStatus={setUploadStatus} | |||
| setUpdateApplicationObject={setUpdateApplicationObject} | |||
| isEditMode={isEditMode} | |||
| setiIsSave={setiIsSave} | |||
| @@ -318,6 +338,7 @@ const PublicNoticeDetail_GLD = () => { | |||
| <GazetteDetailCard | |||
| // updateUserObject={updateUserObject} | |||
| applicationDetailData={applicationDetailData} | |||
| setStatus={setStatus} | |||
| // isCollectData={isCollectData} | |||
| // isNewRecord={isNewRecord} | |||
| /> | |||
| @@ -58,11 +58,13 @@ export const POST_PUBLIC_NOTICE_APPLY = apiPath+'/application/apply'; | |||
| export const POST_ADMIN_USER_REGISTER = apiPath+'/user/registry'; | |||
| export const DELETE_USER = apiPath+'/user'; | |||
| export const GET_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/application-detail'; | |||
| export const SET_PUBLIC_NOTICE_STATUS_ACCEPTED = apiPath+'/application/application-detail-status-accepted'; | |||
| export const SET_PUBLIC_NOTICE_GROUP_DETAIL = apiPath+'/application/application-group-detail'; | |||
| export const SET_PUBLIC_NOTICE_STATUS_NOT_ACCEPT = apiPath+'/application/application-detail-status-not-accept'; | |||
| 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_WITHDRAW = apiPath+'/application/application-detail-status-withdrawn'; | |||
| export const SET_PUBLIC_NOTICE_STATUS_RESUBMIT = apiPath+'/application/application-detail-status-resubmit'; | |||
| export const SET_PUBLIC_NOTICE_STATUS_REVIEWED = apiPath+'/application/application-detail-status-reviewed'; | |||
| export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save'; | |||
| export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo'; | |||