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