Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

644 rindas
37 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 }) => {
  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 MMM 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. careOfDum: yup.string().max(60, getMaxErrStr(60)).test('checkCareOfDumFormat', intl.formatMessage({ id: 'requireCareOf' }), 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. if (isDummyLoggedIn()) {
  164. careOf = values.careOfDum
  165. }
  166. if (isDummyLoggedIn()) {
  167. remarks = values.emailAddress
  168. }
  169. HttpUtils.postWithFiles({
  170. url: UrlUtils.POST_PUBLIC_NOTICE_APPLY,
  171. params: {
  172. id: 0,
  173. contactPerson: values.contactPerson,
  174. contactTelNo: {
  175. countryCode: values.tel_countryCode,
  176. phoneNumber: values.phoneNumber
  177. },
  178. contactFaxNo: {
  179. countryCode: values.fax_countryCode,
  180. faxNumber: values.faxNumber
  181. },
  182. issueId: issueId,
  183. careOf: careOf,
  184. remarks: remarks,
  185. },
  186. files: [attachment],
  187. onSuccess: function (responData) {
  188. if (responData.msg) {
  189. setVal({});
  190. setReloadPage(true);
  191. setWarningTitle(intl.formatMessage({ id: "attention" }))
  192. setWarningText(intl.formatMessage({ id: responData.msg }));
  193. setIsWarningPopUp(true);
  194. return;
  195. }
  196. setSubmitting(false)
  197. notifyActionSuccess(intl.formatMessage({ id: 'submissionSuccess' }) + '!')
  198. navigate("/publicNotice");
  199. // location.reload();
  200. }
  201. });
  202. }
  203. const readFile = (event) => {
  204. let file = event.target.files[0];
  205. if (file) {
  206. if (file.name.toLowerCase().substr(file.name.length - 4).includes(".doc")
  207. || file.name.toLowerCase().substr(file.name.length - 5).includes(".docx")
  208. || file.name.toLowerCase().substr(file.name.length - 4).includes(".xls")
  209. || file.name.toLowerCase().substr(file.name.length - 5).includes(".xlsx")
  210. ) {
  211. setAttachment(event.target.files[0]);
  212. } else {
  213. setWarningTitle(intl.formatMessage({ id: "attention" }))
  214. setWarningText(intl.formatMessage({ id: 'requireValidFileWithFormat' }));
  215. setIsWarningPopUp(true);
  216. setAttachment({});
  217. document.getElementById("uploadFileBtn").value = "";
  218. return;
  219. }
  220. }
  221. }
  222. return (
  223. <Grid container sx={{ minHeight: '87vh', backgroundColor: '#ffffff', mb: 3 }} direction="column" alignItems="center">
  224. <Grid item xs={12} md={12} width="100%" >
  225. <div style={BackgroundHead}>
  226. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  227. <Typography ml={15} color='#FFF' variant="h4" sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}>
  228. <FormattedMessage id="applyPublicNotice" />
  229. </Typography>
  230. </Stack>
  231. </div>
  232. </Grid>
  233. <Grid item xs={12} width={{ xs: "90%", sm: "90%", md: "60%", lg: "60%" }}>
  234. <Button
  235. aria-label={intl.formatMessage({ id: 'back' })}
  236. title={intl.formatMessage({ id: 'back' })}
  237. sx={{ ml: 0, mt: 2.5 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate(-1) }}
  238. >
  239. <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} />
  240. </Button>
  241. </Grid>
  242. {/* <Grid item xs={12}>
  243. <Typography variant="pnspsFormParagraphBold">申請公共啟事</Typography>
  244. </Grid> */}
  245. {
  246. isSubmitting ?
  247. <Grid item xs={12} md={12} width={{ md: "60%", xs: "90%" }}>
  248. <LoadingComponent />
  249. </Grid>
  250. :
  251. <Grid item xs={12} md={12} width={{ md: "60%", xs: "90%" }}>
  252. <Box xs={12} mt={1} sx={{ p: 2, border: '3px groove grey', borderRadius: '10px' }}>
  253. <form onSubmit={formik.handleSubmit}>
  254. <Grid container spacing={1} sx={{ minHeight: '80vh' }} direction="row" justifyContent="flex-start" alignItems="center">
  255. <Grid item xs={12} md={12} lg={12} sx={{ mb: 1 }}>
  256. {FieldUtils.getTextField({
  257. label: intl.formatMessage({ id: 'applyPerson' }) + ":",
  258. valueName: "applyPerson",
  259. form: formik,
  260. disabled: true,
  261. autoFocus: false
  262. })}
  263. </Grid>
  264. <Grid item xs={12} md={12}>
  265. {FieldUtils.getTextField({
  266. label: intl.formatMessage({ id: 'contactPerson' }) + ":",
  267. valueName: "contactPerson",
  268. form: formik,
  269. disabled: !isDummyLoggedIn(),
  270. autoFocus: isDummyLoggedIn()
  271. })}
  272. </Grid>
  273. <Grid item xs={12} md={12}>
  274. {FieldUtils.getPhoneField({
  275. label: intl.formatMessage({ id: 'userContactNumber' }) + ":",
  276. disabled: !isDummyLoggedIn(),
  277. valueName: {
  278. code: "tel_countryCode",
  279. num: "phoneNumber",
  280. },
  281. form: formik
  282. })}
  283. </Grid>
  284. <Grid item xs={12} md={12}>
  285. {FieldUtils.getPhoneField({
  286. label: intl.formatMessage({ id: 'contactFaxNumber' }) + ":",
  287. disabled: !isDummyLoggedIn(),
  288. valueName: {
  289. code: "fax_countryCode",
  290. num: "faxNumber",
  291. },
  292. form: formik
  293. })}
  294. </Grid>
  295. <Grid item xs={12} lg={12}>
  296. <Grid container alignItems={"center"}>
  297. <Grid item xs={12} md={3} lg={3}
  298. sx={{ display: 'flex', alignItems: 'center' }}>
  299. <Typography variant="pnspsFormParagraphBold">
  300. <FormattedMessage id="targetVol" />:
  301. </Typography>
  302. </Grid>
  303. <Grid item xs={12} md={9} lg={6}>
  304. <RadioGroup
  305. aria-labelledby="radio-buttons-group-label"
  306. id="issueId"
  307. name="issueId"
  308. defaultValue={issueId}
  309. onChange={(event) => {
  310. setIssueId(event.target.value);
  311. }}
  312. >
  313. {
  314. selections
  315. }
  316. </RadioGroup>
  317. </Grid>
  318. </Grid>
  319. </Grid>
  320. {!isCreditorLoggedIn() ?
  321. <Grid item xs={12} alignItems={"center"} sx={{ p: 2 }}>
  322. <table style={tabelStyle}>
  323. <tbody>
  324. <tr style={tabelStyle}>
  325. <th style={tabelStyle} width="400" align="left"><FormattedMessage id="paymentMeans" /></th>
  326. <th style={tabelStyle} width="300" align="left"><FormattedMessage id="confirmingDealine" /></th>
  327. <th style={tabelStyle} width="300" align="left"><FormattedMessage id="PaymentCoonpletDealine" /></th>
  328. </tr>
  329. <tr>
  330. <td style={tabelStyle}>
  331. <FormattedMessage id="payOnline" />
  332. <br /><a href="#payOnlineDetails" color='#fff' onClick={() => {
  333. setWarningTitle(intl.formatMessage({ id: "paymentMeans" }) + ": " + intl.formatMessage({ id: "payOnline" }))
  334. setWarningText(
  335. <><FormattedMessage id="paymentMethodMeans" />:
  336. <ul>
  337. <li><FormattedMessage id="fps" /></li>
  338. <li><FormattedMessage id="card" /></li>
  339. <li><FormattedMessage id="pps" /></li>
  340. </ul>
  341. </>
  342. );
  343. setIsWarningPopUp(true);
  344. }}><FormattedMessage id="viewDetail" /></a>
  345. </td>
  346. <td style={tabelStyle}>{DateUtils.dateFormat(closeDate, dft)} {locale==='en'?"2:00 p.m.":"下午2時"}</td>
  347. <td style={tabelStyle}>
  348. <FormattedMessage id="payOnlineRemark" values={{
  349. date: DateUtils.dateFormat(closeDate, dft)
  350. }} />
  351. </td>
  352. </tr>
  353. <tr>
  354. <td style={tabelStyle}><FormattedMessage id="payDn" />
  355. <br /><a href="#payDnDetails" onClick={() => {
  356. setWarningTitle(intl.formatMessage({ id: "paymentMeans" }) + ": " + intl.formatMessage({ id: "payDn" }))
  357. setWarningText(
  358. <><FormattedMessage id="paymentMethodMeans" />:
  359. <ul>
  360. <li><FormattedMessage id="atm" /></li>
  361. <li><FormattedMessage id="pps" /></li>
  362. <li><FormattedMessage id="eBank" /></li>
  363. <li><FormattedMessage id="phoneBank" /></li>
  364. <li><FormattedMessage id="eCheque" /></li>
  365. <li><FormattedMessage id="fps" /></li>
  366. <li><FormattedMessage id="hkpo" /></li>
  367. <li><FormattedMessage id="store" /></li>
  368. <li><FormattedMessage id="post" /></li>
  369. </ul>
  370. <Typography variant="h6">
  371. <div style={{ padding: 12 }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "proofNote" }) }} />
  372. </Typography>
  373. </>
  374. );
  375. setIsWarningPopUp(true);
  376. }}><FormattedMessage id="viewDetail" /></a>
  377. </td>
  378. <td style={tabelStyle}>{DateUtils.dateFormat(closingDateOff, dft)} {locale==='en'?"5:00 p.m.":"下午5時"}</td>
  379. <td style={tabelStyle}>
  380. <FormattedMessage id="payDnRemark" values={{
  381. date: DateUtils.dateFormat(closeDate, dft)
  382. }} />
  383. </td>
  384. </tr>
  385. <tr>
  386. <td style={tabelStyle}><FormattedMessage id="payNPGO" />
  387. <br /><a href="#payNPGODetails" onClick={() => {
  388. setWarningTitle(intl.formatMessage({ id: "paymentMeans" }) + ": " + intl.formatMessage({ id: "payNPGOPopUpTitle" }))
  389. setWarningText(
  390. <><FormattedMessage id="paymentMethodMeans" />:
  391. <ul>
  392. <li><FormattedMessage id="cheque" /></li>
  393. <li><FormattedMessage id="drafts" /></li>
  394. <li><FormattedMessage id="cashierOrders" /></li>
  395. <li><FormattedMessage id="cash" /></li>
  396. </ul>
  397. </>
  398. );
  399. setIsWarningPopUp(true);
  400. }}><FormattedMessage id="viewDetail" /></a>
  401. </td>
  402. <td style={tabelStyle}>{DateUtils.dateFormat(closeDate, dft)} {locale==='en'?"12:00 p.m.":"下午12時"}</td>
  403. <td style={tabelStyle}>
  404. <FormattedMessage id="payNPGORemark" values={{
  405. date: DateUtils.dateFormat(closeDate, dft)
  406. }} />
  407. </td>
  408. </tr>
  409. </tbody>
  410. </table>
  411. </Grid> : null
  412. }
  413. <Grid item xs={12} md={12} lg={12}>
  414. <Grid container direction="row" justifyContent="flex-start" alignItems="center">
  415. <Grid item xs={12} md={3} lg={3}
  416. sx={{ display: 'flex', alignItems: 'center' }}>
  417. <Typography variant="pnspsFormParagraphBold">
  418. <FormattedMessage id="draftFile" /> ({intl.formatMessage({ id: 'fileSizeWarning' })}):
  419. </Typography>
  420. </Grid>
  421. <Grid item xs={12} md={6} lg={6} sx={{ wordBreak: 'break-word' }}>
  422. <input
  423. id="uploadFileBtn"
  424. name="file"
  425. type="file"
  426. accept=".doc,.docx,.xls,.xlsx"
  427. style={{ display: 'none' }}
  428. onChange={(event) => {
  429. readFile(event)
  430. }}
  431. />
  432. {attachment.name}
  433. </Grid>
  434. {/* <Grid item xs={12} md={3} lg={3}>
  435. <label htmlFor="uploadFileBtn">
  436. <Button
  437. aria-label={intl.formatMessage({id: 'uploadFileBtn'})}
  438. component="span"
  439. variant="outlined"
  440. size="large"
  441. >{attachment ? intl.formatMessage({id: 'uploadFileBtn'}) : intl.formatMessage({id: 'reUpload'})}</Button>
  442. </label>
  443. </Grid> */}
  444. </Grid>
  445. </Grid>
  446. <Grid item xs={12} md={12} lg={12}>
  447. <Grid container direction="row" justifyContent="flex-start" alignItems="center">
  448. <Grid item xs={12} md={3} lg={3}
  449. sx={{ display: 'flex', alignItems: 'center' }}>
  450. </Grid>
  451. <Grid item xs={12} md={6} lg={6} >
  452. <label htmlFor="uploadFileBtn">
  453. <Button
  454. aria-label={intl.formatMessage({ id: 'uploadFileBtn' })}
  455. component="span"
  456. variant="outlined"
  457. size="large"
  458. >{attachment ? intl.formatMessage({ id: 'uploadFileBtn' }) : intl.formatMessage({ id: 'reUpload' })}</Button>
  459. </label>
  460. </Grid>
  461. <Grid item xs={12} md={3} lg={3}>
  462. </Grid>
  463. </Grid>
  464. </Grid>
  465. <Grid item xs={12} md={12} lg={12} sx={{ mb: 3 }}>
  466. <Typography display="inline" variant="subtitle1" sx={{ color: 'primary.primary' }}>
  467. <FormattedMessage id="uploadApplicationFileRemark" />
  468. </Typography>
  469. </Grid>
  470. {isORGLoggedIn() ?
  471. <>
  472. {isDummyLoggedIn() ?
  473. <Grid item xs={12} md={12} lg={12}>
  474. {FieldUtils.getCarOfField({
  475. label: intl.formatMessage({ id: 'careOf' }) + ":",
  476. valueName: "careOfDum",
  477. form: formik,
  478. // disabled: true
  479. })}
  480. </Grid>
  481. :
  482. <Grid item xs={12} md={12} lg={12}>
  483. {FieldUtils.getCarOfField({
  484. label: intl.formatMessage({ id: 'careOf' }) + ":",
  485. valueName: "careOf",
  486. form: formik,
  487. // disabled: true
  488. })}
  489. </Grid>
  490. }
  491. <Grid item xs={12} md={12} lg={12} sx={{ mb: 3 }}>
  492. <Typography display="inline" variant="subtitle1" sx={{ color: 'primary.primary' }}>
  493. <FormattedMessage id="noteOnClientRemark" />
  494. </Typography>
  495. </Grid>
  496. </>
  497. :
  498. null
  499. }
  500. {
  501. isDummyLoggedIn() ?
  502. <Grid item xs={12} md={12} lg={12}>
  503. {FieldUtils.getTextField({
  504. label: intl.formatMessage({ id: 'userContactEmail' }),
  505. valueName: "emailAddress",
  506. form: formik
  507. })}
  508. </Grid>
  509. :
  510. <Grid item xs={12} md={12} lg={12}>
  511. {FieldUtils.getTextArea({
  512. label: intl.formatMessage({ id: 'extraMark' }) + ":",
  513. valueName: "remarks",
  514. form: formik,
  515. inputProps: { maxLength: 255 }
  516. })}
  517. </Grid>
  518. }
  519. <Grid item xs={12} mr={1} mb={2}>
  520. <Typography variant="pnspsFormParagraphBold">
  521. <span style={{ textAlign: 'justify', }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickUnderStr0" }) }} />
  522. </Typography>
  523. <Typography display="inline" variant="subtitle1" sx={{ color: 'primary.primary' }} >
  524. <ol style={{ textAlign: 'justify', }}>
  525. <li dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickUnderStr1" }) }} />
  526. <li dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickUnderStr2" }) }} />
  527. <li dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickUnderStr3" }) }} />
  528. <li dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "tradeMarkFootnote" }) }} />
  529. </ol>
  530. </Typography>
  531. </Grid>
  532. <Grid item xs={12}>
  533. <Stack direction="row">
  534. <Checkbox
  535. checked={tickAccept}
  536. onChange={(event) => {
  537. setTickAccept(event.target.checked)
  538. }}
  539. name="tickAccept"
  540. color="primary"
  541. size="small"
  542. />
  543. <Typography variant="h6" height="100%" >
  544. <div style={{ padding: 12, textAlign: 'justify' }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "applyTickStr" }) }} />
  545. </Typography>
  546. </Stack>
  547. </Grid>
  548. <Grid item xs={12}>
  549. <center>
  550. <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
  551. <Button
  552. aria-label={intl.formatMessage({ id: 'applyPublicNotice' })}
  553. variant="contained"
  554. type="submit"
  555. disabled={!tickAccept}
  556. >
  557. <FormattedMessage id="applyPublicNotice" />
  558. </Button>
  559. </ThemeProvider>
  560. </center>
  561. </Grid>
  562. </Grid>
  563. </form>
  564. </Box>
  565. </Grid>
  566. }
  567. <div>
  568. <Dialog
  569. open={isWarningPopUp}
  570. onClose={() => setIsWarningPopUp(false)}
  571. PaperProps={{
  572. sx: {
  573. minWidth: '40vw',
  574. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
  575. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
  576. }
  577. }}
  578. >
  579. <DialogTitle>
  580. {warningTitle}
  581. </DialogTitle>
  582. <DialogContent style={{ display: 'flex', }}>
  583. <Typography variant="h5" style={{ padding: '16px' }}>
  584. {warningText}
  585. </Typography>
  586. </DialogContent>
  587. <DialogActions>
  588. <Button
  589. aria-label={intl.formatMessage({ id: 'ok' })}
  590. onClick={() => {
  591. if (val.contactPerson) {
  592. apply(val);
  593. setIsWarningPopUp(false);
  594. } else {
  595. setIsWarningPopUp(false);
  596. if (reloadPage) {
  597. location.reload();
  598. }
  599. }
  600. }}
  601. >
  602. <FormattedMessage id="ok" />
  603. </Button>
  604. </DialogActions>
  605. </Dialog>
  606. </div>
  607. </Grid>
  608. );
  609. };
  610. export default PublicNoticeApplyForm;