Ver a proveniência

update proof searchCriteria save

CR013B1
Alex Cheung há 3 meses
ascendente
cometimento
8307b7a052
4 ficheiros alterados com 27 adições e 4 eliminações
  1. +2
    -0
      src/auth/index.js
  2. +12
    -0
      src/auth/utils.js
  3. +6
    -4
      src/pages/Proof/Search_GLD/SearchForm.js
  4. +7
    -0
      src/pages/Proof/Search_GLD/index.js

+ 2
- 0
src/auth/index.js Ver ficheiro

@@ -32,6 +32,7 @@ export const handleLogin = data => {
localStorage.setItem('accessToken', data.accessToken)
localStorage.setItem('refreshToken', data.refreshToken)
localStorage.setItem('axiosToken', "Bearer " + data.accessToken)
localStorage.setItem('searchCriteria',"")
//localStorage.setItem(config.storageUserRoleKeyName, JSON.stringify(data.role).slice(1).slice(0, -1))
localStorage.setItem(refreshIntervalName, "60")
// for demo only
@@ -91,6 +92,7 @@ export const handleLogoutFunction = () => {
localStorage.removeItem('refreshToken')
localStorage.removeItem('webtoken')
localStorage.removeItem('transactionid')
localStorage.removeItem('searchCriteria')
//localStorage.removeItem(config.storageUserRoleKeyName)
localStorage.removeItem('expiredAlertShown')
localStorage.removeItem(refreshIntervalName)


+ 12
- 0
src/auth/utils.js Ver ficheiro

@@ -130,4 +130,16 @@ export const getPaymentMethod = (paymentMethod) => {
if (paymentMethod == "demandNote") return 'payDnMethod';
if (paymentMethod == "office") return 'payNPGOMethod';
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
}
}
}

+ 6
- 4
src/pages/Proof/Search_GLD/SearchForm.js Ver ficheiro

@@ -25,12 +25,12 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
}) => {

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 [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 [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 [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo);
@@ -73,6 +73,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
dateTo: sentDateTo,
contact: data.contact,
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)))
setMaxDate(DateUtils.dateValue(new Date()))
reset();
localStorage.setItem('searchCriteria',"")
}

function getIssueLabel(data) {


+ 7
- 0
src/pages/Proof/Search_GLD/index.js Ver ficheiro

@@ -10,6 +10,7 @@ import * as React from "react";
import * as HttpUtils from "utils/HttpUtils";
import * as DateUtils from "utils/DateUtils";
import {GET_ORG_COMBO, GET_ISSUE_COMBO} from "utils/ApiPathConst";
import { getSearchCriteria } from "auth/utils";

import Loadable from 'components/Loadable';
const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
@@ -42,6 +43,11 @@ const UserSearchPage_Individual = () => {
React.useEffect(() => {
getOrgCombo();
getIssueCombo();
if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){
setSearchCriteria(getSearchCriteria(window.location.pathname))
}else{
localStorage.setItem('searchCriteria',"")
}
}, []);

React.useEffect(() => {
@@ -72,6 +78,7 @@ const UserSearchPage_Individual = () => {
function applySearch(input) {
setGridOnReady(true)
setSearchCriteria(input);
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input}))
}

function applyGridOnReady(input) {


Carregando…
Cancelar
Guardar