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

951 lines
56 KiB

  1. // material-ui
  2. import {
  3. FormControl,
  4. Button,
  5. Grid,
  6. Typography, FormLabel,
  7. TextField,
  8. OutlinedInput,
  9. Stack,
  10. Dialog, DialogTitle, DialogContent, DialogActions, InputAdornment, Autocomplete
  11. } from '@mui/material';
  12. import { isGranted, delBugMode, getPaymentMethod} from "auth/utils";
  13. const MainCard = Loadable(lazy(() => import('components/MainCard')));
  14. import { useForm } from "react-hook-form";
  15. import {
  16. useEffect,
  17. useState,
  18. lazy
  19. } from "react";
  20. import Loadable from 'components/Loadable';
  21. import * as ComboData from "utils/ComboData";
  22. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  23. import * as HttpUtils from "utils/HttpUtils"
  24. import * as DateUtils from "utils/DateUtils"
  25. import { CHECK_CREATE_PROOF, UPDATE_GLDREMARKS, APPLICATION_UPDATE_PAYMENT_MEANS} from "utils/ApiPathConst"
  26. import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils";
  27. import DoneIcon from '@mui/icons-material/Done';
  28. import CloseIcon from '@mui/icons-material/Close';
  29. import EditNoteIcon from '@mui/icons-material/EditNote';
  30. import DownloadIcon from '@mui/icons-material/Download';
  31. import ReplayIcon from '@mui/icons-material/Replay';
  32. import { notifyDownloadSuccess } from 'utils/CommonFunction';
  33. import { isGrantedAny } from "auth/utils";
  34. import { useIntl } from "react-intl";
  35. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  36. const ApplicationDetailCard = (
  37. { applicationDetailData,
  38. setStatus,
  39. setUploadStatus
  40. }
  41. ) => {
  42. const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({});
  43. const [companyName, setCompanyName] = useState({});
  44. const [orgDetail, setOrgDetail] = useState({});
  45. const [verified, setVerified] = useState(null);
  46. const [fileDetail, setfileDetail] = useState({});
  47. const [proofId, setProofId] = useState(null);
  48. const [onReady, setOnReady] = useState(false);
  49. const [showPaymentMeans, setShowPaymentMeans] = useState(false);
  50. const [paymentMeans, setPaymentMeans] = useState(ComboData.paymentMeans[0]);
  51. const [oldPaymentMeans, setOldPaymentMeans] = useState("");
  52. const [isPaymentMeansPopUp, setIsPaymentMeansPopUp] = useState(false);
  53. const { register, handleSubmit } = useForm()
  54. const intl = useIntl();
  55. const [isWarningPopUp, setIsWarningPopUp] = useState(false);
  56. const [warningText, setWarningText] = useState("");
  57. const [remarksPopUp, setRemarksPopUp] = useState(false);
  58. const [onDownload, setOnDownload] = useState(false);
  59. useEffect(() => {
  60. //if user data from parent are not null
  61. // console.log(applicationDetailData)
  62. if (Object.keys(applicationDetailData).length > 0) {
  63. loadApplicationDetail()
  64. }
  65. }, [applicationDetailData]);
  66. useEffect(() => {
  67. //if state data are ready and assign to different field
  68. // console.log(currentApplicationDetailData)
  69. if (Object.keys(currentApplicationDetailData).length > 0) {
  70. setOnReady(true);
  71. }
  72. }, [currentApplicationDetailData]);
  73. const loadApplicationDetail = () => {
  74. setCurrentApplicationDetailData(applicationDetailData.data);
  75. setOrgDetail(applicationDetailData.orgDetail?.data);
  76. setCompanyName(applicationDetailData.companyName);
  77. setVerified(applicationDetailData.userData.verifiedBy ? true : false)
  78. setfileDetail(applicationDetailData.fileDetail);
  79. setProofId(applicationDetailData.proofId);
  80. if (applicationDetailData.data.status == 'submitted'||applicationDetailData.data.status == 'reviewed'||applicationDetailData.data.status == 'confirmed'){
  81. setShowPaymentMeans(true)
  82. if (applicationDetailData.data.paymentMethod!=null){
  83. setOldPaymentMeans(applicationDetailData.data.paymentMethod)
  84. }
  85. }
  86. // setReload(false)
  87. }
  88. const doPaymentMeans = () => {
  89. setIsPaymentMeansPopUp(false);
  90. console.log(oldPaymentMeans)
  91. console.log(paymentMeans.type)
  92. if(paymentMeans?.type!=oldPaymentMeans){
  93. HttpUtils.post({
  94. url: APPLICATION_UPDATE_PAYMENT_MEANS + "/" + currentApplicationDetailData.id,
  95. params: {
  96. paymentMeans: paymentMeans.type
  97. },
  98. onSuccess: function () {
  99. location.reload();
  100. }
  101. });
  102. }
  103. }
  104. const onDownloadClick = () => () => {
  105. setOnDownload(true)
  106. HttpUtils.fileDownload({
  107. fileId: fileDetail?.id,
  108. skey: fileDetail?.skey,
  109. filename: fileDetail?.filename,
  110. onResponse:()=>{
  111. setOnDownload(false)
  112. notifyDownloadSuccess()
  113. },
  114. onError:()=>{
  115. setOnDownload(false)
  116. }
  117. });
  118. setUploadStatus(true)
  119. };
  120. const reSubmitClick = () => () => {
  121. setStatus("resubmit")
  122. };
  123. const notAcceptedClick = () => () => {
  124. setStatus("notAccepted")
  125. };
  126. const paidClick = () => () => {
  127. setStatus("paid")
  128. };
  129. const setCompleteDisable = () => {
  130. if (delBugMode) return false;
  131. return (new Date()).getTime() < DateUtils.convertToDate(applicationDetailData.gazetteIssueDetail.issueDate).getTime();
  132. }
  133. const complatedClick = () => () => {
  134. let issueDate = DateUtils.convertToDate(applicationDetailData.gazetteIssueDetail.issueDate);
  135. let current = new Date();
  136. if (delBugMode) {
  137. setStatus("complete")
  138. } else if (current.getTime() >= issueDate.getTime()) {
  139. setStatus("complete")
  140. }
  141. };
  142. const withdrawnClick = () => () => {
  143. setStatus("withdraw")
  144. };
  145. const doPublish = () => () => {
  146. setStatus("publish")
  147. }
  148. const revokeClick = () => () => {
  149. setStatus("revoke")
  150. };
  151. const onProofClick = () => {
  152. if (applicationDetailData.data.groupNo) {
  153. HttpUtils.get({
  154. url: CHECK_CREATE_PROOF + "/" + currentApplicationDetailData.id,
  155. onSuccess: function (responeData) {
  156. if (responeData.success == true) {
  157. window.open("/proof/create/" + currentApplicationDetailData.id, "_blank", "noreferrer");
  158. window.addEventListener("focus", onFocus)
  159. } else {
  160. let msg = responeData.msg;
  161. if (msg === "haveActiveProof") {
  162. msg = "Action Failed: There is already a pending payment and proofreading record for client review."
  163. } else if (msg === "haveProofed") {
  164. msg = "Action Failed: Already proofed."
  165. }
  166. setWarningText(msg);
  167. setIsWarningPopUp(true);
  168. }
  169. }
  170. });
  171. } else {
  172. setWarningText("Please generate Gazette Code before Create Proof.");
  173. setIsWarningPopUp(true);
  174. }
  175. }
  176. const onFocus = () => {
  177. location.reload();
  178. window.removeEventListener("focus", onFocus)
  179. }
  180. const onSubmit = (data) => {
  181. // console.log(data)
  182. const gldRemarks = data.makeRemarks
  183. if (gldRemarks != null && gldRemarks != currentApplicationDetailData.gldRemarks) {
  184. HttpUtils.post({
  185. url: UPDATE_GLDREMARKS + "/" + currentApplicationDetailData.id,
  186. params: {
  187. gldRemarks: gldRemarks
  188. },
  189. onSuccess: function () {
  190. location.reload();
  191. },
  192. onError: (error) => {
  193. alert(error)
  194. }
  195. });
  196. } else {
  197. setRemarksPopUp(false)
  198. }
  199. };
  200. return (
  201. !onReady ?
  202. <LoadingComponent />
  203. :
  204. <MainCard elevation={0}
  205. border={false}
  206. content={false}
  207. >
  208. {verified && currentApplicationDetailData.status !== "notAccepted" ?
  209. isGrantedAny("MAINTAIN_APPLICATION") ?
  210. <Grid container spacing={4} direction="row">
  211. <Grid item xs={12} md={4} >
  212. <Stack
  213. direction="row"
  214. justifyContent="flex-start"
  215. alignItems="center"
  216. spacing={2}
  217. mb={2}
  218. >
  219. {currentApplicationDetailData.status === "reviewed" && isGranted("MAINTAIN_PROOF") ?
  220. <Button
  221. // size="large"
  222. variant="contained"
  223. onClick={() => { onProofClick() }}
  224. sx={{
  225. textTransform: 'capitalize',
  226. alignItems: 'end'
  227. }}>
  228. <EditNoteIcon />
  229. <Typography ml={1} variant="h5"> Create Proof</Typography>
  230. </Button> :
  231. null
  232. }
  233. </Stack>
  234. </Grid>
  235. <Grid item xs={12} md={8} >
  236. <Stack
  237. direction="row"
  238. justifyContent="flex-start"
  239. alignItems="center"
  240. spacing={2}
  241. mb={2}
  242. >
  243. {
  244. !(orgDetail?.creditor) && currentApplicationDetailData.creditor && currentApplicationDetailData.status === "published" ?
  245. <>
  246. <Button
  247. variant="contained"
  248. onClick={paidClick()}
  249. sx={{
  250. textTransform: 'capitalize',
  251. alignItems: 'end',
  252. }}>
  253. <DoneIcon />
  254. <Typography ml={1} variant="h5">Paid</Typography>
  255. </Button>
  256. </>
  257. :
  258. <></>
  259. }
  260. {currentApplicationDetailData.status === "submitted" || currentApplicationDetailData.status == "reviewed" ?
  261. <>
  262. <Button
  263. // size="large"
  264. variant="contained"
  265. onClick={reSubmitClick()}
  266. color="orange"
  267. >
  268. <ReplayIcon />
  269. <Typography ml={1} variant="h5"> Re-Submit</Typography>
  270. </Button>
  271. {
  272. proofId == null || proofId == 0?
  273. <Button
  274. // size="large"
  275. variant="contained"
  276. onClick={notAcceptedClick()}
  277. color="error"
  278. sx={{
  279. textTransform: 'capitalize',
  280. alignItems: 'end',
  281. }}>
  282. <CloseIcon />
  283. <Typography ml={1} variant="h5">Not Accept</Typography>
  284. </Button>
  285. :
  286. null
  287. }
  288. </> :
  289. (currentApplicationDetailData.status == "confirmed" && currentApplicationDetailData.creditor == 1) ?
  290. <>
  291. <Button
  292. // size="large"
  293. variant="contained"
  294. onClick={doPublish()}
  295. disabled={setCompleteDisable()}
  296. sx={{
  297. textTransform: 'capitalize',
  298. alignItems: 'end',
  299. backgroundColor: '#52b202'
  300. }}>
  301. <DoneIcon />
  302. <Typography ml={1} variant="h5">Publish</Typography>
  303. </Button>
  304. <Button
  305. // size="large"
  306. variant="contained"
  307. onClick={withdrawnClick()}
  308. sx={{
  309. textTransform: 'capitalize',
  310. alignItems: 'end',
  311. backgroundColor: '#ffa733'
  312. }}>
  313. <CloseIcon />
  314. <Typography ml={1} variant="h5">Withdraw</Typography>
  315. </Button>
  316. </>
  317. :
  318. (currentApplicationDetailData.status == "confirmed" && currentApplicationDetailData.creditor == 0) ?
  319. <>
  320. <Button
  321. // size="large"
  322. variant="contained"
  323. onClick={withdrawnClick()}
  324. sx={{
  325. textTransform: 'capitalize',
  326. alignItems: 'end',
  327. backgroundColor: '#ffa733'
  328. }}>
  329. <CloseIcon />
  330. <Typography ml={1} variant="h5">Withdraw</Typography>
  331. </Button>
  332. </>
  333. :
  334. (
  335. (currentApplicationDetailData.status == "paid" && currentApplicationDetailData.creditor == 0) ?
  336. <>
  337. <Button
  338. // size="large"
  339. variant="contained"
  340. onClick={revokeClick()}
  341. disabled={currentApplicationDetailData.paymentMethod == "online" || currentApplicationDetailData.paymentMethod == null}
  342. sx={{
  343. textTransform: 'capitalize',
  344. alignItems: 'end',
  345. backgroundColor: '#ffa733'
  346. }}>
  347. <ReplayIcon />
  348. <Typography ml={1} variant="h5">Revoke Payment</Typography>
  349. </Button>
  350. <Button
  351. // size="large"
  352. variant="contained"
  353. onClick={complatedClick()}
  354. disabled={setCompleteDisable()}
  355. sx={{
  356. textTransform: 'capitalize',
  357. alignItems: 'end',
  358. backgroundColor: '#52b202'
  359. }}>
  360. <DoneIcon />
  361. <Typography ml={1} variant="h5">Publish</Typography>
  362. </Button>
  363. <Button
  364. // size="large"
  365. variant="contained"
  366. onClick={withdrawnClick()}
  367. sx={{
  368. textTransform: 'capitalize',
  369. alignItems: 'end',
  370. backgroundColor: '#ffa733'
  371. }}>
  372. <CloseIcon />
  373. <Typography ml={1} variant="h5">Withdraw</Typography>
  374. </Button>
  375. </> : null
  376. )
  377. }
  378. </Stack>
  379. </Grid>
  380. </Grid>
  381. : null
  382. : null
  383. }
  384. <Typography variant="h4" xs={12} md={12} sx={{ mb: 2, borderBottom: "1px solid black" }}>
  385. Application Details
  386. </Typography>
  387. <form>
  388. <Grid container direction="column">
  389. <Grid item xs={12} md={12}>
  390. <Grid container direction="row" justifyContent="flex-start"
  391. alignItems="center">
  392. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  393. <Grid container alignItems={"center"}>
  394. <Grid item xs={12} md={4} lg={4}
  395. sx={{ display: 'flex', alignItems: 'center' }}>
  396. <FormLabel><Typography variant="h5">Application No:</Typography></FormLabel>
  397. </Grid>
  398. <Grid item xs={12} md={8} lg={8}>
  399. <FormControl variant="outlined" fullWidth disabled >
  400. <OutlinedInput
  401. fullWidth
  402. size="small"
  403. {...register("appNo",
  404. {
  405. value: currentApplicationDetailData.appNo,
  406. })}
  407. id='appNo'
  408. sx={{
  409. "& .MuiInputBase-input.Mui-disabled": {
  410. WebkitTextFillColor: "#000000",
  411. background: "#f8f8f8",
  412. },
  413. }}
  414. />
  415. </FormControl>
  416. </Grid>
  417. </Grid>
  418. </Grid>
  419. <Grid item xs={12} sm={12} md={5.5} lg={5} sx={{ mb: 1, ml: { md: 1, lg: 3 } }}>
  420. <Grid container alignItems={"center"}>
  421. <Grid item xs={12} md={4} lg={4}
  422. sx={{ display: 'flex', alignItems: 'center' }}>
  423. <FormLabel><Typography variant="h5">Status:</Typography></FormLabel>
  424. </Grid>
  425. <Grid item xs={12} md={8} lg={8}>
  426. <FormControl variant="outlined">
  427. {StatusUtils.getStatusByTextEng(currentApplicationDetailData.status, currentApplicationDetailData.creditor)}
  428. </FormControl>
  429. </Grid>
  430. </Grid>
  431. {
  432. currentApplicationDetailData.reason ?
  433. <Grid item xs={12} md={12} lg={12}>
  434. <Grid container alignItems={"center"} direction="row" >
  435. <Grid item xs={12} md={4} lg={4}>
  436. <FormLabel><Typography variant="h5">Reason:</Typography></FormLabel>
  437. </Grid>
  438. <Grid item xs={12} md={8} lg={8}>
  439. <FormLabel>
  440. <Typography id='reason' variant="pnspsFormParagraph">
  441. {currentApplicationDetailData.reason}
  442. </Typography>
  443. </FormLabel>
  444. </Grid>
  445. </Grid>
  446. </Grid>
  447. : ""
  448. }
  449. </Grid>
  450. </Grid>
  451. <Grid container direction="row" justifyContent="flex-start"
  452. alignItems="center">
  453. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  454. <Grid container alignItems={"center"}>
  455. <Grid item xs={12} md={4} lg={4}
  456. sx={{ display: 'flex', alignItems: 'center' }}>
  457. <FormLabel><Typography variant="h5">Applicant:</Typography></FormLabel>
  458. </Grid>
  459. <Grid item xs={12} md={8} lg={8}>
  460. <FormControl variant="outlined" fullWidth disabled >
  461. {currentApplicationDetailData.orgId === null ?
  462. <OutlinedInput
  463. fullWidth
  464. size="small"
  465. {...register("contactPerson",
  466. {
  467. value: currentApplicationDetailData.contactPerson,
  468. })}
  469. id='contactPerson'
  470. sx={{
  471. "& .MuiInputBase-input.Mui-disabled": {
  472. WebkitTextFillColor: "#000000",
  473. background: "#f8f8f8",
  474. },
  475. }}
  476. /> :
  477. companyName.enCompanyName=="GLD"?
  478. <OutlinedInput
  479. fullWidth
  480. size="small"
  481. {...register("custName",
  482. {
  483. value: "GLD: "+currentApplicationDetailData.custName,
  484. })}
  485. id='custName'
  486. sx={{
  487. "& .MuiInputBase-input.Mui-disabled": {
  488. WebkitTextFillColor: "#000000",
  489. background: "#f8f8f8",
  490. },
  491. }}
  492. />:
  493. <OutlinedInput
  494. fullWidth
  495. size="small"
  496. {...register("companyName",
  497. {
  498. value: companyName.enCompanyName,
  499. })}
  500. id='companyName'
  501. sx={{
  502. "& .MuiInputBase-input.Mui-disabled": {
  503. WebkitTextFillColor: "#000000",
  504. background: "#f8f8f8",
  505. },
  506. }}
  507. />
  508. }
  509. </FormControl>
  510. </Grid>
  511. </Grid>
  512. </Grid>
  513. <Grid item xs={12} md={5.5} lg={5.5} sx={{ mb: 1, ml: { md: 1, lg: 3 } }}>
  514. <Grid container alignItems={"center"}>
  515. <Grid item xs={12} md={4} lg={4}
  516. sx={{ display: 'flex', alignItems: 'center' }}>
  517. <FormLabel><Typography variant="h5">Contact Phone:</Typography></FormLabel>
  518. </Grid>
  519. <Grid item xs={12} md={8} lg={8}>
  520. <Stack direction="row">
  521. <FormControl variant="outlined" sx={{ width: '25%', minWidth: 100, }} disabled >
  522. <OutlinedInput
  523. size="small"
  524. {...register("contactTelNo.countryCode",
  525. {
  526. value: currentApplicationDetailData.contactTelNo.countryCode,
  527. })}
  528. id='countryCode'
  529. sx={{
  530. "& .MuiInputBase-input.Mui-disabled": {
  531. WebkitTextFillColor: "#000000",
  532. background: "#f8f8f8",
  533. },
  534. mr: 1
  535. }}
  536. inputProps={{
  537. maxLength: 3,
  538. }}
  539. endAdornment={<InputAdornment position="end">-</InputAdornment>}
  540. />
  541. </FormControl>
  542. <FormControl variant="outlined" sx={{ width: '75%' }} disabled >
  543. <OutlinedInput
  544. size="small"
  545. type="tel"
  546. {...register("contactTelNo.phoneNumber",
  547. {
  548. value: currentApplicationDetailData.contactTelNo.phoneNumber,
  549. })}
  550. id='phoneNumber'
  551. sx={{
  552. "& .MuiInputBase-input.Mui-disabled": {
  553. WebkitTextFillColor: "#000000",
  554. background: "#f8f8f8",
  555. },
  556. }}
  557. inputProps={{
  558. maxLength: 11,
  559. }}
  560. />
  561. </FormControl>
  562. </Stack>
  563. </Grid>
  564. </Grid>
  565. </Grid>
  566. </Grid>
  567. <Grid container direction="row" justifyContent="flex-start"
  568. alignItems="center">
  569. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  570. <Grid container alignItems={"center"}>
  571. <Grid item xs={12} md={4} lg={4}
  572. sx={{ display: 'flex', alignItems: 'center' }}>
  573. <FormLabel><Typography variant="h5">Contact Person:</Typography></FormLabel>
  574. </Grid>
  575. <Grid item xs={12} md={8} lg={8}>
  576. <FormControl variant="outlined" fullWidth disabled>
  577. <OutlinedInput
  578. fullWidth
  579. size="small"
  580. {...register("contactPerson",
  581. {
  582. value: currentApplicationDetailData.contactPerson,
  583. })}
  584. id='contactPerson'
  585. sx={{
  586. "& .MuiInputBase-input.Mui-disabled": {
  587. WebkitTextFillColor: "#000000",
  588. background: "#f8f8f8",
  589. },
  590. }}
  591. />
  592. </FormControl>
  593. </Grid>
  594. </Grid>
  595. </Grid>
  596. <Grid item xs={12} md={5.5} lg={5.5} sx={{ mb: 1, ml: { md: 1, lg: 3 } }}>
  597. <Grid container alignItems={"center"}>
  598. <Grid item xs={12} md={4} lg={4}
  599. sx={{ display: 'flex', alignItems: 'center' }}>
  600. <FormLabel><Typography variant="h5">Contact Fax:</Typography></FormLabel>
  601. </Grid>
  602. <Grid item xs={12} md={8} lg={8}>
  603. <Stack direction="row">
  604. <FormControl variant="outlined" sx={{ width: '25%', minWidth: 100, }} disabled>
  605. <OutlinedInput
  606. size="small"
  607. {...register("contactFaxNo.countryCode",
  608. {
  609. value: currentApplicationDetailData.contactFaxNo.countryCode,
  610. })}
  611. id='countryCode'
  612. sx={{
  613. "& .MuiInputBase-input.Mui-disabled": {
  614. WebkitTextFillColor: "#000000",
  615. background: "#f8f8f8",
  616. },
  617. mr: 1,
  618. }}
  619. inputProps={{
  620. maxLength: 3,
  621. type: "tel"
  622. }}
  623. endAdornment={<InputAdornment position="end">-</InputAdornment>}
  624. />
  625. </FormControl>
  626. <FormControl variant="outlined" sx={{ width: '75%' }} disabled>
  627. <OutlinedInput
  628. size="small"
  629. type="tel"
  630. {...register("contactFaxNo.faxNumber",
  631. {
  632. value: currentApplicationDetailData.contactFaxNo.faxNumber,
  633. })}
  634. id='faxNumber'
  635. sx={{
  636. "& .MuiInputBase-input.Mui-disabled": {
  637. WebkitTextFillColor: "#000000",
  638. background: "#f8f8f8",
  639. },
  640. }}
  641. inputProps={{
  642. maxLength: 8,
  643. }}
  644. />
  645. </FormControl>
  646. </Stack>
  647. </Grid>
  648. </Grid>
  649. </Grid>
  650. </Grid>
  651. <Grid container direction="row" justifyContent="flex-start"
  652. alignItems="center">
  653. <Grid item xs={12} md={12} lg={12} mt={1} mb={2}>
  654. <Grid container alignItems={"center"}>
  655. <Grid item xs={12} md={12} lg={12}>
  656. <Grid container direction="row">
  657. <Grid item xs={12} md={2} lg={2}
  658. sx={{ display: 'flex', alignItems: 'center' }}>
  659. <FormLabel><Typography variant="h5" >Manuscript File:</Typography></FormLabel>
  660. </Grid>
  661. <Grid item xs={12} md={8} lg={8} sx={{ display: 'flex', alignItems: 'center' }}>
  662. <Grid container direction="row" justifyContent="flex-start">
  663. <Grid item xs={10} md={8} lg={8} sx={{ display: 'flex', alignItems: 'center' }}>
  664. <FormControl variant="outlined" fullWidth >
  665. <Typography
  666. // fullWidth
  667. id='fileName'
  668. variant="h5"
  669. sx={{ wordBreak: 'break-word' }}
  670. >
  671. {fileDetail?.filename}
  672. </Typography>
  673. </FormControl>
  674. </Grid>
  675. <Grid item md={2} lg={2}>
  676. <Button
  677. size="small"
  678. variant="contained"
  679. onClick={onDownloadClick()}
  680. disabled={!fileDetail?.filename||onDownload}
  681. sx={{
  682. textTransform: 'capitalize',
  683. alignItems: 'end',
  684. }}>
  685. <DownloadIcon />
  686. </Button>
  687. </Grid>
  688. </Grid>
  689. </Grid>
  690. </Grid>
  691. </Grid>
  692. </Grid>
  693. </Grid>
  694. </Grid>
  695. {showPaymentMeans?
  696. <Grid container direction="row" justifyContent="flex-start"
  697. alignItems="center">
  698. <Grid item xs={12} md={12} lg={12} mt={1} mb={2}>
  699. <Grid container alignItems={"center"}>
  700. <Grid item xs={12} md={12} lg={12}>
  701. <Grid container direction="row">
  702. <Grid item xs={12} md={2} lg={2}
  703. sx={{ display: 'flex', alignItems: 'center' }}>
  704. <FormLabel><Typography variant="h5" >Payment Means:</Typography></FormLabel>
  705. </Grid>
  706. <Grid item xs={12} md={8} lg={8} sx={{ display: 'flex', alignItems: 'center' }}>
  707. <Grid container direction="row" justifyContent="flex-start">
  708. <Grid item xs={10} md={5} lg={5} sx={{ display: 'flex', alignItems: 'center' }}>
  709. <FormControl variant="outlined" fullWidth >
  710. <Typography
  711. // fullWidth
  712. id='paymentMethod'
  713. variant="h5"
  714. >
  715. {currentApplicationDetailData.paymentMethod!=null?intl.formatMessage({ id: getPaymentMethod(currentApplicationDetailData.paymentMethod)}):""}
  716. </Typography>
  717. </FormControl>
  718. </Grid>
  719. <Grid item md={3} lg={3}>
  720. <Button
  721. size="small"
  722. variant="contained"
  723. onClick={() =>{setIsPaymentMeansPopUp(true)}}
  724. sx={{
  725. textTransform: 'capitalize',
  726. alignItems: 'end',
  727. }}>
  728. Change
  729. </Button>
  730. </Grid>
  731. </Grid>
  732. </Grid>
  733. </Grid>
  734. </Grid>
  735. </Grid>
  736. </Grid>
  737. </Grid>
  738. :null
  739. }
  740. <Grid container direction="row" justifyContent="space-start" alignItems="center">
  741. <Grid item xs={12} md={12} lg={12} sx={{ mb: 1, }}>
  742. <Grid container alignItems={"center"}>
  743. <Grid item xs={12} md={2} lg={2}
  744. sx={{ display: 'flex', alignItems: 'center' }}>
  745. <FormLabel><Typography variant="h5">Remarks:</Typography></FormLabel>
  746. </Grid>
  747. <Grid item xs={12} md={10} lg={10}>
  748. <Grid container direction="row" >
  749. <Grid item xs={12} md={9} lg={9} >
  750. <FormControl variant="outlined" fullWidth disabled >
  751. <OutlinedInput
  752. fullWidth
  753. size="small"
  754. {...register("gldRemarks",
  755. {
  756. value: currentApplicationDetailData.gldRemarks,
  757. })}
  758. id='appNo'
  759. sx={{
  760. "& .MuiInputBase-input.Mui-disabled": {
  761. WebkitTextFillColor: "#000000",
  762. background: "#f8f8f8",
  763. },
  764. }}
  765. />
  766. </FormControl>
  767. </Grid>
  768. {isGrantedAny(["MAINTAIN_APPLICATION","MAINTAIN_PAYMENT"]) ?
  769. <Grid item xs={12} ml={1} md={2} lg={2}>
  770. <Button
  771. // size="large"
  772. variant="contained"
  773. onClick={() => setRemarksPopUp(true)}
  774. sx={{
  775. textTransform: 'capitalize',
  776. alignItems: 'end',
  777. }}>
  778. <EditNoteIcon />
  779. <Typography ml={1} variant="h5"> Edit</Typography>
  780. </Button>
  781. </Grid>
  782. :null
  783. }
  784. </Grid>
  785. </Grid>
  786. </Grid>
  787. </Grid>
  788. </Grid>
  789. </Grid>
  790. </Grid>
  791. </form>
  792. <div>
  793. <Dialog
  794. open={isWarningPopUp}
  795. onClose={() => setIsWarningPopUp(false)}
  796. PaperProps={{
  797. sx: {
  798. minWidth: '40vw',
  799. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
  800. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
  801. }
  802. }}
  803. >
  804. <DialogTitle><Typography variant="h3">Warning</Typography></DialogTitle>
  805. <DialogContent style={{ display: 'flex', }}>
  806. <Typography variant="h4" style={{ padding: '16px' }}>{warningText}</Typography>
  807. </DialogContent>
  808. <DialogActions>
  809. <Button onClick={() => setIsWarningPopUp(false)}><Typography variant="h5">OK</Typography></Button>
  810. </DialogActions>
  811. </Dialog>
  812. </div>
  813. <div>
  814. <Dialog
  815. open={remarksPopUp}
  816. onClose={() => setRemarksPopUp(false)}
  817. PaperProps={{
  818. sx: {
  819. minWidth: '40vw',
  820. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
  821. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
  822. }
  823. }}
  824. >
  825. <form onSubmit={handleSubmit(onSubmit)}>
  826. <DialogTitle><Typography variant="h3">Remarks</Typography></DialogTitle>
  827. <DialogContent style={{ display: 'flex', }}>
  828. <Grid container direction="column">
  829. <Grid item sx={{ padding: '16px' }}>
  830. <TextField
  831. fullWidth
  832. {...register("makeRemarks")}
  833. id='makeRemarks'
  834. // label="Remarks"
  835. defaultValue={currentApplicationDetailData.gldRemarks != null ? currentApplicationDetailData.gldRemarks : ""}
  836. InputLabelProps={{
  837. shrink: true
  838. }}
  839. />
  840. </Grid>
  841. </Grid>
  842. </DialogContent>
  843. <DialogActions>
  844. <Stack direction="row" justifyContent="space-between">
  845. <Button onClick={() => setRemarksPopUp(false)}><Typography variant="h5">Cancel</Typography></Button>
  846. <Button type="submit"><Typography variant="h5">Save</Typography></Button>
  847. {/* <Button onClick={() => markAsCreditor()}><Typography variant="h5">Confirm</Typography></Button> */}
  848. </Stack>
  849. </DialogActions>
  850. </form>
  851. </Dialog>
  852. </div>
  853. <div>
  854. <Dialog
  855. open={isPaymentMeansPopUp}
  856. onClose={() => setIsPaymentMeansPopUp(false)}
  857. PaperProps={{
  858. sx: {
  859. minWidth: '40vw',
  860. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
  861. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
  862. }
  863. }}
  864. >
  865. <DialogTitle>Payment Means</DialogTitle>
  866. <DialogContent style={{ display: 'flex', }}>
  867. <Grid container direction="row">
  868. <Grid item xs={12} md={12}>
  869. <Autocomplete
  870. disablePortal={false}
  871. size="small"
  872. id="paymentMeans"
  873. filterOptions={(options) => options}
  874. options={ComboData.paymentMeans}
  875. value={paymentMeans}
  876. getOptionLabel={(option) => option.label}
  877. inputValue={paymentMeans?.label ? paymentMeans?.label : ""}
  878. onChange={(event, newValue) => {
  879. setPaymentMeans(newValue);
  880. }}
  881. renderInput={(params) => (
  882. <TextField {...params}
  883. label=""
  884. />
  885. )}
  886. InputLabelProps={{
  887. shrink: true,
  888. }}
  889. disableClearable={true}
  890. />
  891. </Grid>
  892. </Grid>
  893. </DialogContent>
  894. <DialogActions>
  895. <Button onClick={() => setIsPaymentMeansPopUp(false)}><Typography variant="h5">Cancel</Typography></Button>
  896. <Button onClick={() => doPaymentMeans()}><Typography variant="h5">Confirm</Typography></Button>
  897. </DialogActions>
  898. </Dialog>
  899. </div>
  900. </MainCard>
  901. );
  902. };
  903. export default ApplicationDetailCard;