Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

153 řádky
6.0 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Stack,
  6. Button
  7. } from '@mui/material';
  8. import * as UrlUtils from "utils/ApiPathConst";
  9. import * as React from "react";
  10. import * as HttpUtils from "utils/HttpUtils";
  11. import * as DateUtils from "utils/DateUtils";
  12. import * as FormatUtils from "utils/FormatUtils";
  13. import { useParams } from "react-router-dom";
  14. import { useNavigate } from "react-router-dom";
  15. import ForwardIcon from '@mui/icons-material/Forward';
  16. import Loadable from 'components/Loadable';
  17. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  18. const ApplicationDetails = Loadable(React.lazy(() => import('./ApplicationDetails')));
  19. const ProofForm = Loadable(React.lazy(() => import('./ProofForm')));
  20. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  21. import MainCard from "../../../components/MainCard";
  22. import {FormattedMessage} from "react-intl";
  23. const BackgroundHead = {
  24. backgroundImage: `url(${titleBackgroundImg})`,
  25. width: '100%',
  26. height: '100%',
  27. backgroundSize: 'contain',
  28. backgroundRepeat: 'no-repeat',
  29. backgroundColor: '#0C489E',
  30. backgroundPosition: 'right'
  31. }
  32. import {useIntl} from "react-intl";
  33. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  34. const Index = () => {
  35. const params = useParams();
  36. const navigate = useNavigate()
  37. const intl = useIntl();
  38. const [record, setRecord] = React.useState();
  39. const [onReady, setOnReady] = React.useState(false);
  40. React.useEffect(() => {
  41. loadForm();
  42. }, []);
  43. React.useEffect(() => {
  44. setOnReady(true);
  45. }, [record]);
  46. const loadForm = () => {
  47. if (params.id > 0) {
  48. HttpUtils.get({
  49. url: UrlUtils.GET_PROOF + "/" + params.id,
  50. onSuccess: (responseData) => {
  51. if (!responseData.data?.id) {
  52. navigate("/proof/search");
  53. }
  54. responseData.data["phoneNumber"] = JSON.parse(responseData.data.contactTelNo).phoneNumber;
  55. responseData.data["tel_countryCode"] = JSON.parse(responseData.data.contactTelNo).countryCode;
  56. responseData.data["faxNumber"] = JSON.parse(responseData.data.contactFaxNo).faxNumber;
  57. responseData.data["fax_countryCode"] = JSON.parse(responseData.data.contactFaxNo).countryCode;
  58. responseData.data["issueNoStr"] = responseData.data.issueYear
  59. + " Vol. " + FormatUtils.zeroPad(responseData.data.issueVolume, 3)
  60. + ", No. " + FormatUtils.zeroPad(responseData.data.issueNo, 2);
  61. responseData.data["issueDateStr"] = DateUtils.dateFormat(responseData.data.issueDate, "D MMM YYYY (ddd)");
  62. responseData.data["groupType"] = responseData.data.groupTitle;
  63. responseData.data["action"] = responseData.data.replyDate ? responseData.data.action : true;
  64. setRecord(responseData.data);
  65. }
  66. });
  67. }
  68. }
  69. return (
  70. !onReady ?
  71. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  72. <Grid item>
  73. <LoadingComponent />
  74. </Grid>
  75. </Grid>
  76. :
  77. (
  78. <Grid container sx={{ width: '100%', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" >
  79. <Grid item xs={12} width="100%">
  80. <div style={BackgroundHead} width="100%">
  81. <Stack direction="row" height='70px'>
  82. <Typography ml={15} color='#FFF' variant="h4" sx={{display: { xs: 'none', sm: 'none', md: 'block' }, pt:2}}>
  83. <FormattedMessage id="proofRecord"/>
  84. </Typography>
  85. </Stack>
  86. </div>
  87. </Grid>
  88. <Grid item xs={12} width="100%">
  89. <Button
  90. aria-label={intl.formatMessage({id: 'back'})}
  91. title={intl.formatMessage({id: 'back'})}
  92. sx={{ mt: 2.5, ml: 3 }} style={{ border: '2px solid' }}
  93. variant="outlined" onClick={() => { navigate("/proof/search") }}>
  94. <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} />
  95. </Button>
  96. </Grid>
  97. {/*row 1*/}
  98. <Grid item xs={12} sm={12} md={12} lg={12} sx={{ width:'100%', mt:2, mb: -3}}>
  99. <MainCard
  100. sx={{
  101. mr:2,
  102. boxShadow: 1,
  103. border: 1,
  104. borderColor: '#DDD',
  105. }}
  106. border= '1px groove grey'
  107. >
  108. <ApplicationDetails
  109. formData={record}
  110. />
  111. </MainCard>
  112. </Grid>
  113. {/*row 2*/}
  114. <Grid item xs={12} sm={12} md={12} lg={12} sx={{ width:'100%', mt: 2, mb: 2}}>
  115. <MainCard
  116. sx={{
  117. boxShadow: 1,
  118. border: 1,
  119. borderColor: '#DDD',
  120. }}
  121. border= '1px groove grey'
  122. // sx={..._sx}
  123. >
  124. <ProofForm
  125. formData={record}
  126. />
  127. </MainCard>
  128. </Grid>
  129. </Grid >
  130. )
  131. );
  132. };
  133. export default Index;