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.
 
 

129 regels
4.2 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, lazy } from "react";
  10. import { getSearchCriteria } from "auth/utils";
  11. import Loadable from 'components/Loadable';
  12. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  13. const SearchForm = Loadable(lazy(() => import('./UserSearchForm')));
  14. const EventTable = Loadable(lazy(() => import('./UserTable')));
  15. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  16. const BackgroundHead = {
  17. backgroundImage: `url(${titleBackgroundImg})`,
  18. width: '100%',
  19. height: '100%',
  20. backgroundSize: 'contain',
  21. backgroundRepeat: 'no-repeat',
  22. backgroundColor: '#0C489E',
  23. backgroundPosition: 'right'
  24. }
  25. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  26. const UserSettingPage = () => {
  27. // const [record, setRecord] = useState([]);
  28. const [searchCriteria, setSearchCriteria] = useState({});
  29. const [onReady, setOnReady] = useState(false);
  30. const [onGridReady, setGridOnReady] = useState(false);
  31. //const [changelocked, setChangeLocked] = useState(false);
  32. // useLayoutEffect(() => {
  33. // getUserList();
  34. // }, [changelocked]);
  35. useEffect(() => {
  36. if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){
  37. setSearchCriteria(getSearchCriteria(window.location.pathname))
  38. }else{
  39. localStorage.setItem('searchCriteria',"")
  40. setSearchCriteria({})
  41. }
  42. }, []);
  43. useEffect(() => {
  44. setOnReady(true);
  45. }, [searchCriteria]);
  46. // useLayoutEffect(() => {
  47. // getUserList();
  48. // }, [searchCriteria]);
  49. // function getUserList() {
  50. // axios.get(`${GLD_USER_PATH}`,
  51. // { params: searchCriteria }
  52. // )
  53. // .then((response) => {
  54. // if (response.status === 200) {
  55. // setRecord(response.data);
  56. // }
  57. // })
  58. // .catch(error => {
  59. // console.log(error);
  60. // return false;
  61. // });
  62. // }
  63. function applySearch(input) {
  64. setGridOnReady(true)
  65. setSearchCriteria(input);
  66. localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input}))
  67. }
  68. function applyGridOnReady(input) {
  69. setGridOnReady(input);
  70. }
  71. return (
  72. !onReady ?
  73. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  74. <Grid item>
  75. <LoadingComponent />
  76. </Grid>
  77. </Grid>
  78. :
  79. <Grid container sx={{ minHeight: '87vh', backgroundColor: "backgroundColor.default" }} direction="column">
  80. <Grid item xs={12}>
  81. <div style={BackgroundHead}>
  82. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  83. <Typography ml={15} color='#FFF' variant="h4" sx={{ "textShadow": "0px 0px 25px #0C489E" }}>View GLD User</Typography>
  84. </Stack>
  85. </div>
  86. </Grid>
  87. {/*row 1*/}
  88. <Grid item xs={12} md={12} lg={12} sx={{mb:-1}}>
  89. <SearchForm
  90. applySearch={applySearch}
  91. onGridReady={onGridReady}
  92. searchCriteria={searchCriteria}
  93. />
  94. </Grid>
  95. {/*row 2*/}
  96. <Grid item xs={12} md={12} lg={12}>
  97. <MainCard elevation={0}
  98. border={false}
  99. content={false}
  100. >
  101. <EventTable
  102. searchCriteria={searchCriteria}
  103. applyGridOnReady={applyGridOnReady}
  104. applySearch={applySearch}
  105. // setChangeLocked={setChangeLocked}
  106. />
  107. </MainCard>
  108. </Grid>
  109. </Grid>
  110. );
  111. };
  112. export default UserSettingPage;