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.
 
 

88 lines
2.9 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Stack,
  6. // Button
  7. } from '@mui/material';
  8. import MainCard from "components/MainCard";
  9. import { useEffect, useState } from "react";
  10. import * as DateUtils from "utils/DateUtils";
  11. import Loadable from 'components/Loadable';
  12. import { lazy } from 'react';
  13. const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent')));
  14. const SearchForm = Loadable(lazy(() => import('./AuditLogSearchForm')));
  15. const EventTable = Loadable(lazy(() => import('./AuditLogTable')));
  16. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  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 AuditLogPage = () => {
  28. const [searchCriteria, setSearchCriteria] = useState({
  29. modifiedTo: DateUtils.dateValue(new Date()),
  30. modifiedFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)),
  31. });
  32. const [onReady, setOnReady] = useState(false);
  33. useEffect(() => {
  34. setOnReady(true);
  35. }, [searchCriteria]);
  36. function applySearch(input) {
  37. setSearchCriteria(input);
  38. }
  39. return (
  40. !onReady ?
  41. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  42. <Grid item>
  43. <LoadingComponent />
  44. </Grid>
  45. </Grid>
  46. :
  47. <Grid container sx={{ minHeight: '87vh', backgroundColor: "backgroundColor.default" }} direction="column">
  48. <Grid item xs={12}>
  49. <div style={BackgroundHead}>
  50. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  51. <Typography ml={15} color='#FFF' variant="h4" sx={{ "textShadow": "0px 0px 25px #0C489E" }}>Audit Log</Typography>
  52. </Stack>
  53. </div>
  54. </Grid>
  55. {/*row 1*/}
  56. <Grid item xs={12} md={12} lg={12} sx={{mb:-1}}>
  57. <SearchForm
  58. applySearch={applySearch}
  59. searchCriteria={searchCriteria}
  60. />
  61. </Grid>
  62. {/*row 2*/}
  63. <Grid item xs={12} md={12} lg={12}>
  64. <MainCard elevation={0}
  65. border={false}
  66. content={false}
  67. >
  68. <EventTable
  69. searchCriteria={searchCriteria}
  70. />
  71. </MainCard>
  72. </Grid>
  73. </Grid>
  74. );
  75. };
  76. export default AuditLogPage;