Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

356 Zeilen
16 KiB

  1. // material-ui
  2. import {
  3. FormControl,
  4. Grid,
  5. Typography,
  6. FormLabel,
  7. TextField,
  8. Button,
  9. Stack,
  10. Dialog, DialogTitle, DialogContent, DialogActions,
  11. } from '@mui/material';
  12. import { useFormik } from 'formik';
  13. import {isGranted} from "auth/utils";
  14. import {useState,useEffect,lazy} from "react";
  15. import * as HttpUtils from "utils/HttpUtils"
  16. import * as UrlUtils from "utils/ApiPathConst"
  17. import * as DateUtils from "utils/DateUtils"
  18. import * as FormatUtils from "utils/FormatUtils"
  19. import { useParams } from "react-router-dom";
  20. import Loadable from 'components/Loadable';
  21. const MainCard = Loadable(lazy(() => import('components/MainCard')));
  22. import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils";
  23. import FileList from "components/FileList"
  24. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  25. const ApplicationDetailCard = ({
  26. formData,
  27. showCancelBtn,
  28. showProofBtn
  29. // setBackButtonPos
  30. }) => {
  31. const params = useParams();
  32. const [data, setData] = useState({});
  33. const [cancelPopUp, setCancelPopUp] = useState(false);
  34. const [onDownload, setOnDownload] = useState(false);
  35. useEffect(() => {
  36. if (formData) {
  37. console.log(formData)
  38. setData(formData);
  39. }
  40. }, [formData]);
  41. const formik = useFormik({
  42. enableReinitialize: true,
  43. initialValues: data,
  44. });
  45. const DisplayField = ({ name, width, dummyUser }) => {
  46. return <>
  47. {dummyUser?
  48. <TextField
  49. fullWidth
  50. disabled
  51. size="small"
  52. onChange={formik.handleChange}
  53. id={name}
  54. name={name}
  55. value={"GLD: "+formik.values[name]}
  56. variant="outlined"
  57. sx={
  58. {
  59. "& .MuiInputBase-input.Mui-disabled": {
  60. WebkitTextFillColor: "#000000",
  61. background: "#f8f8f8",
  62. },
  63. width: width ? width : '100%'
  64. }
  65. }
  66. />
  67. :
  68. <TextField
  69. fullWidth
  70. disabled
  71. size="small"
  72. onChange={formik.handleChange}
  73. id={name}
  74. name={name}
  75. value={formik.values[name]}
  76. variant="outlined"
  77. sx={
  78. {
  79. "& .MuiInputBase-input.Mui-disabled": {
  80. WebkitTextFillColor: "#000000",
  81. background: "#f8f8f8",
  82. },
  83. width: width ? width : '100%'
  84. }
  85. }
  86. />
  87. }
  88. </>
  89. }
  90. const confirmCancel = () => {
  91. setCancelPopUp(false);
  92. HttpUtils.get({
  93. url: UrlUtils.CANCEL_PROOF + "/" + params.id,
  94. onSuccess: function () {
  95. window.location.reload(false);
  96. }
  97. });
  98. }
  99. const doCancel = () => {
  100. setCancelPopUp(true);
  101. }
  102. const genProof = () => {
  103. setOnDownload(true)
  104. HttpUtils.fileDownload({
  105. url: UrlUtils.GEN_GAZETTE_PROOF + "/" + params.id,
  106. onResponse:()=>{
  107. setOnDownload(false)
  108. },
  109. onError:()=>{
  110. setOnDownload(false)
  111. }
  112. });
  113. }
  114. return (
  115. <MainCard
  116. id={"applicationDetailsMainCard"}
  117. border={false}
  118. content={false}
  119. >
  120. <Typography variant="h4" sx={{ textAlign: "left", mb: 2, borderBottom: "1px solid black" }}>
  121. <Stack
  122. direction="row"
  123. justifyContent="space-between"
  124. alignItems="center"
  125. >
  126. Public Notice: Proofreading Reply
  127. <Button
  128. component="span"
  129. variant="contained"
  130. size="large"
  131. disabled={!showProofBtn||onDownload}
  132. onClick={genProof}
  133. >
  134. <Typography variant="h5">Proof Slip</Typography>
  135. </Button>
  136. {
  137. isGranted(["MAINTAIN_PROOF"]) ? <Button
  138. component="span"
  139. variant="contained"
  140. size="large"
  141. color="error"
  142. disabled={showCancelBtn}
  143. onClick={doCancel}
  144. >
  145. <Typography variant="h5">Cancel</Typography>
  146. </Button> : <></>
  147. }
  148. </Stack>
  149. </Typography>
  150. <form>
  151. <Grid container direction="column">
  152. <Grid item xs={12} md={12} lg={12}>
  153. <Grid container direction="row" justifyContent="space-between"
  154. alignItems="center">
  155. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  156. <Grid container alignItems={"center"}>
  157. <Grid item xs={12} md={3} lg={3}
  158. sx={{ display: 'flex', alignItems: 'center' }}>
  159. <FormLabel><Typography variant="h5">App. No.:</Typography></FormLabel>
  160. </Grid>
  161. <Grid item xs={12} md={9} lg={9}>
  162. <DisplayField name="appNo" />
  163. </Grid>
  164. </Grid>
  165. </Grid>
  166. <Grid item xs={12} md={5} lg={5} sx={{ mb: 1, ml: 1 }}>
  167. <Grid container alignItems={"left"}>
  168. <Grid item xs={12} md={3} lg={3}
  169. sx={{ display: 'flex', alignItems: 'center' }}>
  170. <FormLabel><Typography variant="h5">App. Status:</Typography></FormLabel>
  171. </Grid>
  172. <Grid item xs={12} md={9} lg={9} sx={{ display: 'flex', alignItems: 'center' }}>
  173. <FormControl variant="outlined">
  174. {StatusUtils.getStatusByText(data.appStatus)}
  175. </FormControl>
  176. </Grid>
  177. </Grid>
  178. </Grid>
  179. </Grid>
  180. <Grid container direction="row" justifyContent="space-between"
  181. alignItems="center">
  182. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  183. <Grid container alignItems={"center"}>
  184. <Grid item xs={12} md={3} lg={3}
  185. sx={{ display: 'flex', alignItems: 'center' }}>
  186. <FormLabel><Typography variant="h5">Applicant:</Typography></FormLabel>
  187. </Grid>
  188. <Grid item xs={12} md={9} lg={9}>
  189. <FormControl variant="outlined" fullWidth disabled >
  190. {data?.orgId?
  191. <DisplayField
  192. name="applicant"
  193. dummyUser={data?.enCompanyName == "GLD" ? true : false}/>
  194. :
  195. <DisplayField name="contactPerson" />
  196. }
  197. </FormControl>
  198. </Grid>
  199. </Grid>
  200. </Grid>
  201. <Grid item xs={12} md={5} lg={5} sx={{ mb: 1, ml: 1 }}>
  202. <Grid container alignItems={"center"}>
  203. <Grid item xs={12} md={3} lg={3}
  204. sx={{ display: 'flex', alignItems: 'center' }}>
  205. <FormLabel><Typography variant="h5">Issue No:</Typography></FormLabel>
  206. </Grid>
  207. <Grid item xs={12} md={9} lg={9}>
  208. <DisplayField name="issueNoStr" />
  209. </Grid>
  210. </Grid>
  211. </Grid>
  212. </Grid>
  213. <Grid container direction="row" justifyContent="space-between"
  214. alignItems="center">
  215. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  216. <Grid container alignItems={"center"}>
  217. <Grid item xs={12} md={3} lg={3}
  218. sx={{ display: 'flex', alignItems: 'center' }}>
  219. <FormLabel><Typography variant="h5">Contact Person:</Typography></FormLabel>
  220. </Grid>
  221. <Grid item xs={12} md={9} lg={9}>
  222. <DisplayField name="contactPerson" />
  223. </Grid>
  224. </Grid>
  225. </Grid>
  226. <Grid item xs={12} md={5} lg={5} sx={{ mb: 1, ml: 1 }}>
  227. <Grid container alignItems={"center"}>
  228. <Grid item xs={12} md={3} lg={3}
  229. sx={{ display: 'flex', alignItems: 'center' }}>
  230. <FormLabel><Typography variant="h5">Issue Date:</Typography></FormLabel>
  231. </Grid>
  232. <Grid item xs={12} md={9} lg={9}>
  233. <DisplayField name="issueDateStr" />
  234. </Grid>
  235. </Grid>
  236. </Grid>
  237. </Grid>
  238. {/* <Grid container direction="row" justifyContent="space-between"
  239. alignItems="center">
  240. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1, }}>
  241. <Grid container alignItems="left">
  242. <Grid item xs={12} md={3} lg={3}
  243. sx={{ display: 'flex', alignItems: 'center' }}>
  244. <FormLabel>Remarks:</FormLabel>
  245. </Grid>
  246. <Grid item xs={12} md={9} lg={9}>
  247. <Stack direction="row">
  248. <DisplayField name="appRemarks" />
  249. </Stack>
  250. </Grid>
  251. </Grid>
  252. </Grid>
  253. </Grid> */}
  254. <Grid container direction="row" justifyContent="space-between"
  255. alignItems="center">
  256. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1, }}>
  257. <Grid container alignItems={"center"}>
  258. <Grid item xs={12} md={12} lg={12} sx={{ display: 'flex', alignItems: 'center' }}>
  259. <Typography variant="h5">Print file:</Typography>
  260. </Grid>
  261. </Grid>
  262. <FileList
  263. refId={params.id}
  264. refType={"proof"}
  265. dateHideable={true}
  266. disablePagination
  267. disableSelectionOnClick
  268. disableColumnMenu
  269. disableColumnSelector
  270. hideFooter
  271. />
  272. </Grid>
  273. <Grid item xs={12} md={4} lg={4} sx={{ mb: 1, }}>
  274. <Grid container alignItems={"center"}>
  275. <Grid item xs={12} md={12} lg={12}
  276. sx={{ display: 'flex', alignItems: 'center' }}>
  277. <Typography variant="h5">Deadline for proof with revision:</Typography>
  278. </Grid>
  279. <Grid item xs={12} md={12} lg={12} sx={{ mb: 4, display: 'flex', alignItems: 'center' }}>
  280. <Typography variant="h5">Before {DateUtils.datetimeStr(data.reviseDeadline)}</Typography>
  281. </Grid>
  282. <Grid item xs={12} md={12} lg={12}
  283. sx={{ display: 'flex', alignItems: 'center' }}>
  284. <Typography variant="h5">Deadline for confirm proof and payment:</Typography>
  285. </Grid>
  286. <Grid item xs={12} md={12} lg={12} sx={{ mb: 4, display: 'flex', alignItems: 'center' }}>
  287. <Typography variant="h5">Before {DateUtils.datetimeStr(data.proofPaymentDeadline)}</Typography>
  288. </Grid>
  289. <Grid item xs={12} md={3} lg={3}
  290. sx={{ mb: 1, display: 'flex', alignItems: 'center' }}>
  291. <Typography variant="h5">Fee:</Typography>
  292. </Grid>
  293. <Grid item xs={12} md={9} lg={9} sx={{ mb: 1, display: 'flex', alignItems: 'center' }}>
  294. <Typography variant="h5" style={{ color: "blue", fontWeight: "bold", }}>{FormatUtils.currencyFormat(data.fee)}</Typography>
  295. </Grid>
  296. <Grid item xs={12} md={12} lg={12} sx={{ mb: 4, display: 'flex', alignItems: 'center' }}>
  297. {
  298. formik.values.groupType == "Private Bill"
  299. ?
  300. <Typography variant="h5">( {data.noOfPages} page x $6,552 )</Typography>
  301. :
  302. <Typography variant="h5">( {data.length} cm x {data.colCount == 2 ? "$364 Double Column" : "$182 Single Column"} )</Typography>
  303. }
  304. </Grid>
  305. </Grid>
  306. </Grid>
  307. </Grid>
  308. </Grid>
  309. </Grid>
  310. <div>
  311. <Dialog
  312. open={cancelPopUp}
  313. onClose={() => setCancelPopUp(false)}
  314. >
  315. <DialogTitle><Typography variant="h3">Confirm</Typography></DialogTitle>
  316. <DialogContent style={{ display: 'flex', }}>
  317. <Typography variant="h4" style={{ padding: '16px' }}>Are you sure you want to cancel this proof?</Typography>
  318. </DialogContent>
  319. <DialogActions>
  320. <Button onClick={() => setCancelPopUp(false)}><Typography variant="h5">Cancel</Typography></Button>
  321. <Button onClick={() => confirmCancel()}><Typography variant="h5">Confirm</Typography></Button>
  322. </DialogActions>
  323. </Dialog>
  324. </div>
  325. </form>
  326. </MainCard>
  327. );
  328. };
  329. export default ApplicationDetailCard;