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.
 
 

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