You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

656 lines
38 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Button,
  6. RadioGroup,
  7. Checkbox,
  8. Dialog, DialogTitle, DialogContent, DialogActions,
  9. Stack, Box
  10. } from '@mui/material';
  11. import { useFormik } from 'formik';
  12. import * as yup from 'yup';
  13. import * as HttpUtils from "utils/HttpUtils";
  14. import * as UrlUtils from "utils/ApiPathConst";
  15. import * as FieldUtils from "utils/FieldUtils";
  16. import * as DateUtils from "utils/DateUtils";
  17. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  18. import ForwardIcon from '@mui/icons-material/Forward';
  19. import {
  20. isORGLoggedIn,
  21. isDummyLoggedIn,
  22. isCreditorLoggedIn
  23. } from "utils/Utils";
  24. import { useNavigate } from "react-router-dom";
  25. import { notifyActionSuccess } from 'utils/CommonFunction';
  26. import { PNSPS_LONG_BUTTON_THEME } from "../../../themes/buttonConst";
  27. import { ThemeProvider } from "@emotion/react";
  28. import { FormattedMessage, useIntl } from "react-intl";
  29. import Loadable from 'components/Loadable';
  30. import { useState, useEffect, lazy } from 'react';
  31. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  32. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  33. const PublicNoticeApplyForm = ({ loadedData, _selections, gazetteIssueList, isOnlyOnlinePayment }) => {
  34. const [isWarningPopUp, setIsWarningPopUp] = useState(false);
  35. const [warningTitle, setWarningTitle] = useState("");
  36. const [warningText, setWarningText] = useState("");
  37. const [attachment, setAttachment] = useState({});
  38. const [selections, setsSelections] = useState(<></>);
  39. const intl = useIntl();
  40. const { locale } = intl;
  41. const dft = locale === 'en' ? "DD MMMM YYYY" : "YYYY年MM月DD日";
  42. const [val, setVal] = useState({});
  43. const [reloadPage, setReloadPage] = useState(false);
  44. const [isSubmitting, setSubmitting] = useState(false);
  45. const [tickAccept, setTickAccept] = useState(false);
  46. const [issueId, setIssueId] = useState(loadedData.issueId);
  47. const [closeDate, setCloseDate] = useState(null);
  48. const [closingDateOff, setClosingDateOff] = useState(null);
  49. const navigate = useNavigate();
  50. const BackgroundHead = {
  51. backgroundImage: `url(${titleBackgroundImg})`,
  52. width: 'auto',
  53. height: 'auto',
  54. backgroundSize: 'contain',
  55. backgroundRepeat: 'no-repeat',
  56. backgroundColor: '#0C489E',
  57. backgroundPosition: 'right'
  58. }
  59. const tabelStyle = {
  60. border: "2px solid gray",
  61. borderCollapse: "collapse",
  62. padding: "right"
  63. }
  64. function getMaxErrStr(num, fieldname) {
  65. return intl.formatMessage({ id: 'noMoreThenNWords' }, { num: num, fieldname: fieldname ? intl.formatMessage({ id: fieldname }) + ": " : "" });
  66. }
  67. useEffect(() => {
  68. setsSelections(_selections)
  69. }, [_selections]);
  70. useEffect(() => {
  71. for (var i = 0; i < gazetteIssueList?.length; i++) {
  72. let data = gazetteIssueList[i];
  73. if (data.id == issueId) {
  74. setCloseDate(data.closingDate)
  75. setClosingDateOff(data.closingDateOff)
  76. break;
  77. }
  78. }
  79. }, [issueId]);
  80. // function displayErrorMsg(errorMsg) {
  81. // return <Typography variant="errorMessage1">{errorMsg}</Typography>
  82. // }
  83. const formik = useFormik({
  84. enableReinitialize: true,
  85. initialValues: loadedData,
  86. validationSchema: yup.object().shape({
  87. contactPerson: yup.string().max(40, intl.formatMessage({ id: 'noMoreThen40Words' })).required(intl.formatMessage({ id: 'requireContactPerson' })).nullable(),
  88. tel_countryCode: yup.string().min(3, intl.formatMessage({ id: 'require3Number' })).required(intl.formatMessage({ id: 'requireDialingCode' })),
  89. fax_countryCode: yup.string().min(3, intl.formatMessage({ id: 'require3Number' })),
  90. phoneNumber: yup.string().min(8, intl.formatMessage({ id: 'require8Number' })).required(intl.formatMessage({ id: 'requireContactNumber' })),
  91. faxNumber: yup.string().min(8, intl.formatMessage({ id: 'require8Number' })),
  92. remarks: yup.string().max(100, getMaxErrStr(100)).nullable(),
  93. careOf: yup.string().max(60, getMaxErrStr(60)).nullable(),
  94. emailAddress: yup.string().email(intl.formatMessage({ id: 'validEmailFormat' })).max(255).test('checkEmailFormat', intl.formatMessage({ id: 'requireEmail' }), function (value) {
  95. if (isDummyLoggedIn()) {
  96. if (value !== undefined) {
  97. return true
  98. } else {
  99. return false
  100. }
  101. } else {
  102. return true
  103. }
  104. }),
  105. custName: yup.string().max(150, getMaxErrStr(150)).test('checkCustNameFormat', intl.formatMessage({ id: 'requireCustName' }), function (value) {
  106. if (isDummyLoggedIn()) {
  107. if (value !== undefined) {
  108. return true
  109. } else {
  110. return false
  111. }
  112. } else {
  113. return true
  114. }
  115. }),
  116. }),
  117. onSubmit: values => {
  118. if (!values.issueId) {
  119. setWarningTitle(intl.formatMessage({ id: "attention" }))
  120. setWarningText(intl.formatMessage({ id: 'requireTargetVol' }));
  121. setIsWarningPopUp(true);
  122. return;
  123. }
  124. if (!attachment) {
  125. setWarningTitle(intl.formatMessage({ id: "attention" }))
  126. setWarningText(intl.formatMessage({ id: 'requireFile' }));
  127. setIsWarningPopUp(true);
  128. return;
  129. } else if (!attachment.size || attachment.size <= 0) {
  130. setWarningTitle(intl.formatMessage({ id: "attention" }))
  131. setWarningText(intl.formatMessage({ id: 'requireValidFile' }));
  132. setIsWarningPopUp(true);
  133. return;
  134. } else if (attachment.size >= (10 * 1024 * 1034)) {
  135. setWarningTitle(intl.formatMessage({ id: "attention" }))
  136. setWarningText(intl.formatMessage({ id: 'fileSizeWarning' }));
  137. setIsWarningPopUp(true);
  138. return;
  139. }
  140. if (isORGLoggedIn()) {
  141. HttpUtils.get({
  142. url: UrlUtils.CHECK_OVERDUE,
  143. onSuccess: (responData) => {
  144. if (responData.haveOverdue) {
  145. setVal(values);
  146. setWarningTitle(intl.formatMessage({ id: "attention" }))
  147. setWarningText(intl.formatMessage({ id: 'dnOverdueWarning' }));
  148. setIsWarningPopUp(true);
  149. } else {
  150. apply(values);
  151. }
  152. }
  153. });
  154. } else {
  155. apply(values);
  156. }
  157. }
  158. });
  159. const apply = (values) => {
  160. setSubmitting(true)
  161. let careOf = values.careOf ?? "";
  162. let remarks = values.remarks ?? "";
  163. let custName = values.custName ?? "";
  164. if (isDummyLoggedIn()) {
  165. custName = values.custName
  166. }
  167. if (isDummyLoggedIn()) {
  168. remarks = values.emailAddress
  169. }
  170. HttpUtils.postWithFiles({
  171. url: UrlUtils.POST_PUBLIC_NOTICE_APPLY,
  172. params: {
  173. id: 0,
  174. contactPerson: values.contactPerson,
  175. contactTelNo: {
  176. countryCode: values.tel_countryCode,
  177. phoneNumber: values.phoneNumber
  178. },
  179. contactFaxNo: {
  180. countryCode: values.fax_countryCode,
  181. faxNumber: values.faxNumber
  182. },
  183. issueId: issueId,
  184. careOf: careOf,
  185. custName: custName,
  186. remarks: remarks,
  187. },
  188. files: [attachment],
  189. onSuccess: function (responData) {
  190. if (responData.msg) {
  191. setVal({});
  192. setReloadPage(true);
  193. setWarningTitle(intl.formatMessage({ id: "attention" }))
  194. setWarningText(intl.formatMessage({ id: responData.msg }));
  195. setIsWarningPopUp(true);
  196. return;
  197. }
  198. setSubmitting(false)
  199. notifyActionSuccess(intl.formatMessage({ id: 'submissionSuccess' }) + '!')
  200. navigate("/publicNotice");
  201. // location.reload();
  202. }
  203. });
  204. }
  205. const readFile = (event) => {
  206. let file = event.target.files[0];
  207. if (file) {
  208. if (file.name.toLowerCase().substr(file.name.length - 4).includes(".doc")
  209. || file.name.toLowerCase().substr(file.name.length - 5).includes(".docx")
  210. || file.name.toLowerCase().substr(file.name.length - 4).includes(".xls")
  211. || file.name.toLowerCase().substr(file.name.length - 5).includes(".xlsx")
  212. ) {
  213. setAttachment(event.target.files[0]);
  214. } else {
  215. setWarningTitle(intl.formatMessage({ id: "attention" }))
  216. setWarningText(intl.formatMessage({ id: 'requireValidFileWithFormat' }));
  217. setIsWarningPopUp(true);
  218. setAttachment({});
  219. document.getElementById("uploadFileBtn").value = "";
  220. return;
  221. }
  222. }
  223. }
  224. return (
  225. <Grid container sx={{ minHeight: '87vh', backgroundColor: '#ffffff', mb: 3 }} direction="column" alignItems="center">
  226. <Grid item xs={12} md={12} width="100%" >
  227. <div style={BackgroundHead}>
  228. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  229. <Typography ml={15} color='#FFF' variant="h4" sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}>
  230. <FormattedMessage id="applyPublicNotice" />
  231. </Typography>
  232. </Stack>
  233. </div>
  234. </Grid>
  235. <Grid item xs={12} width={{ xs: "90%", sm: "90%", md: "60%", lg: "60%" }}>
  236. <Button
  237. aria-label={intl.formatMessage({ id: 'back' })}
  238. title={intl.formatMessage({ id: 'back' })}
  239. sx={{ ml: 0, mt: 2.5 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate(-1) }}
  240. >
  241. <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} />
  242. </Button>
  243. </Grid>
  244. {/* <Grid item xs={12}>
  245. <Typography variant="pnspsFormParagraphBold">申請公共啟事</Typography>
  246. </Grid> */}
  247. {
  248. isSubmitting ?
  249. <Grid item xs={12} md={12} width={{ md: "60%", xs: "90%" }}>
  250. <LoadingComponent />
  251. </Grid>
  252. :
  253. <Grid item xs={12} md={12} width={{ md: "60%", xs: "90%" }}>
  254. <Box xs={12} mt={1} sx={{ p: 2, border: '3px groove grey', borderRadius: '10px' }}>
  255. <form onSubmit={formik.handleSubmit}>
  256. <Grid container spacing={1} sx={{ minHeight: '80vh' }} direction="row" justifyContent="flex-start" alignItems="center">
  257. {
  258. isDummyLoggedIn()?
  259. <Grid item xs={12} md={12} lg={12} sx={{ mb: 1 }}>
  260. {FieldUtils.getTextField({
  261. label: intl.formatMessage({ id: 'applyPerson' }) + ":",
  262. valueName: "custName",
  263. form: formik,
  264. disabled: false,
  265. autoFocus: true
  266. })}
  267. </Grid>:
  268. <Grid item xs={12} md={12} lg={12} sx={{ mb: 1 }}>
  269. {FieldUtils.getTextField({
  270. label: intl.formatMessage({ id: 'applyPerson' }) + ":",
  271. valueName: "applyPerson",
  272. form: formik,
  273. disabled: true,
  274. autoFocus: false
  275. })}
  276. </Grid>
  277. }
  278. <Grid item xs={12} md={12}>
  279. {FieldUtils.getTextField({
  280. label: intl.formatMessage({ id: 'contactPerson' }) + ":",
  281. valueName: "contactPerson",
  282. form: formik,
  283. disabled: !isDummyLoggedIn(),
  284. autoFocus: isDummyLoggedIn()
  285. })}
  286. </Grid>
  287. <Grid item xs={12} md={12}>
  288. {FieldUtils.getPhoneField({
  289. label: intl.formatMessage({ id: 'userContactNumber' }) + ":",
  290. disabled: !isDummyLoggedIn(),
  291. valueName: {
  292. code: "tel_countryCode",
  293. num: "phoneNumber",
  294. },
  295. form: formik
  296. })}
  297. </Grid>
  298. <Grid item xs={12} md={12}>
  299. {FieldUtils.getPhoneField({
  300. label: intl.formatMessage({ id: 'contactFaxNumber' }) + ":",
  301. disabled: !isDummyLoggedIn(),
  302. valueName: {
  303. code: "fax_countryCode",
  304. num: "faxNumber",
  305. },
  306. form: formik
  307. })}
  308. </Grid>
  309. <Grid item xs={12} lg={12}>
  310. <Grid container alignItems={"center"}>
  311. <Grid item xs={12} md={3} lg={3}
  312. sx={{ display: 'flex', alignItems: 'center' }}>
  313. <Typography variant="pnspsFormParagraphBold">
  314. <FormattedMessage id="targetVol" />:
  315. </Typography>
  316. </Grid>
  317. <Grid item xs={12} md={9} lg={6}>
  318. <RadioGroup
  319. aria-labelledby="radio-buttons-group-label"
  320. id="issueId"
  321. name="issueId"
  322. defaultValue={issueId}
  323. onChange={(event) => {
  324. setIssueId(event.target.value);
  325. }}
  326. >
  327. {
  328. selections
  329. }
  330. </RadioGroup>
  331. </Grid>
  332. </Grid>
  333. </Grid>
  334. {!isCreditorLoggedIn() ?
  335. <Grid item xs={12} alignItems={"center"} sx={{ p: 2 }}>
  336. <table style={tabelStyle}>
  337. <tbody>
  338. <tr style={tabelStyle}>
  339. <th style={tabelStyle} width="400" align="left"><FormattedMessage id="paymentMeans" /></th>
  340. <th style={tabelStyle} width="300" align="left"><FormattedMessage id="confirmingDealine" /></th>
  341. <th style={tabelStyle} width="300" align="left"><FormattedMessage id="PaymentCoonpletDealine" /></th>
  342. </tr>
  343. <tr>
  344. <td style={tabelStyle}>
  345. <FormattedMessage id="payOnline" />
  346. <br /><a href="#payOnlineDetails" color='#fff' onClick={() => {
  347. setWarningTitle(intl.formatMessage({ id: "paymentMeans" }) + ": " + intl.formatMessage({ id: "payOnline" }))
  348. setWarningText(
  349. <><FormattedMessage id="paymentMethodMeans" />:
  350. <ul>
  351. <li><FormattedMessage id="fps" /></li>
  352. <li><FormattedMessage id="card" /></li>
  353. <li><FormattedMessage id="pps" /></li>
  354. </ul>
  355. </>
  356. );
  357. setIsWarningPopUp(true);
  358. }}><u><FormattedMessage id="viewDetail" /></u></a>
  359. </td>
  360. <td style={tabelStyle}>{DateUtils.dateFormat(closeDate, dft)} {locale==='en'?"2:00 p.m.":"下午2時"}</td>
  361. <td style={tabelStyle}>
  362. <FormattedMessage id="payOnlineRemark" values={{
  363. date: DateUtils.dateFormat(closeDate, dft)
  364. }} />
  365. </td>
  366. </tr>
  367. {!isOnlyOnlinePayment?
  368. <>
  369. <tr>
  370. <td style={tabelStyle}><FormattedMessage id="payDn" />
  371. <br /><a href="#payDnDetails" onClick={() => {
  372. setWarningTitle(intl.formatMessage({ id: "paymentMeans" }) + ": " + intl.formatMessage({ id: "payDn" }))
  373. setWarningText(
  374. <><FormattedMessage id="paymentMethodMeans" />:
  375. <ul>
  376. <li><FormattedMessage id="atm" /></li>
  377. <li><FormattedMessage id="pps" /></li>
  378. <li><FormattedMessage id="eBank" /></li>
  379. <li><FormattedMessage id="phoneBank" /></li>
  380. <li><FormattedMessage id="eCheque" /></li>
  381. <li><FormattedMessage id="fps" /></li>
  382. <li><FormattedMessage id="hkpo" /></li>
  383. <li><FormattedMessage id="store" /></li>
  384. <li><FormattedMessage id="post" /></li>
  385. </ul>
  386. <Typography variant="h6">
  387. <div style={{ padding: 12 }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "proofNote" }) }} />
  388. </Typography>
  389. </>
  390. );
  391. setIsWarningPopUp(true);
  392. }}><u><FormattedMessage id="viewDetail" /></u></a>
  393. </td>
  394. <td style={tabelStyle}>{DateUtils.dateFormat(closingDateOff, dft)} {locale==='en'?"5:00 p.m.":"下午5時"}</td>
  395. <td style={tabelStyle}>
  396. <FormattedMessage id="payDnRemark" values={{
  397. date: DateUtils.dateFormat(closeDate, dft)
  398. }} />
  399. </td>
  400. </tr>
  401. <tr>
  402. <td style={tabelStyle}><FormattedMessage id="payNPGO" />
  403. <br /><a href="#payNPGODetails" onClick={() => {
  404. setWarningTitle(intl.formatMessage({ id: "paymentMeans" }) + ": " + intl.formatMessage({ id: "payNPGOPopUpTitle" }))
  405. setWarningText(
  406. <><FormattedMessage id="paymentMethodMeans" />:
  407. <ul>
  408. <li><FormattedMessage id="cheque" /></li>
  409. <li><FormattedMessage id="drafts" /></li>
  410. <li><FormattedMessage id="cashierOrders" /></li>
  411. <li><FormattedMessage id="cash" /></li>
  412. </ul>
  413. </>
  414. );
  415. setIsWarningPopUp(true);
  416. }}><u><FormattedMessage id="viewDetail" /></u></a>
  417. </td>
  418. <td style={tabelStyle}>{DateUtils.dateFormat(closeDate, dft)} {locale==='en'?"12:00 p.m.":"下午12時"}</td>
  419. <td style={tabelStyle}>
  420. <FormattedMessage id="payNPGORemark" values={{
  421. date: DateUtils.dateFormat(closeDate, dft)
  422. }} />
  423. </td>
  424. </tr>
  425. </>:null
  426. }
  427. </tbody>
  428. </table>
  429. </Grid> : null
  430. }
  431. <Grid item xs={12} md={12} lg={12}>
  432. <Grid container direction="row" justifyContent="flex-start" alignItems="center">
  433. <Grid item xs={12} md={3} lg={3}
  434. sx={{ display: 'flex', alignItems: 'center' }}>
  435. <Typography variant="pnspsFormParagraphBold">
  436. <FormattedMessage id="draftFile" /> ({intl.formatMessage({ id: 'fileSizeWarning' })}):
  437. </Typography>
  438. </Grid>
  439. <Grid item xs={12} md={6} lg={6} sx={{ wordBreak: 'break-word' }}>
  440. <input
  441. id="uploadFileBtn"
  442. name="file"
  443. type="file"
  444. accept=".doc,.docx,.xls,.xlsx"
  445. style={{ display: 'none' }}
  446. onChange={(event) => {
  447. readFile(event)
  448. }}
  449. />
  450. {attachment.name}
  451. </Grid>
  452. {/* <Grid item xs={12} md={3} lg={3}>
  453. <label htmlFor="uploadFileBtn">
  454. <Button
  455. aria-label={intl.formatMessage({id: 'uploadFileBtn'})}
  456. component="span"
  457. variant="outlined"
  458. size="large"
  459. >{attachment ? intl.formatMessage({id: 'uploadFileBtn'}) : intl.formatMessage({id: 'reUpload'})}</Button>
  460. </label>
  461. </Grid> */}
  462. </Grid>
  463. </Grid>
  464. <Grid item xs={12} md={12} lg={12}>
  465. <Grid container direction="row" justifyContent="flex-start" alignItems="center">
  466. <Grid item xs={12} md={3} lg={3}
  467. sx={{ display: 'flex', alignItems: 'center' }}>
  468. </Grid>
  469. <Grid item xs={12} md={6} lg={6} >
  470. <label htmlFor="uploadFileBtn">
  471. <Button
  472. aria-label={intl.formatMessage({ id: 'uploadFileBtn' })}
  473. component="span"
  474. variant="outlined"
  475. size="large"
  476. >{attachment ? intl.formatMessage({ id: 'uploadFileBtn' }) : intl.formatMessage({ id: 'reUpload' })}</Button>
  477. </label>
  478. </Grid>
  479. <Grid item xs={12} md={3} lg={3}>
  480. </Grid>
  481. </Grid>
  482. </Grid>
  483. <Grid item xs={12} md={12} lg={12} sx={{ mb: 3 }}>
  484. <Typography display="inline" variant="subtitle1" sx={{ color: 'primary.primary' }}>
  485. <FormattedMessage id="uploadApplicationFileRemark" />
  486. </Typography>
  487. </Grid>
  488. {isORGLoggedIn() ?
  489. <>
  490. <Grid item xs={12} md={12} lg={12}>
  491. {FieldUtils.getCarOfField({
  492. label: intl.formatMessage({ id: 'careOf' }) + ":",
  493. valueName: "careOf",
  494. form: formik,
  495. // disabled: true
  496. })}
  497. </Grid>
  498. <Grid item xs={12} md={12} lg={12} sx={{ mb: 3 }}>
  499. <Typography display="inline" variant="subtitle1" sx={{ color: 'primary.primary' }}>
  500. <FormattedMessage id="noteOnClientRemark" />
  501. </Typography>
  502. </Grid>
  503. </>
  504. :
  505. null
  506. }
  507. {
  508. isDummyLoggedIn() ?
  509. <Grid item xs={12} md={12} lg={12}>
  510. {FieldUtils.getTextField({
  511. label: intl.formatMessage({ id: 'userContactEmail' }),
  512. valueName: "emailAddress",
  513. form: formik
  514. })}
  515. </Grid>
  516. :
  517. <Grid item xs={12} md={12} lg={12}>
  518. {FieldUtils.getTextArea({
  519. label: intl.formatMessage({ id: 'extraMark' }) + ":",
  520. valueName: "remarks",
  521. form: formik,
  522. inputProps: { maxLength: 255 }
  523. })}
  524. </Grid>
  525. }
  526. <Grid item xs={12} mr={1} mb={2}>
  527. <Typography variant="pnspsFormParagraphBold">
  528. <span style={{ textAlign: 'justify', }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickUnderStr0" }) }} />
  529. </Typography>
  530. <Typography display="inline" variant="subtitle1" sx={{ color: 'primary.primary' }} >
  531. <ol style={{ textAlign: 'justify', }}>
  532. <li dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickUnderStr1" }) }} />
  533. <li dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickUnderStr2" }) }} />
  534. <li dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickUnderStr3" }) }} />
  535. <li dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "tradeMarkFootnote" }) }} />
  536. </ol>
  537. </Typography>
  538. </Grid>
  539. <Grid item xs={12}>
  540. <Stack direction="row">
  541. <Checkbox
  542. checked={tickAccept}
  543. onChange={(event) => {
  544. setTickAccept(event.target.checked)
  545. }}
  546. name="tickAccept"
  547. color="primary"
  548. size="small"
  549. />
  550. <Typography variant="h6" height="100%" >
  551. <div style={{ padding: 12, textAlign: 'justify' }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickStr" }) }} />
  552. </Typography>
  553. </Stack>
  554. </Grid>
  555. <Grid item xs={12}>
  556. <center>
  557. <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
  558. <Button
  559. aria-label={intl.formatMessage({ id: 'applyPublicNotice' })}
  560. variant="contained"
  561. type="submit"
  562. disabled={!tickAccept}
  563. >
  564. <FormattedMessage id="applyPublicNotice" />
  565. </Button>
  566. </ThemeProvider>
  567. </center>
  568. </Grid>
  569. <Grid item xs={12}>
  570. <Typography variant="h6" height="100%" >
  571. <div style={{ padding: 12 }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyPublicNoticeText" }) }} />
  572. </Typography>
  573. </Grid>
  574. </Grid>
  575. </form>
  576. </Box>
  577. </Grid>
  578. }
  579. <div>
  580. <Dialog
  581. open={isWarningPopUp}
  582. onClose={() => setIsWarningPopUp(false)}
  583. PaperProps={{
  584. sx: {
  585. minWidth: '40vw',
  586. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
  587. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
  588. }
  589. }}
  590. >
  591. <DialogTitle>
  592. {warningTitle}
  593. </DialogTitle>
  594. <DialogContent style={{ display: 'flex', }}>
  595. <Typography variant="h5" style={{ padding: '16px' }}>
  596. {warningText}
  597. </Typography>
  598. </DialogContent>
  599. <DialogActions>
  600. <Button
  601. aria-label={intl.formatMessage({ id: 'close' })}
  602. onClick={() => {
  603. if (val.contactPerson) {
  604. apply(val);
  605. setIsWarningPopUp(false);
  606. } else {
  607. setIsWarningPopUp(false);
  608. if (reloadPage) {
  609. location.reload();
  610. }
  611. }
  612. }}
  613. >
  614. <FormattedMessage id="close" />
  615. </Button>
  616. </DialogActions>
  617. </Dialog>
  618. </div>
  619. </Grid>
  620. );
  621. };
  622. export default PublicNoticeApplyForm;