25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

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