Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

107 wiersze
3.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 } from "react";
  10. import axios from "axios";
  11. import { GLD_USER_PATH } from "../../../utils/ApiPathConst";
  12. import * as React from "react";
  13. import Loadable from 'components/Loadable';
  14. import { lazy } from 'react';
  15. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  16. const SearchForm = Loadable(lazy(() => import('./UserSearchForm')));
  17. const EventTable = Loadable(lazy(() => import('./UserTable')));
  18. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  19. const BackgroundHead = {
  20. backgroundImage: `url(${titleBackgroundImg})`,
  21. width: '100%',
  22. height: '100%',
  23. backgroundSize: 'contain',
  24. backgroundRepeat: 'no-repeat',
  25. backgroundColor: '#0C489E',
  26. backgroundPosition: 'right'
  27. }
  28. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  29. const UserSettingPage = () => {
  30. const [record, setRecord] = useState([]);
  31. const [searchCriteria, setSearchCriteria] = useState({});
  32. const [onReady, setOnReady] = useState(false);
  33. const [changelocked, setChangeLocked] = React.useState(false);
  34. React.useLayoutEffect(() => {
  35. getUserList();
  36. }, [changelocked]);
  37. useEffect(() => {
  38. if (record.length > 0) {
  39. setOnReady(true);
  40. }
  41. }, [record]);
  42. React.useLayoutEffect(() => {
  43. getUserList();
  44. }, [searchCriteria]);
  45. function getUserList() {
  46. axios.get(`${GLD_USER_PATH}`,
  47. { params: searchCriteria }
  48. )
  49. .then((response) => {
  50. if (response.status === 200) {
  51. setRecord(response.data);
  52. }
  53. })
  54. .catch(error => {
  55. console.log(error);
  56. return false;
  57. });
  58. }
  59. function applySearch(input) {
  60. setSearchCriteria(input);
  61. }
  62. return (
  63. !onReady ?
  64. <LoadingComponent />
  65. :
  66. <Grid container sx={{ minHeight: '90vh', backgroundColor: "backgroundColor.default" }} direction="column">
  67. <Grid item xs={12}>
  68. <div style={BackgroundHead}>
  69. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  70. <Typography ml={15} color='#FFF' variant="h4">View GLD User</Typography>
  71. </Stack>
  72. </div>
  73. </Grid>
  74. {/*row 1*/}
  75. <Grid item xs={12} md={12} lg={12}>
  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. setChangeLocked={setChangeLocked}
  87. />
  88. </MainCard>
  89. </Grid>
  90. </Grid>
  91. );
  92. };
  93. export default UserSettingPage;