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.
 
 

661 line
41 KiB

  1. // material-ui
  2. import {
  3. Dialog, DialogTitle, DialogContent, DialogActions,
  4. Typography,
  5. Grid,
  6. Stack,
  7. TextField,
  8. FormLabel,
  9. Button,
  10. Checkbox,
  11. RadioGroup, Radio,
  12. FormControlLabel
  13. } from '@mui/material';
  14. import * as UrlUtils from "utils/ApiPathConst";
  15. import * as HttpUtils from "utils/HttpUtils";
  16. import FileList from "components/FileList"
  17. import MainCard from "components/MainCard";
  18. import * as React from "react";
  19. import * as yup from 'yup';
  20. import { useParams } from "react-router-dom";
  21. import { useFormik } from 'formik';
  22. import { useNavigate } from "react-router-dom";
  23. import * as DateUtils from "utils/DateUtils"
  24. import Loadable from 'components/Loadable';
  25. import { notifyActionSuccess } from 'utils/CommonFunction';
  26. import { PNSPS_BUTTON_THEME } from "themes/buttonConst";
  27. import { ThemeProvider } from "@emotion/react";
  28. import { FormattedMessage, useIntl } from "react-intl";
  29. import { isDummyLoggedIn } from "utils/Utils"
  30. const UploadFileTable = Loadable(React.lazy(() => import('./UploadFileTable')));
  31. //import * as ProofStatus from "utils/statusUtils/ProofStatus";
  32. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  33. const FormPanel = ({ formData }) => {
  34. const intl = useIntl();
  35. const { locale } = intl;
  36. const [data, setData] = React.useState({});
  37. const [paymentMethod, set_paymentMethod] = React.useState("");
  38. const [attachments, setAttachments] = React.useState([]);
  39. const [actionValue, setActionValue] = React.useState(true);
  40. const [warningTitle, setWarningTitle] = React.useState("");
  41. const [isWarningPopUp, setIsWarningPopUp] = React.useState(false);
  42. const [warningText, setWarningText] = React.useState("");
  43. const navigate = useNavigate()
  44. const params = useParams();
  45. const tabelStyle = {
  46. border: "2px solid gray",
  47. borderCollapse: "collapse",
  48. padding: "right"
  49. }
  50. React.useEffect(() => {
  51. if (formData) {
  52. setData(formData);
  53. if (isDummyLoggedIn()) {
  54. set_paymentMethod("demandNote")
  55. }
  56. }
  57. }, [formData]);
  58. const formik = useFormik({
  59. enableReinitialize: true,
  60. initialValues: data,
  61. validationSchema: yup.object().shape({
  62. vaild: yup.string().max(255, intl.formatMessage({ id: 'requireLoginPassword' })).required(intl.formatMessage({ id: 'requireLoginPassword' })),
  63. }),
  64. onSubmit: values => {
  65. if (isOverTime() && !isDummyLoggedIn()) {
  66. setWarningTitle(intl.formatMessage({ id: "attention" }))
  67. setWarningText(intl.formatMessage({ id: 'MSG.proofOutOfTime' }));
  68. setIsWarningPopUp(true);
  69. return;
  70. }
  71. let pm = paymentMethod;
  72. if (!isDummyLoggedIn()) {
  73. if (pm == "demandNote") {
  74. pm = isOverDnReviseDeadline() ? "" : pm;
  75. } else if (pm == "office") {
  76. pm = isOverNpgoReviseDeadline() ? "" : pm;
  77. }
  78. }
  79. if (actionValue == false && isOverReviseDeadline() && !isDummyLoggedIn()) {
  80. setWarningTitle(intl.formatMessage({ id: "attention" }))
  81. setWarningText(intl.formatMessage({ id: 'MSG.overReviseDeadline' }));
  82. setIsWarningPopUp(true);
  83. return;
  84. }
  85. else if (formData.creditor == false && pm == "") {
  86. setWarningTitle(intl.formatMessage({ id: "attention" }))
  87. setWarningText(intl.formatMessage({ id: 'MSG.plzSelectPaymentMethod' }));
  88. setIsWarningPopUp(true);
  89. return;
  90. }
  91. if (!actionValue) {
  92. if (!attachments || attachments.length <= 0) {
  93. setWarningTitle(intl.formatMessage({ id: "attention" }))
  94. setWarningText(intl.formatMessage({ id: 'requireFile' }));
  95. setIsWarningPopUp(true);
  96. return;
  97. }
  98. }
  99. // console.log(values);
  100. HttpUtils.postWithFiles({
  101. url: UrlUtils.REPLY_PROOF,
  102. params: {
  103. id: data.id,
  104. action: actionValue,
  105. vaild: values.vaild,
  106. paymentMethod: pm
  107. },
  108. files: attachments ? attachments : [],
  109. onSuccess: function (responseData) {
  110. if (responseData.msg) {
  111. setWarningTitle(intl.formatMessage({ id: "attention" }))
  112. setWarningText(intl.formatMessage({ id: responseData.msg }));
  113. setIsWarningPopUp(true);
  114. return;
  115. }
  116. if (responseData.id == params.id) {
  117. notifyActionSuccess(intl.formatMessage({ id: "submitted" }))
  118. navigate("/proof/pay/" + params.id);
  119. } else {
  120. navigate("/proof/search");
  121. }
  122. },
  123. onFail: function (response) {
  124. setWarningTitle(intl.formatMessage({ id: "attention" }))
  125. setWarningText(intl.formatMessage({ id: 'actionFail' }));
  126. setIsWarningPopUp(true);
  127. console.log(response);
  128. },
  129. onError: function (error) {
  130. setWarningTitle(intl.formatMessage({ id: "attention" }))
  131. setWarningText(intl.formatMessage({ id: 'actionFail' }));
  132. setIsWarningPopUp(true);
  133. console.log(error);
  134. }
  135. });
  136. }
  137. });
  138. const readFile = (event) => {
  139. let file = event.target.files[0];
  140. if (file) {
  141. if (!file.name.toLowerCase().substr(file.name.length - 4).includes(".pdf")) {
  142. setWarningTitle(intl.formatMessage({ id: "attention" }))
  143. setWarningText(intl.formatMessage({ id: 'requireValidFileWithPdfFormat' }));
  144. setIsWarningPopUp(true);
  145. document.getElementById("uploadFileBtn").value = "";
  146. return;
  147. }
  148. if (file.size >= (10 * 1024 * 1034)) {
  149. setWarningTitle(intl.formatMessage({ id: "attention" }))
  150. setWarningText(intl.formatMessage({ id: 'fileSizeWarning' }));
  151. setIsWarningPopUp(true);
  152. return;
  153. }
  154. file['id'] = attachments.length;
  155. setAttachments([
  156. ...attachments,
  157. file
  158. ]);
  159. document.getElementById("uploadFileBtn").value = "";
  160. }
  161. }
  162. const isOverTime = () => {
  163. let proofPaymentDeadline = DateUtils.convertToDate(formData?.proofPaymentDeadline);
  164. if (!proofPaymentDeadline) return true;
  165. let current = new Date();
  166. return current.getTime() > proofPaymentDeadline;
  167. }
  168. const isOverReviseDeadline = () => {
  169. // if (paymentMethod == "demandNote") return isOverDnReviseDeadline();
  170. // if (paymentMethod == "office") return isOverNpgoReviseDeadline();
  171. //online payment
  172. let reviseDeadline = DateUtils.convertToDate(formData?.reviseDeadline);
  173. // reviseDeadline?.setTime(reviseDeadline?.getTime() + (14 * 60 * 60 * 1000));// 14:00
  174. if (!reviseDeadline) return true;
  175. let current = new Date();
  176. return current.getTime() > reviseDeadline;
  177. }
  178. const isOverDnReviseDeadline = () => {
  179. let reviseDeadline = DateUtils.convertToDate(formData?.closingDateOff);
  180. reviseDeadline?.setTime(reviseDeadline?.getTime() + (17 * 60 * 60 * 1000));// 17:00
  181. if (!reviseDeadline) return true;
  182. let current = new Date();
  183. return current.getTime() > reviseDeadline;
  184. }
  185. const isOverNpgoReviseDeadline = () => {
  186. let reviseDeadline = DateUtils.convertToDate(formData?.closingDate);
  187. reviseDeadline?.setTime(reviseDeadline?.getTime() + (12 * 60 * 60 * 1000));// 12:00
  188. if (!reviseDeadline) return true;
  189. let current = new Date();
  190. return current.getTime() > reviseDeadline;
  191. }
  192. return (
  193. <MainCard xs={12} sm={12} md={12} lg={12}
  194. border={false}
  195. content={false}>
  196. <Typography variant="h4" sx={{ textAlign: "left", mb: 2, borderBottom: "1px solid black" }}>
  197. <FormattedMessage id="publicNoticePaymentProofComment" />
  198. </Typography>
  199. <form onSubmit={formik.handleSubmit}>
  200. {
  201. formik.values.replyDate ?
  202. <Grid container direction="column" sx={{ paddingLeft: 0, paddingRight: 0 }}>
  203. <Grid item xs={12} sm={12} md={12} lg={8} textAlign="left">
  204. <Typography variant="h5">
  205. <FormattedMessage id="proofReplyDate" /> :&nbsp;
  206. {
  207. locale === 'en' ?
  208. DateUtils.dateValue(formik.values.replyDate)
  209. :
  210. DateUtils.datetimeStr_Cht(formik.values.replyDate)
  211. }
  212. </Typography>
  213. </Grid>
  214. <Grid item xs={12} md={12} textAlign="left">
  215. <Typography variant="h5">
  216. <FormattedMessage id="proofReply" /> : {formik.values.action ?
  217. (<span style={{ color: 'green' }}>
  218. <FormattedMessage id="proofErrorFree" />
  219. </span>)
  220. :
  221. (<span style={{ color: 'red' }}>
  222. <FormattedMessage id="proofWithError" />
  223. </span>)}
  224. </Typography>
  225. </Grid>
  226. {/* <Grid item xs={12} md={12} textAlign="left">
  227. <Typography variant="h5">
  228. <FormattedMessage id="proofReply" /> :&nbsp;
  229. <span style={{ color: 'green' }}>
  230. {
  231. locale === 'en' ?
  232. ProofStatus.getStatusText_Eng(formik.values).text
  233. :
  234. ProofStatus.getStatusText_Cht(formik.values).text
  235. }
  236. </span>
  237. </Typography>
  238. </Grid> */}
  239. {
  240. formik.values.action ?
  241. null
  242. :
  243. <Grid item xs={12} md={12} textAlign="left" sx={{ width: '95%', maxWidth: { xs: '70vw', sm: '72vw', md: '75vw', lg: '80vw' } }}>
  244. <FileList
  245. lang="ch"
  246. refId={params.id}
  247. refType={"proofReply"}
  248. dateHideable={true}
  249. disablePagination
  250. disableSelectionOnClick
  251. disableColumnMenu
  252. disableColumnSelector
  253. hideFooter
  254. />
  255. </Grid>
  256. }
  257. </Grid>
  258. :
  259. (
  260. isOverTime() ?
  261. <Grid container direction="column" sx={{ paddingLeft: 0, paddingRight: 0 }} spacing={1}>
  262. <Grid item xs={12} md={12} textAlign="left">
  263. <Typography variant="h5"><FormattedMessage id="MSG.proofOutOfTime" /></Typography>
  264. </Grid>
  265. </Grid>
  266. :
  267. <Grid container direction="column" sx={{ paddingLeft: 0, paddingRight: 0 }} spacing={1}>
  268. <Grid item xs={12} md={12}>
  269. <RadioGroup
  270. aria-labelledby="demo-radio-buttons-group-label"
  271. id="action"
  272. name="action"
  273. defaultValue={true}
  274. onChange={(event) => {
  275. setActionValue(event.target.value === "true" ? true : false);
  276. }}
  277. >
  278. <FormControlLabel value={true} control={<Radio />} label={intl.formatMessage({ id: 'proofErrorFree' })} />
  279. <FormControlLabel value={false} control={<Radio />} label={intl.formatMessage({ id: 'proofWithError' })} />
  280. </RadioGroup>
  281. </Grid>
  282. {
  283. actionValue && formData.creditor == false ?
  284. isDummyLoggedIn() ?
  285. <Grid item xs={12} sx={{ mb: 1, }}>
  286. <table style={tabelStyle}>
  287. <tr style={tabelStyle}>
  288. <th style={tabelStyle} width="50" align="left"></th>
  289. <th style={tabelStyle} width="300" align="left"><FormattedMessage id="paymentMeans" /></th>
  290. <th style={tabelStyle} width="300" align="left"><FormattedMessage id="confirmingDealine" /></th>
  291. <th style={tabelStyle} width="400" align="left"><FormattedMessage id="PaymentCoonpletDealine" /></th>
  292. </tr>
  293. <tr>
  294. <td style={tabelStyle}>
  295. <Checkbox
  296. checked={paymentMethod == "demandNote"}
  297. onChange={() => {
  298. set_paymentMethod("demandNote")
  299. }}
  300. />
  301. </td>
  302. <td style={tabelStyle}>
  303. <FormattedMessage id="payDn" />
  304. <br /><a href="#payOnlineDetails" color='#fff' onClick={() => {
  305. setWarningTitle(intl.formatMessage({ id: "payDn" }))
  306. setWarningText(
  307. <><FormattedMessage id="paymentMethodMeans" />
  308. <ul>
  309. <li><FormattedMessage id="atm" /></li>
  310. <li><FormattedMessage id="pps" /></li>
  311. <li><FormattedMessage id="eBank" /></li>
  312. <li><FormattedMessage id="phoneBank" /></li>
  313. <li><FormattedMessage id="eCheque" /></li>
  314. <li><FormattedMessage id="fps" /></li>
  315. <li><FormattedMessage id="hkpo" /></li>
  316. <li><FormattedMessage id="store" /></li>
  317. <li><FormattedMessage id="post" /></li>
  318. </ul>
  319. </>
  320. );
  321. setIsWarningPopUp(true);
  322. }}><FormattedMessage id="viewDetail" /></a>
  323. </td>
  324. <td style={tabelStyle}>{DateUtils.dateFormat(formData.closingDateOff, intl.formatMessage({ id: "dateStrFormat" }))} 5:00 p.m.</td>
  325. <td style={tabelStyle}>
  326. <FormattedMessage id="payDnRemark" values={{
  327. date: DateUtils.dateFormat(formData.closingDate, intl.formatMessage({ id: "dateStrFormat" })) + " 12:00 p.m."
  328. }} />
  329. </td>
  330. </tr>
  331. <tr>
  332. <td style={tabelStyle}>
  333. <Checkbox
  334. checked={paymentMethod == "office"}
  335. onChange={() => {
  336. set_paymentMethod("office")
  337. }}
  338. />
  339. </td>
  340. <td style={tabelStyle}>
  341. <FormattedMessage id="payNPGO" />
  342. <br /><a href="#payOnlineDetails" color='#fff' onClick={() => {
  343. setWarningTitle(intl.formatMessage({ id: "payNPGO" }))
  344. setWarningText(
  345. <><FormattedMessage id="paymentMethodMeans" />
  346. <ul>
  347. <li><FormattedMessage id="cheque" /></li>
  348. <li><FormattedMessage id="cash" /></li>
  349. </ul>
  350. </>
  351. );
  352. setIsWarningPopUp(true);
  353. }}><FormattedMessage id="viewDetail" /></a>
  354. </td>
  355. <td style={tabelStyle}>{DateUtils.dateFormat(formData.closingDate, intl.formatMessage({ id: "dateStrFormat" }))} 12:00 p.m.</td>
  356. <td style={tabelStyle}>
  357. <FormattedMessage id="payNPGORemark" values={{
  358. date: DateUtils.dateFormat(formData.closingDate, intl.formatMessage({ id: "dateStrFormat" })) + " 12:30 p.m."
  359. }} />
  360. </td>
  361. </tr>
  362. </table>
  363. </Grid> :
  364. <Grid item xs={12} sx={{ mb: 1, }}>
  365. <table style={tabelStyle}>
  366. <tr style={tabelStyle}>
  367. <th style={tabelStyle} width="50" align="left"></th>
  368. <th style={tabelStyle} width="300" align="left"><FormattedMessage id="paymentMeans" /></th>
  369. <th style={tabelStyle} width="300" align="left"><FormattedMessage id="confirmingDealine" /></th>
  370. <th style={tabelStyle} width="400" align="left"><FormattedMessage id="PaymentCoonpletDealine" /></th>
  371. </tr>
  372. <tr>
  373. <td style={tabelStyle}>
  374. <Checkbox
  375. checked={paymentMethod == "online"}
  376. onChange={() => {
  377. set_paymentMethod("online")
  378. }}
  379. />
  380. </td>
  381. <td style={tabelStyle}>
  382. <FormattedMessage id="payOnline" />
  383. <br /><a href="#payOnlineDetails" color='#fff' onClick={() => {
  384. setWarningTitle(intl.formatMessage({ id: "payOnline" }))
  385. setWarningText(
  386. <><FormattedMessage id="paymentMethodMeans" />
  387. <ul>
  388. <li><FormattedMessage id="fps" /></li>
  389. <li><FormattedMessage id="card" /></li>
  390. <li><FormattedMessage id="pps" /></li>
  391. </ul>
  392. </>
  393. );
  394. setIsWarningPopUp(true);
  395. }}><FormattedMessage id="viewDetail" /></a>
  396. </td>
  397. <td style={tabelStyle}>{DateUtils.dateFormat(formData.proofPaymentDeadline, intl.formatMessage({ id: "paymentMethodDatetimeStrFormat" }))?.replace("am", "a.m.")?.replace("pm", "p.m.")}</td>
  398. <td style={tabelStyle}>{DateUtils.dateFormat(formData.expiryDate, intl.formatMessage({ id: "paymentMethodDatetimeStrFormat" }))?.replace("am", "a.m.")?.replace("pm", "p.m.")}</td>
  399. </tr>
  400. <tr>
  401. <td style={tabelStyle}>
  402. {isOverDnReviseDeadline() ?
  403. <></> :
  404. <Checkbox
  405. checked={paymentMethod == "demandNote"}
  406. onChange={() => {
  407. set_paymentMethod("demandNote")
  408. }}
  409. />
  410. }
  411. </td>
  412. <td style={tabelStyle}>
  413. <FormattedMessage id="payDn" />
  414. <br /><a href="#payOnlineDetails" color='#fff' onClick={() => {
  415. setWarningTitle(intl.formatMessage({ id: "payDn" }))
  416. setWarningText(
  417. <><FormattedMessage id="paymentMethodMeans" />
  418. <ul>
  419. <li><FormattedMessage id="atm" /></li>
  420. <li><FormattedMessage id="pps" /></li>
  421. <li><FormattedMessage id="eBank" /></li>
  422. <li><FormattedMessage id="phoneBank" /></li>
  423. <li><FormattedMessage id="eCheque" /></li>
  424. <li><FormattedMessage id="fps" /></li>
  425. <li><FormattedMessage id="hkpo" /></li>
  426. <li><FormattedMessage id="store" /></li>
  427. <li><FormattedMessage id="post" /></li>
  428. </ul>
  429. </>
  430. );
  431. setIsWarningPopUp(true);
  432. }}><FormattedMessage id="viewDetail" /></a>
  433. </td>
  434. <td style={tabelStyle}>{DateUtils.dateFormat(formData.closingDateOff, intl.formatMessage({ id: "dateStrFormat" }))} 5:00 p.m.</td>
  435. <td style={tabelStyle}>
  436. <FormattedMessage id="payDnRemark" values={{
  437. date: DateUtils.dateFormat(formData.closingDate, intl.formatMessage({ id: "dateStrFormat" })) + " 12:00 p.m."
  438. }} />
  439. </td>
  440. </tr>
  441. <tr>
  442. <td style={tabelStyle}>
  443. {
  444. isOverNpgoReviseDeadline() ?
  445. <></> :
  446. <Checkbox
  447. checked={paymentMethod == "office"}
  448. onChange={() => {
  449. set_paymentMethod("office")
  450. }}
  451. />
  452. }
  453. </td>
  454. <td style={tabelStyle}>
  455. <FormattedMessage id="payNPGO" />
  456. <br /><a href="#payOnlineDetails" color='#fff' onClick={() => {
  457. setWarningTitle(intl.formatMessage({ id: "payDn" }))
  458. setWarningText(
  459. <><FormattedMessage id="paymentMethodMeans" />
  460. <ul>
  461. <li><FormattedMessage id="cheque" /></li>
  462. <li><FormattedMessage id="cash" /></li>
  463. </ul>
  464. </>
  465. );
  466. setIsWarningPopUp(true);
  467. }}><FormattedMessage id="viewDetail" /></a>
  468. </td>
  469. <td style={tabelStyle}>{DateUtils.dateFormat(formData.closingDate, intl.formatMessage({ id: "dateStrFormat" }))} 12:00 p.m.</td>
  470. <td style={tabelStyle}>
  471. <FormattedMessage id="payNPGORemark" values={{
  472. date: DateUtils.dateFormat(formData.closingDate, intl.formatMessage({ id: "dateStrFormat" })) + " 12:30 p.m."
  473. }} />
  474. </td>
  475. </tr>
  476. </table>
  477. </Grid>
  478. :
  479. actionValue ?
  480. <></>
  481. :
  482. <>
  483. {
  484. isOverReviseDeadline() ?
  485. <Grid item xs={12} md={12} textAlign="left">
  486. <Typography variant="h5" style={{ color: "red" }}>
  487. <FormattedMessage id="MSG.overReviseDeadline" />
  488. </Typography>
  489. </Grid>
  490. :
  491. <>
  492. <Grid item xs={12} md={12} textAlign="left">
  493. <Typography variant="h5">
  494. <FormattedMessage id="requiredUploadFix" />:
  495. </Typography>
  496. </Grid>
  497. <Grid item xs={12} md={12} textAlign="left">
  498. <input
  499. id="uploadFileBtn"
  500. name="file"
  501. type="file"
  502. accept=".pdf"
  503. style={{ display: 'none' }}
  504. disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)}
  505. onChange={(event) => {
  506. readFile(event)
  507. }}
  508. />
  509. <label htmlFor="uploadFileBtn">
  510. <ThemeProvider theme={PNSPS_BUTTON_THEME}>
  511. <Button
  512. color="save"
  513. component="span"
  514. variant="contained"
  515. aria-label={intl.formatMessage({ id: 'upload' })}
  516. disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)}
  517. >
  518. <FormattedMessage id="upload" />
  519. </Button>
  520. </ThemeProvider>
  521. </label>
  522. </Grid>
  523. <Grid item xs={12} sm={12} md={12} lg={12} textAlign="left" sx={{ width: '95%', maxWidth: { xs: '70vw', sm: '72vw', md: '75vw', lg: '80vw' } }} >
  524. <UploadFileTable key="uploadTable" recordList={attachments} setRecordList={setAttachments} />
  525. </Grid>
  526. </>
  527. }
  528. </>
  529. }
  530. {
  531. actionValue == false && isOverReviseDeadline() ?
  532. <></>
  533. :
  534. <Grid item xs={12} sm={12} md={12} lg={12}>
  535. <Stack direction="row" alignItems="center">
  536. <FormLabel sx={{ paddingRight: 2, paddingBottom: 3, textAlign: "center" }}>
  537. <Typography variant="h5">
  538. <FormattedMessage id="sign" />:
  539. </Typography>
  540. </FormLabel>
  541. <TextField
  542. fullWidth
  543. type="password"
  544. onChange={formik.handleChange}
  545. name="vaild"
  546. variant="outlined"
  547. error={Boolean(formik.errors["vaild"])}
  548. helperText={formik.errors["vaild"] ? formik.errors["vaild"] : ' '}
  549. placeholder={intl.formatMessage({ id: 'requireLoginPassword' })}
  550. sx={
  551. {
  552. "& .MuiInputBase-input.Mui-disabled": {
  553. WebkitTextFillColor: "#000000",
  554. background: "#f8f8f8",
  555. },
  556. width: '70%'
  557. }
  558. }
  559. />
  560. </Stack>
  561. </Grid>
  562. }
  563. <Grid item xs={12} md={12} textAlign="left">
  564. <ThemeProvider theme={PNSPS_BUTTON_THEME}>
  565. <Button
  566. variant="contained"
  567. color="success"
  568. type="submit"
  569. disabled={actionValue == false && isOverReviseDeadline()}
  570. aria-label={intl.formatMessage({ id: 'submitReply' })}
  571. >
  572. <FormattedMessage id="submitReply" />
  573. </Button>
  574. </ThemeProvider>
  575. </Grid>
  576. </Grid>
  577. )
  578. }
  579. </form>
  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="h3" style={{ padding: '16px' }}>{warningText}</Typography>
  597. </DialogContent>
  598. <DialogActions>
  599. <Button
  600. aria-label={intl.formatMessage({ id: 'ok' })}
  601. onClick={() => setIsWarningPopUp(false)}
  602. >
  603. OK
  604. </Button>
  605. </DialogActions>
  606. </Dialog>
  607. </div>
  608. </MainCard>
  609. );
  610. };
  611. export default FormPanel;