Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

406 linhas
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. // useEffect(() => {
  70. // //upload latest data to parent
  71. // const values = getValues();
  72. // const objectData ={
  73. // ...values,
  74. // locked: locked,
  75. // }
  76. // updateUserObject(objectData);
  77. // }, [isCollectData]);
  78. return (
  79. !onReady ?
  80. <LoadingComponent/>
  81. :
  82. <MainCard elevation={0}
  83. border={false}
  84. content={false}
  85. >
  86. <Grid container spacing={4} direction="row">
  87. <Grid item xs={4} >
  88. <Stack
  89. direction="row"
  90. justifyContent="space-between"
  91. alignItems="center"
  92. spacing={2}
  93. mb={2}
  94. >
  95. <Button
  96. // size="large"
  97. variant="contained"
  98. // onClick={handleNewUserClick}
  99. sx={{
  100. textTransform: 'capitalize',
  101. alignItems: 'end',
  102. }}>
  103. <BorderColorOutlinedIcon/>
  104. <Typography ml={1}> Edit</Typography>
  105. </Button>
  106. <Button
  107. // size="large"
  108. variant="contained"
  109. // onClick={handleNewUserClick}
  110. sx={{
  111. textTransform: 'capitalize',
  112. alignItems: 'end'
  113. }}>
  114. <EditNoteIcon/>
  115. <Typography ml={1}> Create Proof</Typography>
  116. </Button>
  117. </Stack>
  118. </Grid>
  119. <Grid item xs={8} >
  120. <Stack
  121. direction="row"
  122. justifyContent="space-between"
  123. alignItems="center"
  124. spacing={2}
  125. mb={2}
  126. >
  127. <Button
  128. // size="large"
  129. variant="contained"
  130. // onClick={handleNewUserClick}
  131. sx={{
  132. textTransform: 'capitalize',
  133. alignItems: 'end',
  134. backgroundColor:'#52b202'
  135. }}>
  136. <DoneIcon/>
  137. <Typography ml={1}> Complete</Typography>
  138. </Button>
  139. <Button
  140. // size="large"
  141. variant="contained"
  142. // onClick={handleNewUserClick}
  143. sx={{
  144. textTransform: 'capitalize',
  145. alignItems: 'end',
  146. backgroundColor:'#52b202'
  147. }}>
  148. <DoneIcon/>
  149. <Typography ml={1}> Accept</Typography>
  150. </Button>
  151. <Button
  152. // size="large"
  153. variant="contained"
  154. // onClick={handleNewUserClick}
  155. sx={{
  156. textTransform: 'capitalize',
  157. alignItems: 'end',
  158. backgroundColor:'#ffa733'
  159. }}>
  160. <CloseIcon/>
  161. <Typography ml={1}> Reject</Typography>
  162. </Button>
  163. <Button
  164. // size="large"
  165. variant="contained"
  166. // onClick={handleNewUserClick}
  167. sx={{
  168. textTransform: 'capitalize',
  169. alignItems: 'end',
  170. backgroundColor:'#ffa733'
  171. }}>
  172. <CloseIcon/>
  173. <Typography ml={1}> Withdraw</Typography>
  174. </Button>
  175. </Stack>
  176. </Grid>
  177. </Grid>
  178. <Typography variant="h5" sx={{mb: 2, borderBottom: "1px solid black"}}>
  179. Application Details
  180. </Typography>
  181. <form>
  182. <Grid container direction="column">
  183. <Grid item xs={12} md={12}>
  184. <Grid container direction="row" justifyContent="space-between"
  185. alignItems="center">
  186. <Grid item xs={12} md={6} lg={6} sx={{mb: 1}}>
  187. <Grid container alignItems={"center"}>
  188. <Grid item xs={12} md={3} lg={3}
  189. sx={{display: 'flex', alignItems: 'center'}}>
  190. <FormLabel>Application No:</FormLabel>
  191. </Grid>
  192. <Grid item xs={12} md={9} lg={9}>
  193. <FormControl variant="outlined" fullWidth >
  194. <OutlinedInput
  195. fullWidth
  196. size="small"
  197. {...register("appNo",
  198. {
  199. value: currentApplicationDetailData.appNo,
  200. })}
  201. id='appNo'
  202. />
  203. </FormControl>
  204. </Grid>
  205. </Grid>
  206. </Grid>
  207. <Grid item xs={12} md={5} lg={5} sx={{mb: 1, ml:1}}>
  208. <Grid container alignItems={"center"}>
  209. <Grid item xs={12} md={3} lg={3}
  210. sx={{display: 'flex', alignItems: 'center'}}>
  211. <FormLabel>Status:</FormLabel>
  212. </Grid>
  213. <Grid item xs={12} md={9} lg={9}>
  214. <FormControl variant="outlined" fullWidth >
  215. {StatusUtils.getStatusByText(currentApplicationDetailData.status)}
  216. </FormControl>
  217. </Grid>
  218. </Grid>
  219. </Grid>
  220. </Grid>
  221. <Grid container direction="row" justifyContent="space-between"
  222. alignItems="center">
  223. <Grid item xs={12} md={6} lg={6} sx={{mb: 1}}>
  224. <Grid container alignItems={"center"}>
  225. <Grid item xs={12} md={3} lg={3}
  226. sx={{display: 'flex', alignItems: 'center'}}>
  227. <FormLabel>Applicant:</FormLabel>
  228. </Grid>
  229. <Grid item xs={12} md={9} lg={9}>
  230. <FormControl variant="outlined" fullWidth >
  231. { currentApplicationDetailData.orgId===null?
  232. <OutlinedInput
  233. fullWidth
  234. size="small"
  235. {...register("contactPerson",
  236. {
  237. value: currentApplicationDetailData.contactPerson,
  238. })}
  239. id='contactPerson'
  240. />:
  241. <OutlinedInput
  242. fullWidth
  243. size="small"
  244. {...register("companyName",
  245. {
  246. value: companyName.enCompanyName,
  247. })}
  248. id='companyName'
  249. />
  250. }
  251. </FormControl>
  252. </Grid>
  253. </Grid>
  254. </Grid>
  255. <Grid item xs={12} md={5} lg={5} sx={{mb: 1, ml:1}}>
  256. <Grid container alignItems={"center"}>
  257. <Grid item xs={12} md={4} lg={4}
  258. sx={{display: 'flex', alignItems: 'center'}}>
  259. <FormLabel>Contact Phone:</FormLabel>
  260. </Grid>
  261. <Grid item xs={12} md={8} lg={8}>
  262. <Stack direction="row">
  263. <FormControl variant="outlined" sx={{width:'25%'}}>
  264. <OutlinedInput
  265. size="small"
  266. {...register("countryCode",
  267. {
  268. value: currentApplicationDetailData.contactTelNo.countryCode,
  269. })}
  270. id='countryCode'
  271. />
  272. </FormControl>
  273. <FormControl variant="outlined" sx={{width:'100%'}}>
  274. <OutlinedInput
  275. size="small"
  276. {...register("phoneNumber",
  277. {
  278. value: currentApplicationDetailData.contactTelNo.phoneNumber,
  279. })}
  280. id='phoneNumber'
  281. />
  282. </FormControl>
  283. </Stack>
  284. </Grid>
  285. </Grid>
  286. </Grid>
  287. </Grid>
  288. <Grid container direction="row" justifyContent="space-between"
  289. alignItems="center">
  290. <Grid item xs={12} md={6} lg={6} sx={{mb: 1}}>
  291. <Grid container alignItems={"center"}>
  292. <Grid item xs={12} md={3} lg={3}
  293. sx={{display: 'flex', alignItems: 'center'}}>
  294. <FormLabel>Contect Person:</FormLabel>
  295. </Grid>
  296. <Grid item xs={12} md={9} lg={9}>
  297. <FormControl variant="outlined" fullWidth >
  298. <OutlinedInput
  299. fullWidth
  300. size="small"
  301. {...register("contactPerson",
  302. {
  303. value: currentApplicationDetailData.contactPerson,
  304. })}
  305. id='contactPerson'
  306. />
  307. </FormControl>
  308. </Grid>
  309. </Grid>
  310. </Grid>
  311. <Grid item xs={12} md={5} lg={5} sx={{mb: 1, ml:1}}>
  312. <Grid container alignItems={"center"}>
  313. <Grid item xs={12} md={4} lg={4}
  314. sx={{display: 'flex', alignItems: 'center'}}>
  315. <FormLabel>Contact Fax:</FormLabel>
  316. </Grid>
  317. <Grid item xs={12} md={8} lg={8}>
  318. <Stack direction="row">
  319. <FormControl variant="outlined" sx={{width:'25%'}}>
  320. <OutlinedInput
  321. size="small"
  322. {...register("countryCode",
  323. {
  324. value: currentApplicationDetailData.contactFaxNo.countryCode,
  325. })}
  326. id='countryCode'
  327. />
  328. </FormControl>
  329. <FormControl variant="outlined" sx={{width:'100%'}}>
  330. <OutlinedInput
  331. size="small"
  332. {...register("faxNumber",
  333. {
  334. value: currentApplicationDetailData.contactFaxNo.faxNumber,
  335. })}
  336. id='faxNumber'
  337. />
  338. </FormControl>
  339. </Stack>
  340. </Grid>
  341. </Grid>
  342. </Grid>
  343. </Grid>
  344. <Grid container direction="row" justifyContent="space-between"
  345. alignItems="center">
  346. <Grid item xs={12} md={12} lg={12} mt={1}>
  347. <Grid container alignItems={"center"}>
  348. <Grid item xs={12} md={12} lg={12}>
  349. <Grid container direction="row">
  350. <Grid item xs={12} md={2} lg={2}
  351. sx={{display: 'flex', alignItems: 'center'}}>
  352. <FormLabel>Manuscript File:</FormLabel>
  353. </Grid>
  354. <Grid item xs={12} md={6} lg={6} sx={{display: 'flex', alignItems: 'center'}}>
  355. <Grid container direction="row" justifyContent="flex-start">
  356. <Grid item xs={12} md={5} lg={5} sx={{display: 'flex', alignItems: 'center'}}>
  357. <FormControl variant="outlined" fullWidth >
  358. <Typography
  359. fullWidth
  360. id='fileName'
  361. >
  362. {fileDetail.filename}
  363. </Typography>
  364. </FormControl>
  365. </Grid>
  366. <Grid item md={2} lg={2}>
  367. <Button
  368. size="small"
  369. variant="contained"
  370. onClick={onDownloadClick()}
  371. sx={{
  372. textTransform: 'capitalize',
  373. alignItems: 'end',
  374. }}>
  375. <DownloadIcon/>
  376. </Button>
  377. </Grid>
  378. </Grid>
  379. </Grid>
  380. </Grid>
  381. </Grid>
  382. </Grid>
  383. </Grid>
  384. </Grid>
  385. </Grid>
  386. </Grid>
  387. </form>
  388. </MainCard>
  389. );
  390. };
  391. export default ApplicationDetailCard;