| @@ -44,6 +44,28 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||
| const intl = useIntl(); | |||
| const { locale } = intl; | |||
| React.useEffect(() => { | |||
| if(searchCriteria.status!=undefined){ | |||
| if(searchCriteria.status === ""){ | |||
| ComboData.denmandNoteStatus[0] | |||
| }else{ | |||
| setSelectedStatus(ComboData.denmandNoteStatus.find(item => item.type === searchCriteria.status)) | |||
| } | |||
| if(searchCriteria.dueDateFrom != ""){ | |||
| setMinDueDate(DateUtils.dateValue(searchCriteria.dueDateFrom)) | |||
| }else{ | |||
| setMinDueDate(null) | |||
| } | |||
| if(searchCriteria.dueDateTo != ""){ | |||
| setMaxDueDate(DateUtils.dateValue(searchCriteria.dueDateTo)) | |||
| }else{ | |||
| setMaxDueDate(null); | |||
| } | |||
| }else{ | |||
| setSelectedStatus(ComboData.denmandNoteStatus[0]) | |||
| } | |||
| }, [searchCriteria]); | |||
| React.useEffect(() => { | |||
| setFromDateValue(minDate); | |||
| }, [minDate]); | |||
| @@ -101,12 +123,18 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||
| 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]); | |||
| @@ -117,9 +145,13 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||
| setSelectedStatus(ComboData.denmandNoteStatus[0]); | |||
| setMinDueDate(null); | |||
| setMaxDueDate(null); | |||
| setMinDate(searchCriteria.dateFrom); | |||
| setMaxDate(searchCriteria.dateTo); | |||
| reset(); | |||
| setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | |||
| setMaxDate(DateUtils.dateValue(new Date())) | |||
| reset({ | |||
| appNo:"", | |||
| dnNo:"", | |||
| }); | |||
| localStorage.setItem('searchCriteria',"") | |||
| } | |||
| function getIssueLabel(data) { | |||
| @@ -10,6 +10,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'))); | |||
| @@ -35,8 +36,8 @@ 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)), | |||
| // dateTo: DateUtils.dateValue(new Date()), | |||
| // dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)), | |||
| // dueDateTo: DateUtils.dateValue(new Date()), | |||
| // dueDateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)), | |||
| }); | |||
| @@ -46,6 +47,15 @@ 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',"") | |||
| setSearchCriteria({ | |||
| dateTo: DateUtils.dateValue(new Date()), | |||
| dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), | |||
| }) | |||
| } | |||
| }, []); | |||
| React.useEffect(() => { | |||
| @@ -76,6 +86,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) { | |||
| @@ -38,6 +38,18 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData, onG | |||
| 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.denmandNoteStatus_Public[0] | |||
| }else{ | |||
| setSelectedStatus(ComboData.denmandNoteStatus_Public.find(item => item.type === searchCriteria.status)) | |||
| } | |||
| }else{ | |||
| setSelectedStatus(ComboData.denmandNoteStatus_Public[0]) | |||
| } | |||
| }, [searchCriteria]); | |||
| React.useEffect(() => { | |||
| setFromDateValue(minDate); | |||
| }, [minDate]); | |||
| @@ -76,6 +88,9 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData, onG | |||
| React.useEffect(() => { | |||
| if (issueComboData && issueComboData.length > 0) { | |||
| setIssueCombo(issueComboData); | |||
| if(searchCriteria.issueId!=undefined){ | |||
| setIssueSelected(issueComboData.find(item => item.id === searchCriteria.issueId)) | |||
| } | |||
| } | |||
| }, [issueComboData]); | |||
| @@ -86,7 +101,10 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData, onG | |||
| setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | |||
| setMaxDate(DateUtils.dateValue(new Date())) | |||
| setIssueSelected({}); | |||
| reset(); | |||
| reset({ | |||
| appNo:"", | |||
| dnNo:"", | |||
| }); | |||
| } | |||
| function getIssueLabel(data) { | |||
| @@ -10,6 +10,7 @@ import * as React from "react"; | |||
| import {GET_ORG_COMBO, GET_ISSUE_COMBO} 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'))); | |||
| @@ -34,16 +35,22 @@ const SearchPage_DemandNote_Pub = () => { | |||
| 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(() => { | |||
| @@ -75,6 +82,7 @@ const SearchPage_DemandNote_Pub = () => { | |||
| function applySearch(input) { | |||
| setGridOnReady(true) | |||
| setSearchCriteria(input); | |||
| localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||
| } | |||
| function applyGridOnReady(input) { | |||
| @@ -8,7 +8,7 @@ import { | |||
| import MainCard from "components/MainCard"; | |||
| import { useForm } from "react-hook-form"; | |||
| import { useState } from "react"; | |||
| import { useState,useEffect } from "react"; | |||
| import * as React from "react"; | |||
| import * as UrlUtils from "utils/ApiPathConst"; | |||
| @@ -19,11 +19,20 @@ import {ThemeProvider} from "@emotion/react"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||
| const OrganizationSearchForm = ({ applySearch, onGridReady, searchCriteria }) => { | |||
| const [type, setType] = useState([]); | |||
| const [creditorSelected, setCreditorSelected] = React.useState(ComboData.CreditorStatus[0]); | |||
| const { reset, register, handleSubmit } = useForm() | |||
| useEffect(() => { | |||
| if(searchCriteria.creditor!=undefined){ | |||
| setCreditorSelected(ComboData.CreditorStatus.find(item => item.type === searchCriteria.creditor.toString())) | |||
| }else{ | |||
| setCreditorSelected(ComboData.CreditorStatus[0]); | |||
| } | |||
| }, [searchCriteria]); | |||
| const onSubmit = (data) => { | |||
| let typeArray = []; | |||
| @@ -48,7 +57,11 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||
| function resetForm() { | |||
| setType([]); | |||
| setCreditorSelected(ComboData.CreditorStatus[0]); | |||
| reset(); | |||
| reset({ | |||
| brNo: "", | |||
| enCompanyName: "", | |||
| chCompanyName: "", | |||
| }); | |||
| } | |||
| const doExport=()=>{ | |||
| @@ -80,6 +93,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("brNo")} | |||
| id='brNo' | |||
| label="BR No." | |||
| defaultValue={searchCriteria.brNo} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -92,6 +106,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("enCompanyName")} | |||
| id="enCompanyName" | |||
| label="Name (English)" | |||
| defaultValue={searchCriteria.enCompanyName} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -104,6 +119,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("chCompanyName")} | |||
| id="chCompanyName" | |||
| label="Name (Chinese)" | |||
| defaultValue={searchCriteria.chCompanyName} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -5,7 +5,7 @@ import { | |||
| import MainCard from "components/MainCard"; | |||
| import { useEffect, useState } from "react"; | |||
| import * as React from "react"; | |||
| import { getSearchCriteria } from "auth/utils"; | |||
| // import LoadingComponent from "../extra-pages/LoadingComponent"; | |||
| // import SearchForm from "./OrganizationSearchForm"; | |||
| @@ -34,6 +34,15 @@ const OrganizationSearchPage = () => { | |||
| const [onReady, setOnReady] = useState(false); | |||
| const [onGridReady, setGridOnReady] = React.useState(false); | |||
| useEffect(() => { | |||
| if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||
| setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||
| }else{ | |||
| localStorage.setItem('searchCriteria',"") | |||
| setSearchCriteria({}) | |||
| } | |||
| }, []); | |||
| useEffect(() => { | |||
| setOnReady(true); | |||
| }, [searchCriteria]); | |||
| @@ -41,6 +50,7 @@ const OrganizationSearchPage = () => { | |||
| function applySearch(input) { | |||
| setGridOnReady(true) | |||
| setSearchCriteria(input); | |||
| localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||
| } | |||
| function applyGridOnReady(input) { | |||
| @@ -68,6 +78,7 @@ const OrganizationSearchPage = () => { | |||
| <SearchForm | |||
| applySearch={applySearch} | |||
| onGridReady={onGridReady} | |||
| searchCriteria={searchCriteria} | |||
| /> | |||
| </Grid> | |||
| {/*row 2*/} | |||
| @@ -31,6 +31,18 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||
| 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.paymentStatus[0] | |||
| }else{ | |||
| setStatus(ComboData.paymentStatus.find(item => item.type === searchCriteria.status)) | |||
| } | |||
| }else{ | |||
| setStatus(ComboData.paymentStatus[0]) | |||
| } | |||
| }, [searchCriteria]); | |||
| React.useEffect(() => { | |||
| setFromDateValue(minDate); | |||
| }, [minDate]); | |||
| @@ -62,7 +74,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:"" | |||
| }); | |||
| } | |||
| @@ -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 Index = () => { | |||
| 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(() => { | |||
| 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 Index = () => { | |||
| function applySearch(input) { | |||
| setGridOnReady(true) | |||
| setSearchCriteria(input); | |||
| localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||
| } | |||
| function applyGridOnReady(input) { | |||
| @@ -37,6 +37,18 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||
| 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.proofStatus_GLD[0] | |||
| // }else{ | |||
| // setSelectedStatus(ComboData.proofStatus_GLD.find(item => item.type === searchCriteria.status)) | |||
| // } | |||
| // }else{ | |||
| // setSelectedStatus(ComboData.proofStatus_GLD[0]) | |||
| // } | |||
| // }, [searchCriteria]); | |||
| React.useEffect(() => { | |||
| setFromDateValue(minDate); | |||
| }, [minDate]); | |||
| @@ -129,7 +141,11 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||
| setGroupSelected({}); | |||
| setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | |||
| setMaxDate(DateUtils.dateValue(new Date())) | |||
| reset(); | |||
| reset({ | |||
| refNo:"", | |||
| code:"", | |||
| contact:"" | |||
| }); | |||
| localStorage.setItem('searchCriteria',"") | |||
| } | |||
| @@ -33,20 +33,21 @@ 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(() => { | |||
| 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)), | |||
| }) | |||
| } | |||
| }, []); | |||
| @@ -114,7 +114,6 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||
| function resetForm() { | |||
| setType([]); | |||
| // setStatus({ key: 0, label: 'All', type: 'all' }); | |||
| localStorage.setItem('searchCriteria',"") | |||
| setOrgSelected({}); | |||
| setIssueSelected({}); | |||
| setGroupSelected({}); | |||
| @@ -126,6 +125,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||
| contact:"", | |||
| groupNo:"" | |||
| }); | |||
| localStorage.setItem('searchCriteria',"") | |||
| } | |||
| const getIssueLabel=(data)=> { | |||
| @@ -37,6 +37,18 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||
| 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]); | |||
| @@ -81,12 +93,18 @@ 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]); | |||
| @@ -98,7 +116,12 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||
| 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:"" | |||
| }); | |||
| localStorage.setItem('searchCriteria',"") | |||
| } | |||
| const getIssueLabel=(data)=> { | |||
| @@ -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) { | |||
| @@ -11,8 +11,8 @@ import {useState} from "react"; | |||
| import Checkbox from "@mui/material/Checkbox"; | |||
| import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; | |||
| import { useNavigate } from "react-router"; | |||
| import axios from "axios"; | |||
| import { GET_EMAIL_LIST } from 'utils/ApiPathConst'; | |||
| // import axios from "axios"; | |||
| // import { GET_EMAIL_LIST } from 'utils/ApiPathConst'; | |||
| import { PNSPS_BUTTON_THEME } from "themes/buttonConst"; | |||
| import { ThemeProvider } from "@emotion/react"; | |||
| @@ -21,14 +21,13 @@ import { isGrantedAny } from "auth/utils"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| const UserSearchForm = ({ applySearch, onGridReady }) => { | |||
| const UserSearchForm = ({ applySearch, onGridReady, searchCriteria }) => { | |||
| const navigate = useNavigate(); | |||
| const [type, setType] = useState([]); | |||
| const [locked, setLocked] = useState(false); | |||
| const [locked, setLocked] = useState(searchCriteria.locked); | |||
| const { reset, register, handleSubmit } = useForm() | |||
| const onSubmit = (data) => { | |||
| let typeArray = []; | |||
| @@ -51,14 +50,20 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||
| function resetForm() { | |||
| setType([]); | |||
| setLocked(false); | |||
| reset(); | |||
| axios.get(`${GET_EMAIL_LIST}`) | |||
| .then(r => { | |||
| console.log(r) | |||
| }) | |||
| .catch(err => { | |||
| console.log(err) | |||
| }) | |||
| reset({ | |||
| userName:"", | |||
| fullenName:"", | |||
| post:"", | |||
| email:"" | |||
| }); | |||
| localStorage.setItem('searchCriteria',"") | |||
| // axios.get(`${GET_EMAIL_LIST}`) | |||
| // .then(r => { | |||
| // console.log(r) | |||
| // }) | |||
| // .catch(err => { | |||
| // console.log(err) | |||
| // }) | |||
| } | |||
| const handleNewUserClick = () => { | |||
| @@ -70,7 +75,9 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||
| return ( | |||
| <MainCard xs={12} md={12} lg={12} | |||
| border={false} | |||
| content={false}> | |||
| content={false} | |||
| sx={{ backgroundColor: '#fff' }} | |||
| > | |||
| <form onSubmit={handleSubmit(onSubmit)}> | |||
| <Grid container sx={{ backgroundColor: '#ffffff', ml: 2, mt: 1 }} width="98%"> | |||
| @@ -89,6 +96,7 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("userName")} | |||
| id='userName' | |||
| label="Username" | |||
| defaultValue={searchCriteria.username} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -101,6 +109,7 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("fullenName")} | |||
| id="fullenName" | |||
| label="Full Name" | |||
| defaultValue={searchCriteria.enName} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -113,6 +122,7 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("post")} | |||
| id="post" | |||
| label="Post" | |||
| defaultValue={searchCriteria.post} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -125,6 +135,7 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("email")} | |||
| id="email" | |||
| label="Email" | |||
| defaultValue={searchCriteria.email} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -7,6 +7,7 @@ import { | |||
| } from '@mui/material'; | |||
| import MainCard from "../../../components/MainCard"; | |||
| import { useEffect, useState, lazy } from "react"; | |||
| import { getSearchCriteria } from "auth/utils"; | |||
| import Loadable from 'components/Loadable'; | |||
| const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | |||
| @@ -37,6 +38,15 @@ const UserSettingPage = () => { | |||
| // getUserList(); | |||
| // }, [changelocked]); | |||
| useEffect(() => { | |||
| if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||
| setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||
| }else{ | |||
| localStorage.setItem('searchCriteria',"") | |||
| setSearchCriteria({}) | |||
| } | |||
| }, []); | |||
| useEffect(() => { | |||
| setOnReady(true); | |||
| }, [searchCriteria]); | |||
| @@ -63,6 +73,7 @@ const UserSettingPage = () => { | |||
| function applySearch(input) { | |||
| setGridOnReady(true) | |||
| setSearchCriteria(input); | |||
| localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||
| } | |||
| function applyGridOnReady(input) { | |||
| @@ -91,6 +102,7 @@ const UserSettingPage = () => { | |||
| <SearchForm | |||
| applySearch={applySearch} | |||
| onGridReady={onGridReady} | |||
| searchCriteria={searchCriteria} | |||
| /> | |||
| </Grid> | |||
| {/*row 2*/} | |||
| @@ -7,18 +7,31 @@ import { | |||
| } from '@mui/material'; | |||
| import MainCard from "components/MainCard"; | |||
| import { useForm } from "react-hook-form"; | |||
| import { useState } from "react"; | |||
| import { useState,useEffect } from "react"; | |||
| import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; | |||
| import {ThemeProvider} from "@emotion/react"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||
| const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) => { | |||
| const [type, setType] = useState([]); | |||
| const [accountFilter, setAccountFilter] = useState("All"); | |||
| const { reset, register, handleSubmit } = useForm() | |||
| useEffect(() => { | |||
| if(searchCriteria.accountFilter!=undefined){ | |||
| if(searchCriteria.accountFilter === ""){ | |||
| setAccountFilter("All") | |||
| }else{ | |||
| setAccountFilter(searchCriteria.accountFilter) | |||
| } | |||
| }else{ | |||
| setAccountFilter("All") | |||
| } | |||
| }, [searchCriteria]); | |||
| const onSubmit = (data) => { | |||
| let typeArray = []; | |||
| @@ -42,7 +55,12 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||
| function resetForm() { | |||
| setType([]); | |||
| setAccountFilter("All"); | |||
| reset(); | |||
| reset({ | |||
| userName:"", | |||
| fullenName:"", | |||
| email:"", | |||
| phone:"", | |||
| }); | |||
| } | |||
| return ( | |||
| @@ -67,6 +85,7 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||
| {...register("userName")} | |||
| id='userName' | |||
| label="Username" | |||
| defaultValue={searchCriteria.username} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -79,6 +98,7 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||
| {...register("fullenName")} | |||
| id="fullenName" | |||
| label="Full Name" | |||
| defaultValue={searchCriteria.fullName} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -91,6 +111,7 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||
| {...register("email")} | |||
| id="email" | |||
| label="Email" | |||
| defaultValue={searchCriteria.email} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -103,6 +124,7 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||
| {...register("phone")} | |||
| id="phone" | |||
| label="Phone" | |||
| defaultValue={searchCriteria.phone} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -4,6 +4,8 @@ import { | |||
| } from '@mui/material'; | |||
| import MainCard from "components/MainCard"; | |||
| import { useEffect, useState, lazy } from "react"; | |||
| import { getSearchCriteria } from "auth/utils"; | |||
| import Loadable from 'components/Loadable'; | |||
| const LoadingComponent = Loadable(lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||
| const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Individual'))); | |||
| @@ -26,6 +28,15 @@ const UserSearchPage_Individual = () => { | |||
| const [searchCriteria, setSearchCriteria] = useState({}); | |||
| const [onReady, setOnReady] = useState(false); | |||
| const [onGridReady, setGridOnReady] = useState(false); | |||
| useEffect(() => { | |||
| if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||
| setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||
| }else{ | |||
| localStorage.setItem('searchCriteria',"") | |||
| setSearchCriteria({}) | |||
| } | |||
| }, []); | |||
| useEffect(() => { | |||
| setOnReady(true); | |||
| @@ -34,6 +45,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) { | |||
| @@ -64,6 +76,7 @@ const UserSearchPage_Individual = () => { | |||
| <SearchForm | |||
| applySearch={applySearch} | |||
| onGridReady={onGridReady} | |||
| searchCriteria={searchCriteria} | |||
| /> | |||
| </Grid> | |||
| {/*row 2*/} | |||
| @@ -14,7 +14,7 @@ import {ThemeProvider} from "@emotion/react"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) => { | |||
| const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady, searchCriteria}) => { | |||
| const [type, setType] = useState([]); | |||
| const [accountFilter, setAccountFilter] = useState("All"); | |||
| @@ -22,6 +22,19 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||
| const [orgSelected, setOrgSelected] = useState({}); | |||
| const { reset, register, handleSubmit } = useForm() | |||
| useEffect(() => { | |||
| if(searchCriteria.accountFilter!=undefined){ | |||
| if(searchCriteria.accountFilter === ""){ | |||
| setAccountFilter("All") | |||
| }else{ | |||
| setAccountFilter(searchCriteria.accountFilter) | |||
| } | |||
| }else{ | |||
| setAccountFilter("All") | |||
| } | |||
| }, [searchCriteria]); | |||
| const onSubmit = (data) => { | |||
| let typeArray = []; | |||
| @@ -46,6 +59,9 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||
| useEffect(() => { | |||
| if (orgComboData && orgComboData.length > 0) { | |||
| setOrgCombo(orgComboData); | |||
| if(searchCriteria.orgName!=undefined){ | |||
| setOrgSelected(orgComboData.find(item => item.name === searchCriteria.orgName)) | |||
| } | |||
| } | |||
| }, [orgComboData]); | |||
| @@ -53,7 +69,14 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||
| setType([]); | |||
| setAccountFilter("All"); | |||
| setOrgSelected({}); | |||
| reset(); | |||
| reset({ | |||
| userName:"", | |||
| fullenName:"", | |||
| email:"", | |||
| phone:"", | |||
| contactPerson:"", | |||
| brNoStr:"", | |||
| }); | |||
| } | |||
| return ( | |||
| @@ -120,6 +143,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||
| {...register("brNoStr")} | |||
| id="brNoStr" | |||
| label="BR No." | |||
| defaultValue={searchCriteria.brNoStr} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -132,6 +156,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||
| {...register("userName")} | |||
| id='userName' | |||
| label="Username" | |||
| defaultValue={searchCriteria.username} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -144,6 +169,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||
| {...register("contactPerson")} | |||
| id="contactPerson" | |||
| label="Name" | |||
| defaultValue={searchCriteria.contactPerson} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -156,6 +182,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||
| {...register("email")} | |||
| id="email" | |||
| label="Email" | |||
| defaultValue={searchCriteria.email} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -168,6 +195,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||
| {...register("phone")} | |||
| id="phone" | |||
| label="Phone" | |||
| defaultValue={searchCriteria.contactTel} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -7,6 +7,7 @@ import { useEffect, useState, lazy } from "react"; | |||
| import Loadable from 'components/Loadable'; | |||
| import * as HttpUtils from "utils/HttpUtils"; | |||
| import {GET_ORG_COMBO} from "utils/ApiPathConst"; | |||
| import { getSearchCriteria } from "auth/utils"; | |||
| const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | |||
| const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Organization'))); | |||
| @@ -34,6 +35,12 @@ const UserSearchPage_Organization = () => { | |||
| useEffect(() => { | |||
| getOrgCombo(); | |||
| // getIssueCombo(); | |||
| if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||
| setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||
| }else{ | |||
| localStorage.setItem('searchCriteria',"") | |||
| setSearchCriteria({}) | |||
| } | |||
| }, []); | |||
| function getOrgCombo() { | |||
| @@ -53,6 +60,7 @@ const UserSearchPage_Organization = () => { | |||
| function applySearch(input) { | |||
| setGridOnReady(true) | |||
| setSearchCriteria(input); | |||
| localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||
| } | |||
| function applyGridOnReady(input) { | |||
| @@ -81,6 +89,7 @@ const UserSearchPage_Organization = () => { | |||
| applySearch={applySearch} | |||
| orgComboData={orgCombo} | |||
| onGridReady={onGridReady} | |||
| searchCriteria={searchCriteria} | |||
| /> | |||
| </Grid> | |||
| {/*row 2*/} | |||
| @@ -14,7 +14,7 @@ import { ThemeProvider } from "@emotion/react"; | |||
| import { isGrantedAny } from "auth/utils"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| const UserGroupSearchForm = ({ applySearch, onGridReady }) => { | |||
| const UserGroupSearchForm = ({ applySearch, onGridReady, searchCriteria }) => { | |||
| const navigate = useNavigate(); | |||
| const { reset, register, handleSubmit } = useForm() | |||
| @@ -23,7 +23,10 @@ const UserGroupSearchForm = ({ applySearch, onGridReady }) => { | |||
| }; | |||
| function resetForm() { | |||
| reset(); | |||
| reset({ | |||
| name:"", | |||
| description:"" | |||
| }); | |||
| } | |||
| const handleNewGroupClick = (id) => { | |||
| @@ -54,6 +57,7 @@ const UserGroupSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("name")} | |||
| id='userGroupName' | |||
| label="User Group Name" | |||
| defaultValue={searchCriteria.name} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -66,6 +70,7 @@ const UserGroupSearchForm = ({ applySearch, onGridReady }) => { | |||
| {...register("description")} | |||
| id="userGroupDescription" | |||
| label="User Group Description" | |||
| defaultValue={searchCriteria.description} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| @@ -8,6 +8,7 @@ import { | |||
| import MainCard from "components/MainCard"; | |||
| import { useEffect, useState } from "react"; | |||
| import * as React from "react"; | |||
| import { getSearchCriteria } from "auth/utils"; | |||
| //import LoadingComponent from "../extra-pages/LoadingComponent"; | |||
| // import UserGroupSearchForm from "./UserGroupSearchForm"; | |||
| @@ -36,6 +37,15 @@ const UserGroupSearchPanel = () => { | |||
| const [onReady, setOnReady] = useState(false); | |||
| const [onGridReady, setGridOnReady] = useState(false); | |||
| useEffect(() => { | |||
| if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||
| setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||
| }else{ | |||
| localStorage.setItem('searchCriteria',"") | |||
| setSearchCriteria({}) | |||
| } | |||
| }, []); | |||
| useEffect(() => { | |||
| setOnReady(true); | |||
| }, [searchCriteria]); | |||
| @@ -43,6 +53,7 @@ const UserGroupSearchPanel = () => { | |||
| function applySearch(input) { | |||
| setGridOnReady(true) | |||
| setSearchCriteria(input); | |||
| localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||
| } | |||
| function applyGridOnReady(input) { | |||
| @@ -73,6 +84,7 @@ const UserGroupSearchPanel = () => { | |||
| <UserGroupSearchForm | |||
| applySearch={applySearch} | |||
| onGridReady={onGridReady} | |||
| searchCriteria={searchCriteria} | |||
| /> | |||
| </Grid> | |||
| {/*row 2*/} | |||