Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

146 wiersze
6.1 KiB

  1. // material-ui
  2. import {
  3. Grid, Box, Stack, Typography
  4. } from '@mui/material';
  5. import MainCard from "components/MainCard";
  6. import * as UrlUtils from "utils/ApiPathConst";
  7. import * as React from "react";
  8. import * as HttpUtils from "utils/HttpUtils";
  9. import * as DateUtils from "utils/DateUtils";
  10. import { useParams } from "react-router-dom";
  11. import Loadable from 'components/Loadable';
  12. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  13. const ApplicationDetails = Loadable(React.lazy(() => import('./ApplicationDetails')));
  14. const GazetteDetails = Loadable(React.lazy(() => import('./GazetteDetails')));
  15. const ProofForm = Loadable(React.lazy(() => import('./ProofForm')));
  16. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  17. const BackgroundHead = {
  18. backgroundImage: `url(${titleBackgroundImg})`,
  19. width: '100%',
  20. height: '100%',
  21. backgroundSize: 'contain',
  22. backgroundRepeat: 'no-repeat',
  23. backgroundColor: '#0C489E',
  24. backgroundPosition: 'right'
  25. }
  26. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  27. const Index = () => {
  28. const params = useParams();
  29. const [record, setRecord] = React.useState();
  30. const [onReady, setOnReady] = React.useState(false);
  31. React.useEffect(() => {
  32. loadForm();
  33. }, []);
  34. React.useEffect(() => {
  35. setOnReady(true);
  36. }, [record]);
  37. const loadForm = () => {
  38. if (params.id > 0) {
  39. HttpUtils.get({
  40. url: UrlUtils.GET_PROOF_APP + "/" + params.id,
  41. onSuccess: (responseData) => {
  42. responseData.data["phoneNumber"] = JSON.parse(responseData.data.contactTelNo).phoneNumber;
  43. responseData.data["tel_countryCode"] = JSON.parse(responseData.data.contactTelNo).countryCode;
  44. responseData.data["faxNumber"] = JSON.parse(responseData.data.contactFaxNo).faxNumber;
  45. responseData.data["fax_countryCode"] = JSON.parse(responseData.data.contactFaxNo).countryCode;
  46. responseData.data["issueNoStr"] = responseData.data.issueVolume + "/" + responseData.data.issueYear + " No. " + responseData.data.issueNo
  47. responseData.data["issueDate"] = DateUtils.dateStr(responseData.data.issueDate);
  48. responseData.data["groupType"] = responseData.data.groupTitle;
  49. responseData.data["reviseDeadline"] = DateUtils.datetimeFieldFormat(responseData.data.reviseDeadline);
  50. responseData.data["proofPaymentDeadline"] = DateUtils.datetimeFieldFormat(responseData.data.proofPaymentDeadline);
  51. setRecord(responseData.data);
  52. }
  53. });
  54. }
  55. }
  56. return (
  57. !onReady ?
  58. <Grid container sx={{ minHeight: '95vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  59. <Grid item>
  60. <LoadingComponent />
  61. </Grid>
  62. </Grid>
  63. :
  64. <Grid container sx={{ minHeight: '85vh', backgroundColor: "backgroundColor.default" }} direction="column" spacing={1} >
  65. <Grid item xs={12}>
  66. <div style={BackgroundHead}>
  67. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  68. <Typography ml={15} color='#FFF' variant="h4">Create Proof</Typography>
  69. </Stack>
  70. </div>
  71. </Grid>
  72. <MainCard
  73. elevation={0}
  74. border={false}
  75. content={false}
  76. sx={{
  77. backgroundColor: "backgroundColor.default"
  78. }}
  79. >
  80. {/*row 1*/}
  81. <Grid item xs={12} md={12} lg={12}>
  82. <Grid container direction="row" justify="flex-start" alignItems="stretch" spacing={1}>
  83. <Grid item xs={12} md={12} lg={8}>
  84. <Box xs={12} ml={4} mt={3} sx={{ pb: 8.5, pt: 1, borderRadius: '10px', backgroundColor: "#fff" }}>
  85. <ApplicationDetails
  86. formData={record}
  87. style={{
  88. display: "flex",
  89. height: "100%",
  90. flex: 1
  91. }}
  92. />
  93. </Box>
  94. </Grid>
  95. <Grid item xs={12} md={12} lg={3.85}>
  96. <Box xs={12} ml={4} mt={3} sx={{ p: 1, borderRadius: '10px', backgroundColor: "#fff" }}>
  97. <GazetteDetails
  98. formData={record}
  99. style={{
  100. display: "flex",
  101. height: "100%",
  102. flex: 1
  103. }}
  104. />
  105. </Box>
  106. </Grid>
  107. </Grid>
  108. </Grid>
  109. {/*row 2*/}
  110. <Grid item xs={12} md={12} lg={12} sx={{ ml: 1 }}>
  111. <MainCard elevation={0}
  112. border={false}
  113. content={false}
  114. backgroundColor={"backgroundColor.default"}
  115. >
  116. <Box xs={12} ml={4} mt={3} sx={{ p: 1, borderRadius: '10px', backgroundColor: "#fff" }}>
  117. <ProofForm
  118. formData={record}
  119. />
  120. </Box>
  121. <br />
  122. </MainCard>
  123. </Grid>
  124. </MainCard>
  125. </Grid>
  126. );
  127. };
  128. export default Index;