選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

118 行
4.3 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. <LoadingComponent />
  54. :
  55. (
  56. <Grid container sx={{ minHeight: '110vh', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" >
  57. <Grid item xs={12} width="100%">
  58. <div style={BackgroundHead} width="100%">
  59. <Stack direction="row" height='70px'>
  60. <Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}>
  61. <FormattedMessage id="msgDetails" />
  62. </Typography>
  63. </Stack>
  64. </div>
  65. </Grid>
  66. {/*row 1*/}
  67. <Grid item xs={12} md={12} >
  68. <Grid container justifyContent="flex-start" alignItems="center" >
  69. <center>
  70. <Grid item xs={12} md={12} sx={{p:2}} >
  71. <Typography variant="h2" sx={{ textAlign: "left", borderBottom: "1px solid black" }}>
  72. {record?.subject}
  73. </Typography>
  74. <Typography sx={{p:1}} align="justify">{DateUtils.datetimeStr(record?.sentDate)}</Typography>
  75. <Typography variant="body1" sx={{ p:4, textAlign: "left" }} align="justify" backgroundColor="#f8f8f8">
  76. <div dangerouslySetInnerHTML={{__html: record?.content}}></div>
  77. </Typography>
  78. <Typography variant="h3" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "center" }}>
  79. <Button
  80. component="span"
  81. variant="contained"
  82. size="large"
  83. sx={{ m: 4 }}
  84. onClick={() => {
  85. navigate(-1);
  86. }}
  87. >
  88. <FormattedMessage id="back" />
  89. </Button>
  90. </Typography>
  91. </Grid>
  92. </center>
  93. </Grid>
  94. </Grid>
  95. {/*row 2*/}
  96. </Grid >
  97. )
  98. );
  99. };
  100. export default Index;