Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

130 строки
4.6 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 { getSearchCriteria } from "auth/utils";
  13. import Loadable from 'components/Loadable';
  14. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  15. const SearchForm = Loadable(React.lazy(() => import('./SearchForm')));
  16. const EventTable = Loadable(React.lazy(() => import('./DataGrid')));
  17. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  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 [issueCombo, setIssueCombo] = React.useState([]);
  30. const [searchCriteria, setSearchCriteria] = React.useState({
  31. // dateTo: DateUtils.dateValue(new Date()),
  32. // dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)),
  33. // dueDateTo: DateUtils.dateValue(new Date()),
  34. // dueDateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)),
  35. });
  36. const [onReady, setOnReady] = React.useState(false);
  37. const [onGridReady, setGridOnReady] = React.useState(false);
  38. React.useEffect(() => {
  39. getIssueCombo();
  40. if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){
  41. setSearchCriteria(getSearchCriteria(window.location.pathname))
  42. }else{
  43. localStorage.setItem('searchCriteria',"")
  44. setSearchCriteria({
  45. dateTo: DateUtils.dateValue(new Date()),
  46. dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)),
  47. })
  48. }
  49. }, []);
  50. React.useEffect(() => {
  51. setOnReady(true);
  52. }, [searchCriteria]);
  53. function getIssueCombo() {
  54. HttpUtils.get({
  55. url: UrlUtils.GET_ISSUE_COMBO,
  56. onSuccess: function (responseData) {
  57. let combo = responseData;
  58. setIssueCombo(combo);
  59. }
  60. });
  61. }
  62. function applySearch(input) {
  63. setGridOnReady(true)
  64. setSearchCriteria(input);
  65. localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input}))
  66. }
  67. function applyGridOnReady(input) {
  68. setGridOnReady(input);
  69. }
  70. return (
  71. !onReady ?
  72. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  73. <Grid item>
  74. <LoadingComponent />
  75. </Grid>
  76. </Grid>
  77. :
  78. <Grid container sx={{ minHeight: '87vh', backgroundColor: 'backgroundColor.default' }} direction="column">
  79. <Grid item xs={12}>
  80. <div style={BackgroundHead}>
  81. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  82. <Typography ml={15} color='#FFF' variant="h4" sx={{ "textShadow": "0px 0px 25px #1976d2" }}>
  83. Demand Note
  84. </Typography>
  85. </Stack>
  86. </div>
  87. </Grid>
  88. {/*row 1*/}
  89. <Grid item xs={12} md={12} lg={12} sx={{mb: -1}}>
  90. <SearchForm
  91. applySearch={applySearch}
  92. issueComboData={issueCombo}
  93. searchCriteria={searchCriteria}
  94. onGridReady={onGridReady}
  95. />
  96. </Grid>
  97. {/*row 2*/}
  98. <Grid item xs={12} md={12} lg={12}>
  99. <MainCard elevation={0}
  100. border={false}
  101. content={false}
  102. sx={{ backgroundColor: '#fff' }}
  103. >
  104. <EventTable
  105. applySearch={applySearch}
  106. searchCriteria={searchCriteria}
  107. applyGridOnReady={applyGridOnReady}
  108. />
  109. </MainCard>
  110. </Grid>
  111. </Grid>
  112. );
  113. }
  114. export default UserSearchPage_Individual;