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.

100 linhas
3.6 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. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  28. const Index = () => {
  29. const [record, setRecord] = React.useState([]);
  30. const [onReady, setOnReady] = React.useState(false);
  31. const navigate = useNavigate()
  32. React.useLayoutEffect(() => {
  33. loadForm();
  34. }, []);
  35. React.useLayoutEffect(() => {
  36. setOnReady(true);
  37. }, [record]);
  38. const loadForm = () => {
  39. HttpUtils.get({
  40. url: UrlUtils.GET_EMAIL_LIST,
  41. onSuccess: (responseData) => {
  42. setRecord(responseData);
  43. }
  44. });
  45. }
  46. return (
  47. !onReady ?
  48. <LoadingComponent />
  49. :
  50. (
  51. <Grid container sx={{ minHeight: '110vh', backgroundColor: 'backgroundColor.default' }} direction="column" justifyContent="flex-start" alignItems="center" >
  52. <Grid item xs={12} width="100%">
  53. <div style={BackgroundHead} width="100%">
  54. <Stack direction="row" height='70px'>
  55. <Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}>Email Template</Typography>
  56. </Stack>
  57. </div>
  58. </Grid>
  59. {/*row 1*/}
  60. <Grid item xs={12} md={12} lg={12} width="100%">
  61. <MainCard elevation={0}
  62. border={false}
  63. content={false}
  64. >
  65. <EmailTemplateTable
  66. recordList={record}
  67. />
  68. </MainCard>
  69. </Grid>
  70. <Grid container direction="row"
  71. justifyContent="space-between"
  72. alignItems="center">
  73. <Grid item xs={3} md={3} sx={{ ml: 3, mr: 1, mb: 3, mt: 3 }}>
  74. <Button
  75. size="large"
  76. variant="contained"
  77. onClick={()=>{navigate('/emailTemplate/-1')}}
  78. sx={{
  79. textTransform: 'capitalize',
  80. alignItems: 'end'
  81. }}>
  82. <AddCircleOutlineIcon sx={{ mb: 0.5 }} />
  83. <Typography sx={{ ml: 1 }} variant="h5">New Email Template</Typography>
  84. </Button>
  85. </Grid>
  86. </Grid>
  87. </Grid >
  88. )
  89. );
  90. };
  91. export default Index;