Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

106 linhas
3.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 Loadable from 'components/Loadable';
  12. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  13. const EmailTemplateTable = Loadable(React.lazy(() => import('pages/EmailTemplate/Search_GLD/DataGrid')))
  14. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  15. import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline';
  16. import MainCard from 'components/MainCard';
  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. import { useNavigate } from "react-router";
  27. import {PNSPS_LONG_BUTTON_THEME} from "../../../themes/buttonConst";
  28. import {ThemeProvider} from "@emotion/react";
  29. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  30. const Index = () => {
  31. const [record, setRecord] = React.useState([]);
  32. const [onReady, setOnReady] = React.useState(false);
  33. const navigate = useNavigate()
  34. React.useLayoutEffect(() => {
  35. loadForm();
  36. }, []);
  37. React.useLayoutEffect(() => {
  38. setOnReady(true);
  39. }, [record]);
  40. const loadForm = () => {
  41. HttpUtils.get({
  42. url: UrlUtils.GET_EMAIL_LIST,
  43. onSuccess: (responseData) => {
  44. setRecord(responseData);
  45. }
  46. });
  47. }
  48. return (
  49. !onReady ?
  50. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  51. <Grid item>
  52. <LoadingComponent />
  53. </Grid>
  54. </Grid>
  55. :
  56. (
  57. <Grid container sx={{ backgroundColor: 'backgroundColor.default' }} direction="column" justifyContent="flex-start" alignItems="center" >
  58. <Grid item xs={12} width="100%">
  59. <div style={BackgroundHead} width="100%">
  60. <Stack direction="row" height='70px'>
  61. <Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}>Email Template</Typography>
  62. </Stack>
  63. </div>
  64. </Grid>
  65. {/*row 1*/}
  66. <Grid item xs={12} md={12} lg={12} width="100%">
  67. <MainCard elevation={0}
  68. border={false}
  69. content={false}
  70. >
  71. <EmailTemplateTable
  72. recordList={record}
  73. />
  74. </MainCard>
  75. </Grid>
  76. <Grid container direction="row"
  77. justifyContent="space-between"
  78. alignItems="center">
  79. <Grid item xs={3} md={3} sx={{ mb:3, ml: 3, mr: 1 }}>
  80. <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
  81. <Button
  82. variant="contained"
  83. onClick={()=>{navigate('/setting/emailTemplate/-1')}}
  84. startIcon={<AddCircleOutlineIcon/>}
  85. >
  86. New Email Template
  87. </Button>
  88. </ThemeProvider>
  89. </Grid>
  90. </Grid>
  91. </Grid >
  92. )
  93. );
  94. };
  95. export default Index;