Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

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