|
|
@@ -14,15 +14,23 @@ import * as DateUtils from "utils/DateUtils"; |
|
|
|
import * as UrlUtils from "utils/ApiPathConst"; |
|
|
|
import * as HttpUtils from "utils/HttpUtils"; |
|
|
|
import { useNavigate } from "react-router-dom"; |
|
|
|
import { notifyDownloadSuccess } from 'utils/CommonFunction'; |
|
|
|
|
|
|
|
|
|
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
|
|
|
|
|
|
|
|
|
const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => { |
|
|
|
const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _publishCount }) => { |
|
|
|
|
|
|
|
const [isFailPopUp, setIsFailPopUp] = React.useState(false); |
|
|
|
const [failText, setFailText] = React.useState(""); |
|
|
|
|
|
|
|
const [isSuccessPopUp, setIsSuccessPopUp] = React.useState(false); |
|
|
|
const [resultCount, setResultCount] = React.useState(0); |
|
|
|
|
|
|
|
const [issueSelected, setIssueSelected] = React.useState({}); |
|
|
|
const [paymentCount, setPaymentCount] = React.useState(0); |
|
|
|
const [publishCount, setPublishCount] = React.useState(0); |
|
|
|
const [issueCombo, setIssueCombo] = React.useState([]); |
|
|
|
const navigate = useNavigate() |
|
|
|
|
|
|
@@ -48,7 +56,14 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => { |
|
|
|
} |
|
|
|
}, [issueComboData]); |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
setPaymentCount(_paymentCount); |
|
|
|
}, [_paymentCount]); |
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
setPublishCount(_publishCount); |
|
|
|
}, [_publishCount]); |
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
onPreView(); |
|
|
|
}, [issueSelected]); |
|
|
@@ -69,14 +84,33 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => { |
|
|
|
} else { |
|
|
|
HttpUtils.post({ |
|
|
|
url: UrlUtils.DEMAND_NOTE_CREATE + "/" + issueSelected.id, |
|
|
|
onSuccess: function () { |
|
|
|
navigate('/paymentPage/demandNote'); |
|
|
|
onSuccess: function (responseData) { |
|
|
|
setResultCount(responseData.count); |
|
|
|
setIsSuccessPopUp(true); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
const fileDownload = () => { |
|
|
|
HttpUtils.fileDownload({ |
|
|
|
url: UrlUtils.DEMAND_NOTE_EXPORT, |
|
|
|
params: { |
|
|
|
"issueId": issueSelected.id |
|
|
|
}, |
|
|
|
onSuccess: function () { |
|
|
|
notifyDownloadSuccess(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const onNavigate = () => { |
|
|
|
setIsSuccessPopUp(false); |
|
|
|
if(resultCount > 0) |
|
|
|
navigate('/paymentPage/demandNote'); |
|
|
|
}; |
|
|
|
|
|
|
|
const onPreView = () => { |
|
|
|
if (!issueSelected?.id) { |
|
|
|
return; |
|
|
@@ -104,7 +138,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => { |
|
|
|
|
|
|
|
{/*row 2*/} |
|
|
|
<Grid container alignItems={"center"}> |
|
|
|
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb:1 }}> |
|
|
|
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 1 }}> |
|
|
|
<Autocomplete |
|
|
|
disablePortal |
|
|
|
id="issueId" |
|
|
@@ -139,7 +173,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => { |
|
|
|
<Typography variant="h5">Preview</Typography> |
|
|
|
</Button> |
|
|
|
</Grid> */} |
|
|
|
<Grid item sx={{ ml: 3, mr: 3}} > |
|
|
|
<Grid item sx={{ ml: 3, mr: 3 }} > |
|
|
|
<Button |
|
|
|
size="large" |
|
|
|
variant="contained" |
|
|
@@ -152,6 +186,14 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => { |
|
|
|
<Typography variant="h5">Create</Typography> |
|
|
|
</Button> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item sx={{ ml: 3, mr: 3 }} > |
|
|
|
<Typography variant="h5">Pending Payment: {paymentCount}</Typography> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item sx={{ ml: 3, mr: 3 }} > |
|
|
|
<Typography variant="h5">Pending Publish: {publishCount}</Typography> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
</form> |
|
|
|
<div> |
|
|
@@ -165,6 +207,35 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => { |
|
|
|
</DialogActions> |
|
|
|
</Dialog> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<Dialog open={isSuccessPopUp} onClose={() => setIsSuccessPopUp(false)} > |
|
|
|
<DialogTitle><Typography variant="h3">Create Result</Typography></DialogTitle> |
|
|
|
<DialogContent style={{ display: 'flex', }}> |
|
|
|
<Grid container alignItems={"center"}> |
|
|
|
<Grid item md={12}> |
|
|
|
<Typography variant="h4" style={{ padding: '16px' }}>Created DN record: {resultCount}</Typography> |
|
|
|
</Grid> |
|
|
|
{resultCount == 0 ? <></> : |
|
|
|
<Grid item md={12}> |
|
|
|
<Button |
|
|
|
size="large" |
|
|
|
onClick={fileDownload} |
|
|
|
sx={{ |
|
|
|
textTransform: 'capitalize', |
|
|
|
alignItems: 'end' |
|
|
|
}}> |
|
|
|
<Typography variant="h5">Click here to download GDNS xml file.</Typography> |
|
|
|
</Button> |
|
|
|
</Grid> |
|
|
|
} |
|
|
|
|
|
|
|
</Grid> |
|
|
|
</DialogContent> |
|
|
|
<DialogActions> |
|
|
|
<Button onClick={() => onNavigate()}><Typography variant="h5">OK</Typography></Button> |
|
|
|
</DialogActions> |
|
|
|
</Dialog> |
|
|
|
</div> |
|
|
|
</MainCard> |
|
|
|
); |
|
|
|
}; |
|
|
|