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.
 
 

107 line
3.4 KiB

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