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.
 
 

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