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.
 
 

418 Zeilen
22 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 BorderColorOutlinedIcon from '@mui/icons-material/BorderColorOutlined';
  26. import DoneIcon from '@mui/icons-material/Done';
  27. import CloseIcon from '@mui/icons-material/Close';
  28. import EditNoteIcon from '@mui/icons-material/EditNote';
  29. import DownloadIcon from '@mui/icons-material/Download';
  30. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  31. const ApplicationDetailCard = (
  32. { applicationDetailData,
  33. // isCollectData,
  34. // updateUserObject,
  35. // isNewRecord
  36. }
  37. ) => {
  38. // const params = useParams();
  39. const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({});
  40. const [companyName, setCompanyName] = useState({});
  41. const [fileDetail, setfileDetail] = useState({});
  42. const [onReady,setOnReady] = useState(false);
  43. const {register,
  44. // getValues
  45. } = useForm()
  46. useEffect(() => {
  47. //if user data from parent are not null
  48. // console.log(applicationDetailData)
  49. if (Object.keys(applicationDetailData).length > 0) {
  50. setCurrentApplicationDetailData(applicationDetailData.data);
  51. setCompanyName(applicationDetailData.companyName);
  52. setfileDetail(applicationDetailData.fileDetail);
  53. }
  54. }, [applicationDetailData]);
  55. useEffect(() => {
  56. //if state data are ready and assign to different field
  57. // console.log(currentApplicationDetailData)
  58. if (Object.keys(currentApplicationDetailData).length > 0) {
  59. setOnReady(true);
  60. }
  61. }, [currentApplicationDetailData]);
  62. const onDownloadClick = () => () => {
  63. HttpUtils.fileDownload({
  64. fileId:fileDetail.id,
  65. skey:fileDetail.skey,
  66. filename:fileDetail.filename,
  67. });
  68. };
  69. // const onStatusClick = () => () => {
  70. // if(params.id > 0 ){
  71. // axios.post(`${GET_PUBLIC_NOTICE_APPLY_DETAIL}/${params.id}`)
  72. // .then((response) => {
  73. // if (response.status === 200) {
  74. // navigate(`/application/${params.id}`);
  75. // }
  76. // })
  77. // .catch(error => {
  78. // console.log(error);
  79. // return false;
  80. // });
  81. // }
  82. // };
  83. return (
  84. !onReady ?
  85. <LoadingComponent/>
  86. :
  87. <MainCard elevation={0}
  88. border={false}
  89. content={false}
  90. >
  91. <Grid container spacing={4} direction="row">
  92. <Grid item xs={4} >
  93. <Stack
  94. direction="row"
  95. justifyContent="space-between"
  96. alignItems="center"
  97. spacing={2}
  98. mb={2}
  99. >
  100. <Button
  101. // size="large"
  102. variant="contained"
  103. // onClick={handleNewUserClick}
  104. sx={{
  105. textTransform: 'capitalize',
  106. alignItems: 'end',
  107. }}>
  108. <BorderColorOutlinedIcon/>
  109. <Typography ml={1}> Edit</Typography>
  110. </Button>
  111. <Button
  112. // size="large"
  113. variant="contained"
  114. // onClick={handleNewUserClick}
  115. sx={{
  116. textTransform: 'capitalize',
  117. alignItems: 'end'
  118. }}>
  119. <EditNoteIcon/>
  120. <Typography ml={1}> Create Proof</Typography>
  121. </Button>
  122. </Stack>
  123. </Grid>
  124. <Grid item xs={8} >
  125. <Stack
  126. direction="row"
  127. justifyContent="space-between"
  128. alignItems="center"
  129. spacing={2}
  130. mb={2}
  131. >
  132. {currentApplicationDetailData.status =="submitted"?
  133. <>
  134. <Button
  135. // size="large"
  136. variant="contained"
  137. // onClick={handleNewUserClick}
  138. sx={{
  139. textTransform: 'capitalize',
  140. alignItems: 'end',
  141. backgroundColor:'#52b202'
  142. }}>
  143. <DoneIcon/>
  144. <Typography ml={1}> Accept</Typography>
  145. </Button>
  146. <Button
  147. // size="large"
  148. variant="contained"
  149. // onClick={handleNewUserClick}
  150. sx={{
  151. textTransform: 'capitalize',
  152. alignItems: 'end',
  153. backgroundColor:'#ffa733'
  154. }}>
  155. <CloseIcon/>
  156. <Typography ml={1}> Reject</Typography>
  157. </Button>
  158. </>:
  159. <>
  160. <Button
  161. // size="large"
  162. variant="contained"
  163. // onClick={handleNewUserClick}
  164. sx={{
  165. textTransform: 'capitalize',
  166. alignItems: 'end',
  167. backgroundColor:'#52b202'
  168. }}>
  169. <DoneIcon/>
  170. <Typography ml={1}> Complete</Typography>
  171. </Button>
  172. <Button
  173. // size="large"
  174. variant="contained"
  175. // onClick={handleNewUserClick}
  176. sx={{
  177. textTransform: 'capitalize',
  178. alignItems: 'end',
  179. backgroundColor:'#ffa733'
  180. }}>
  181. <CloseIcon/>
  182. <Typography ml={1}> Withdraw</Typography>
  183. </Button>
  184. </>
  185. }
  186. </Stack>
  187. </Grid>
  188. </Grid>
  189. <Typography variant="h5" sx={{mb: 2, borderBottom: "1px solid black"}}>
  190. Application Details
  191. </Typography>
  192. <form>
  193. <Grid container direction="column">
  194. <Grid item xs={12} md={12}>
  195. <Grid container direction="row" justifyContent="space-between"
  196. alignItems="center">
  197. <Grid item xs={12} md={6} lg={6} sx={{mb: 1}}>
  198. <Grid container alignItems={"center"}>
  199. <Grid item xs={12} md={3} lg={3}
  200. sx={{display: 'flex', alignItems: 'center'}}>
  201. <FormLabel>Application No:</FormLabel>
  202. </Grid>
  203. <Grid item xs={12} md={9} lg={9}>
  204. <FormControl variant="outlined" fullWidth >
  205. <OutlinedInput
  206. fullWidth
  207. size="small"
  208. {...register("appNo",
  209. {
  210. value: currentApplicationDetailData.appNo,
  211. })}
  212. id='appNo'
  213. />
  214. </FormControl>
  215. </Grid>
  216. </Grid>
  217. </Grid>
  218. <Grid item xs={12} md={5} lg={5} sx={{mb: 1, ml:1}}>
  219. <Grid container alignItems={"center"}>
  220. <Grid item xs={12} md={3} lg={3}
  221. sx={{display: 'flex', alignItems: 'center'}}>
  222. <FormLabel>Status:</FormLabel>
  223. </Grid>
  224. <Grid item xs={12} md={9} lg={9}>
  225. <FormControl variant="outlined" fullWidth >
  226. {StatusUtils.getStatusByText(currentApplicationDetailData.status)}
  227. </FormControl>
  228. </Grid>
  229. </Grid>
  230. </Grid>
  231. </Grid>
  232. <Grid container direction="row" justifyContent="space-between"
  233. alignItems="center">
  234. <Grid item xs={12} md={6} lg={6} sx={{mb: 1}}>
  235. <Grid container alignItems={"center"}>
  236. <Grid item xs={12} md={3} lg={3}
  237. sx={{display: 'flex', alignItems: 'center'}}>
  238. <FormLabel>Applicant:</FormLabel>
  239. </Grid>
  240. <Grid item xs={12} md={9} lg={9}>
  241. <FormControl variant="outlined" fullWidth >
  242. { currentApplicationDetailData.orgId===null?
  243. <OutlinedInput
  244. fullWidth
  245. size="small"
  246. {...register("contactPerson",
  247. {
  248. value: currentApplicationDetailData.contactPerson,
  249. })}
  250. id='contactPerson'
  251. />:
  252. <OutlinedInput
  253. fullWidth
  254. size="small"
  255. {...register("companyName",
  256. {
  257. value: companyName.enCompanyName,
  258. })}
  259. id='companyName'
  260. />
  261. }
  262. </FormControl>
  263. </Grid>
  264. </Grid>
  265. </Grid>
  266. <Grid item xs={12} md={5} lg={5} sx={{mb: 1, ml:1}}>
  267. <Grid container alignItems={"center"}>
  268. <Grid item xs={12} md={4} lg={4}
  269. sx={{display: 'flex', alignItems: 'center'}}>
  270. <FormLabel>Contact Phone:</FormLabel>
  271. </Grid>
  272. <Grid item xs={12} md={8} lg={8}>
  273. <Stack direction="row">
  274. <FormControl variant="outlined" sx={{width:'25%'}}>
  275. <OutlinedInput
  276. size="small"
  277. {...register("countryCode",
  278. {
  279. value: currentApplicationDetailData.contactTelNo.countryCode,
  280. })}
  281. id='countryCode'
  282. />
  283. </FormControl>
  284. <FormControl variant="outlined" sx={{width:'100%'}}>
  285. <OutlinedInput
  286. size="small"
  287. {...register("phoneNumber",
  288. {
  289. value: currentApplicationDetailData.contactTelNo.phoneNumber,
  290. })}
  291. id='phoneNumber'
  292. />
  293. </FormControl>
  294. </Stack>
  295. </Grid>
  296. </Grid>
  297. </Grid>
  298. </Grid>
  299. <Grid container direction="row" justifyContent="space-between"
  300. alignItems="center">
  301. <Grid item xs={12} md={6} lg={6} sx={{mb: 1}}>
  302. <Grid container alignItems={"center"}>
  303. <Grid item xs={12} md={3} lg={3}
  304. sx={{display: 'flex', alignItems: 'center'}}>
  305. <FormLabel>Contect Person:</FormLabel>
  306. </Grid>
  307. <Grid item xs={12} md={9} lg={9}>
  308. <FormControl variant="outlined" fullWidth >
  309. <OutlinedInput
  310. fullWidth
  311. size="small"
  312. {...register("contactPerson",
  313. {
  314. value: currentApplicationDetailData.contactPerson,
  315. })}
  316. id='contactPerson'
  317. />
  318. </FormControl>
  319. </Grid>
  320. </Grid>
  321. </Grid>
  322. <Grid item xs={12} md={5} lg={5} sx={{mb: 1, ml:1}}>
  323. <Grid container alignItems={"center"}>
  324. <Grid item xs={12} md={4} lg={4}
  325. sx={{display: 'flex', alignItems: 'center'}}>
  326. <FormLabel>Contact Fax:</FormLabel>
  327. </Grid>
  328. <Grid item xs={12} md={8} lg={8}>
  329. <Stack direction="row">
  330. <FormControl variant="outlined" sx={{width:'25%'}}>
  331. <OutlinedInput
  332. size="small"
  333. {...register("countryCode",
  334. {
  335. value: currentApplicationDetailData.contactFaxNo.countryCode,
  336. })}
  337. id='countryCode'
  338. />
  339. </FormControl>
  340. <FormControl variant="outlined" sx={{width:'100%'}}>
  341. <OutlinedInput
  342. size="small"
  343. {...register("faxNumber",
  344. {
  345. value: currentApplicationDetailData.contactFaxNo.faxNumber,
  346. })}
  347. id='faxNumber'
  348. />
  349. </FormControl>
  350. </Stack>
  351. </Grid>
  352. </Grid>
  353. </Grid>
  354. </Grid>
  355. <Grid container direction="row" justifyContent="space-between"
  356. alignItems="center">
  357. <Grid item xs={12} md={12} lg={12} mt={1}>
  358. <Grid container alignItems={"center"}>
  359. <Grid item xs={12} md={12} lg={12}>
  360. <Grid container direction="row">
  361. <Grid item xs={12} md={2} lg={2}
  362. sx={{display: 'flex', alignItems: 'center'}}>
  363. <FormLabel>Manuscript File:</FormLabel>
  364. </Grid>
  365. <Grid item xs={12} md={6} lg={6} sx={{display: 'flex', alignItems: 'center'}}>
  366. <Grid container direction="row" justifyContent="flex-start">
  367. <Grid item xs={12} md={5} lg={5} sx={{display: 'flex', alignItems: 'center'}}>
  368. <FormControl variant="outlined" fullWidth >
  369. <Typography
  370. fullWidth
  371. id='fileName'
  372. >
  373. {fileDetail.filename}
  374. </Typography>
  375. </FormControl>
  376. </Grid>
  377. <Grid item md={2} lg={2}>
  378. <Button
  379. size="small"
  380. variant="contained"
  381. onClick={onDownloadClick()}
  382. sx={{
  383. textTransform: 'capitalize',
  384. alignItems: 'end',
  385. }}>
  386. <DownloadIcon/>
  387. </Button>
  388. </Grid>
  389. </Grid>
  390. </Grid>
  391. </Grid>
  392. </Grid>
  393. </Grid>
  394. </Grid>
  395. </Grid>
  396. </Grid>
  397. </Grid>
  398. </form>
  399. </MainCard>
  400. );
  401. };
  402. export default ApplicationDetailCard;