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.

686 lines
40 KiB

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