// material-ui import { Grid, Typography, Stack } from '@mui/material'; import MainCard from "components/MainCard"; import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; import * as DateUtils from "utils/DateUtils"; import {GET_ORG_COMBO, GET_ISSUE_COMBO} from "utils/ApiPathConst"; import { getSearchCriteria } from "auth/utils"; import Loadable from 'components/Loadable'; const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' const BackgroundHead = { backgroundImage: `url(${titleBackgroundImg})`, width: '100%', height: '100%', backgroundSize: 'contain', backgroundRepeat: 'no-repeat', backgroundColor: '#0C489E', backgroundPosition: 'right' } // ==============================|| DASHBOARD - DEFAULT ||============================== // const UserSearchPage_Individual = () => { const [orgCombo, setOrgCombo] = React.useState([]); const [issueCombo, setIssueCombo] = React.useState([]); const [searchCriteria, setSearchCriteria] = React.useState({}); const [onReady, setOnReady] = React.useState(false); const [onGridReady, setGridOnReady] = React.useState(false); React.useEffect(() => { getOrgCombo(); getIssueCombo(); if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ setSearchCriteria(getSearchCriteria(window.location.pathname)) }else{ localStorage.setItem('searchCriteria',"") setSearchCriteria({ dateTo: DateUtils.dateValue(new Date()), dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), }) } }, []); React.useEffect(() => { setOnReady(true); }, [searchCriteria]); function getOrgCombo() { HttpUtils.get({ url: GET_ORG_COMBO, onSuccess: function (responseData) { let combo = responseData; setOrgCombo(combo); } }); } function getIssueCombo() { HttpUtils.get({ url: GET_ISSUE_COMBO, onSuccess: function (responseData) { let combo = responseData; setIssueCombo(combo); } }); } function applySearch(input) { setGridOnReady(true) setSearchCriteria(input); localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) } function applyGridOnReady(input) { setGridOnReady(input); } return ( !onReady ? :
Proof
{/*row 1*/} {/*row 2*/}
); }; export default UserSearchPage_Individual;