No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

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