|
|
@@ -43,8 +43,14 @@ const Index = () => { |
|
|
dateTo: DateUtils.dateValue(new Date()), |
|
|
dateTo: DateUtils.dateValue(new Date()), |
|
|
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), |
|
|
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), |
|
|
}); |
|
|
}); |
|
|
|
|
|
const [previewSearchCriteria, setPreviewSearchCriteria] = React.useState({ |
|
|
|
|
|
dateTo: DateUtils.dateValue(new Date()), |
|
|
|
|
|
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), |
|
|
|
|
|
}); |
|
|
const [onReady, setOnReady] = React.useState(false); |
|
|
const [onReady, setOnReady] = React.useState(false); |
|
|
const [onGridReady, setGridOnReady] = React.useState(false); |
|
|
const [onGridReady, setGridOnReady] = React.useState(false); |
|
|
|
|
|
const [isPreviewLoading, setIsPreviewLoading] = React.useState(false); |
|
|
|
|
|
|
|
|
const [isPopUp, setIsPopUp] = React.useState(false); |
|
|
const [isPopUp, setIsPopUp] = React.useState(false); |
|
|
const [downloadInput, setDownloadInput] = React.useState(); |
|
|
const [downloadInput, setDownloadInput] = React.useState(); |
|
|
const [selectedIds, setSelectedIds] = React.useState([]); |
|
|
const [selectedIds, setSelectedIds] = React.useState([]); |
|
|
@@ -130,6 +136,20 @@ const Index = () => { |
|
|
setInputDate(input.dateFrom) |
|
|
setInputDate(input.dateFrom) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function previewSearch() { |
|
|
|
|
|
// trigger reload even if criteria object is identical |
|
|
|
|
|
const withToken = { ...searchCriteria, __ts: Date.now() }; |
|
|
|
|
|
setIsPopUp(false); |
|
|
|
|
|
setIsPreviewLoading(true); |
|
|
|
|
|
setPreviewSearchCriteria(withToken); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onPreviewGridOnReady(isLoading) { |
|
|
|
|
|
// FiDataGrid calls this with true/false |
|
|
|
|
|
setIsPreviewLoading(isLoading); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function applyGridOnReady(input) { |
|
|
function applyGridOnReady(input) { |
|
|
setGridOnReady(input); |
|
|
setGridOnReady(input); |
|
|
} |
|
|
} |
|
|
@@ -162,6 +182,7 @@ const Index = () => { |
|
|
onGridReady={onGridReady} |
|
|
onGridReady={onGridReady} |
|
|
selectedIds={selectedIds} |
|
|
selectedIds={selectedIds} |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
</Grid> |
|
|
</Grid> |
|
|
{/*row 2*/} |
|
|
{/*row 2*/} |
|
|
<Grid item xs={12} md={12} lg={12}> |
|
|
<Grid item xs={12} md={12} lg={12}> |
|
|
@@ -179,6 +200,16 @@ const Index = () => { |
|
|
/> |
|
|
/> |
|
|
</MainCard> |
|
|
</MainCard> |
|
|
</Grid> |
|
|
</Grid> |
|
|
|
|
|
<Grid item xs={12} md={12} lg={12} sx={{ml:2}}> |
|
|
|
|
|
<Button |
|
|
|
|
|
variant="contained" |
|
|
|
|
|
onClick={previewSearch} |
|
|
|
|
|
disabled={isPreviewLoading || selectedIds.length === 0} |
|
|
|
|
|
> |
|
|
|
|
|
Preview |
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
|
|
|
|
</Grid> |
|
|
<Grid item xs={12} md={12} lg={12}> |
|
|
<Grid item xs={12} md={12} lg={12}> |
|
|
<MainCard elevation={0} |
|
|
<MainCard elevation={0} |
|
|
border={false} |
|
|
border={false} |
|
|
@@ -186,10 +217,11 @@ const Index = () => { |
|
|
sx={{width: "-webkit-fill-available"}} |
|
|
sx={{width: "-webkit-fill-available"}} |
|
|
> |
|
|
> |
|
|
<EventTable |
|
|
<EventTable |
|
|
searchCriteria={searchCriteria} |
|
|
|
|
|
applyGridOnReady={applyGridOnReady} |
|
|
|
|
|
applySearch={applySearch} |
|
|
|
|
|
|
|
|
previewSearchCriteria={previewSearchCriteria} |
|
|
|
|
|
onPreviewGridOnReady={onPreviewGridOnReady} |
|
|
|
|
|
selectedIds={selectedIds} |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
</MainCard> |
|
|
</MainCard> |
|
|
</Grid> |
|
|
</Grid> |
|
|
<Dialog |
|
|
<Dialog |
|
|
|