Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

192 lignes
8.5 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Stack,
  6. Button,
  7. Dialog, DialogTitle, DialogContent, DialogActions
  8. } from '@mui/material';
  9. import * as UrlUtils from "utils/ApiPathConst";
  10. import * as React from "react";
  11. import * as HttpUtils from "utils/HttpUtils";
  12. import { useParams } from "react-router-dom";
  13. import { useNavigate } from "react-router-dom";
  14. import * as DateUtils from "utils/DateUtils"
  15. import * as FormatUtils from "utils/FormatUtils";
  16. import Loadable from 'components/Loadable';
  17. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  18. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  19. const BackgroundHead = {
  20. backgroundImage: `url(${titleBackgroundImg})`,
  21. width: '100%',
  22. height: '100%',
  23. backgroundSize: 'contain',
  24. backgroundRepeat: 'no-repeat',
  25. backgroundColor: '#0C489E',
  26. backgroundPosition: 'right'
  27. }
  28. import {
  29. // useEffect,
  30. useState
  31. } from "react";
  32. import {PNSPS_BUTTON_THEME, PNSPS_LONG_BUTTON_THEME} from "../../../themes/buttonConst";
  33. import {ThemeProvider} from "@emotion/react";
  34. import {FormattedMessage} from "react-intl";
  35. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  36. const Index = () => {
  37. const params = useParams();
  38. const navigate = useNavigate()
  39. const [fee, setFee] = useState(0);
  40. const [record, setRecord] = React.useState();
  41. const [onReady, setOnReady] = React.useState(false);
  42. const [isPopUp, setIsPopUp] = useState(false);
  43. React.useEffect(() => {
  44. loadForm();
  45. }, []);
  46. React.useEffect(() => {
  47. setOnReady(true);
  48. }, [record]);
  49. const loadForm = () => {
  50. if (params.id > 0) {
  51. HttpUtils.get({
  52. url: UrlUtils.GET_PROOF_PAY + "/" + params.id,
  53. onSuccess: (responseData) => {
  54. if (!responseData.data?.id) {
  55. navigate("/proof/search");
  56. }
  57. setRecord(responseData.data);
  58. setFee(responseData.data.fee);
  59. }
  60. });
  61. }
  62. }
  63. function doPayment() {
  64. setIsPopUp(false);
  65. navigate('/paymentPage', { state: { amount: fee, appIdList: [record?.appId] } });
  66. }
  67. return (
  68. !onReady ?
  69. <LoadingComponent />
  70. :
  71. (
  72. <Grid container sx={{ minHeight: '110vh', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" >
  73. <Grid item xs={12} width="100%">
  74. <div style={BackgroundHead} width="100%">
  75. <Stack direction="row" height='70px'>
  76. <Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}>
  77. <FormattedMessage id="proofRecord"/>
  78. </Typography>
  79. </Stack>
  80. </div>
  81. </Grid>
  82. {/*row 1*/}
  83. <Grid item xs={12} md={12} >
  84. <Grid container justifyContent="flex-start" alignItems="center" >
  85. <center>
  86. <Grid item xs={12} md={8} >
  87. <Typography variant="h3" sx={{ textAlign: "left", ml: 4, mr: 4, mt: 4, borderBottom: "1px solid black" }}>
  88. <FormattedMessage id="publicNoticePaymentProofDoneAndPaid"/>
  89. </Typography>
  90. <Typography variant="h4" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "left" }}>
  91. 我們已收到申請編號: {record?.appNo} 的稿件校對確定及可付印的指示。
  92. <br /><br />
  93. 請於 <span style={{ color: "red" }}>{DateUtils.dateStr_Cht(record?.returnBeforeDate)} 下午 2:00 前</span> 完成繳費,我們將於收到繳費確認後處理刊出事宜。
  94. <br /><br />
  95. 如你在憲報期數 {record?.issueYear} 年 {record?.issueVolume} 卷, 第 {record?.issueNo} 期內有多於一個公共啟事的申請,你可選擇完成所有此期所有稿件校對確定後,於繳費期限前在「我的公共啟事」內合併付款。
  96. </Typography>
  97. <Typography variant="h4" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "left" }}>
  98. 請按以下完成繳費:
  99. </Typography>
  100. <Typography variant="h4" sx={{ml:8, textAlign: "left" }}>
  101. <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
  102. <Button
  103. component="span"
  104. variant="contained"
  105. sx={{ ml: {md:4,lg:4}, mr:4}}
  106. onClick={() => { setIsPopUp(true) }}
  107. >
  108. 即時網上繳費
  109. </Button>
  110. </ThemeProvider>
  111. <FormattedMessage id="or"/>
  112. <ThemeProvider theme={PNSPS_BUTTON_THEME}>
  113. <Button
  114. component="span"
  115. variant="contained"
  116. sx={{ ml: {sm:4, md:4, lg:4}, mr: 4, mt:{xs:2,sm:2}, mb:{xs:2, sm:2}}}
  117. onClick={()=>{
  118. navigate("/publicNotice");
  119. }}
  120. >
  121. 稍後繳費
  122. </Button>
  123. (返回「我的公共啟事」)
  124. </ThemeProvider>
  125. </Typography>
  126. </Grid>
  127. </center>
  128. </Grid>
  129. </Grid>
  130. <div>
  131. <Dialog
  132. open={isPopUp}
  133. onClose={() => setIsPopUp(false)}
  134. PaperProps={{
  135. sx: {
  136. minWidth: '40vw',
  137. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '30vw' },
  138. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '50vh' }
  139. }
  140. }}
  141. >
  142. <DialogTitle>
  143. <Typography variant="h3" >
  144. <FormattedMessage id="payConfirm"/>
  145. </Typography>
  146. </DialogTitle>
  147. <DialogContent style={{ display: 'flex', }}>
  148. <Stack direction="column" justifyContent="space-between">
  149. <Typography variant="h4">
  150. <FormattedMessage id="totalAmount"/>(HK$): {FormatUtils.currencyFormat(fee)}
  151. </Typography>
  152. </Stack>
  153. </DialogContent>
  154. <DialogActions>
  155. <Button onClick={() => setIsPopUp(false)}>
  156. <Typography variant="h5">
  157. <FormattedMessage id="close"/>
  158. </Typography></Button>
  159. <Button onClick={() => doPayment()}><Typography variant="h5">
  160. <FormattedMessage id="confirm"/>
  161. </Typography></Button>
  162. </DialogActions>
  163. </Dialog>
  164. </div>
  165. {/*row 2*/}
  166. </Grid >
  167. )
  168. );
  169. };
  170. export default Index;