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.
 
 

128 line
3.9 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. 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.dateStr(new Date()),
  33. dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)),
  34. });
  35. const [onReady, setOnReady] = React.useState(false);
  36. React.useEffect(() => {
  37. getUserList();
  38. getOrgCombo();
  39. getIssueCombo();
  40. }, []);
  41. React.useEffect(() => {
  42. setOnReady(true);
  43. }, [record]);
  44. React.useEffect(() => {
  45. getUserList();
  46. }, [searchCriteria]);
  47. function getUserList(){
  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. <LoadingComponent/>
  80. :
  81. <Grid container sx={{minHeight: '85vh',backgroundColor:'#ffffff'}} direction="column">
  82. <Grid item xs={12}>
  83. <div style={BackgroundHead}>
  84. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  85. <Typography ml={15} color='#FFF' variant="h4">Application</Typography>
  86. </Stack>
  87. </div>
  88. </Grid>
  89. {/*row 1*/}
  90. <Grid item xs={12} md={12} lg={12}>
  91. <SearchForm
  92. applySearch={applySearch}
  93. orgComboData={orgCombo}
  94. issueComboData={issueCombo}
  95. searchCriteria={searchCriteria}
  96. />
  97. </Grid>
  98. {/*row 2*/}
  99. <Grid item xs={12} md={12} lg={12}>
  100. <MainCard elevation={0}
  101. border={false}
  102. content={false}
  103. >
  104. <EventTable
  105. recordList={record}
  106. />
  107. </MainCard>
  108. </Grid>
  109. </Grid>
  110. );
  111. };
  112. export default UserSearchPage_Individual;