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.
 
 

105 lines
3.5 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Stack
  6. } from '@mui/material';
  7. import MainCard from "components/MainCard";
  8. import * as UrlUtils from "utils/ApiPathConst";
  9. import * as React from "react";
  10. import * as HttpUtils from "utils/HttpUtils";
  11. import * as DateUtils from "utils/DateUtils";
  12. import Loadable from 'components/Loadable';
  13. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  14. const SearchForm = Loadable(React.lazy(() => import('./SearchForm')));
  15. const EventTable = Loadable(React.lazy(() => import('./DataGrid')));
  16. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  17. import { FormattedMessage } from "react-intl";
  18. const BackgroundHead = {
  19. backgroundImage: `url(${titleBackgroundImg})`,
  20. width: '100%',
  21. height: '100%',
  22. backgroundSize: 'contain',
  23. backgroundRepeat: 'no-repeat',
  24. backgroundColor: '#0C489E',
  25. backgroundPosition: 'right'
  26. }
  27. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  28. const UserSearchPage_Individual = () => {
  29. const [record, setRecord] = React.useState([]);
  30. const [searchCriteria, setSearchCriteria] = React.useState({
  31. dateTo: DateUtils.dateStr(new Date()),
  32. dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate() - 90)),
  33. });
  34. const [onReady, setOnReady] = React.useState(false);
  35. React.useEffect(() => {
  36. getDataList();
  37. }, []);
  38. React.useEffect(() => {
  39. setOnReady(true);
  40. }, [record]);
  41. React.useEffect(() => {
  42. getDataList();
  43. }, [searchCriteria]);
  44. function getDataList() {
  45. HttpUtils.get({
  46. url: UrlUtils.GET_ANNOUNCE_LIST,
  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: '95vh',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"><FormattedMessage id="announcement" /></Typography>
  69. </Stack>
  70. </div>
  71. </Grid>
  72. {/*row 1*/}
  73. <Grid item xs={12} md={12} lg={12} sx={{mb: -1}}>
  74. <SearchForm
  75. applySearch={applySearch}
  76. searchCriteria={searchCriteria}
  77. />
  78. </Grid>
  79. {/*row 2*/}
  80. <Grid item xs={12} md={12} lg={12}>
  81. <MainCard elevation={0}
  82. border={false}
  83. content={false}
  84. sx={{ backgroundColor: '#fff' }}
  85. >
  86. <EventTable
  87. recordList={record}
  88. />
  89. </MainCard>
  90. </Grid>
  91. </Grid>
  92. );
  93. }
  94. export default UserSearchPage_Individual;