Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

110 řádky
3.8 KiB

  1. // material-ui
  2. import {
  3. // Box,
  4. Stack,
  5. // Button,
  6. Grid, Typography
  7. } from '@mui/material';
  8. import MainCard from "components/MainCard";
  9. import { useEffect, useState } from "react";
  10. import * as React from "react";
  11. import { getSearchCriteria } from "auth/utils";
  12. //import LoadingComponent from "../extra-pages/LoadingComponent";
  13. // import UserGroupSearchForm from "./UserGroupSearchForm";
  14. // import UserGroupTable from "./UserGroupTable";
  15. import Loadable from 'components/Loadable';
  16. import { lazy } from 'react';
  17. const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent')));
  18. const UserGroupSearchForm = Loadable(lazy(() => import('./UserGroupSearchForm')));
  19. const UserGroupTable = Loadable(lazy(() => import('./UserGroupTable')));
  20. // import {useNavigate} from "react-router";
  21. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  22. const BackgroundHead = {
  23. backgroundImage: `url(${titleBackgroundImg})`,
  24. width: '100%',
  25. height: '100%',
  26. backgroundSize: 'contain',
  27. backgroundRepeat: 'no-repeat',
  28. backgroundColor: '#0C489E',
  29. backgroundPosition: 'right'
  30. }
  31. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  32. const UserGroupSearchPanel = () => {
  33. const [searchCriteria, setSearchCriteria] = useState({});
  34. const [onReady, setOnReady] = useState(false);
  35. const [onGridReady, setGridOnReady] = useState(false);
  36. useEffect(() => {
  37. if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){
  38. setSearchCriteria(getSearchCriteria(window.location.pathname))
  39. }else{
  40. localStorage.setItem('searchCriteria',"")
  41. setSearchCriteria({})
  42. }
  43. }, []);
  44. useEffect(() => {
  45. setOnReady(true);
  46. }, [searchCriteria]);
  47. function applySearch(input) {
  48. setGridOnReady(true)
  49. setSearchCriteria(input);
  50. localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input}))
  51. }
  52. function applyGridOnReady(input) {
  53. setGridOnReady(input);
  54. }
  55. return (
  56. !onReady ?
  57. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  58. <Grid item>
  59. <LoadingComponent />
  60. </Grid>
  61. </Grid>
  62. :
  63. <Grid container sx={{ minHeight: '87vh', backgroundColor: "backgroundColor.default"}} direction="column">
  64. <Grid item xs={12}>
  65. <div style={BackgroundHead}>
  66. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  67. <Typography ml={15} color='#FFF' variant="h4" sx={{ "textShadow": "0px 0px 25px #0c489e" }}>
  68. View User Group
  69. </Typography>
  70. </Stack>
  71. </div>
  72. </Grid>
  73. {/*row 1*/}
  74. <Grid item xs={12} md={12} lg={12} sx={{mb:-1}}>
  75. <UserGroupSearchForm
  76. applySearch={applySearch}
  77. onGridReady={onGridReady}
  78. searchCriteria={searchCriteria}
  79. />
  80. </Grid>
  81. {/*row 2*/}
  82. <Grid item xs={12} md={12} lg={12}>
  83. <MainCard elevation={0}
  84. border={false}
  85. content={false}
  86. >
  87. <UserGroupTable
  88. searchCriteria={searchCriteria}
  89. applyGridOnReady={applyGridOnReady}
  90. applySearch={applySearch}
  91. />
  92. </MainCard>
  93. </Grid>
  94. </Grid>
  95. );
  96. };
  97. export default UserGroupSearchPanel;