@@ -150,7 +150,7 @@ export const checkSearchCriteriaPath = (path) =>{ | |||
if(!path.startsWith("/application") | |||
|| path === "/application/search"){ | |||
if(!path.startsWith("/user/")){ | |||
if(!path.startsWith("/publicNotice/")){ | |||
if(!path.startsWith("/publicNotice/")|| path === "/publicNotice"){ | |||
return true | |||
} | |||
} | |||
@@ -12,7 +12,7 @@ import { getSearchCriteria, checkSearchCriteriaPath } from "auth/utils"; | |||
export function FiDataGrid({ rows, columns, sx, autoHeight, | |||
hideFooterSelectedRowCount, rowModesModel, editMode, | |||
pageSizeOptions, filterItems, customPageSize, doLoad, applyGridOnReady, applySearch, ...props }) { | |||
pageSizeOptions, filterItems, customPageSize, doLoad, applyGridOnReady, applySearch, tab, ...props }) { | |||
const intl = useIntl(); | |||
const [_rows, set_rows] = useState([]); | |||
const [_doLoad, set_doLoad] = useState({}); | |||
@@ -148,7 +148,13 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||
_doLoad.params.start = page * pageSize; | |||
_doLoad.params.limit = pageSize; | |||
if(checkSearchCriteriaPath(window.location.pathname)){ | |||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) | |||
if(window.location.pathname === "/publicNotice"){ | |||
if (tab != undefined && tab ==="application"){ | |||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) | |||
} | |||
}else if (window.location.pathname != "/publicNotice"){ | |||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) | |||
} | |||
} | |||
HttpUtils.get({ | |||
@@ -24,7 +24,7 @@ import {LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider"; | |||
import {AdapterDayjs} from "@mui/x-date-pickers/AdapterDayjs"; | |||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||
const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => { | |||
const intl = useIntl(); | |||
const [type, setType] = React.useState([]); | |||
const [status, setStatus] = React.useState(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); | |||
@@ -328,6 +328,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||
<Button | |||
variant="contained" | |||
type="submit" | |||
disabled={onGridReady} | |||
aria-label={intl.formatMessage({id: 'search'})} | |||
> | |||
<Typography variant="pnspsButtonText"> | |||
@@ -18,6 +18,7 @@ const UserSearchPage_Individual = () => { | |||
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){ | |||
@@ -38,8 +39,13 @@ const UserSearchPage_Individual = () => { | |||
}, [searchCriteria]); | |||
function applySearch(input) { | |||
setGridOnReady(true); | |||
setSearchCriteria(input); | |||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,tab:"application",data:input})) | |||
} | |||
function applyGridOnReady(input) { | |||
setGridOnReady(input); | |||
} | |||
return ( | |||
@@ -56,6 +62,7 @@ const UserSearchPage_Individual = () => { | |||
<SearchForm | |||
applySearch={applySearch} | |||
searchCriteria={searchCriteria} | |||
onGridReady={onGridReady} | |||
/> | |||
</Grid> | |||
{/*row 2*/} | |||
@@ -69,6 +76,7 @@ const UserSearchPage_Individual = () => { | |||
<EventTable | |||
autoHeight | |||
searchCriteria={searchCriteria} | |||
applyGridOnReady={applyGridOnReady} | |||
applySearch={applySearch} | |||
/> | |||
</div> | |||
@@ -18,7 +18,7 @@ import { FormattedMessage, useIntl } from "react-intl"; | |||
import * as React from 'react'; | |||
// ==============================|| EVENT TABLE ||============================== // | |||
export default function SearchPublicNoticeTable({ searchCriteria, applySearch }) { | |||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady, applySearch }) { | |||
const navigate = useNavigate() | |||
const theme = useTheme(); | |||
const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | |||
@@ -142,16 +142,19 @@ export default function SearchPublicNoticeTable({ searchCriteria, applySearch }) | |||
<FiDataGrid | |||
columns={columns} | |||
customPageSize={10} | |||
onRowDoubleClick={handleRowDoubleClick} | |||
getRowHeight={() => 'auto'} | |||
onRowDoubleClick={handleRowDoubleClick} | |||
applyGridOnReady = {applyGridOnReady} | |||
applySearch={applySearch} | |||
// doLoad={{ | |||
// url: GET_PUBLIC_NOTICE_LIST, | |||
// params: _searchCriteria | |||
// }} | |||
tab={"application"} | |||
doLoad={React.useMemo(() => ({ | |||
url: GET_PUBLIC_NOTICE_LIST, | |||
params: _searchCriteria, | |||
applyGridOnReady: applyGridOnReady, | |||
// callback: function (responseData) { | |||
// setRows(responseData?.records); | |||
// // applyGridOnReady(false) | |||
// } | |||
}), [_searchCriteria])} | |||
/> | |||
</div> | |||