|
|
@@ -9,6 +9,12 @@ import { FormattedMessage, useIntl } from "react-intl"; |
|
|
import { TablePagination, Typography } from '@mui/material'; |
|
|
import { TablePagination, Typography } from '@mui/material'; |
|
|
import { getSearchCriteria, checkSearchCriteriaPath } from "auth/utils"; |
|
|
import { getSearchCriteria, checkSearchCriteriaPath } from "auth/utils"; |
|
|
|
|
|
|
|
|
|
|
|
/** When Gazette Issue No. is selected, load all matching rows (no start/limit). */ |
|
|
|
|
|
function hasGazetteIssueFilter(params) { |
|
|
|
|
|
const issueId = params?.issueId; |
|
|
|
|
|
return issueId != null && issueId !== ""; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// ==============================|| EVENT TABLE ||============================== // |
|
|
// ==============================|| EVENT TABLE ||============================== // |
|
|
|
|
|
|
|
|
export function FiDataGrid({ rows, columns, sx, autoHeight = true, |
|
|
export function FiDataGrid({ rows, columns, sx, autoHeight = true, |
|
|
@@ -107,8 +113,13 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, |
|
|
delete params.sort; |
|
|
delete params.sort; |
|
|
delete params.direction; |
|
|
delete params.direction; |
|
|
} |
|
|
} |
|
|
params.start = 0; |
|
|
|
|
|
params.limit = pageSize; |
|
|
|
|
|
|
|
|
if (hasGazetteIssueFilter(params)) { |
|
|
|
|
|
delete params.start; |
|
|
|
|
|
delete params.limit; |
|
|
|
|
|
} else { |
|
|
|
|
|
params.start = 0; |
|
|
|
|
|
params.limit = pageSize; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (applySearch != undefined) { |
|
|
if (applySearch != undefined) { |
|
|
applySearch(params); |
|
|
applySearch(params); |
|
|
@@ -118,6 +129,9 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const ignorePaging = hasGazetteIssueFilter(_doLoad?.params); |
|
|
|
|
|
const effectivePagination = pagination && !ignorePaging; |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
getDataList(); |
|
|
getDataList(); |
|
|
}, [_doLoad, page]); |
|
|
}, [_doLoad, page]); |
|
|
@@ -201,8 +215,13 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, |
|
|
if (_doLoad.params == undefined) return; |
|
|
if (_doLoad.params == undefined) return; |
|
|
if (_doLoad.params.searchCriteria !== undefined) return; |
|
|
if (_doLoad.params.searchCriteria !== undefined) return; |
|
|
if (_doLoad.params == null) _doLoad.params = {}; |
|
|
if (_doLoad.params == null) _doLoad.params = {}; |
|
|
_doLoad.params.start = page * pageSize; |
|
|
|
|
|
_doLoad.params.limit = pageSize; |
|
|
|
|
|
|
|
|
if (hasGazetteIssueFilter(_doLoad.params)) { |
|
|
|
|
|
delete _doLoad.params.start; |
|
|
|
|
|
delete _doLoad.params.limit; |
|
|
|
|
|
} else { |
|
|
|
|
|
_doLoad.params.start = page * pageSize; |
|
|
|
|
|
_doLoad.params.limit = pageSize; |
|
|
|
|
|
} |
|
|
if(checkSearchCriteriaPath(window.location.pathname)){ |
|
|
if(checkSearchCriteriaPath(window.location.pathname)){ |
|
|
if(window.location.pathname === "/publicNotice"){ |
|
|
if(window.location.pathname === "/publicNotice"){ |
|
|
if (tab != undefined && tab ==="application"){ |
|
|
if (tab != undefined && tab ==="application"){ |
|
|
@@ -289,13 +308,13 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, |
|
|
disableColumnMenu |
|
|
disableColumnMenu |
|
|
shrinkWrap |
|
|
shrinkWrap |
|
|
rowModesModel={_rowModesModel} |
|
|
rowModesModel={_rowModesModel} |
|
|
pageSizeOptions={pagination ? _pageSizeOptions : []} |
|
|
|
|
|
|
|
|
pageSizeOptions={effectivePagination ? _pageSizeOptions : []} |
|
|
editMode={_editMode} |
|
|
editMode={_editMode} |
|
|
autoHeight={effectiveAutoHeight} |
|
|
autoHeight={effectiveAutoHeight} |
|
|
hideFooterSelectedRowCount={myHideFooterSelectedRowCount} |
|
|
hideFooterSelectedRowCount={myHideFooterSelectedRowCount} |
|
|
filterModel={{ items: _filterItems }} |
|
|
filterModel={{ items: _filterItems }} |
|
|
loading={loading} |
|
|
loading={loading} |
|
|
paginationMode={pagination ? "server" : undefined} |
|
|
|
|
|
|
|
|
paginationMode={effectivePagination ? "server" : undefined} |
|
|
sortingMode={serverSorting ? "server" : undefined} |
|
|
sortingMode={serverSorting ? "server" : undefined} |
|
|
sortModel={serverSorting ? sortModel : undefined} |
|
|
sortModel={serverSorting ? sortModel : undefined} |
|
|
onSortModelChange={serverSorting ? handleSortModelChange : undefined} |
|
|
onSortModelChange={serverSorting ? handleSortModelChange : undefined} |
|
|
@@ -306,7 +325,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, |
|
|
overflowX: height || maxHeight ? 'auto' : 'visible', |
|
|
overflowX: height || maxHeight ? 'auto' : 'visible', |
|
|
}, |
|
|
}, |
|
|
// 👇 completely hide the footer when pagination is off |
|
|
// 👇 completely hide the footer when pagination is off |
|
|
...(pagination === false && { |
|
|
|
|
|
|
|
|
...(!effectivePagination && { |
|
|
'& .MuiDataGrid-footerContainer': { |
|
|
'& .MuiDataGrid-footerContainer': { |
|
|
display: 'none', |
|
|
display: 'none', |
|
|
}, |
|
|
}, |
|
|
@@ -314,7 +333,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, |
|
|
}} |
|
|
}} |
|
|
components={{ |
|
|
components={{ |
|
|
NoRowsOverlay: CustomNoRowsOverlay, |
|
|
NoRowsOverlay: CustomNoRowsOverlay, |
|
|
...(pagination |
|
|
|
|
|
|
|
|
...(effectivePagination |
|
|
? { |
|
|
? { |
|
|
Pagination: () => ( |
|
|
Pagination: () => ( |
|
|
<TablePagination |
|
|
<TablePagination |
|
|
|