Browse Source

add publish button

master
Anna Ho 1 year ago
parent
commit
24b1a9fd93
3 changed files with 78 additions and 41 deletions
  1. +49
    -29
      src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js
  2. +28
    -12
      src/pages/PublicNotice/Details_GLD/index.js
  3. +1
    -0
      src/utils/ApiPathConst.js

+ 49
- 29
src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js View File

@@ -100,19 +100,23 @@ const ApplicationDetailCard = (
setStatus("withdraw") setStatus("withdraw")
}; };


const doPublish =()=>()=>{
setStatus("published")
}

const onProofClick = () => { const onProofClick = () => {
if (applicationDetailData.data.groupNo) { if (applicationDetailData.data.groupNo) {
HttpUtils.get({ HttpUtils.get({
url: UrlUtils.CHECK_CREATE_PROOF+"/"+currentApplicationDetailData.id,
onSuccess:function(responeData){
if(responeData.success == true){
url: UrlUtils.CHECK_CREATE_PROOF + "/" + currentApplicationDetailData.id,
onSuccess: function (responeData) {
if (responeData.success == true) {
window.open("/proof/create/" + currentApplicationDetailData.id, "_blank", "noreferrer"); window.open("/proof/create/" + currentApplicationDetailData.id, "_blank", "noreferrer");
window.addEventListener("focus", onFocus) window.addEventListener("focus", onFocus)
}else{
} else {
let msg = responeData.msg; let msg = responeData.msg;
if(msg === "haveActiveProof"){
if (msg === "haveActiveProof") {
msg = "Action Failed: There is already a pending payment and proofreading record for client review." msg = "Action Failed: There is already a pending payment and proofreading record for client review."
}else if(msg === "haveProofed"){
} else if (msg === "haveProofed") {
msg = "Action Failed: Already proofed." msg = "Action Failed: Already proofed."
} }
setWarningText(msg); setWarningText(msg);
@@ -120,8 +124,8 @@ const ApplicationDetailCard = (
} }
} }
}); });
}else {
} else {
setWarningText("Please generate Gazette Code before Create Proof."); setWarningText("Please generate Gazette Code before Create Proof.");
setIsWarningPopUp(true); setIsWarningPopUp(true);
} }
@@ -199,33 +203,49 @@ const ApplicationDetailCard = (
<Typography ml={1} variant="h5">Not accept</Typography> <Typography ml={1} variant="h5">Not accept</Typography>
</Button> </Button>
</> : </> :
currentApplicationDetailData.status == "paid" ?
(currentApplicationDetailData.status == "confirmed" && currentApplicationDetailData.creditor == 1) ?
<> <>
<Button <Button
// size="large" // size="large"
variant="contained" variant="contained"
onClick={complatedClick()}
onClick={doPublish()}
sx={{ sx={{
textTransform: 'capitalize', textTransform: 'capitalize',
alignItems: 'end', alignItems: 'end',
backgroundColor: '#52b202' backgroundColor: '#52b202'
}}> }}>
<DoneIcon /> <DoneIcon />
<Typography ml={1} variant="h5">Complete</Typography>
<Typography ml={1} variant="h5">Publish</Typography>
</Button> </Button>
<Button
// size="large"
variant="contained"
onClick={withdrawnClick()}
sx={{
textTransform: 'capitalize',
alignItems: 'end',
backgroundColor: '#ffa733'
}}>
<CloseIcon />
<Typography ml={1} variant="h5">Withdraw</Typography>
</Button>
</> : null
</>
:
(currentApplicationDetailData.status == "paid" && currentApplicationDetailData.creditor == 0) ?
<>
<Button
// size="large"
variant="contained"
onClick={complatedClick()}
sx={{
textTransform: 'capitalize',
alignItems: 'end',
backgroundColor: '#52b202'
}}>
<DoneIcon />
<Typography ml={1} variant="h5">Complete</Typography>
</Button>
<Button
// size="large"
variant="contained"
onClick={withdrawnClick()}
sx={{
textTransform: 'capitalize',
alignItems: 'end',
backgroundColor: '#ffa733'
}}>
<CloseIcon />
<Typography ml={1} variant="h5">Withdraw</Typography>
</Button>
</> : null
} }
</Stack> </Stack>
</Grid> </Grid>
@@ -267,7 +287,7 @@ const ApplicationDetailCard = (
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
<Grid item xs={12} sm={12} md={5.5} lg={5.5} sx={{ mb: 1, ml: {md:1, lg:3} }}>
<Grid item xs={12} sm={12} md={5.5} lg={5.5} sx={{ mb: 1, ml: { md: 1, lg: 3 } }}>
<Grid container alignItems={"center"}> <Grid container alignItems={"center"}>
<Grid item xs={12} md={4} lg={4} <Grid item xs={12} md={4} lg={4}
sx={{ display: 'flex', alignItems: 'center' }}> sx={{ display: 'flex', alignItems: 'center' }}>
@@ -329,7 +349,7 @@ const ApplicationDetailCard = (
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
<Grid item xs={12} md={5.5} lg={5.5} sx={{ mb: 1, ml: {md:1, lg:3} }}>
<Grid item xs={12} md={5.5} lg={5.5} sx={{ mb: 1, ml: { md: 1, lg: 3 } }}>
<Grid container alignItems={"center"}> <Grid container alignItems={"center"}>
<Grid item xs={12} md={4} lg={4} <Grid item xs={12} md={4} lg={4}
sx={{ display: 'flex', alignItems: 'center' }}> sx={{ display: 'flex', alignItems: 'center' }}>
@@ -351,7 +371,7 @@ const ApplicationDetailCard = (
WebkitTextFillColor: "#000000", WebkitTextFillColor: "#000000",
background: "#f8f8f8", background: "#f8f8f8",
}, },
mr:1
mr: 1
}} }}
inputProps={{ inputProps={{
maxLength: 3, maxLength: 3,
@@ -414,7 +434,7 @@ const ApplicationDetailCard = (
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
<Grid item xs={12} md={5.5} lg={5.5} sx={{ mb: 1, ml: {md:1, lg:3} }}>
<Grid item xs={12} md={5.5} lg={5.5} sx={{ mb: 1, ml: { md: 1, lg: 3 } }}>
<Grid container alignItems={"center"}> <Grid container alignItems={"center"}>
<Grid item xs={12} md={4} lg={4} <Grid item xs={12} md={4} lg={4}
sx={{ display: 'flex', alignItems: 'center' }}> sx={{ display: 'flex', alignItems: 'center' }}>
@@ -436,7 +456,7 @@ const ApplicationDetailCard = (
WebkitTextFillColor: "#000000", WebkitTextFillColor: "#000000",
background: "#f8f8f8", background: "#f8f8f8",
}, },
mr:1,
mr: 1,
}} }}
inputProps={{ inputProps={{
maxLength: 3, maxLength: 3,


+ 28
- 12
src/pages/PublicNotice/Details_GLD/index.js View File

@@ -32,7 +32,8 @@ import {
SET_PUBLIC_NOTICE_STATUS_COMPLATED, SET_PUBLIC_NOTICE_STATUS_COMPLATED,
SET_PUBLIC_NOTICE_STATUS_WITHDRAW, SET_PUBLIC_NOTICE_STATUS_WITHDRAW,
SET_PUBLIC_NOTICE_STATUS_RESUBMIT, SET_PUBLIC_NOTICE_STATUS_RESUBMIT,
SET_PUBLIC_NOTICE_STATUS_REVIEWED
SET_PUBLIC_NOTICE_STATUS_REVIEWED,
SET_PUBLIC_NOTICE_STATUS_PUBLISH
} 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";
@@ -182,6 +183,8 @@ const PublicNoticeDetail_GLD = () => {
onNotAcceptClick(getReason); onNotAcceptClick(getReason);
} else if (getStatus == "resubmit") { } else if (getStatus == "resubmit") {
onReSubmitClick(); onReSubmitClick();
} else if (getStatus == "published") {
onPublishClick();
} }
} }
}, [statusWindowAccepted]); }, [statusWindowAccepted]);
@@ -225,6 +228,19 @@ const PublicNoticeDetail_GLD = () => {
}); });
} }


