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.
 
 

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