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.
 
 

126 wiersze
4.6 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. import usePageTitle from 'components/usePageTitle';
  18. const BackgroundHead = {
  19. backgroundImage: `url(${titleBackgroundImg})`,
  20. width: '100%',
  21. height: '100%',
  22. backgroundSize: 'contain',
  23. backgroundRepeat: 'no-repeat',
  24. backgroundColor: '#0C489E',
  25. backgroundPosition: 'right'
  26. }
  27. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  28. const Index = () => {
  29. usePageTitle("msgDetails");
  30. const params = useParams();
  31. const navigate = useNavigate()
  32. const [record, setRecord] = React.useState();
  33. const [onReady, setOnReady] = React.useState(false);
  34. React.useEffect(() => {
  35. loadForm();
  36. }, []);
  37. React.useEffect(() => {
  38. setOnReady(true);
  39. }, [record]);
  40. const loadForm = () => {
  41. if (params.id > 0) {
  42. HttpUtils.get({
  43. url: UrlUtils.GET_MSG_DETAILS + "/" + params.id,
  44. onSuccess: (responseData) => {
  45. if (!responseData?.sentDate) {
  46. navigate("/");
  47. }
  48. setRecord(responseData);
  49. }
  50. });
  51. }
  52. }
  53. return (
  54. !onReady ?
  55. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  56. <Grid item>
  57. <LoadingComponent />
  58. </Grid>
  59. </Grid>
  60. :
  61. (
  62. <Grid container sx={{ minHeight: '110vh', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" >
  63. <Grid item xs={12} width="100%">
  64. <div style={BackgroundHead} width="100%">
  65. <Stack direction="row" height='70px'>
  66. <Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}>
  67. <FormattedMessage id="msgDetails" />
  68. </Typography>
  69. </Stack>
  70. </div>
  71. </Grid>
  72. {/*row 1*/}
  73. <Grid item xs={12} md={12} >
  74. <Grid container justifyContent="flex-start" alignItems="center" >
  75. <center>
  76. <Grid item xs={12} md={12} sx={{p:2}} >
  77. <Typography variant="h3" sx={{ textAlign: "left", borderBottom: "1px solid black" }}>
  78. {record?.subject}
  79. </Typography>
  80. <Typography sx={{p:1}} align="justify">{DateUtils.datetimeStr(record?.sentDate)}</Typography>
  81. <Typography variant="body1" sx={{ p:4, textAlign: "left" }} align="justify" backgroundColor="#f8f8f8">
  82. <div dangerouslySetInnerHTML={{__html: record?.content}}></div>
  83. </Typography>
  84. <Typography variant="h4" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "center" }}>
  85. <Button
  86. component="span"
  87. variant="contained"
  88. size="large"
  89. sx={{ m: 4 }}
  90. onClick={() => {
  91. navigate(-1);
  92. }}
  93. >
  94. <FormattedMessage id="back" />
  95. </Button>
  96. </Typography>
  97. </Grid>
  98. </center>
  99. </Grid>
  100. </Grid>
  101. {/*row 2*/}
  102. </Grid >
  103. )
  104. );
  105. };
  106. export default Index;