No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

149 líneas
5.8 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. <LoadingComponent />
  72. :
  73. (
  74. <Grid container sx={{ width: '100%', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" >
  75. <Grid item xs={12} width="100%">
  76. <div style={BackgroundHead} width="100%">
  77. <Stack direction="row" height='70px'>
  78. <Typography ml={15} color='#FFF' variant="h4" sx={{display: { xs: 'none', sm: 'none', md: 'block' }, pt:2}}>
  79. <FormattedMessage id="proofRecord"/>
  80. </Typography>
  81. </Stack>
  82. </div>
  83. </Grid>
  84. <Grid item xs={12} width="100%">
  85. <Button
  86. aria-label={intl.formatMessage({id: 'back'})}
  87. title={intl.formatMessage({id: 'back'})}
  88. sx={{ mt: 2.5, ml: 3 }} style={{ border: '2px solid' }}
  89. variant="outlined" onClick={() => { navigate("/proof/search") }}>
  90. <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} />
  91. </Button>
  92. </Grid>
  93. {/*row 1*/}
  94. <Grid item xs={12} sm={12} md={12} lg={12} sx={{ width:'100%', mt:2, mb: -3}}>
  95. <MainCard
  96. sx={{
  97. mr:2,
  98. boxShadow: 1,
  99. border: 1,
  100. borderColor: '#DDD',
  101. }}
  102. border= '1px groove grey'
  103. >
  104. <ApplicationDetails
  105. formData={record}
  106. />
  107. </MainCard>
  108. </Grid>
  109. {/*row 2*/}
  110. <Grid item xs={12} sm={12} md={12} lg={12} sx={{ width:'100%', mt: 2, mb: 2}}>
  111. <MainCard
  112. sx={{
  113. boxShadow: 1,
  114. border: 1,
  115. borderColor: '#DDD',
  116. }}
  117. border= '1px groove grey'
  118. // sx={..._sx}
  119. >
  120. <ProofForm
  121. formData={record}
  122. />
  123. </MainCard>
  124. </Grid>
  125. </Grid >
  126. )
  127. );
  128. };
  129. export default Index;