選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

863 行
52 KiB

  1. // material-ui
  2. import {
  3. FormControl,
  4. Button,
  5. Grid,
  6. // InputAdornment,
  7. Typography, FormLabel,
  8. OutlinedInput,
  9. Stack,
  10. Dialog, DialogTitle, DialogContent, DialogActions
  11. } from '@mui/material';
  12. // import MainCard from "../../components/MainCard";
  13. const MainCard = Loadable(lazy(() => import('components/MainCard')));
  14. import { useForm } from "react-hook-form";
  15. import { useNavigate } from "react-router-dom";
  16. import {
  17. useEffect,
  18. useState,
  19. lazy
  20. } from "react";
  21. // import Checkbox from "@mui/material/Checkbox";
  22. import Loadable from 'components/Loadable';
  23. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  24. // import {useParams} from "react-router-dom";
  25. import * as HttpUtils from "utils/HttpUtils"
  26. import * as UrlUtils from "utils/ApiPathConst"
  27. import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils";
  28. import * as DateUtils from "utils/DateUtils";
  29. import * as FormatUtils from "utils/FormatUtils";
  30. import {
  31. isORGLoggedIn,
  32. // isDummyLoggedIn
  33. } from "utils/Utils";
  34. import * as utils from "auth/utils"
  35. // import BorderColorOutlinedIcon from '@mui/icons-material/BorderColorOutlined';
  36. // import DoneIcon from '@mui/icons-material/Done';
  37. import CloseIcon from '@mui/icons-material/Close';
  38. import EditNoteIcon from '@mui/icons-material/EditNote';
  39. import DownloadIcon from '@mui/icons-material/Download';
  40. import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst";
  41. import { PRIMARY_CONTAINED_BUTTON_SX } from "themes/colorConst";
  42. import SafeHtml from 'components/SafeHtml';
  43. import { ThemeProvider } from "@emotion/react";
  44. import { FormattedMessage, useIntl } from "react-intl";
  45. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  46. const ApplicationDetailCard = (
  47. { applicationDetailData,
  48. setStatus,
  49. fee
  50. }
  51. ) => {
  52. const [isPopUp, setIsPopUp] = useState(false);
  53. const [errorText, setErrorText] = useState("");
  54. const [errorPopUp, setErrorPopUp] = useState(false);
  55. const [paymentHoldedErrText, setPaymentHoldedErrText] = useState("");
  56. const [paymentHoldedErr, setPaymentHoldedErr] = useState(false);
  57. // const params = useParams();
  58. const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({});
  59. const [companyName, setCompanyName] = useState({});
  60. const [fileDetail, setfileDetail] = useState({});
  61. const [onReady, setOnReady] = useState(false);
  62. const [issueNum, setIssueNum] = useState("");
  63. const [issueDate, setIssueDate] = useState("");
  64. const [onDownload, setOnDownload] = useState(false);
  65. const [mode, setMode] = useState("");
  66. const { register,
  67. // getValues
  68. } = useForm();
  69. const navigate = useNavigate();
  70. const intl = useIntl();
  71. useEffect(() => {
  72. //if user data from parent are not null
  73. // console.log(applicationDetailData)
  74. if (Object.keys(applicationDetailData)?.length > 0 && applicationDetailData.data !== null) {
  75. setCurrentApplicationDetailData(applicationDetailData.data);
  76. setCompanyName(applicationDetailData.companyName);
  77. setfileDetail(applicationDetailData.fileDetail);
  78. setIssueNum(applicationDetailData.gazetteIssueDetail.volume + "/" + applicationDetailData.gazetteIssueDetail.issueYear
  79. + " No. " + applicationDetailData.gazetteIssueDetail.issueNo);
  80. setIssueDate(DateUtils.dateFormat(applicationDetailData.gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)"));
  81. if (applicationDetailData.data.mode != null){
  82. setMode(applicationDetailData.data.mode);
  83. }
  84. }
  85. }, [applicationDetailData]);
  86. useEffect(() => {
  87. //if state data are ready and assign to different field
  88. // console.log(currentApplicationDetailData)
  89. if (Object.keys(currentApplicationDetailData)?.length > 0) {
  90. setOnReady(true);
  91. }
  92. }, [currentApplicationDetailData]);
  93. const onDownloadClick = () => () => {
  94. setOnDownload(true)
  95. HttpUtils.fileDownload({
  96. fileId: fileDetail?.id,
  97. skey: fileDetail?.skey,
  98. filename: fileDetail?.filename,
  99. onResponse:()=>{
  100. setOnDownload(false)
  101. },
  102. onError:()=>{
  103. setOnDownload(false)
  104. }
  105. });
  106. };
  107. const cancelledClick = () => () => {
  108. setStatus("cancel")
  109. };
  110. const isPastPaymentDeadline = (expiryDate) => {
  111. if (!expiryDate) return false;
  112. const deadline = DateUtils.convertToDate(expiryDate);
  113. if (!deadline || Number.isNaN(deadline.getTime())) return false;
  114. return Date.now() >= deadline.getTime();
  115. };
  116. const checkExprityDate = () => {
  117. HttpUtils.post({
  118. url: UrlUtils.POST_CHECK_APP_EXPRITY_DATE,
  119. params: {
  120. ids: [currentApplicationDetailData.id]
  121. },
  122. onSuccess: (responData) => {
  123. if (responData.success == true) {
  124. let appIdList = [currentApplicationDetailData.id]
  125. handlePaymentCheck(appIdList)
  126. return;
  127. }
  128. setErrorText(intl.formatMessage({ id: "MSG.App" }));
  129. setErrorPopUp(true);
  130. }
  131. });
  132. };
  133. function doPayment() {
  134. setIsPopUp(false);
  135. let appIdList = [currentApplicationDetailData.id]
  136. navigate('/paymentPage', { state: { amount: fee, appIdList: appIdList } });
  137. }
  138. const handlePaymentCheck = (appIdList) => {
  139. HttpUtils.post({
  140. url: UrlUtils.PAYMENT_CHECK,
  141. params: {
  142. appIds: appIdList
  143. },
  144. onSuccess: (responseData) => {
  145. const latestData = {};
  146. responseData.forEach(item => {
  147. const { appId, timeDiff } = item;
  148. if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) {
  149. latestData[appId] = item;
  150. }
  151. });
  152. const latestDataObjects = Object.values(latestData);
  153. // const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 || item.status !== "APPR");
  154. const filteredData = latestDataObjects.filter(item => item.timeDiff > 30 || item.status == "CANC" || item.status == "REJT");
  155. const filteredAppIds = filteredData.map(item => item.appId);
  156. const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId));
  157. const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds];
  158. const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId));
  159. if (readyToPayment) {
  160. setIsPopUp(true);
  161. return;
  162. } else {
  163. const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId));
  164. const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId));
  165. const resultString = HoldingApplication.map(item => item.appNo).join(' , ');
  166. setPaymentHoldedErrText(resultString);
  167. // setPaymentHoldedErrText(intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: record.appNo }));
  168. setPaymentHoldedErr(true);
  169. }
  170. }
  171. });
  172. };
  173. return (
  174. !onReady ?
  175. <LoadingComponent />
  176. :
  177. <MainCard elevation={0}
  178. border={false}
  179. content={false}
  180. >
  181. {mode != "offline"?
  182. <div>
  183. <Grid container spacing={1} direction="row">
  184. <Grid item xs={12}>
  185. <Stack
  186. direction="row"
  187. justifyContent="space-between"
  188. alignItems="center"
  189. spacing={2}
  190. mb={2}
  191. >
  192. <ThemeProvider theme={PNSPS_BUTTON_THEME}>
  193. {
  194. currentApplicationDetailData.status == "confirmed"
  195. && !isPastPaymentDeadline(currentApplicationDetailData.expiryDate) ?
  196. <Button
  197. variant="contained"
  198. color="create"
  199. onClick={() => { checkExprityDate(true) }}
  200. disabled={currentApplicationDetailData.status == "rejected"
  201. || currentApplicationDetailData.status == "cancelled"
  202. || currentApplicationDetailData.status == "paid"
  203. || currentApplicationDetailData.creditor
  204. || currentApplicationDetailData.paymentMethod != "online"
  205. }
  206. startIcon={<EditNoteIcon />}
  207. aria-label={intl.formatMessage({ id: 'payFor' })}
  208. >
  209. <FormattedMessage id="payFor" />
  210. </Button>
  211. : null
  212. }
  213. <Button
  214. variant="contained"
  215. onClick={cancelledClick()}
  216. disabled={currentApplicationDetailData.status == "rejected"
  217. || currentApplicationDetailData.status == "cancelled"
  218. || currentApplicationDetailData.status == "withdrawn"
  219. || currentApplicationDetailData.status == "completed"
  220. || currentApplicationDetailData.status == "notAccepted"
  221. || currentApplicationDetailData.status == "resubmit"
  222. || (!currentApplicationDetailData.creditor
  223. && currentApplicationDetailData.status == "paid")
  224. || (currentApplicationDetailData.creditor
  225. && currentApplicationDetailData.status == "confirmed")
  226. || (currentApplicationDetailData.creditor
  227. && currentApplicationDetailData.status == "published")
  228. }
  229. title={intl.formatMessage({ id: 'cancelApp' })}
  230. startIcon={<CloseIcon />}
  231. aria-label={intl.formatMessage({ id: 'cancelApp' })}
  232. sx={{
  233. backgroundColor: '#0c489e',
  234. color: '#FFFFFF',
  235. '&:hover': { backgroundColor: '#1565c0' },
  236. }}
  237. >
  238. <FormattedMessage id="cancelApp" />
  239. </Button>
  240. </ThemeProvider>
  241. </Stack>
  242. </Grid>
  243. </Grid>
  244. </div>
  245. :null
  246. }
  247. <Typography variant="h4" component="h3" sx={{ mb: 2, borderBottom: "1px solid black" }}>
  248. <FormattedMessage id="publicNoticeDetailTitle" />
  249. </Typography>
  250. <form>
  251. <Grid container direction="column">
  252. <Grid item xs={12} md={12}>
  253. <Grid container direction="row" justifyContent="space-between"
  254. alignItems="center">
  255. <Grid item xs={12} sm={12} md={9} lg={6} sx={{ mb: 1 }}>
  256. <Grid container alignItems={"center"}>
  257. <Grid item xs={12} md={3} lg={3}
  258. sx={{ display: 'flex', alignItems: 'center' }}>
  259. <FormLabel><Typography variant="pnspsFormParagraph">
  260. <FormattedMessage id="applicationId" />:
  261. </Typography></FormLabel>
  262. </Grid>
  263. <Grid item xs={12} md={9} lg={9}>
  264. <FormControl variant="outlined" fullWidth disabled>
  265. <OutlinedInput
  266. fullWidth
  267. size="small"
  268. {...register("appNo",
  269. {
  270. value: currentApplicationDetailData.appNo,
  271. })}
  272. id='appNo'
  273. sx={{
  274. "& .MuiInputBase-input.Mui-disabled": {
  275. WebkitTextFillColor: "#000000",
  276. background: "#f8f8f8",
  277. },
  278. }}
  279. />
  280. </FormControl>
  281. </Grid>
  282. </Grid>
  283. </Grid>
  284. <Grid item xs={12} sm={12} md={9} lg={5} sx={{ mb: 1}}>
  285. <Grid container alignItems={"center"}>
  286. <Grid item xs={12} md={3} lg={3}
  287. sx={{ display: 'flex', alignItems: 'center' }}>
  288. <FormLabel><Typography variant="pnspsFormParagraph">
  289. <FormattedMessage id="applyStatus" />:
  290. </Typography></FormLabel>
  291. </Grid>
  292. <Grid item xs={12} md={9} lg={9}>
  293. <FormControl variant="outlined">
  294. {currentApplicationDetailData.status ? StatusUtils.getStatusByTextIntl(currentApplicationDetailData.status, currentApplicationDetailData.creditor, intl) : ""}
  295. </FormControl>
  296. </Grid>
  297. </Grid>
  298. {
  299. currentApplicationDetailData.reason ?
  300. <Grid item xs={12} md={12} lg={12}>
  301. <Grid container alignItems={"center"} direction="row" >
  302. <Grid item xs={12} md={3} lg={3}>
  303. <FormLabel><Typography variant="pnspsFormParagraph"><FormattedMessage id="reason" />:</Typography></FormLabel>
  304. </Grid>
  305. <Grid item xs={12} md={9} lg={9}>
  306. <FormLabel>
  307. <Typography id='reason' variant="pnspsFormParagraph">
  308. {currentApplicationDetailData.reason}
  309. </Typography>
  310. </FormLabel>
  311. </Grid>
  312. </Grid>
  313. </Grid>
  314. : ""
  315. }
  316. </Grid>
  317. </Grid>
  318. <Grid container direction="row" justifyContent="space-between"
  319. alignItems="center">
  320. <Grid item xs={12} sm={12} md={9} lg={6} sx={{ mb: 1 }}>
  321. <Grid container alignItems={"center"}>
  322. <Grid item xs={12} md={3} lg={3}
  323. sx={{ display: 'flex', alignItems: 'center' }}>
  324. <FormLabel><Typography variant="pnspsFormParagraph">
  325. <FormattedMessage id="applyPerson" />:
  326. </Typography></FormLabel>
  327. </Grid>
  328. <Grid item xs={12} md={9} lg={9}>
  329. <FormControl variant="outlined" fullWidth disabled >
  330. {currentApplicationDetailData.orgId === null ?
  331. <OutlinedInput
  332. fullWidth
  333. size="small"
  334. {...register("contactPerson",
  335. {
  336. value: currentApplicationDetailData.contactPerson,
  337. })}
  338. id='contactPerson'
  339. sx={{
  340. "& .MuiInputBase-input.Mui-disabled": {
  341. WebkitTextFillColor: "#000000",
  342. background: "#f8f8f8",
  343. },
  344. }}
  345. /> :
  346. <OutlinedInput
  347. fullWidth
  348. size="small"
  349. {...register("companyName",
  350. {
  351. value: companyName.enCompanyName,
  352. })}
  353. id='companyName'
  354. sx={{
  355. "& .MuiInputBase-input.Mui-disabled": {
  356. WebkitTextFillColor: "#000000",
  357. background: "#f8f8f8",
  358. },
  359. }}
  360. />
  361. }
  362. </FormControl>
  363. </Grid>
  364. </Grid>
  365. </Grid>
  366. <Grid item xs={12} sm={12} md={9} lg={5} sx={{ mb: 1, ml: { lg: 1 } }}>
  367. <Grid container alignItems={"center"}>
  368. <Grid item xs={12} md={3} lg={3}
  369. sx={{ display: 'flex', alignItems: 'center' }}>
  370. <FormLabel><Typography variant="pnspsFormParagraph">
  371. <FormattedMessage id="gazetteCount" />:
  372. </Typography></FormLabel>
  373. </Grid>
  374. <Grid item xs={12} md={9} lg={9}>
  375. <Stack direction="row">
  376. <FormControl variant="outlined" fullWidth disabled>
  377. <OutlinedInput
  378. size="small"
  379. {...register("issueNum",
  380. {
  381. value: issueNum,
  382. })}
  383. id='issueNum'
  384. sx={{
  385. "& .MuiInputBase-input.Mui-disabled": {
  386. WebkitTextFillColor: "#000000",
  387. background: "#f8f8f8",
  388. },
  389. }}
  390. />
  391. </FormControl>
  392. </Stack>
  393. </Grid>
  394. </Grid>
  395. </Grid>
  396. </Grid>
  397. <Grid container direction="row" justifyContent="space-between"
  398. alignItems="center">
  399. <Grid item xs={12} sm={12} md={9} lg={6} sx={{ mb: 1 }}>
  400. <Grid container alignItems={"center"}>
  401. <Grid item xs={12} md={3} lg={3}
  402. sx={{ display: 'flex', alignItems: 'center' }}>
  403. <FormLabel><Typography variant="pnspsFormParagraph">
  404. <FormattedMessage id="contactPerson" />:
  405. </Typography></FormLabel>
  406. </Grid>
  407. <Grid item xs={12} md={9} lg={9}>
  408. <FormControl variant="outlined" fullWidth disabled>
  409. <OutlinedInput
  410. fullWidth
  411. size="small"
  412. {...register("contactPerson",
  413. {
  414. value: currentApplicationDetailData.contactPerson,
  415. })}
  416. id='contactPerson'
  417. sx={{
  418. "& .MuiInputBase-input.Mui-disabled": {
  419. WebkitTextFillColor: "#000000",
  420. background: "#f8f8f8",
  421. },
  422. }}
  423. />
  424. </FormControl>
  425. </Grid>
  426. </Grid>
  427. </Grid>
  428. <Grid item xs={12} sm={12} md={9} lg={5} sx={{ mb: 1, ml: { lg: 1 } }}>
  429. <Grid container alignItems={"center"}>
  430. <Grid item xs={12} md={3} lg={3}
  431. sx={{ display: 'flex', alignItems: 'center' }}>
  432. <FormLabel><Typography variant="pnspsFormParagraph">
  433. <FormattedMessage id="publishDate" />:
  434. </Typography></FormLabel>
  435. </Grid>
  436. <Grid item xs={12} md={9} lg={9}>
  437. <Stack direction="row">
  438. <FormControl variant="outlined" fullWidth disabled>
  439. <OutlinedInput
  440. size="small"
  441. {...register("issueDate",
  442. {
  443. value: issueDate,
  444. })}
  445. id='issueDate'
  446. sx={{
  447. "& .MuiInputBase-input.Mui-disabled": {
  448. WebkitTextFillColor: "#000000",
  449. background: "#f8f8f8",
  450. },
  451. }}
  452. />
  453. </FormControl>
  454. </Stack>
  455. </Grid>
  456. </Grid>
  457. </Grid>
  458. </Grid>
  459. <Grid container direction="row" justifyContent="space-between"
  460. alignItems="center">
  461. <Grid item xs={12} sm={12} md={9} lg={6} sx={{ mb: 1, }}>
  462. <Grid container alignItems={"center"}>
  463. <Grid item xs={12} md={3} lg={3}
  464. sx={{ display: 'flex', alignItems: 'center' }}>
  465. <FormLabel><Typography variant="pnspsFormParagraph">
  466. <FormattedMessage id="userContactNumber" />:
  467. </Typography></FormLabel>
  468. </Grid>
  469. <Grid item xs={12} md={9} lg={9}>
  470. <Stack direction="row">
  471. <FormControl variant="outlined" sx={{ width: '25%' }} disabled>
  472. <OutlinedInput
  473. size="small"
  474. {...register("countryCode",
  475. {
  476. value: currentApplicationDetailData.contactTelNo.countryCode,
  477. })}
  478. id='countryCode'
  479. sx={{
  480. "& .MuiInputBase-input.Mui-disabled": {
  481. WebkitTextFillColor: "#000000",
  482. background: "#f8f8f8",
  483. },
  484. }}
  485. />
  486. </FormControl>
  487. <FormControl variant="outlined" sx={{ width: '100%' }} disabled>
  488. <OutlinedInput
  489. size="small"
  490. {...register("phoneNumber",
  491. {
  492. value: currentApplicationDetailData.contactTelNo.phoneNumber,
  493. })}
  494. id='phoneNumber'
  495. sx={{
  496. "& .MuiInputBase-input.Mui-disabled": {
  497. WebkitTextFillColor: "#000000",
  498. background: "#f8f8f8",
  499. },
  500. }}
  501. />
  502. </FormControl>
  503. </Stack>
  504. </Grid>
  505. </Grid>
  506. </Grid>
  507. {
  508. fee > 0 ?
  509. <Grid item xs={12} sm={12} md={9} lg={5} sx={{ mb: 1, }}>
  510. <Grid container alignItems={"center"}>
  511. <Grid item xs={12} md={3} lg={3}
  512. sx={{ display: 'flex', alignItems: 'center' }}>
  513. <FormLabel>
  514. <Typography variant="pnspsFormParagraph">
  515. <FormattedMessage id="currencyAmountTitle" />
  516. </Typography>
  517. </FormLabel>
  518. </Grid>
  519. <Grid item xs={12} md={9} lg={9}>
  520. <FormControl variant="outlined" fullWidth disabled>
  521. <OutlinedInput
  522. size="small"
  523. value={FormatUtils.currencyFormat(fee)}
  524. sx={{
  525. "& .MuiInputBase-input.Mui-disabled": {
  526. WebkitTextFillColor: "#000000",
  527. background: "#f8f8f8",
  528. },
  529. }}
  530. />
  531. </FormControl>
  532. </Grid>
  533. </Grid>
  534. </Grid>
  535. :
  536. <></>
  537. }
  538. </Grid>
  539. <Grid container direction="row" justifyContent="space-between"
  540. alignItems="center">
  541. <Grid item xs={12} sm={12} md={9} lg={6} sx={{ mb: 1, }}>
  542. <Grid container alignItems={"center"}>
  543. <Grid item xs={12} md={3} lg={3}
  544. sx={{ display: 'flex', alignItems: 'center' }}>
  545. <FormLabel><Typography variant="pnspsFormParagraph">
  546. <FormattedMessage id="userFaxNumber" />:
  547. </Typography></FormLabel>
  548. </Grid>
  549. <Grid item xs={12} sm={12} md={9} lg={9}>
  550. <Stack direction="row">
  551. <FormControl variant="outlined" sx={{ width: '25%' }} disabled>
  552. <OutlinedInput
  553. size="small"
  554. {...register("countryCode",
  555. {
  556. value: currentApplicationDetailData.contactFaxNo.countryCode,
  557. })}
  558. id='countryCode'
  559. sx={{
  560. "& .MuiInputBase-input.Mui-disabled": {
  561. WebkitTextFillColor: "#000000",
  562. background: "#f8f8f8",
  563. },
  564. }}
  565. />
  566. </FormControl>
  567. <FormControl variant="outlined" sx={{ width: '100%' }} disabled>
  568. <OutlinedInput
  569. size="small"
  570. {...register("faxNumber",
  571. {
  572. value: currentApplicationDetailData.contactFaxNo.faxNumber,
  573. })}
  574. id='faxNumber'
  575. sx={{
  576. "& .MuiInputBase-input.Mui-disabled": {
  577. WebkitTextFillColor: "#000000",
  578. background: "#f8f8f8",
  579. },
  580. }}
  581. />
  582. </FormControl>
  583. </Stack>
  584. </Grid>
  585. </Grid>
  586. </Grid>
  587. {
  588. fee > 0 ?
  589. <Grid item xs={12} sm={12} md={9} lg={5} sx={{ mb: 1, }}>
  590. <Grid container alignItems={"center"}>
  591. <Grid item xs={12} md={3} lg={3}
  592. sx={{ display: 'flex', alignItems: 'center' }}>
  593. <FormLabel><Typography variant="pnspsFormParagraph">
  594. <FormattedMessage id="paymentMethod" />:
  595. </Typography></FormLabel>
  596. </Grid>
  597. <Grid item xs={12} md={9} lg={9}>
  598. <FormControl variant="outlined" fullWidth disabled>
  599. <OutlinedInput
  600. size="small"
  601. value={currentApplicationDetailData.paymentMethod!=null?intl.formatMessage({ id: utils.getPaymentMethod(currentApplicationDetailData.paymentMethod)}):""}
  602. id='paymentMethod'
  603. sx={{
  604. "& .MuiInputBase-input.Mui-disabled": {
  605. WebkitTextFillColor: "#000000",
  606. background: "#f8f8f8",
  607. },
  608. }}
  609. />
  610. </FormControl>
  611. </Grid>
  612. </Grid>
  613. </Grid>
  614. :
  615. <></>
  616. }
  617. </Grid>
  618. <Grid container direction="row" justifyContent="space-between"
  619. alignItems="center">
  620. <Grid item xs={12} sm={12} md={11} lg={11} mt={1}>
  621. <Grid container alignItems={"center"}>
  622. <Grid item xs={12} sm={12} md={12} lg={12}>
  623. <Grid container direction="row">
  624. <Grid item xs={12} sm={12} md={2.5} lg={1.6}
  625. sx={{ display: 'flex', alignItems: 'center' }}>
  626. <FormLabel><Typography variant="pnspsFormParagraph">
  627. <FormattedMessage id="draftFile" />:
  628. </Typography></FormLabel>
  629. </Grid>
  630. <Grid item xs={12} sm={12} md={9} lg={9} >
  631. <Grid container direction="row" alignItems="center" justifyContent="flex-start">
  632. <Grid item xs={12} sm={12} md={12} lg={12} sx={{ wordBreak: 'break-word', }}>
  633. <Typography
  634. id='fileName'
  635. variant="pnspsFormParagraph"
  636. sx={{ width: '100%' }}
  637. >
  638. {fileDetail?.filename}
  639. </Typography>
  640. <ThemeProvider theme={PNSPS_BUTTON_THEME}>
  641. <Button
  642. sx={{
  643. ml: 3,
  644. backgroundColor: '#0c489e',
  645. color: '#FFFFFF',
  646. '&:hover': { backgroundColor: '#1565c0' },
  647. }}
  648. variant="contained"
  649. onClick={onDownloadClick()}
  650. aria-label={intl.formatMessage({ id: 'download' })}
  651. title={intl.formatMessage({ id: 'download' })}
  652. disabled={!fileDetail?.filename||onDownload}
  653. startIcon={<DownloadIcon sx={{ alignItems: "center" }} />}
  654. >
  655. <FormattedMessage id="download" />
  656. </Button>
  657. </ThemeProvider>
  658. </Grid>
  659. </Grid>
  660. </Grid>
  661. </Grid>
  662. </Grid>
  663. </Grid>
  664. </Grid>
  665. </Grid>
  666. {isORGLoggedIn() ?
  667. <Grid item xs={12} md={9} lg={6} sx={{ mb: 1, paddingTop: 2 }}>
  668. <Grid container alignItems={"center"}>
  669. <Grid item xs={12} md={3} lg={3}
  670. sx={{ display: 'flex', alignItems: 'center' }}>
  671. <FormLabel><Typography variant="pnspsFormParagraph"><FormattedMessage id="careOf" />:</Typography></FormLabel>
  672. </Grid>
  673. <Grid item xs={12} md={9} lg={9}>
  674. <FormControl variant="outlined" sx={{ width: '100%' }} disabled>
  675. <OutlinedInput
  676. size="small"
  677. id="careOf"
  678. value={currentApplicationDetailData.careOf}
  679. inputProps={{ 'aria-label': intl.formatMessage({ id: 'careOf' }) }}
  680. sx={{
  681. "& .MuiInputBase-input.Mui-disabled": {
  682. WebkitTextFillColor: "#000000",
  683. background: "#f8f8f8",
  684. },
  685. }}
  686. />
  687. </FormControl>
  688. </Grid>
  689. </Grid>
  690. </Grid> : null
  691. }
  692. <Grid item xs={12} md={9} lg={6} sx={{ mb: 1, paddingTop: 2 }}>
  693. <Grid container alignItems={"center"}>
  694. <Grid item xs={12} md={3} lg={3}
  695. sx={{ display: 'flex', alignItems: 'center' }}>
  696. <FormLabel><Typography variant="pnspsFormParagraph">
  697. <FormattedMessage id="extraMark" />:
  698. </Typography></FormLabel>
  699. </Grid>
  700. <Grid item xs={12} md={9} lg={9}>
  701. <FormControl variant="outlined" sx={{ width: '100%' }} disabled>
  702. <OutlinedInput
  703. size="small"
  704. value={currentApplicationDetailData.remarks}
  705. sx={{
  706. "& .MuiInputBase-input.Mui-disabled": {
  707. WebkitTextFillColor: "#000000",
  708. background: "#f8f8f8",
  709. },
  710. }}
  711. />
  712. </FormControl>
  713. </Grid>
  714. </Grid>
  715. </Grid>
  716. </Grid>
  717. </Grid>
  718. <div>
  719. <Dialog
  720. open={isPopUp}
  721. onClose={() => setIsPopUp(false)}
  722. PaperProps={{
  723. sx: {
  724. minWidth: '40vw',
  725. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '30vw' },
  726. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '50vh' }
  727. }
  728. }}
  729. >
  730. <DialogTitle>
  731. <Typography variant="h3" component="span">
  732. <FormattedMessage id="payConfirm" />
  733. </Typography>
  734. </DialogTitle>
  735. <DialogContent style={{ display: 'flex', }}>
  736. <Stack direction="column" justifyContent="space-between">
  737. <Typography variant="h4" component="span">
  738. <FormattedMessage id="totalAmount" /> ($): {FormatUtils.currencyFormat(fee)}
  739. </Typography>
  740. </Stack>
  741. </DialogContent>
  742. <DialogActions>
  743. <Button
  744. variant="contained"
  745. onClick={() => setIsPopUp(false)}
  746. aria-label={intl.formatMessage({ id: 'close' })}
  747. sx={PRIMARY_CONTAINED_BUTTON_SX}
  748. >
  749. <Typography variant="pnspsFormParagraph" sx={{ color: 'inherit' }}>
  750. <FormattedMessage id="close" />
  751. </Typography></Button>
  752. <Button
  753. variant="contained"
  754. onClick={() => doPayment()}
  755. aria-label={intl.formatMessage({ id: 'confirm' })}
  756. sx={PRIMARY_CONTAINED_BUTTON_SX}
  757. >
  758. <Typography variant="pnspsFormParagraph" sx={{ color: 'inherit' }}>
  759. <FormattedMessage id="confirm" />
  760. </Typography></Button>
  761. </DialogActions>
  762. </Dialog>
  763. </div>
  764. <div>
  765. <Dialog
  766. open={errorPopUp}
  767. onClose={() => setErrorPopUp(false)}
  768. PaperProps={{
  769. sx: {
  770. minWidth: '40vw',
  771. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
  772. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
  773. }
  774. }}
  775. >
  776. <DialogTitle></DialogTitle>
  777. <Typography variant="h2" component="span" style={{ padding: '16px' }}><FormattedMessage id="MSG.actionFail" /></Typography>
  778. <DialogContent style={{ display: 'flex', }}>
  779. <Stack direction="column" justifyContent="space-between">
  780. {
  781. errorText
  782. }
  783. </Stack>
  784. </DialogContent>
  785. <DialogActions>
  786. <Button
  787. onClick={() => setErrorPopUp(false)}
  788. aria-label={intl.formatMessage({ id: 'close' })}
  789. >
  790. <Typography variant="pnspsFormParagraph">
  791. <FormattedMessage id="close" />
  792. </Typography></Button>
  793. </DialogActions>
  794. </Dialog>
  795. </div>
  796. <div>
  797. <Dialog
  798. open={paymentHoldedErr}
  799. onClose={() => setPaymentHoldedErr(false)}
  800. PaperProps={{
  801. sx: {
  802. minWidth: '40vw',
  803. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
  804. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
  805. }
  806. }}
  807. >
  808. <DialogTitle></DialogTitle>
  809. <Typography variant="h4" component="span" style={{ paddingLeft: '24px' }}><FormattedMessage id="MSG.actionFail" /></Typography>
  810. <DialogContent style={{ display: 'flex', }}>
  811. <Stack direction="column" justifyContent="space-between">
  812. <SafeHtml html={intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: paymentHoldedErrText })} />
  813. </Stack>
  814. </DialogContent>
  815. <DialogActions>
  816. <Button onClick={() => setPaymentHoldedErr(false)} aria-label={intl.formatMessage({ id: 'close' })}>
  817. <Typography variant="h5" component="span">
  818. <FormattedMessage id="close" />
  819. </Typography></Button>
  820. </DialogActions>
  821. </Dialog>
  822. </div>
  823. </form>
  824. </MainCard >
  825. );
  826. };
  827. export default ApplicationDetailCard;