const onPublishClick = () => {
if (params.id <= 0) return;
HttpUtils.post({
url: `${SET_PUBLIC_NOTICE_STATUS_PUBLISH}/${params.id}`,
onSuccess: function () {
setOpen(false);
handleClose();
loadApplicationDetail()
notifySaveSuccess()
}
});
}

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}`)
@@ -301,7 +317,7 @@ const PublicNoticeDetail_GLD = () => {
}, [getUploadStatus]); }, [getUploadStatus]);


return ( return (
<Grid container sx={{ width:"100%", backgroundColor: 'backgroundColor.default' }} direction="column">
<Grid container sx={{ width: "100%", backgroundColor: 'backgroundColor.default' }} direction="column">
<StatusChangeDialog open={open} <StatusChangeDialog open={open}
handleClose={handleClose} handleClose={handleClose}
setReason={setReason} setReason={setReason}
@@ -324,12 +340,12 @@ const PublicNoticeDetail_GLD = () => {
</div> </div>
</Grid> </Grid>
<Grid item xs={12} sm={12} md={12} lg={12}> <Grid item xs={12} sm={12} md={12} lg={12}>
<Stack direction="row">
<Button title="Back" sx={{ml:3.5, mt:2.5}} style={{ border: '2px solid' }} variant="outlined" onClick={()=>{navigate("/application/search")}}>
<ForwardIcon style={{height: 30, width: 50, transform : "rotate(180deg)"}}/>
<Stack direction="row">
<Button title="Back" sx={{ ml: 3.5, mt: 2.5 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate("/application/search") }}>
<ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} />
</Button> </Button>
<Typography ml={4} mt={3} variant="h4">{title}</Typography> <Typography ml={4} mt={3} variant="h4">{title}</Typography>
</Stack>
</Stack>
</Grid> </Grid>
{/* <Grid item xs={12} > {/* <Grid item xs={12} >
<Stack direction="row" height='20px' justifyContent="flex-start" alignItems="center"> <Stack direction="row" height='20px' justifyContent="flex-start" alignItems="center">
@@ -341,7 +357,7 @@ const PublicNoticeDetail_GLD = () => {
<Grid item xs={12} md={12} lg={9} xl={9}> <Grid item xs={12} md={12} lg={9} xl={9}>
<Grid container direction="column"> <Grid container direction="column">
<Grid item xs={12} sm={12} md={12} lg={12} xl={12}> <Grid item xs={12} sm={12} md={12} lg={12} xl={12}>
<Box xs={12} sx={{ ml:2 , mt:3, mr:{xs:2, sm:2}, borderRadius: '10px', backgroundColor: '#ffffff' }}>
<Box xs={12} sx={{ ml: 2, mt: 3, mr: { xs: 2, sm: 2 }, borderRadius: '10px', backgroundColor: '#ffffff' }}>
{isLoading && editMode ? {isLoading && editMode ?
<LoadingComponent /> : <LoadingComponent /> :
<ApplicationDetailCard <ApplicationDetailCard
@@ -358,7 +374,7 @@ const PublicNoticeDetail_GLD = () => {
</Box> </Box>
</Grid> </Grid>
<Grid item xs={12} md={12} lg={12} xl={12}> <Grid item xs={12} md={12} lg={12} xl={12}>
<Box xs={12} sx={{ml:2, mt:3, mr:{xs:2, sm:2}, borderRadius: '10px', backgroundColor: '#ffffff' }}>
<Box xs={12} sx={{ ml: 2, mt: 3, mr: { xs: 2, sm: 2 }, borderRadius: '10px', backgroundColor: '#ffffff' }}>
<GazetteDetailCard <GazetteDetailCard
// updateUserObject={updateUserObject} // updateUserObject={updateUserObject}
applicationDetailData={applicationDetailData} applicationDetailData={applicationDetailData}
@@ -369,21 +385,21 @@ const PublicNoticeDetail_GLD = () => {
</Box> </Box>
</Grid> </Grid>
<Grid item xs={12} md={12} lg={12} xl={12}> <Grid item xs={12} md={12} lg={12} xl={12}>
<Box xs={12} sx={{ml:2, mt:3, mr:{sm:2}, borderRadius: '10px',width: {xs:'92vw', sm:'96.5vw', md:"auto"}, backgroundColor: '#ffffff' }}>
<Box xs={12} sx={{ ml: 2, mt: 3, mr: { sm: 2 }, borderRadius: '10px', width: { xs: '92vw', sm: '96.5vw', md: "auto" }, backgroundColor: '#ffffff' }}>
<TabTableDetail <TabTableDetail
applicationDetailData={applicationDetailData} applicationDetailData={applicationDetailData}
proofList={proofList} proofList={proofList}
paymentList={paymentList} paymentList={paymentList}
/> />
</Box> </Box>
<br/>
<br />
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
<Grid item xs={12} md={12} lg={3} xl={3} sx={{mt:{xs: -3, sm:-3}}}>
<Grid item xs={12} md={12} lg={3} xl={3} sx={{ mt: { xs: -3, sm: -3 } }}>
<Grid container> <Grid container>
<Grid item xs={12} md={12}> <Grid item xs={12} md={12}>
<Box xs={12} md={12} height='800px' sx={{ ml:2, mt:3, mb:3, mr:{xs:2, sm:2}, borderRadius: '10px', backgroundColor: '#ffffff' }}>
<Box xs={12} md={12} height='800px' sx={{ ml: 2, mt: 3, mb: 3, mr: { xs: 2, sm: 2 }, borderRadius: '10px', backgroundColor: '#ffffff' }}>
<ClientDetailCard <ClientDetailCard
// updateUserObject={updateUserObject} // updateUserObject={updateUserObject}
applicationDetailData={applicationDetailData} applicationDetailData={applicationDetailData}


+ 1
- 0
src/utils/ApiPathConst.js View File

@@ -77,6 +77,7 @@ export const SET_PUBLIC_NOTICE_STATUS_COMPLATED = apiPath+'/application/applicat
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 SET_PUBLIC_NOTICE_STATUS_RESUBMIT = apiPath+'/application/application-detail-status-resubmit'; 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 SET_PUBLIC_NOTICE_STATUS_REVIEWED = apiPath+'/application/application-detail-status-reviewed';
export const SET_PUBLIC_NOTICE_STATUS_PUBLISH = apiPath+'/application/application-detail-status-publish';
export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save'; export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save';


export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo'; export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo';


Loading…
Cancel
Save