You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

122 line
4.5 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Stack,
  6. Button,
  7. } from '@mui/material';
  8. import * as React from "react";
  9. import * as HttpUtils from "utils/HttpUtils";
  10. import * as UrlUtils from "utils/ApiPathConst";
  11. import * as DateUtils from "utils/DateUtils";
  12. import { useParams, useNavigate } from "react-router-dom";
  13. import Loadable from 'components/Loadable';
  14. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  15. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  16. import { FormattedMessage } from "react-intl";
  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 navigate = useNavigate()
  30. const [record, setRecord] = React.useState();
  31. const [onReady, setOnReady] = React.useState(false);
  32. React.useEffect(() => {
  33. loadForm();
  34. }, []);
  35. React.useEffect(() => {
  36. setOnReady(true);
  37. }, [record]);
  38. const loadForm = () => {
  39. if (params.id > 0) {
  40. HttpUtils.get({
  41. url: UrlUtils.GET_MSG_DETAILS + "/" + params.id,
  42. onSuccess: (responseData) => {
  43. if (!responseData?.sentDate) {
  44. navigate("/");
  45. }
  46. setRecord(responseData);
  47. }
  48. });
  49. }
  50. }
  51. return (
  52. !onReady ?
  53. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  54. <Grid item>
  55. <LoadingComponent />
  56. </Grid>
  57. </Grid>
  58. :
  59. (
  60. <Grid container sx={{ minHeight: '110vh', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" >
  61. <Grid item xs={12} width="100%">
  62. <div style={BackgroundHead} width="100%">
  63. <Stack direction="row" height='70px'>
  64. <Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}>
  65. <FormattedMessage id="msgDetails" />
  66. </Typography>
  67. </Stack>
  68. </div>
  69. </Grid>
  70. {/*row 1*/}
  71. <Grid item xs={12} md={12} >
  72. <Grid container justifyContent="flex-start" alignItems="center" >
  73. <center>
  74. <Grid item xs={12} md={12} sx={{p:2}} >
  75. <Typography variant="h3" sx={{ textAlign: "left", borderBottom: "1px solid black" }}>
  76. {record?.subject}
  77. </Typography>
  78. <Typography sx={{p:1}} align="justify">{DateUtils.datetimeStr(record?.sentDate)}</Typography>
  79. <Typography variant="body1" sx={{ p:4, textAlign: "left" }} align="justify" backgroundColor="#f8f8f8">
  80. <div dangerouslySetInnerHTML={{__html: record?.content}}></div>
  81. </Typography>
  82. <Typography variant="h4" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "center" }}>
  83. <Button
  84. component="span"
  85. variant="contained"
  86. size="large"
  87. sx={{ m: 4 }}
  88. onClick={() => {
  89. navigate(-1);
  90. }}
  91. >
  92. <FormattedMessage id="back" />
  93. </Button>
  94. </Typography>
  95. </Grid>
  96. </center>
  97. </Grid>
  98. </Grid>
  99. {/*row 2*/}
  100. </Grid >
  101. )
  102. );
  103. };
  104. export default Index;