您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

476 行
28 KiB

  1. // material-ui
  2. import {
  3. FormControl,
  4. Button,
  5. Grid,
  6. // InputAdornment,
  7. Typography, FormLabel,
  8. OutlinedInput,
  9. Stack
  10. } from '@mui/material';
  11. // import MainCard from "../../components/MainCard";
  12. const MainCard = Loadable(lazy(() => import('components/MainCard')));
  13. import { useForm } from "react-hook-form";
  14. import {
  15. useEffect,
  16. useState
  17. } from "react";
  18. // import Checkbox from "@mui/material/Checkbox";
  19. import Loadable from 'components/Loadable';
  20. import { lazy } from 'react';
  21. const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent')));
  22. // import {useParams} from "react-router-dom";
  23. import * as HttpUtils from "utils/HttpUtils"
  24. import * as StatusUtils from "../PublicNotice/ListPanel/PublicNoteStatusUtils";
  25. import * as DateUtils from "utils/DateUtils";
  26. // import BorderColorOutlinedIcon from '@mui/icons-material/BorderColorOutlined';
  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. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  32. const ApplicationDetailCard = (
  33. { applicationDetailData,
  34. setStatus,
  35. // updateUserObject,
  36. // isNewRecord
  37. }
  38. ) => {
  39. // const params = useParams();
  40. const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({});
  41. const [companyName, setCompanyName] = useState({});
  42. const [fileDetail, setfileDetail] = useState({});
  43. const [onReady, setOnReady] = useState(false);
  44. const [issueNum, setIssueNum] = useState("");
  45. const [issueDate, setIssueDate] = useState("");
  46. const { register,
  47. // getValues
  48. } = useForm()
  49. useEffect(() => {
  50. //if user data from parent are not null
  51. // console.log(applicationDetailData)
  52. if (Object.keys(applicationDetailData).length > 0 && applicationDetailData.data !== null) {
  53. setCurrentApplicationDetailData(applicationDetailData.data);
  54. setCompanyName(applicationDetailData.companyName);
  55. setfileDetail(applicationDetailData.fileDetail);
  56. setIssueNum(applicationDetailData.gazetteIssueDetail.volume + "/" + applicationDetailData.gazetteIssueDetail.year
  57. + " No. " + applicationDetailData.gazetteIssueDetail.issueNo);
  58. setIssueDate(DateUtils.dateFormat(applicationDetailData.gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)"));
  59. }
  60. }, [applicationDetailData]);
  61. useEffect(() => {
  62. //if state data are ready and assign to different field
  63. // console.log(currentApplicationDetailData)
  64. if (Object.keys(currentApplicationDetailData).length > 0) {
  65. setOnReady(true);
  66. }
  67. }, [currentApplicationDetailData]);
  68. const onDownloadClick = () => () => {
  69. HttpUtils.fileDownload({
  70. fileId: fileDetail.id,
  71. skey: fileDetail.skey,
  72. filename: fileDetail.filename,
  73. });
  74. };
  75. const cancelledClick = () => () => {
  76. setStatus("cancel")
  77. };
  78. return (
  79. !onReady ?
  80. <LoadingComponent />
  81. :
  82. <MainCard elevation={0}
  83. border={false}
  84. content={false}
  85. >
  86. <Grid container spacing={1} direction="row">
  87. <Grid item xs={12}>
  88. <Stack
  89. direction="row"
  90. justifyContent="space-between"
  91. alignItems="center"
  92. spacing={2}
  93. mb={2}
  94. >
  95. {
  96. currentApplicationDetailData.status == "confirmed"?
  97. <Button
  98. // size="large"
  99. variant="contained"
  100. // onClick={handleNewUserClick}
  101. disabled={currentApplicationDetailData.status == "rejected" || currentApplicationDetailData.status == "cancelled" || currentApplicationDetailData.status == "paid"}
  102. sx={{
  103. textTransform: 'capitalize',
  104. alignItems: 'end'
  105. }}>
  106. <EditNoteIcon />
  107. <Typography ml={1}> 支付</Typography>
  108. </Button>
  109. :<div></div>
  110. }
  111. <Button
  112. // size="large"
  113. variant="contained"
  114. onClick={cancelledClick()}
  115. disabled={currentApplicationDetailData.status !== "submitted"}
  116. sx={{
  117. textTransform: 'capitalize',
  118. alignItems: 'end',
  119. backgroundColor: '#ffa733'
  120. }}>
  121. <CloseIcon />
  122. <Typography ml={1}> 取消</Typography>
  123. </Button>
  124. </Stack>
  125. </Grid>
  126. </Grid>
  127. <Typography variant="h5" sx={{ mb: 2, borderBottom: "1px solid black" }}>
  128. 公共啟事申請資料
  129. </Typography>
  130. <form>
  131. <Grid container direction="column">
  132. <Grid item xs={12} md={12}>
  133. <Grid container direction="row" justifyContent="space-between"
  134. alignItems="center">
  135. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  136. <Grid container alignItems={"center"}>
  137. <Grid item xs={12} md={3} lg={3}
  138. sx={{ display: 'flex', alignItems: 'center' }}>
  139. <FormLabel>申請編號:</FormLabel>
  140. </Grid>
  141. <Grid item xs={12} md={9} lg={9}>
  142. <FormControl variant="outlined" fullWidth disabled>
  143. <OutlinedInput
  144. fullWidth
  145. size="small"
  146. {...register("appNo",
  147. {
  148. value: currentApplicationDetailData.appNo,
  149. })}
  150. id='appNo'
  151. sx={{
  152. "& .MuiInputBase-input.Mui-disabled": {
  153. WebkitTextFillColor: "#000000",
  154. background: "#f8f8f8",
  155. },
  156. }}
  157. />
  158. </FormControl>
  159. </Grid>
  160. </Grid>
  161. </Grid>
  162. <Grid item xs={12} md={5} lg={5} sx={{ mb: 1, ml: 1 }}>
  163. <Grid container alignItems={"center"}>
  164. <Grid item xs={12} md={3} lg={3}
  165. sx={{ display: 'flex', alignItems: 'center' }}>
  166. <FormLabel>申請狀態:</FormLabel>
  167. </Grid>
  168. <Grid item xs={12} md={9} lg={9}>
  169. <FormControl variant="outlined" fullWidth >
  170. {StatusUtils.getStatusByText(currentApplicationDetailData.status)}
  171. </FormControl>
  172. </Grid>
  173. </Grid>
  174. </Grid>
  175. </Grid>
  176. <Grid container direction="row" justifyContent="space-between"
  177. alignItems="center">
  178. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  179. <Grid container alignItems={"center"}>
  180. <Grid item xs={12} md={3} lg={3}
  181. sx={{ display: 'flex', alignItems: 'center' }}>
  182. <FormLabel>申請人:</FormLabel>
  183. </Grid>
  184. <Grid item xs={12} md={9} lg={9}>
  185. <FormControl variant="outlined" fullWidth disabled >
  186. {currentApplicationDetailData.orgId === null ?
  187. <OutlinedInput
  188. fullWidth
  189. size="small"
  190. {...register("contactPerson",
  191. {
  192. value: currentApplicationDetailData.contactPerson,
  193. })}
  194. id='contactPerson'
  195. sx={{
  196. "& .MuiInputBase-input.Mui-disabled": {
  197. WebkitTextFillColor: "#000000",
  198. background: "#f8f8f8",
  199. },
  200. }}
  201. /> :
  202. <OutlinedInput
  203. fullWidth
  204. size="small"
  205. {...register("companyName",
  206. {
  207. value: companyName.enCompanyName,
  208. })}
  209. id='companyName'
  210. sx={{
  211. "& .MuiInputBase-input.Mui-disabled": {
  212. WebkitTextFillColor: "#000000",
  213. background: "#f8f8f8",
  214. },
  215. }}
  216. />
  217. }
  218. </FormControl>
  219. </Grid>
  220. </Grid>
  221. </Grid>
  222. <Grid item xs={12} md={5} lg={5} sx={{ mb: 1, ml: 1 }}>
  223. <Grid container alignItems={"center"}>
  224. <Grid item xs={12} md={3} lg={3}
  225. sx={{ display: 'flex', alignItems: 'center' }}>
  226. <FormLabel>憲報期數:</FormLabel>
  227. </Grid>
  228. <Grid item xs={12} md={9} lg={9}>
  229. <Stack direction="row">
  230. <FormControl variant="outlined" fullWidth disabled>
  231. <OutlinedInput
  232. size="small"
  233. {...register("issueNum",
  234. {
  235. value: issueNum,
  236. })}
  237. id='issueNum'
  238. sx={{
  239. "& .MuiInputBase-input.Mui-disabled": {
  240. WebkitTextFillColor: "#000000",
  241. background: "#f8f8f8",
  242. },
  243. }}
  244. />
  245. </FormControl>
  246. </Stack>
  247. </Grid>
  248. </Grid>
  249. </Grid>
  250. </Grid>
  251. <Grid container direction="row" justifyContent="space-between"
  252. alignItems="center">
  253. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1 }}>
  254. <Grid container alignItems={"center"}>
  255. <Grid item xs={12} md={3} lg={3}
  256. sx={{ display: 'flex', alignItems: 'center' }}>
  257. <FormLabel>聯絡人:</FormLabel>
  258. </Grid>
  259. <Grid item xs={12} md={9} lg={9}>
  260. <FormControl variant="outlined" fullWidth disabled>
  261. <OutlinedInput
  262. fullWidth
  263. size="small"
  264. {...register("contactPerson",
  265. {
  266. value: currentApplicationDetailData.contactPerson,
  267. })}
  268. id='contactPerson'
  269. sx={{
  270. "& .MuiInputBase-input.Mui-disabled": {
  271. WebkitTextFillColor: "#000000",
  272. background: "#f8f8f8",
  273. },
  274. }}
  275. />
  276. </FormControl>
  277. </Grid>
  278. </Grid>
  279. </Grid>
  280. <Grid item xs={12} md={5} lg={5} sx={{ mb: 1, ml: 1 }}>
  281. <Grid container alignItems={"center"}>
  282. <Grid item xs={12} md={3} lg={3}
  283. sx={{ display: 'flex', alignItems: 'center' }}>
  284. <FormLabel>發布日期:</FormLabel>
  285. </Grid>
  286. <Grid item xs={12} md={9} lg={9}>
  287. <Stack direction="row">
  288. <FormControl variant="outlined" fullWidth disabled>
  289. <OutlinedInput
  290. size="small"
  291. {...register("issueDate",
  292. {
  293. value: issueDate,
  294. })}
  295. id='issueDate'
  296. sx={{
  297. "& .MuiInputBase-input.Mui-disabled": {
  298. WebkitTextFillColor: "#000000",
  299. background: "#f8f8f8",
  300. },
  301. }}
  302. />
  303. </FormControl>
  304. </Stack>
  305. </Grid>
  306. </Grid>
  307. </Grid>
  308. </Grid>
  309. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1, }}>
  310. <Grid container alignItems={"center"}>
  311. <Grid item xs={12} md={3} lg={3}
  312. sx={{ display: 'flex', alignItems: 'center' }}>
  313. <FormLabel>聯絡電話:</FormLabel>
  314. </Grid>
  315. <Grid item xs={12} md={9} lg={9}>
  316. <Stack direction="row">
  317. <FormControl variant="outlined" sx={{ width: '25%' }} disabled>
  318. <OutlinedInput
  319. size="small"
  320. {...register("countryCode",
  321. {
  322. value: currentApplicationDetailData.contactTelNo.countryCode,
  323. })}
  324. id='countryCode'
  325. sx={{
  326. "& .MuiInputBase-input.Mui-disabled": {
  327. WebkitTextFillColor: "#000000",
  328. background: "#f8f8f8",
  329. },
  330. }}
  331. />
  332. </FormControl>
  333. <FormControl variant="outlined" sx={{ width: '100%' }} disabled>
  334. <OutlinedInput
  335. size="small"
  336. {...register("phoneNumber",
  337. {
  338. value: currentApplicationDetailData.contactTelNo.phoneNumber,
  339. })}
  340. id='phoneNumber'
  341. sx={{
  342. "& .MuiInputBase-input.Mui-disabled": {
  343. WebkitTextFillColor: "#000000",
  344. background: "#f8f8f8",
  345. },
  346. }}
  347. />
  348. </FormControl>
  349. </Stack>
  350. </Grid>
  351. </Grid>
  352. </Grid>
  353. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1, }}>
  354. <Grid container alignItems={"center"}>
  355. <Grid item xs={12} md={3} lg={3}
  356. sx={{ display: 'flex', alignItems: 'center' }}>
  357. <FormLabel>傳真號碼:</FormLabel>
  358. </Grid>
  359. <Grid item xs={12} md={9} lg={9}>
  360. <Stack direction="row">
  361. <FormControl variant="outlined" sx={{ width: '25%' }} disabled>
  362. <OutlinedInput
  363. size="small"
  364. {...register("countryCode",
  365. {
  366. value: currentApplicationDetailData.contactFaxNo.countryCode,
  367. })}
  368. id='countryCode'
  369. sx={{
  370. "& .MuiInputBase-input.Mui-disabled": {
  371. WebkitTextFillColor: "#000000",
  372. background: "#f8f8f8",
  373. },
  374. }}
  375. />
  376. </FormControl>
  377. <FormControl variant="outlined" sx={{ width: '100%' }} disabled>
  378. <OutlinedInput
  379. size="small"
  380. {...register("faxNumber",
  381. {
  382. value: currentApplicationDetailData.contactFaxNo.faxNumber,
  383. })}
  384. id='faxNumber'
  385. sx={{
  386. "& .MuiInputBase-input.Mui-disabled": {
  387. WebkitTextFillColor: "#000000",
  388. background: "#f8f8f8",
  389. },
  390. }}
  391. />
  392. </FormControl>
  393. </Stack>
  394. </Grid>
  395. </Grid>
  396. </Grid>
  397. <Grid container direction="row" justifyContent="space-between"
  398. alignItems="center">
  399. <Grid item xs={12} md={12} lg={12} mt={1}>
  400. <Grid container alignItems={"center"}>
  401. <Grid item xs={12} md={6} lg={6}>
  402. <Grid container direction="row">
  403. <Grid item xs={12} md={3} lg={3}
  404. sx={{ display: 'flex', alignItems: 'center' }}>
  405. <FormLabel>犒件檔案:</FormLabel>
  406. </Grid>
  407. <Grid item xs={12} md={9} lg={9} sx={{ display: 'flex', alignItems: 'center' }}>
  408. <Grid container direction="row" justifyContent="flex-start">
  409. <Grid item xs={12} md={5} lg={5} sx={{ display: 'flex', alignItems: 'center' }}>
  410. <FormControl variant="outlined" fullWidth >
  411. <Typography
  412. fullWidth
  413. id='fileName'
  414. >
  415. {fileDetail.filename}
  416. </Typography>
  417. </FormControl>
  418. </Grid>
  419. <Grid item md={2} lg={2}>
  420. <Button
  421. size="small"
  422. variant="contained"
  423. onClick={onDownloadClick()}
  424. sx={{
  425. textTransform: 'capitalize',
  426. alignItems: 'end',
  427. }}>
  428. <DownloadIcon />
  429. </Button>
  430. </Grid>
  431. </Grid>
  432. </Grid>
  433. </Grid>
  434. </Grid>
  435. </Grid>
  436. </Grid>
  437. </Grid>
  438. <Grid item xs={12} md={6} lg={6} sx={{ mb: 1, paddingTop: 2}}>
  439. <Grid container alignItems={"center"}>
  440. <Grid item xs={12} md={3} lg={3}
  441. sx={{ display: 'flex', alignItems: 'center' }}>
  442. <FormLabel>備註:</FormLabel>
  443. </Grid>
  444. <Grid item xs={12} md={9} lg={9}>
  445. <FormLabel>{currentApplicationDetailData.remarks}</FormLabel>
  446. </Grid>
  447. </Grid>
  448. </Grid>
  449. </Grid>
  450. </Grid>
  451. </form>
  452. </MainCard>
  453. );
  454. };
  455. export default ApplicationDetailCard;