// material-ui
import {
Grid,
Typography,
Stack
} from '@mui/material';
import MainCard from "components/MainCard";
// import * as UrlUtils from "utils/ApiPathConst";
import * as React from "react";
// import * as HttpUtils from "utils/HttpUtils";
import * as DateUtils from "utils/DateUtils";
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'
import {FormattedMessage} from "react-intl";
import { getSearchCriteria } from "auth/utils";
const BackgroundHead = {
backgroundImage: `url(${titleBackgroundImg})`,
width: '100%',
height: '100%',
backgroundSize:'contain',
backgroundRepeat: 'no-repeat',
backgroundColor: '#0C489E',
backgroundPosition: 'right'
}
// ==============================|| DASHBOARD - DEFAULT ||============================== //
const Index = () => {
const [searchCriteria, setSearchCriteria] = React.useState({});
const [onReady, setOnReady] = React.useState(false);
const [onGridReady, setGridOnReady] = React.useState(false);
React.useEffect(() => {
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(() => {
if(Object.keys(searchCriteria).length>0){
setOnReady(true);
}
}, [searchCriteria]);
// function loadGrid(){
// HttpUtils.get({
// url: UrlUtils.GET_MSG_LIST,
// params: searchCriteria,
// onSuccess: function(responseData){
// setRecord(responseData);
// }
// });
// }
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 ?
:
{/*row 1*/}
{/*row 2*/}
);
};
export default Index;