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.

133 lines
4.2 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 React from "react";
  9. import * as UrlUtils from "utils/ApiPathConst";
  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. const BackgroundHead = {
  18. backgroundImage: `url(${titleBackgroundImg})`,
  19. width: '100%',
  20. height: '100%',
  21. backgroundSize: 'contain',
  22. backgroundRepeat: 'no-repeat',
  23. backgroundColor: '#0C489E',
  24. backgroundPosition: 'right'
  25. }
  26. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  27. const UserSearchPage_Individual = () => {
  28. const [record, setRecord] = React.useState([]);
  29. const [orgCombo, setOrgCombo] = React.useState([]);
  30. const [issueCombo, setIssueCombo] = React.useState([]);
  31. const [searchCriteria, setSearchCriteria] = React.useState({
  32. dateTo: DateUtils.dateValue(new Date()),
  33. dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)),
  34. });
  35. const [onReady, setOnReady] = React.useState(false);
  36. React.useEffect(() => {
  37. getDataList();
  38. getOrgCombo();
  39. getIssueCombo();
  40. }, []);
  41. React.useEffect(() => {
  42. setOnReady(true);
  43. }, [record]);
  44. React.useEffect(() => {
  45. getDataList();
  46. }, [searchCriteria]);
  47. function getDataList() {
  48. HttpUtils.get({
  49. url: UrlUtils.GET_PUBLIC_NOTICE_LIST,
  50. params: searchCriteria,
  51. onSuccess: function (responseData) {
  52. setRecord(responseData);
  53. }
  54. });
  55. }
  56. function getOrgCombo() {
  57. HttpUtils.get({
  58. url: UrlUtils.GET_ORG_COMBO,
  59. onSuccess: function (responseData) {
  60. let combo = responseData;
  61. setOrgCombo(combo);
  62. }
  63. });
  64. }
  65. function getIssueCombo() {
  66. HttpUtils.get({
  67. url: UrlUtils.GET_ISSUE_COMBO,
  68. onSuccess: function (responseData) {
  69. let combo = responseData;
  70. setIssueCombo(combo);
  71. }
  72. });
  73. }
  74. function applySearch(input) {
  75. setSearchCriteria(input);
  76. }
  77. return (
  78. !onReady ?
  79. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  80. <Grid item>
  81. <LoadingComponent />
  82. </Grid>
  83. </Grid>
  84. :
  85. <Grid container sx={{ minHeight: '87vh',backgroundColor: 'backgroundColor.default' }} direction="column">
  86. <Grid item xs={12}>
  87. <div style={BackgroundHead}>
  88. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  89. <Typography ml={15} color='#FFF' variant="h4">Application</Typography>
  90. </Stack>
  91. </div>
  92. </Grid>
  93. {/*row 1*/}
  94. <Grid item xs={12} md={12} lg={12} sx={{mb: -1}}>
  95. <SearchForm
  96. applySearch={applySearch}
  97. orgComboData={orgCombo}
  98. issueComboData={issueCombo}
  99. searchCriteria={searchCriteria}
  100. />
  101. </Grid>
  102. {/*row 2*/}
  103. <Grid item xs={12} md={12} lg={12}>
  104. <MainCard elevation={0}
  105. border={false}
  106. content={false}
  107. sx={{ backgroundColor: '#fff' }}
  108. >
  109. <EventTable
  110. recordList={record}
  111. reloadFunction={getDataList}
  112. />
  113. </MainCard>
  114. </Grid>
  115. </Grid>
  116. );
  117. }
  118. export default UserSearchPage_Individual;