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