| @@ -32,6 +32,7 @@ export const handleLogin = data => { | |||||
| localStorage.setItem('accessToken', data.accessToken) | localStorage.setItem('accessToken', data.accessToken) | ||||
| localStorage.setItem('refreshToken', data.refreshToken) | localStorage.setItem('refreshToken', data.refreshToken) | ||||
| localStorage.setItem('axiosToken', "Bearer " + data.accessToken) | localStorage.setItem('axiosToken', "Bearer " + data.accessToken) | ||||
| localStorage.setItem('searchCriteria',"") | |||||
| //localStorage.setItem(config.storageUserRoleKeyName, JSON.stringify(data.role).slice(1).slice(0, -1)) | //localStorage.setItem(config.storageUserRoleKeyName, JSON.stringify(data.role).slice(1).slice(0, -1)) | ||||
| localStorage.setItem(refreshIntervalName, "60") | localStorage.setItem(refreshIntervalName, "60") | ||||
| // for demo only | // for demo only | ||||
| @@ -91,6 +92,7 @@ export const handleLogoutFunction = () => { | |||||
| localStorage.removeItem('refreshToken') | localStorage.removeItem('refreshToken') | ||||
| localStorage.removeItem('webtoken') | localStorage.removeItem('webtoken') | ||||
| localStorage.removeItem('transactionid') | localStorage.removeItem('transactionid') | ||||
| localStorage.removeItem('searchCriteria') | |||||
| //localStorage.removeItem(config.storageUserRoleKeyName) | //localStorage.removeItem(config.storageUserRoleKeyName) | ||||
| localStorage.removeItem('expiredAlertShown') | localStorage.removeItem('expiredAlertShown') | ||||
| localStorage.removeItem(refreshIntervalName) | localStorage.removeItem(refreshIntervalName) | ||||
| @@ -130,4 +130,16 @@ export const getPaymentMethod = (paymentMethod) => { | |||||
| if (paymentMethod == "demandNote") return 'payDnMethod'; | if (paymentMethod == "demandNote") return 'payDnMethod'; | ||||
| if (paymentMethod == "office") return 'payNPGOMethod'; | if (paymentMethod == "office") return 'payNPGOMethod'; | ||||
| return "other"; | return "other"; | ||||
| } | |||||
| export const getSearchCriteria = (path) =>{ | |||||
| let searchCriteria = "" | |||||
| if (localStorage.getItem('searchCriteria')==""){ | |||||
| return searchCriteria | |||||
| } else if (Object.keys(localStorage.getItem('searchCriteria')).length>0){ | |||||
| searchCriteria = JSON.parse(localStorage.getItem("searchCriteria")) | |||||
| if (searchCriteria.path === path){ | |||||
| return searchCriteria.data | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -25,12 +25,12 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| }) => { | }) => { | ||||
| const [type, setType] = React.useState([]); | const [type, setType] = React.useState([]); | ||||
| const [status, setStatus] = React.useState(ComboData.proofStatus[0]); | |||||
| const [orgSelected, setOrgSelected] = React.useState({}); | |||||
| const [status, setStatus] = React.useState(searchCriteria.statusKey!=undefined?ComboData.proofStatus_GLD[searchCriteria.statusKey]:ComboData.proofStatus_GLD[0]); | |||||
| const [orgSelected, setOrgSelected] = React.useState(searchCriteria.orgId!=undefined?orgComboData && orgComboData.length > 0?orgComboData.find(item => item.key === searchCriteria.orgId):{}:{}); | |||||
| const [orgCombo, setOrgCombo] = React.useState(); | const [orgCombo, setOrgCombo] = React.useState(); | ||||
| const [issueSelected, setIssueSelected] = React.useState({}); | |||||
| const [issueSelected, setIssueSelected] = React.useState(searchCriteria.issueId!=undefined?issueComboData && issueComboData.length > 0?issueComboData.find(item => item.id === searchCriteria.issueId):{}:{}); | |||||
| const [issueCombo, setIssueCombo] = React.useState([]); | const [issueCombo, setIssueCombo] = React.useState([]); | ||||
| const [groupSelected, setGroupSelected] = React.useState({}); | |||||
| const [groupSelected, setGroupSelected] = React.useState(searchCriteria.gazettGroup!=undefined?ComboData.groupTitle.find(item => item.code === searchCriteria.gazettGroup):{}); | |||||
| const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); | const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); | ||||
| const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); | const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); | ||||
| @@ -73,6 +73,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| dateTo: sentDateTo, | dateTo: sentDateTo, | ||||
| contact: data.contact, | contact: data.contact, | ||||
| orgId: (orgSelected?.key && orgSelected?.key > 0) ? orgSelected?.key : "", | orgId: (orgSelected?.key && orgSelected?.key > 0) ? orgSelected?.key : "", | ||||
| statusKey:status?.key, | |||||
| }; | }; | ||||
| @@ -123,6 +124,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | ||||
| setMaxDate(DateUtils.dateValue(new Date())) | setMaxDate(DateUtils.dateValue(new Date())) | ||||
| reset(); | reset(); | ||||
| localStorage.setItem('searchCriteria',"") | |||||
| } | } | ||||
| function getIssueLabel(data) { | function getIssueLabel(data) { | ||||
| @@ -10,6 +10,7 @@ import * as React from "react"; | |||||
| import * as HttpUtils from "utils/HttpUtils"; | import * as HttpUtils from "utils/HttpUtils"; | ||||
| import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
| import {GET_ORG_COMBO, GET_ISSUE_COMBO} from "utils/ApiPathConst"; | import {GET_ORG_COMBO, GET_ISSUE_COMBO} from "utils/ApiPathConst"; | ||||
| import { getSearchCriteria } from "auth/utils"; | |||||
| import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | ||||
| @@ -42,6 +43,11 @@ const UserSearchPage_Individual = () => { | |||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| getOrgCombo(); | getOrgCombo(); | ||||
| getIssueCombo(); | getIssueCombo(); | ||||
| if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||||
| setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||||
| }else{ | |||||
| localStorage.setItem('searchCriteria',"") | |||||
| } | |||||
| }, []); | }, []); | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| @@ -72,6 +78,7 @@ const UserSearchPage_Individual = () => { | |||||
| function applySearch(input) { | function applySearch(input) { | ||||
| setGridOnReady(true) | setGridOnReady(true) | ||||
| setSearchCriteria(input); | setSearchCriteria(input); | ||||
| localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||||
| } | } | ||||
| function applyGridOnReady(input) { | function applyGridOnReady(input) { | ||||