Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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