Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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