You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

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