選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.js 6.5 KiB

1年前
2年前
2年前
2年前
2年前
1年前
2年前
1年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
1年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
1年前
1年前
2年前
1年前
2年前
2年前
1年前
2年前
1年前
2年前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import React, {
  2. useEffect,
  3. useState,
  4. lazy
  5. } from "react";
  6. // material-ui
  7. import {
  8. Grid,
  9. Typography,
  10. Stack,
  11. Box,
  12. Button
  13. } from '@mui/material';
  14. import Loadable from 'components/Loadable';
  15. import {
  16. // useNavigate,
  17. useParams
  18. } from "react-router-dom";
  19. import axios from "axios";
  20. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  21. const ApplicationDetailCard = Loadable(lazy(() => import('./ApplicationDetailCard')));
  22. const StatusChangeDialog = Loadable(lazy(() => import('./StatusChangeDialog')));
  23. const TabTableDetail = Loadable(lazy(() => import('./tabTableDetail/TabTable')));
  24. import {
  25. GET_PUBLIC_NOTICE_APPLY_DETAIL,
  26. SET_PUBLIC_NOTICE_STATUS_CANCELLED
  27. } from "utils/ApiPathConst";
  28. import { useNavigate } from "react-router-dom";
  29. import ForwardIcon from '@mui/icons-material/Forward';
  30. import { notifyActionSuccess } from "utils/CommonFunction";
  31. import { FormattedMessage, useIntl } from "react-intl";
  32. import usePageTitle from "components/usePageTitle";
  33. // ==============================|| Body - DEFAULT ||============================== //
  34. const DashboardDefault = () => {
  35. usePageTitle("myPublicNotice");
  36. const params = useParams();
  37. const [applicationDetailData, setApplicationDetailData] = useState({});
  38. const [appNo, setAapNo] = useState("");
  39. const [gazetteIssue, setGazetteIssue] = useState("");
  40. const [issueNum, setIssueNum] = useState("");
  41. const navigate = useNavigate()
  42. const intl = useIntl();
  43. //statusWindow
  44. const [open, setOpen] = useState(false);
  45. const [getStatus, setStatus] = useState("");
  46. const [statusWindowAccepted, setStatusWindowAccepted] = useState(false);
  47. const [proofCount, setProofCount] = useState(0);
  48. const [paymentCount, setPaymentCount] = useState(0);
  49. const [fee, setFee] = useState(0);
  50. const title = appNo + ", " + gazetteIssue + ", " + issueNum
  51. const _sx = {
  52. boxShadow: 1,
  53. border: 1,
  54. borderColor: '#DDD',
  55. '& .MuiDataGrid-cell': {
  56. borderTop: 1,
  57. borderBottom: 1,
  58. borderColor: "#EEE"
  59. },
  60. '& .MuiDataGrid-footerContainer': {
  61. border: 1,
  62. borderColor: "#EEE"
  63. }
  64. }
  65. const BackgroundHead = {
  66. backgroundImage: `url(${titleBackgroundImg})`,
  67. width: '100%',
  68. height: '100%',
  69. backgroundSize: 'contain',
  70. backgroundRepeat: 'no-repeat',
  71. backgroundColor: '#0C489E',
  72. backgroundPosition: 'right'
  73. }
  74. // const appNo = "G2023-343"
  75. useEffect(() => {
  76. loadApplicationDetail()
  77. }, []);
  78. const loadApplicationDetail = () => {
  79. if (params.id > 0) {
  80. axios.get(`${GET_PUBLIC_NOTICE_APPLY_DETAIL}/${params.id}`)
  81. .then((response) => {
  82. if (response.status === 200) {
  83. setApplicationDetailData(response.data);
  84. const gazetteIssueDetail = response.data.gazetteIssueDetail;
  85. setAapNo(response.data.data.appNo);
  86. setGazetteIssue(gazetteIssueDetail.issueYear + " Vol " + gazetteIssueDetail.volume);
  87. setIssueNum(" No. " + gazetteIssueDetail.issueNo);
  88. setProofCount(response.data.proofCount);
  89. setPaymentCount(response.data.paymentCount);
  90. setFee(response.data.fee);
  91. }
  92. })
  93. .catch(error => {
  94. console.log(error);
  95. return false;
  96. });
  97. }
  98. }
  99. useEffect(() => {
  100. if (applicationDetailData.data === null) {
  101. navigate('/publicNotice');
  102. }
  103. }, [applicationDetailData]);
  104. const handleClose = () => {
  105. setOpen(false);
  106. setStatus("")
  107. setStatusWindowAccepted(false)
  108. };
  109. useEffect(() => {
  110. if (statusWindowAccepted) {
  111. if (getStatus == "cancel") {
  112. onCancelledClick()
  113. }
  114. }
  115. }, [statusWindowAccepted]);
  116. useEffect(() => {
  117. // console.log(getStatus)
  118. if (getStatus !== "") {
  119. setOpen(true)
  120. }
  121. }, [getStatus]);
  122. const onCancelledClick = () => {
  123. if (params.id > 0) {
  124. axios.get(`${SET_PUBLIC_NOTICE_STATUS_CANCELLED}/${params.id}`)
  125. .then((response) => {
  126. if (response.status === 204) {
  127. notifyActionSuccess("取消成功!")
  128. setOpen(false);
  129. handleClose();
  130. loadApplicationDetail()
  131. window.location.reload();
  132. }
  133. })
  134. .catch(error => {
  135. console.log(error);
  136. return false;
  137. });
  138. }
  139. };
  140. return (
  141. <Grid container sx={{ backgroundColor: '#ffffff' }} direction="column">
  142. <StatusChangeDialog open={open} handleClose={handleClose} setStatusWindowAccepted={setStatusWindowAccepted} getStatus={getStatus} />
  143. <Grid item xs={12}>
  144. <div style={BackgroundHead}>
  145. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  146. <Typography ml={15} color='#FFF' variant="h4" sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}>
  147. <FormattedMessage id="myPublicNotice" />
  148. </Typography>
  149. </Stack>
  150. </div>
  151. </Grid>
  152. <Grid item xs={12} md={12}>
  153. <Grid container direction="column" justifyContent="flex-start" alignItems="center">
  154. <Grid item xs={12} width={{ xs: "90%", sm: "90%", md: "60%", lg: "60%" }}>
  155. <Stack direction="row">
  156. <Button
  157. aria-label={intl.formatMessage({ id: 'back' })}
  158. title={intl.formatMessage({ id: 'back' })}
  159. sx={{ ml: 0, mt: 2.5 }} style={{ border: '2px solid' }}
  160. variant="outlined" onClick={() => { navigate("/publicNotice") }}
  161. >
  162. <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} />
  163. </Button>
  164. <Typography ml={3} mt={3} variant="h4">{title}</Typography>
  165. </Stack>
  166. </Grid>
  167. <Grid item width={{ md: "60%", xs: "90%" }}>
  168. <Box xs={12} mt={3} sx={{ border: '0px groove grey', borderRadius: '10px', ..._sx }}>
  169. <ApplicationDetailCard
  170. setStatus={setStatus}
  171. applicationDetailData={applicationDetailData}
  172. fee={fee}
  173. />
  174. </Box>
  175. </Grid>
  176. <Grid item width={{ md: "75%" }}>
  177. <Box xs={12} mt={3} sx={{ border: '0px groove grey', borderRadius: '10px', ..._sx, mb: 2 }}>
  178. <TabTableDetail
  179. appId={params.id}
  180. proofCount={proofCount}
  181. paymentCount={paymentCount}
  182. setProofCount={setProofCount}
  183. setPaymentCount={setPaymentCount}
  184. />
  185. </Box>
  186. </Grid>
  187. </Grid>
  188. </Grid>
  189. </Grid>
  190. );
  191. };
  192. export default DashboardDefault;