@@ -17,6 +17,7 @@ import dayjs from "dayjs"; | |||||
import {DemoItem} from "@mui/x-date-pickers/internals/demo"; | import {DemoItem} from "@mui/x-date-pickers/internals/demo"; | ||||
import {LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider"; | 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, onGridReady}) => { | const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady}) => { | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -58,7 +59,8 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady}) => | |||||
function resetForm() { | function resetForm() { | ||||
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({key:""}); | |||||
localStorage.setItem('searchCriteria',"") | |||||
} | } | ||||
@@ -7,6 +7,7 @@ import { | |||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
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'))); | ||||
@@ -28,13 +29,22 @@ const BackgroundHead = { | |||||
const UserSearchPage_Individual = () => { | const UserSearchPage_Individual = () => { | ||||
const [searchCriteria, setSearchCriteria] = React.useState({ | |||||
dateTo: DateUtils.dateValue(new Date()), | |||||
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 90)), | |||||
}); | |||||
const [searchCriteria, setSearchCriteria] = React.useState({}); | |||||
const [onReady, setOnReady] = React.useState(false); | const [onReady, setOnReady] = React.useState(false); | ||||
const [onGridReady, setGridOnReady] = React.useState(false); | const [onGridReady, setGridOnReady] = React.useState(false); | ||||
React.useEffect(() => { | |||||
if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||||
setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||||
}else{ | |||||
localStorage.setItem('searchCriteria',"") | |||||
setSearchCriteria({ | |||||
dateTo: DateUtils.dateValue(new Date()), | |||||
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), | |||||
}) | |||||
} | |||||
}, []); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setOnReady(true); | setOnReady(true); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
@@ -42,6 +52,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) { | ||||
@@ -76,7 +76,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
function resetForm() { | function resetForm() { | ||||
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({key:""}); | |||||
localStorage.setItem('searchCriteria',"") | localStorage.setItem('searchCriteria',"") | ||||
} | } | ||||
@@ -213,7 +213,8 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||||
size="small" | size="small" | ||||
value={orgSelected} | value={orgSelected} | ||||
getOptionLabel={(option) => option.name? option.name : ""} | getOptionLabel={(option) => option.name? option.name : ""} | ||||
inputValue={orgSelected ? orgSelected.name : ""} | |||||
inputValue={orgSelected ? orgSelected.name!=undefined?orgSelected.name:"" : ""} | |||||
onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
if (newValue !== null) { | if (newValue !== null) { | ||||
setOrgSelected(newValue); | setOrgSelected(newValue); | ||||
@@ -78,7 +78,10 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
setStatus(ComboData.paymentStatus[0]); | setStatus(ComboData.paymentStatus[0]); | ||||
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({ | |||||
code:"", | |||||
transNo:"" | |||||
}); | |||||
localStorage.setItem('searchCriteria',"") | localStorage.setItem('searchCriteria',"") | ||||
} | } | ||||
@@ -362,7 +362,8 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
size="small" | size="small" | ||||
value={orgSelected} | value={orgSelected} | ||||
getOptionLabel={(option) => option.name? option.name : ""} | getOptionLabel={(option) => option.name? option.name : ""} | ||||
inputValue={orgSelected ? orgSelected.name : ""} | |||||
inputValue={orgSelected ? orgSelected.name!=undefined?orgSelected.name:"" : ""} | |||||
onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
if (newValue !== null) { | if (newValue !== null) { | ||||
setOrgSelected(newValue); | setOrgSelected(newValue); | ||||
@@ -122,7 +122,10 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
setGroupSelected({}); | setGroupSelected({}); | ||||
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({ | |||||
refNo:"", | |||||
code:"", | |||||
}); | |||||
localStorage.setItem('searchCriteria',"") | localStorage.setItem('searchCriteria',"") | ||||
} | } | ||||
@@ -41,9 +41,17 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
if(searchCriteria.status!=undefined){ | if(searchCriteria.status!=undefined){ | ||||
if(localStorage.getItem('userData').creditor){ | if(localStorage.getItem('userData').creditor){ | ||||
setStatus(ComboData.publicNoticeStatic_Creditor.find(item => item.type === searchCriteria.status)) | |||||
if(searchCriteria.status === ""){ | |||||
ComboData.publicNoticeStatic_Creditor[0] | |||||
}else{ | |||||
setStatus(ComboData.publicNoticeStatic_Creditor.find(item => item.type === searchCriteria.status)) | |||||
} | |||||
}else{ | }else{ | ||||
setStatus(ComboData.publicNoticeStatic.find(item => item.type === searchCriteria.status)) | |||||
if(searchCriteria.status === ""){ | |||||
ComboData.publicNoticeStatic[0] | |||||
}else{ | |||||
setStatus(ComboData.publicNoticeStatic.find(item => item.type === searchCriteria.status)) | |||||
} | |||||
} | } | ||||
}else{ | }else{ | ||||
if(localStorage.getItem('userData').creditor){ | if(localStorage.getItem('userData').creditor){ | ||||
@@ -93,7 +101,10 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
setStatus(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); | setStatus(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); | ||||
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({ | |||||
appNo:"" | |||||
}); | |||||
localStorage.setItem('searchCriteria',"") | |||||
} | } | ||||
return ( | return ( | ||||
@@ -31,13 +31,25 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
const [issueSelected, setIssueSelected] = React.useState({}); | const [issueSelected, setIssueSelected] = React.useState({}); | ||||
const [issueCombo, setIssueCombo] = React.useState([]); | const [issueCombo, setIssueCombo] = React.useState([]); | ||||
const [selectedStatus, setSelectedStatus] = React.useState({key: 0, label: 'All', type: 'all'}); | const [selectedStatus, setSelectedStatus] = React.useState({key: 0, label: 'All', type: 'all'}); | ||||
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); | ||||
const [fromDateValue, setFromDateValue] = React.useState("dd / mm / yyyy"); | const [fromDateValue, setFromDateValue] = React.useState("dd / mm / yyyy"); | ||||
const [toDateValue, setToDateValue] = React.useState("dd / mm / yyyy"); | const [toDateValue, setToDateValue] = React.useState("dd / mm / yyyy"); | ||||
React.useEffect(() => { | |||||
if(searchCriteria.status!=undefined){ | |||||
if(searchCriteria.status === ""){ | |||||
ComboData.publicNoticeStatic_GLD[0] | |||||
}else{ | |||||
setSelectedStatus(ComboData.publicNoticeStatic_GLD.find(item => item.type === searchCriteria.status)) | |||||
} | |||||
}else{ | |||||
setSelectedStatus(ComboData.publicNoticeStatic_GLD[0]) | |||||
} | |||||
}, [searchCriteria]); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setFromDateValue(minDate); | setFromDateValue(minDate); | ||||
}, [minDate]); | }, [minDate]); | ||||
@@ -84,25 +96,36 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
if (orgComboData && orgComboData.length > 0) { | if (orgComboData && orgComboData.length > 0) { | ||||
setOrgCombo(orgComboData); | setOrgCombo(orgComboData); | ||||
if(searchCriteria.orgId!=undefined){ | |||||
setOrgSelected(orgComboData.find(item => item.key === searchCriteria.orgId)) | |||||
} | |||||
} | } | ||||
}, [orgComboData]); | }, [orgComboData]); | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
if (issueComboData && issueComboData.length > 0) { | if (issueComboData && issueComboData.length > 0) { | ||||
setIssueCombo(issueComboData); | setIssueCombo(issueComboData); | ||||
if(searchCriteria.issueId!=undefined){ | |||||
setIssueSelected(issueComboData.find(item => item.id === searchCriteria.issueId)) | |||||
} | |||||
} | } | ||||
}, [issueComboData]); | }, [issueComboData]); | ||||
function resetForm() { | function resetForm() { | ||||
setType([]); | setType([]); | ||||
// setStatus({ key: 0, label: 'All', type: 'all' }); | // setStatus({ key: 0, label: 'All', type: 'all' }); | ||||
localStorage.setItem('searchCriteria',"") | |||||
setOrgSelected({}); | setOrgSelected({}); | ||||
setIssueSelected({}); | setIssueSelected({}); | ||||
setGroupSelected({}); | setGroupSelected({}); | ||||
setSelectedStatus({key: 0, label: 'All', type: 'all'}); | setSelectedStatus({key: 0, label: 'All', type: 'all'}); | ||||
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({ | |||||
appNo:"", | |||||
contact:"", | |||||
groupNo:"" | |||||
}); | |||||
} | } | ||||
const getIssueLabel=(data)=> { | const getIssueLabel=(data)=> { | ||||
@@ -303,7 +326,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
size="small" | size="small" | ||||
value={orgSelected} | value={orgSelected} | ||||
getOptionLabel={(option) => option.name? option.name : ""} | getOptionLabel={(option) => option.name? option.name : ""} | ||||
inputValue={orgSelected ? orgSelected.name : ""} | |||||
inputValue={orgSelected ? orgSelected.name!=undefined?orgSelected.name:"" : ""} | |||||
onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
if (newValue !== null) { | if (newValue !== null) { | ||||
setOrgSelected(newValue); | setOrgSelected(newValue); | ||||
@@ -9,6 +9,7 @@ import * as React from "react"; | |||||
import * as UrlUtils from "utils/ApiPathConst"; | import * as UrlUtils from "utils/ApiPathConst"; | ||||
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 { 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'))); | ||||
@@ -31,16 +32,22 @@ const BackgroundHead = { | |||||
const UserSearchPage_Individual = () => { | const UserSearchPage_Individual = () => { | ||||
const [orgCombo, setOrgCombo] = React.useState([]); | const [orgCombo, setOrgCombo] = React.useState([]); | ||||
const [issueCombo, setIssueCombo] = React.useState([]); | const [issueCombo, setIssueCombo] = React.useState([]); | ||||
const [searchCriteria, setSearchCriteria] = React.useState({ | |||||
dateTo: DateUtils.dateValue(new Date()), | |||||
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)) | |||||
}); | |||||
const [searchCriteria, setSearchCriteria] = React.useState({}); | |||||
const [onReady, setOnReady] = React.useState(false); | const [onReady, setOnReady] = React.useState(false); | ||||
const [onGridReady, setGridOnReady] = React.useState(false); | const [onGridReady, setGridOnReady] = React.useState(false); | ||||
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',"") | |||||
setSearchCriteria({ | |||||
dateTo: DateUtils.dateValue(new Date()), | |||||
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), | |||||
}) | |||||
} | |||||
}, []); | }, []); | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
@@ -70,6 +77,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) { | ||||
@@ -299,7 +299,8 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
size="small" | size="small" | ||||
value={orgSelected} | value={orgSelected} | ||||
getOptionLabel={(option) => option.name? option.name : ""} | getOptionLabel={(option) => option.name? option.name : ""} | ||||
inputValue={orgSelected ? orgSelected.name : ""} | |||||
inputValue={orgSelected ? orgSelected.name!=undefined?orgSelected.name:"" : ""} | |||||
onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
if (newValue !== null) { | if (newValue !== null) { | ||||
setOrgSelected(newValue); | setOrgSelected(newValue); | ||||
@@ -84,7 +84,8 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
size="small" | size="small" | ||||
value={orgSelected} | value={orgSelected} | ||||
getOptionLabel={(option) => option.name? option.name : ""} | getOptionLabel={(option) => option.name? option.name : ""} | ||||
inputValue={orgSelected ? orgSelected.name : ""} | |||||
inputValue={orgSelected ? orgSelected.name!=undefined?orgSelected.name:"" : ""} | |||||
onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
if (newValue !== null) { | if (newValue !== null) { | ||||
setOrgSelected(newValue); | setOrgSelected(newValue); | ||||