@@ -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,29 @@ 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 | |||||
} else { | |||||
return "" | |||||
} | |||||
} | |||||
} | |||||
export const checkSearchCriteriaPath = (path) =>{ | |||||
if(!path.startsWith("/application") | |||||
|| path === "/application/search"){ | |||||
if(!path.startsWith("/user/")){ | |||||
if(!path.startsWith("/publicNotice/")|| path === "/publicNotice"){ | |||||
return true | |||||
} | |||||
} | |||||
} | |||||
} | } |
@@ -6,12 +6,13 @@ import { | |||||
import * as HttpUtils from "utils/HttpUtils"; | import * as HttpUtils from "utils/HttpUtils"; | ||||
import { FormattedMessage, useIntl } from "react-intl"; | import { FormattedMessage, useIntl } from "react-intl"; | ||||
import { TablePagination, Typography } from '@mui/material'; | import { TablePagination, Typography } from '@mui/material'; | ||||
import { getSearchCriteria, checkSearchCriteriaPath } from "auth/utils"; | |||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export function FiDataGrid({ rows, columns, sx, autoHeight, | export function FiDataGrid({ rows, columns, sx, autoHeight, | ||||
hideFooterSelectedRowCount, rowModesModel, editMode, | hideFooterSelectedRowCount, rowModesModel, editMode, | ||||
pageSizeOptions, filterItems, customPageSize, doLoad, applyGridOnReady, ...props }) { | |||||
pageSizeOptions, filterItems, customPageSize, doLoad, applyGridOnReady, applySearch, tab, ...props }) { | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const [_rows, set_rows] = useState([]); | const [_rows, set_rows] = useState([]); | ||||
const [_doLoad, set_doLoad] = useState({}); | const [_doLoad, set_doLoad] = useState({}); | ||||
@@ -52,7 +53,16 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
useEffect(() => { | useEffect(() => { | ||||
if (doLoad !== undefined && Object.keys(doLoad).length>0 ){ | if (doLoad !== undefined && Object.keys(doLoad).length>0 ){ | ||||
setPage(0); | |||||
if(applySearch!=undefined){ | |||||
if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||||
const localStorageSearchCriteria = getSearchCriteria(window.location.pathname) | |||||
if(localStorageSearchCriteria.start!=undefined){ | |||||
setPage(localStorageSearchCriteria.start/pageSize); | |||||
} | |||||
} | |||||
}else{ | |||||
setPage(0); | |||||
} | |||||
set_doLoad(doLoad); | set_doLoad(doLoad); | ||||
setLoading(true) | setLoading(true) | ||||
} | } | ||||
@@ -137,6 +147,16 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
if (_doLoad.params == null) _doLoad.params = {}; | if (_doLoad.params == null) _doLoad.params = {}; | ||||
_doLoad.params.start = page * pageSize; | _doLoad.params.start = page * pageSize; | ||||
_doLoad.params.limit = pageSize; | _doLoad.params.limit = pageSize; | ||||
if(checkSearchCriteriaPath(window.location.pathname)){ | |||||
if(window.location.pathname === "/publicNotice"){ | |||||
if (tab != undefined && tab ==="application"){ | |||||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) | |||||
} | |||||
}else if (window.location.pathname != "/publicNotice"){ | |||||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) | |||||
} | |||||
} | |||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: _doLoad.url, | url: _doLoad.url, | ||||
params: _doLoad.params, | params: _doLoad.params, | ||||
@@ -19,6 +19,7 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable | |||||
const theme = useTheme(); | const theme = useTheme(); | ||||
const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | ||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const [onDownload, setOnDownload] = React.useState(false); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
loadData(); | loadData(); | ||||
@@ -41,10 +42,17 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable | |||||
}; | }; | ||||
const onDownloadClick = (fileId, skey, filename) => () => { | const onDownloadClick = (fileId, skey, filename) => () => { | ||||
setOnDownload(true) | |||||
HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
fileId: fileId, | fileId: fileId, | ||||
skey: skey, | skey: skey, | ||||
filename: filename, | filename: filename, | ||||
onResponse:()=>{ | |||||
setOnDownload(false) | |||||
}, | |||||
onError:()=>{ | |||||
setOnDownload(false) | |||||
} | |||||
}); | }); | ||||
}; | }; | ||||
@@ -91,6 +99,7 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable | |||||
className="textPrimary" | className="textPrimary" | ||||
onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | ||||
color="primary" | color="primary" | ||||
disabled={onDownload} | |||||
/>] | />] | ||||
}, | }, | ||||
}, | }, | ||||
@@ -139,6 +148,7 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable | |||||
className="textPrimary" | className="textPrimary" | ||||
onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | ||||
color="primary" | color="primary" | ||||
disabled={onDownload} | |||||
/>] | />] | ||||
}, | }, | ||||
}, | }, | ||||
@@ -1,6 +1,7 @@ | |||||
import { useEffect, useState } from 'react'; | import { useEffect, useState } from 'react'; | ||||
import { Outlet } from 'react-router-dom'; | import { Outlet } from 'react-router-dom'; | ||||
import { useDispatch, useSelector } from 'react-redux'; | import { useDispatch, useSelector } from 'react-redux'; | ||||
import { useLocation } from 'react-router-dom'; | |||||
// material-ui | // material-ui | ||||
import { useTheme } from '@mui/material/styles'; | import { useTheme } from '@mui/material/styles'; | ||||
@@ -31,7 +32,8 @@ const MainLayout = () => { | |||||
const theme = useTheme(); | const theme = useTheme(); | ||||
const matchDownLG = useMediaQuery(theme.breakpoints.down('lg')); | const matchDownLG = useMediaQuery(theme.breakpoints.down('lg')); | ||||
const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
const location = useLocation(); | |||||
const hideNavbarRoutes = ['/databaseHealthCheck'] | |||||
const { drawerOpen } = useSelector((state) => state.menu); | const { drawerOpen } = useSelector((state) => state.menu); | ||||
// drawer toggler | // drawer toggler | ||||
@@ -55,18 +57,26 @@ const MainLayout = () => { | |||||
}, [drawerOpen]); | }, [drawerOpen]); | ||||
return ( | return ( | ||||
<Box sx={{backgroundColor:'#ffffff', display: 'flex', width: '100%', flexDirection: "column", paddingTop: { xs: "5px", sm: "25px", md: "43px" }}}> | |||||
<Header/> | |||||
{/* <Drawer open={open} handleDrawerToggle={handleDrawerToggle} /> */} | |||||
<Box style={{ width: '100%', flexGrow: 1 } } sx={{ paddingTop: "38px" }}> | |||||
{/* <Toolbar /> */} | |||||
{/* <Breadcrumbs navigation={navigation} title /> */} | |||||
<Outlet /> | |||||
</Box> | |||||
<Box sx={{borderTop: "3px solid #0C489E"}}> | |||||
<Footer/> | |||||
</Box> | |||||
</Box> | |||||
<> | |||||
{!hideNavbarRoutes.includes(location.pathname) && ( | |||||
<Box sx={{backgroundColor:'#ffffff', display: 'flex', width: '100%', flexDirection: "column", paddingTop: { xs: "5px", sm: "25px", md: "43px" }}}> | |||||
<Header/> | |||||
{/* <Drawer open={open} handleDrawerToggle={handleDrawerToggle} /> */} | |||||
<Box style={{ width: '100%', flexGrow: 1 } } sx={{ paddingTop: "38px" }}> | |||||
{/* <Toolbar /> */} | |||||
{/* <Breadcrumbs navigation={navigation} title /> */} | |||||
<Outlet /> | |||||
</Box> | |||||
<Box sx={{borderTop: "3px solid #0C489E"}}> | |||||
<Footer/> | |||||
</Box> | |||||
</Box> | |||||
)} | |||||
{hideNavbarRoutes.includes(location.pathname) && ( | |||||
<Outlet /> | |||||
)} | |||||
</> | |||||
); | ); | ||||
}; | }; | ||||
@@ -10,7 +10,7 @@ import { clickableLink } from 'utils/CommonFunction'; | |||||
import {GET_ANNOUNCE_LIST} from "utils/ApiPathConst"; | import {GET_ANNOUNCE_LIST} from "utils/ApiPathConst"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady }) { | |||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady, applySearch}) { | |||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -74,6 +74,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch = {applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: GET_ANNOUNCE_LIST, | // url: GET_ANNOUNCE_LIST, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -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) { | ||||
@@ -83,6 +94,7 @@ const UserSearchPage_Individual = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -6,7 +6,7 @@ import { FormattedMessage, useIntl } from "react-intl"; | |||||
import {GET_ANNOUNCE_LIST} from "utils/ApiPathConst"; | import {GET_ANNOUNCE_LIST} from "utils/ApiPathConst"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady }) { | |||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady,applySearch }) { | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const { locale } = intl; | const { locale } = intl; | ||||
@@ -58,6 +58,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
customPageSize={10} | customPageSize={10} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: GET_ANNOUNCE_LIST, | // url: GET_ANNOUNCE_LIST, | ||||
// params: _searchCriteria | // params: _searchCriteria | ||||
@@ -39,6 +39,22 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
setToDateValue(maxDate); | setToDateValue(maxDate); | ||||
}, [maxDate]); | }, [maxDate]); | ||||
const _sx = { | |||||
padding: "4 2 4 2", | |||||
boxShadow: 1, | |||||
border: 1, | |||||
borderColor: '#DDD', | |||||
'& .MuiDataGrid-cell': { | |||||
borderTop: 1, | |||||
borderBottom: 1, | |||||
borderColor: "#EEE" | |||||
}, | |||||
'& .MuiDataGrid-footerContainer': { | |||||
border: 1, | |||||
borderColor: "#EEE" | |||||
} | |||||
} | |||||
const marginBottom = 2.5; | const marginBottom = 2.5; | ||||
const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
const onSubmit = (data) => { | const onSubmit = (data) => { | ||||
@@ -60,7 +76,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',"") | |||||
} | } | ||||
@@ -68,7 +85,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
<MainCard xs={12} md={12} lg={12} | <MainCard xs={12} md={12} lg={12} | ||||
border={false} | border={false} | ||||
content={false} | content={false} | ||||
sx={{ backgroundColor: '#fff' }} | |||||
sx={_sx} | |||||
> | > | ||||
<form onSubmit={handleSubmit(onSubmit)}> | <form onSubmit={handleSubmit(onSubmit)}> | ||||
@@ -187,6 +204,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
variant="contained" | variant="contained" | ||||
type="submit" | type="submit" | ||||
disabled={onGridReady} | disabled={onGridReady} | ||||
aria-label={intl.formatMessage({id: 'submit'})} | |||||
> | > | ||||
<FormattedMessage id="submit"></FormattedMessage> | <FormattedMessage id="submit"></FormattedMessage> | ||||
</Button> | </Button> | ||||
@@ -14,6 +14,7 @@ const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); | |||||
const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); | const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
import { FormattedMessage } from "react-intl"; | import { FormattedMessage } from "react-intl"; | ||||
import { getSearchCriteria } from "auth/utils"; | |||||
const BackgroundHead = { | const BackgroundHead = { | ||||
backgroundImage: `url(${titleBackgroundImg})`, | backgroundImage: `url(${titleBackgroundImg})`, | ||||
@@ -29,21 +30,32 @@ 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(() => { | React.useEffect(() => { | ||||
setOnReady(true); | |||||
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(() => { | |||||
if(Object.keys(searchCriteria).length>0){ | |||||
setOnReady(true); | |||||
} | |||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
function applySearch(input) { | function applySearch(input) { | ||||
setGridOnReady(true) | |||||
setSearchCriteria(input); | setSearchCriteria(input); | ||||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||||
} | } | ||||
function applyGridOnReady(input) { | function applyGridOnReady(input) { | ||||
@@ -84,6 +96,7 @@ const UserSearchPage_Individual = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -21,8 +21,8 @@ import {ThemeProvider} from "@emotion/react"; | |||||
import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
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 Loadable from 'components/Loadable'; | |||||
const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||||
// import Loadable from 'components/Loadable'; | |||||
// const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||||
import {DatePicker} from "@mui/x-date-pickers/DatePicker"; | import {DatePicker} from "@mui/x-date-pickers/DatePicker"; | ||||
import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||
@@ -79,6 +79,7 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { | |||||
setOnDownload(true) | setOnDownload(true) | ||||
HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
url: UrlUtils.AUDIT_LOG_EXPORT, | url: UrlUtils.AUDIT_LOG_EXPORT, | ||||
params: searchCriteria, | |||||
onResponse:()=>{ | onResponse:()=>{ | ||||
setOnDownload(false) | setOnDownload(false) | ||||
}, | }, | ||||
@@ -189,16 +190,13 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { | |||||
<Grid container maxWidth justifyContent="flex-end"> | <Grid container maxWidth justifyContent="flex-end"> | ||||
{isGranted("MAINTAIN_SETTING") ? | {isGranted("MAINTAIN_SETTING") ? | ||||
<Grid item sx={{ ml: 3, mr: 3, mb: 3,}}> | <Grid item sx={{ ml: 3, mr: 3, mb: 3,}}> | ||||
{onDownload? | |||||
<LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
: | |||||
<Button | |||||
variant="contained" | |||||
onClick={exportExcel} | |||||
> | |||||
Export | |||||
</Button> | |||||
} | |||||
<Button | |||||
variant="contained" | |||||
onClick={exportExcel} | |||||
disabled={onDownload} | |||||
> | |||||
Export | |||||
</Button> | |||||
</Grid> : null | </Grid> : null | ||||
} | } | ||||
<Grid item sx={{ ml: 3, mr: 3, mb: 3,}}> | <Grid item sx={{ ml: 3, mr: 3, mb: 3,}}> | ||||
@@ -12,7 +12,7 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function AuditLogTable({searchCriteria, applyGridOnReady}) { | |||||
export default function AuditLogTable({searchCriteria, applyGridOnReady,applySearch}) { | |||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | ||||
useEffect(() => { | useEffect(() => { | ||||
@@ -88,6 +88,7 @@ export default function AuditLogTable({searchCriteria, applyGridOnReady}) { | |||||
customPageSize={10} | customPageSize={10} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: GET_AUDIT_LOG_LIST, | // url: GET_AUDIT_LOG_LIST, | ||||
// params: _searchCriteria | // params: _searchCriteria | ||||
@@ -83,6 +83,7 @@ const AuditLogPage = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -41,6 +41,7 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri | |||||
const [_searchCriteria, set_searchCriteria] = useState({}); | const [_searchCriteria, set_searchCriteria] = useState({}); | ||||
const [selectedRowItems, setSelectedRowItems] = useState([]); | const [selectedRowItems, setSelectedRowItems] = useState([]); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
const [onDownload, setOnDownload] = useState(false); | |||||
useEffect(() => { | useEffect(() => { | ||||
set_searchCriteria(searchCriteria); | set_searchCriteria(searchCriteria); | ||||
@@ -86,10 +87,17 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri | |||||
} | } | ||||
const onDownloadClick = (params) => () => { | const onDownloadClick = (params) => () => { | ||||
setOnDownload(true) | |||||
HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
fileId: params.row.fileId, | fileId: params.row.fileId, | ||||
skey: params.row.skey, | skey: params.row.skey, | ||||
filename: params.row.filename, | filename: params.row.filename, | ||||
onResponse:()=>{ | |||||
setOnDownload(false) | |||||
}, | |||||
onError:()=>{ | |||||
setOnDownload(false) | |||||
} | |||||
}); | }); | ||||
}; | }; | ||||
@@ -282,7 +290,7 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri | |||||
), | ), | ||||
width: 280, | width: 280, | ||||
renderCell: (params) => { | renderCell: (params) => { | ||||
return <Button onClick={onDownloadClick(params)}><u>{params.row.filename}</u></Button>; | |||||
return <Button disabled={onDownload} onClick={onDownloadClick(params)}><u>{params.row.filename}</u></Button>; | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
@@ -389,6 +397,7 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri | |||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
doLoad={useMemo(() => ({ | doLoad={useMemo(() => ({ | ||||
url: DEMAND_NOTE_LIST_ALL, | url: DEMAND_NOTE_LIST_ALL, | ||||
params: _searchCriteria, | params: _searchCriteria, | ||||
@@ -44,6 +44,28 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const { locale } = intl; | 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(() => { | React.useEffect(() => { | ||||
setFromDateValue(minDate); | setFromDateValue(minDate); | ||||
}, [minDate]); | }, [minDate]); | ||||
@@ -101,12 +123,18 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||||
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]); | ||||
@@ -117,9 +145,13 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||||
setSelectedStatus(ComboData.denmandNoteStatus[0]); | setSelectedStatus(ComboData.denmandNoteStatus[0]); | ||||
setMinDueDate(null); | setMinDueDate(null); | ||||
setMaxDueDate(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) { | function getIssueLabel(data) { | ||||
@@ -213,7 +245,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); | ||||
@@ -10,6 +10,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'))); | ||||
@@ -35,8 +36,8 @@ 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({ | 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()), | // dueDateTo: DateUtils.dateValue(new Date()), | ||||
// dueDateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)), | // dueDateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)), | ||||
}); | }); | ||||
@@ -46,6 +47,15 @@ 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',"") | |||||
setSearchCriteria({ | |||||
dateTo: DateUtils.dateValue(new Date()), | |||||
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), | |||||
}) | |||||
} | |||||
}, []); | }, []); | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
@@ -76,6 +86,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) { | ||||
@@ -15,7 +15,7 @@ import {useIntl} from "react-intl"; | |||||
import {DEMAND_NOTE_LIST} from "utils/ApiPathConst"; | import {DEMAND_NOTE_LIST} from "utils/ApiPathConst"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchDemandNote({ searchCriteria, applyGridOnReady }) { | |||||
export default function SearchDemandNote({ searchCriteria, applyGridOnReady,applySearch }) { | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const theme = useTheme(); | const theme = useTheme(); | ||||
@@ -98,6 +98,7 @@ export default function SearchDemandNote({ searchCriteria, applyGridOnReady }) { | |||||
customPageSize={10} | customPageSize={10} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: DEMAND_NOTE_LIST, | // url: DEMAND_NOTE_LIST, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -38,6 +38,18 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData, onG | |||||
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.denmandNoteStatus_Public[0] | |||||
}else{ | |||||
setSelectedStatus(ComboData.denmandNoteStatus_Public.find(item => item.type === searchCriteria.status)) | |||||
} | |||||
}else{ | |||||
setSelectedStatus(ComboData.denmandNoteStatus_Public[0]) | |||||
} | |||||
}, [searchCriteria]); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setFromDateValue(minDate); | setFromDateValue(minDate); | ||||
}, [minDate]); | }, [minDate]); | ||||
@@ -76,17 +88,23 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData, onG | |||||
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' }); | |||||
setSelectedStatus(ComboData.denmandNoteStatus_Public[0]); | |||||
// setOrgSelected({}); | // setOrgSelected({}); | ||||
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())) | ||||
setIssueSelected({}); | setIssueSelected({}); | ||||
reset(); | |||||
reset({ | |||||
appNo:"", | |||||
dnNo:"", | |||||
}); | |||||
} | } | ||||
function getIssueLabel(data) { | function getIssueLabel(data) { | ||||
@@ -10,6 +10,7 @@ import * as React from "react"; | |||||
import {GET_ORG_COMBO, GET_ISSUE_COMBO} from "utils/ApiPathConst"; | import {GET_ORG_COMBO, GET_ISSUE_COMBO} 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'))); | ||||
@@ -34,16 +35,22 @@ const SearchPage_DemandNote_Pub = () => { | |||||
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(() => { | ||||
@@ -75,6 +82,7 @@ const SearchPage_DemandNote_Pub = () => { | |||||
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) { | ||||
@@ -119,6 +127,7 @@ const SearchPage_DemandNote_Pub = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -143,6 +143,7 @@ const Index = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -0,0 +1,121 @@ | |||||
// import { useState } from 'react'; | |||||
// material-ui | |||||
import { | |||||
Grid, | |||||
Typography, | |||||
Stack, | |||||
Paper, | |||||
Box, | |||||
CircularProgress, | |||||
Button | |||||
} from '@mui/material'; | |||||
import * as React from "react"; | |||||
import { GET_JVM_INFO } from "utils/ApiPathConst"; | |||||
import axios from "axios"; | |||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const JVMDefault = () => { | |||||
const [jvmInfo, setJvmInfo] = React.useState(null); | |||||
const [loading, setLoading] = React.useState(true); | |||||
const [error, setError] = React.useState(null); | |||||
const fetchJvmInfo = () => { | |||||
setLoading(true); | |||||
setError(null); | |||||
axios.get(`${GET_JVM_INFO}`) | |||||
.then((response) => { | |||||
if (response.status === 200) { | |||||
console.log(response) | |||||
setJvmInfo(response.data); | |||||
} | |||||
}) | |||||
.catch(error => { | |||||
setError(error); | |||||
setLoading(false); | |||||
}); | |||||
}; | |||||
React.useEffect(() => { | |||||
localStorage.setItem('searchCriteria', ""); | |||||
setLoading(false); | |||||
}, []); | |||||
React.useEffect(() => { | |||||
if(jvmInfo != null) { | |||||
if (Object.keys(jvmInfo).length > 0 && jvmInfo !== undefined) { | |||||
setLoading(false); | |||||
} | |||||
} | |||||
}, [jvmInfo]); | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize: 'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
}; | |||||
return ( | |||||
<Grid container sx={{ minHeight: '87vh', backgroundColor: "backgroundColor.default" }} direction="column"> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="space-between" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4" sx={{ "textShadow": "0px 0px 25px #0C489E" }}> | |||||
JVM Information | |||||
</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
<Grid item xs={12} ml={15} mb={2} mt={2}> | |||||
<Button | |||||
size="large" | |||||
variant="contained" | |||||
type="submit" | |||||
sx={{ | |||||
textTransform: 'capitalize', | |||||
alignItems: 'end' | |||||
}} | |||||
onClick={fetchJvmInfo} | |||||
disabled={loading} | |||||
> | |||||
<Typography variant="h5">JVM Info</Typography> | |||||
</Button> | |||||
</Grid> | |||||
<Grid item xs={12} ml={15} mb={2} mt={2}> | |||||
<Paper elevation={3} sx={{ p: 2, bgcolor: 'background.paper' }}> | |||||
{loading ? ( | |||||
<Box display="flex" justifyContent="center" alignItems="center" minHeight={200}> | |||||
<CircularProgress /> | |||||
</Box> | |||||
) : error ? ( | |||||
<Typography color="error">Error: {error.message}</Typography> | |||||
) : jvmInfo ? ( | |||||
<Box | |||||
component="pre" | |||||
sx={{ | |||||
p: 2, | |||||
borderRadius: 1, | |||||
bgcolor: 'grey.100', | |||||
overflow: 'auto', | |||||
maxHeight: 400, | |||||
fontSize: '0.875rem', | |||||
lineHeight: 1.6 | |||||
}} | |||||
> | |||||
{JSON.stringify(jvmInfo, null, 2)} | |||||
</Box> | |||||
) : ( | |||||
<Typography>No data available</Typography> | |||||
)} | |||||
</Paper> | |||||
</Grid> | |||||
</Grid> | |||||
); | |||||
}; | |||||
export default JVMDefault; |
@@ -5,13 +5,21 @@ import { useNavigate } from "react-router-dom"; | |||||
import { FiDataGrid } from "components/FiDataGrid"; | import { FiDataGrid } from "components/FiDataGrid"; | ||||
import {useIntl} from "react-intl"; | import {useIntl} from "react-intl"; | ||||
import { clickableLink } from 'utils/CommonFunction'; | import { clickableLink } from 'utils/CommonFunction'; | ||||
import {GET_MSG_LIST} from "utils/ApiPathConst"; | |||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function MsgTable({ recordList }) { | |||||
const [rows, setRows] = React.useState(recordList); | |||||
export default function MsgTable({ searchCriteria, applyGridOnReady, applySearch}) { | |||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | |||||
React.useEffect(() => { | |||||
set_searchCriteria(searchCriteria); | |||||
}, [searchCriteria]); | |||||
const _sx = { | const _sx = { | ||||
padding: "4 2 4 2", | padding: "4 2 4 2", | ||||
boxShadow: 1, | boxShadow: 1, | ||||
@@ -25,25 +33,24 @@ export default function MsgTable({ recordList }) { | |||||
'& .MuiDataGrid-footerContainer': { | '& .MuiDataGrid-footerContainer': { | ||||
border: 1, | border: 1, | ||||
borderColor: "#EEE" | borderColor: "#EEE" | ||||
} | |||||
}, | |||||
"& .MuiDataGrid-columnHeaderTitle": { | |||||
whiteSpace: "normal", | |||||
lineHeight: "normal" | |||||
}, | |||||
"& .MuiDataGrid-columnHeader": { | |||||
// Forced to use important since overriding inline styles | |||||
height: "unset !important" | |||||
}, | |||||
} | } | ||||
React.useEffect(() => { | |||||
setRows(recordList); | |||||
}, [recordList]); | |||||
const handleEditClick = (params) => () => { | |||||
navigate('/msg/details/' + params.row.id); | |||||
}; | |||||
const columns = [ | const columns = [ | ||||
{ | { | ||||
id: 'sentDate', | id: 'sentDate', | ||||
field: 'sentDate', | field: 'sentDate', | ||||
headerName: intl.formatMessage({id: 'date'}), | headerName: intl.formatMessage({id: 'date'}), | ||||
width: 170, | width: 170, | ||||
renderCell: (params) => { | |||||
return DateUtils.datetimeStr(params.row.sentDate); | |||||
valueGetter: (params) => { | |||||
return DateUtils.datetimeStr(params?.value); | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
@@ -57,16 +64,25 @@ export default function MsgTable({ recordList }) { | |||||
}, | }, | ||||
]; | ]; | ||||
function handleEditClick(params) { | |||||
navigate('/msg/details/' + params.row.id); | |||||
} | |||||
return ( | return ( | ||||
<div style={{ minHeight: 400, width: '100%' }}> | |||||
<div style={{ width: '100%', overflowX: 'auto'}}> | |||||
<FiDataGrid | <FiDataGrid | ||||
sx={_sx} | sx={_sx} | ||||
rowHeight={80} | |||||
rows={rows} | |||||
columns={columns} | columns={columns} | ||||
customPageSize={20} | |||||
customPageSize={10} | |||||
getRowHeight={() => 'auto'} | |||||
onRowDoubleClick={handleEditClick} | onRowDoubleClick={handleEditClick} | ||||
applyGridOnReady={applyGridOnReady} | |||||
applySearch={applySearch} | |||||
doLoad={React.useMemo(() => ({ | |||||
url: GET_MSG_LIST, | |||||
params: _searchCriteria, | |||||
}), [_searchCriteria])} | |||||
/> | /> | ||||
</div> | </div> | ||||
); | ); | ||||
@@ -21,7 +21,7 @@ import {AdapterDayjs} from "@mui/x-date-pickers/AdapterDayjs"; | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const SearchForm = ({ applySearch, searchCriteria }) => { | |||||
const SearchForm = ({ applySearch, searchCriteria, onGridReady }) => { | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
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); | ||||
@@ -64,7 +64,7 @@ const SearchForm = ({ applySearch, searchCriteria }) => { | |||||
sentDateTo = DateUtils.dateValue(toDateValue) | sentDateTo = DateUtils.dateValue(toDateValue) | ||||
} | } | ||||
const temp = { | const temp = { | ||||
keywork: data.keywork, | |||||
keyword: data.keyword, | |||||
dateFrom: sentDateFrom, | dateFrom: sentDateFrom, | ||||
dateTo: sentDateTo, | dateTo: sentDateTo, | ||||
}; | }; | ||||
@@ -75,6 +75,8 @@ const SearchForm = ({ applySearch, searchCriteria }) => { | |||||
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',"") | |||||
} | } | ||||
@@ -196,6 +198,7 @@ const SearchForm = ({ applySearch, searchCriteria }) => { | |||||
<Button | <Button | ||||
variant="contained" | variant="contained" | ||||
type="submit" | type="submit" | ||||
disabled={onGridReady} | |||||
aria-label={intl.formatMessage({id: 'submit'})} | aria-label={intl.formatMessage({id: 'submit'})} | ||||
> | > | ||||
<FormattedMessage id="submit"/> | <FormattedMessage id="submit"/> | ||||
@@ -5,9 +5,9 @@ import { | |||||
Stack | Stack | ||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
import * as UrlUtils from "utils/ApiPathConst"; | |||||
// import * as UrlUtils from "utils/ApiPathConst"; | |||||
import * as React from "react"; | 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 Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
@@ -16,6 +16,7 @@ const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); | |||||
const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); | const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
import {FormattedMessage} from "react-intl"; | import {FormattedMessage} from "react-intl"; | ||||
import { getSearchCriteria } from "auth/utils"; | |||||
const BackgroundHead = { | const BackgroundHead = { | ||||
backgroundImage: `url(${titleBackgroundImg})`, | backgroundImage: `url(${titleBackgroundImg})`, | ||||
@@ -31,41 +32,58 @@ const BackgroundHead = { | |||||
const Index = () => { | const Index = () => { | ||||
const [record,setRecord] = 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); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setOnReady(true); | |||||
}, [record]); | |||||
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(() => { | ||||
loadGrid(); | |||||
if(Object.keys(searchCriteria).length>0){ | |||||
setOnReady(true); | |||||
} | |||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
function loadGrid(){ | |||||
HttpUtils.get({ | |||||
url: UrlUtils.GET_MSG_LIST, | |||||
params: searchCriteria, | |||||
onSuccess: function(responseData){ | |||||
setRecord(responseData); | |||||
} | |||||
}); | |||||
} | |||||
// function loadGrid(){ | |||||
// HttpUtils.get({ | |||||
// url: UrlUtils.GET_MSG_LIST, | |||||
// params: searchCriteria, | |||||
// onSuccess: function(responseData){ | |||||
// setRecord(responseData); | |||||
// } | |||||
// }); | |||||
// } | |||||
function applySearch(input) { | function applySearch(input) { | ||||
setGridOnReady(true) | |||||
setSearchCriteria(input); | setSearchCriteria(input); | ||||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input})) | |||||
} | |||||
function applyGridOnReady(input) { | |||||
setGridOnReady(input); | |||||
} | } | ||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<Grid container sx={{ minHeight: '95vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> | |||||
<Grid item> | |||||
<LoadingComponent /> | |||||
</Grid> | |||||
</Grid> | |||||
: | : | ||||
<Grid container sx={{minHeight: '85vh',backgroundColor:'#ffffff'}} direction="column"> | |||||
<Grid container sx={{ minHeight: '95vh',backgroundColor: 'backgroundColor.default' }} direction="column"> | |||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
@@ -78,8 +96,9 @@ const Index = () => { | |||||
{/*row 1*/} | {/*row 1*/} | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<SearchForm | <SearchForm | ||||
applySearch={applySearch} | |||||
searchCriteria={searchCriteria} | |||||
applySearch={applySearch} | |||||
searchCriteria={searchCriteria} | |||||
onGridReady={onGridReady} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
@@ -90,7 +109,10 @@ const Index = () => { | |||||
sx={{width: "-webkit-fill-available"}} | sx={{width: "-webkit-fill-available"}} | ||||
> | > | ||||
<EventTable | <EventTable | ||||
recordList={record} | |||||
// recordList={record} | |||||
searchCriteria={searchCriteria} | |||||
applyGridOnReady={applyGridOnReady} | |||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -8,7 +8,7 @@ import { | |||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
import { useForm } from "react-hook-form"; | import { useForm } from "react-hook-form"; | ||||
import { useState } from "react"; | |||||
import { useState,useEffect } from "react"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
import * as UrlUtils from "utils/ApiPathConst"; | import * as UrlUtils from "utils/ApiPathConst"; | ||||
@@ -19,11 +19,21 @@ import {ThemeProvider} from "@emotion/react"; | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||||
const OrganizationSearchForm = ({ applySearch, onGridReady, searchCriteria }) => { | |||||
const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
const [creditorSelected, setCreditorSelected] = React.useState(ComboData.CreditorStatus[0]); | const [creditorSelected, setCreditorSelected] = React.useState(ComboData.CreditorStatus[0]); | ||||
const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
const [onDownload, setOnDownload] = React.useState(false); | |||||
useEffect(() => { | |||||
if(searchCriteria.creditor!=undefined){ | |||||
setCreditorSelected(ComboData.CreditorStatus.find(item => item.type === searchCriteria.creditor.toString())) | |||||
}else{ | |||||
setCreditorSelected(ComboData.CreditorStatus[0]); | |||||
} | |||||
}, [searchCriteria]); | |||||
const onSubmit = (data) => { | const onSubmit = (data) => { | ||||
let typeArray = []; | let typeArray = []; | ||||
@@ -48,12 +58,23 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||||
function resetForm() { | function resetForm() { | ||||
setType([]); | setType([]); | ||||
setCreditorSelected(ComboData.CreditorStatus[0]); | setCreditorSelected(ComboData.CreditorStatus[0]); | ||||
reset(); | |||||
reset({ | |||||
brNo: "", | |||||
enCompanyName: "", | |||||
chCompanyName: "", | |||||
}); | |||||
} | } | ||||
const doExport=()=>{ | const doExport=()=>{ | ||||
setOnDownload(true) | |||||
HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
url: UrlUtils.GET_ORG_EXPORT | |||||
url: UrlUtils.GET_ORG_EXPORT, | |||||
onResponse:()=>{ | |||||
setOnDownload(false) | |||||
}, | |||||
onError:()=>{ | |||||
setOnDownload(false) | |||||
} | |||||
}); | }); | ||||
} | } | ||||
@@ -80,6 +101,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("brNo")} | {...register("brNo")} | ||||
id='brNo' | id='brNo' | ||||
label="BR No." | label="BR No." | ||||
defaultValue={searchCriteria.brNo} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -92,6 +114,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("enCompanyName")} | {...register("enCompanyName")} | ||||
id="enCompanyName" | id="enCompanyName" | ||||
label="Name (English)" | label="Name (English)" | ||||
defaultValue={searchCriteria.enCompanyName} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -104,6 +127,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("chCompanyName")} | {...register("chCompanyName")} | ||||
id="chCompanyName" | id="chCompanyName" | ||||
label="Name (Chinese)" | label="Name (Chinese)" | ||||
defaultValue={searchCriteria.chCompanyName} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -148,6 +172,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady }) => { | |||||
<Button | <Button | ||||
variant="contained" | variant="contained" | ||||
onClick={doExport} | onClick={doExport} | ||||
disabled={onDownload} | |||||
> | > | ||||
Export | Export | ||||
</Button> | </Button> | ||||
@@ -11,7 +11,7 @@ import { clickableLink} from 'utils/CommonFunction'; | |||||
import {GET_ORG_PATH} from "utils/ApiPathConst"; | import {GET_ORG_PATH} from "utils/ApiPathConst"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function OrganizationTable({ searchCriteria, applyGridOnReady }) { | |||||
export default function OrganizationTable({ searchCriteria, applyGridOnReady, applySearch}) { | |||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -114,6 +114,7 @@ export default function OrganizationTable({ searchCriteria, applyGridOnReady }) | |||||
customPageSize={10} | customPageSize={10} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: GET_ORG_PATH, | // url: GET_ORG_PATH, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -5,7 +5,7 @@ import { | |||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
import { useEffect, useState } from "react"; | import { useEffect, useState } from "react"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import { getSearchCriteria } from "auth/utils"; | |||||
// import LoadingComponent from "../extra-pages/LoadingComponent"; | // import LoadingComponent from "../extra-pages/LoadingComponent"; | ||||
// import SearchForm from "./OrganizationSearchForm"; | // import SearchForm from "./OrganizationSearchForm"; | ||||
@@ -34,6 +34,15 @@ const OrganizationSearchPage = () => { | |||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [onGridReady, setGridOnReady] = React.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(() => { | useEffect(() => { | ||||
setOnReady(true); | setOnReady(true); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
@@ -41,6 +50,7 @@ const OrganizationSearchPage = () => { | |||||
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) { | ||||
@@ -68,6 +78,7 @@ const OrganizationSearchPage = () => { | |||||
<SearchForm | <SearchForm | ||||
applySearch={applySearch} | applySearch={applySearch} | ||||
onGridReady={onGridReady} | onGridReady={onGridReady} | ||||
searchCriteria={searchCriteria} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
@@ -79,6 +90,7 @@ const OrganizationSearchPage = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -165,14 +165,10 @@ const PaymentDetails = ({ formData,doPrint,onDownload }) => { | |||||
</FormLabel> | </FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid xs={6} md={5} sx={{ml:5,textAlign: "left" }}> | <Grid xs={6} md={5} sx={{ml:5,textAlign: "left" }}> | ||||
{onDownload? | |||||
<LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
: | |||||
<Button className="printHidden" variant="contained" sx={{ mt:2 }} onClick={doPrint}> | |||||
<DownloadIcon/> | |||||
<Typography sx={{fontSize: "16px"}}>Download</Typography> | |||||
</Button> | |||||
} | |||||
<Button className="printHidden" variant="contained" disabled={onDownload} sx={{ mt:2 }} onClick={doPrint}> | |||||
<DownloadIcon/> | |||||
<Typography sx={{fontSize: "16px"}}>Download</Typography> | |||||
</Button> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -208,16 +208,12 @@ const PaymentDetails = ({ formData,doPrint,onDownload }) => { | |||||
</FormLabel> | </FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={6} md={5} sx={{textAlign: "left" }}> | <Grid item xs={6} md={5} sx={{textAlign: "left" }}> | ||||
{onDownload? | |||||
<LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
: | |||||
<Button className="printHidden" variant="contained" sx={{ mt:2 }} onClick={doPrint}> | |||||
<DownloadIcon/> | |||||
<Typography sx={{fontSize: "16px"}}> | |||||
<FormattedMessage id="download"/> | |||||
</Typography> | |||||
</Button> | |||||
} | |||||
<Button className="printHidden" variant="contained" disabled={onDownload} sx={{ mt:2 }} onClick={doPrint}> | |||||
<DownloadIcon/> | |||||
<Typography sx={{fontSize: "16px"}}> | |||||
<FormattedMessage id="download"/> | |||||
</Typography> | |||||
</Button> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -286,7 +286,8 @@ const Index = () => { | |||||
} | } | ||||
}, | }, | ||||
onError: function(){ | onError: function(){ | ||||
cancelPayment() | |||||
alert("ERROR") | |||||
// cancelPayment() | |||||
// clearInterval(currentTimer.current); | // clearInterval(currentTimer.current); | ||||
} | } | ||||
}); | }); | ||||
@@ -301,16 +302,17 @@ const Index = () => { | |||||
// console.log(timeOutDate) | // console.log(timeOutDate) | ||||
// console.log(currentTime) | // console.log(currentTime) | ||||
// console.log(timeOutDate.getTime()-currentTime.getTime()) | // console.log(timeOutDate.getTime()-currentTime.getTime()) | ||||
getPaymentStatus(); | |||||
if (timeOutDate.getTime()<currentTime.getTime()){ | |||||
// console.log("stop"); | |||||
clearInterval(currentTimer.current); | |||||
setqrCodeTimeout(true) | |||||
setTimeDownCount(0); | |||||
cancelPayment() | |||||
}else{ | |||||
setTimeDownCount(timedowncount); | |||||
if (browserType === desktopBrowser){ | |||||
getPaymentStatus(); | |||||
if (timeOutDate.getTime()<currentTime.getTime()){ | |||||
// console.log("stop"); | |||||
clearInterval(currentTimer.current); | |||||
setqrCodeTimeout(true) | |||||
setTimeDownCount(0); | |||||
cancelPayment() | |||||
}else{ | |||||
setTimeDownCount(timedowncount); | |||||
} | |||||
} | } | ||||
},[time]) | },[time]) | ||||
@@ -9,7 +9,7 @@ import { FiDataGrid } from "components/FiDataGrid"; | |||||
import { clickableLink } from 'utils/CommonFunction'; | import { clickableLink } from 'utils/CommonFunction'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPaymentTable({ searchCriteria, applyGridOnReady }) { | |||||
export default function SearchPaymentTable({ searchCriteria, applyGridOnReady, applySearch}) { | |||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -97,6 +97,7 @@ export default function SearchPaymentTable({ searchCriteria, applyGridOnReady }) | |||||
customPageSize={10} | customPageSize={10} | ||||
onRowDoubleClick={handleEditClick} | onRowDoubleClick={handleEditClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url:PAYMENT_LIST, | // url:PAYMENT_LIST, | ||||
// params:_searchCriteria, | // params:_searchCriteria, | ||||
@@ -31,6 +31,18 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
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.paymentStatus[0] | |||||
}else{ | |||||
setStatus(ComboData.paymentStatus.find(item => item.type === searchCriteria.status)) | |||||
} | |||||
}else{ | |||||
setStatus(ComboData.paymentStatus[0]) | |||||
} | |||||
}, [searchCriteria]); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setFromDateValue(minDate); | setFromDateValue(minDate); | ||||
}, [minDate]); | }, [minDate]); | ||||
@@ -62,7 +74,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:"" | |||||
}); | |||||
} | } | ||||
@@ -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 Index = () => { | 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 [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 Index = () => { | |||||
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) { | ||||
@@ -84,6 +95,7 @@ const Index = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -14,7 +14,7 @@ import { clickableLink } from 'utils/CommonFunction'; | |||||
import {PAYMENT_LIST} from "utils/ApiPathConst"; | import {PAYMENT_LIST} from "utils/ApiPathConst"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady }) { | |||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady, applySearch }) { | |||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
const theme = useTheme(); | const theme = useTheme(); | ||||
const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | ||||
@@ -111,6 +111,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
customPageSize={10} | customPageSize={10} | ||||
onRowDoubleClick={handleEditDoubleClick} | onRowDoubleClick={handleEditDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: PAYMENT_LIST, | // url: PAYMENT_LIST, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -25,7 +25,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
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 [status, setStatus] = React.useState(ComboData.paymentStatus[0]); | |||||
const [status, setStatus] = React.useState(searchCriteria.status!=undefined?ComboData.paymentStatus.find(item => item.type === searchCriteria.status):ComboData.paymentStatus[0]); | |||||
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"); | ||||
@@ -78,7 +78,11 @@ 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',"") | |||||
} | } | ||||
@@ -14,6 +14,7 @@ const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); | |||||
const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); | const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
import {FormattedMessage} from "react-intl"; | import {FormattedMessage} from "react-intl"; | ||||
import { getSearchCriteria } from "auth/utils"; | |||||
const BackgroundHead = { | const BackgroundHead = { | ||||
backgroundImage: `url(${titleBackgroundImg})`, | backgroundImage: `url(${titleBackgroundImg})`, | ||||
@@ -36,12 +37,27 @@ const Index = () => { | |||||
const [onGridReady, setGridOnReady] = React.useState(false); | const [onGridReady, setGridOnReady] = React.useState(false); | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setOnReady(true); | |||||
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(() => { | |||||
if(Object.keys(searchCriteria).length>0){ | |||||
setOnReady(true); | |||||
} | |||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
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) { | ||||
@@ -84,6 +100,7 @@ const Index = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -34,6 +34,7 @@ const ApplicationDetailCard = ({ | |||||
const [data, setData] = useState({}); | const [data, setData] = useState({}); | ||||
const [cancelPopUp, setCancelPopUp] = useState(false); | const [cancelPopUp, setCancelPopUp] = useState(false); | ||||
const [onDownload, setOnDownload] = useState(false); | |||||
useEffect(() => { | useEffect(() => { | ||||
if (formData) { | if (formData) { | ||||
@@ -108,8 +109,15 @@ const ApplicationDetailCard = ({ | |||||
} | } | ||||
const genProof = () => { | const genProof = () => { | ||||
setOnDownload(true) | |||||
HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
url: UrlUtils.GEN_GAZETTE_PROOF + "/" + params.id | |||||
url: UrlUtils.GEN_GAZETTE_PROOF + "/" + params.id, | |||||
onResponse:()=>{ | |||||
setOnDownload(false) | |||||
}, | |||||
onError:()=>{ | |||||
setOnDownload(false) | |||||
} | |||||
}); | }); | ||||
} | } | ||||
@@ -130,7 +138,7 @@ const ApplicationDetailCard = ({ | |||||
component="span" | component="span" | ||||
variant="contained" | variant="contained" | ||||
size="large" | size="large" | ||||
disabled={!showProofBtn} | |||||
disabled={!showProofBtn||onDownload} | |||||
onClick={genProof} | onClick={genProof} | ||||
> | > | ||||
<Typography variant="h5">Proof Slip</Typography> | <Typography variant="h5">Proof Slip</Typography> | ||||
@@ -9,7 +9,7 @@ import { FiDataGrid } from "components/FiDataGrid"; | |||||
import { clickableLink } from 'utils/CommonFunction'; | import { clickableLink } from 'utils/CommonFunction'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({searchCriteria, applyGridOnReady}) { | |||||
export default function SearchPublicNoticeTable({searchCriteria, applyGridOnReady,applySearch}) { | |||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -125,6 +125,7 @@ export default function SearchPublicNoticeTable({searchCriteria, applyGridOnRead | |||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch = {applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: LIST_PROOF, | // url: LIST_PROOF, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -25,18 +25,30 @@ 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 [status, setStatus] = React.useState(searchCriteria.statusKey!=undefined?ComboData.proofStatus_GLD[searchCriteria.statusKey]:ComboData.proofStatus_GLD[0]); | |||||
const [orgSelected, setOrgSelected] = React.useState({}); | const [orgSelected, setOrgSelected] = React.useState({}); | ||||
const [orgCombo, setOrgCombo] = React.useState(); | const [orgCombo, setOrgCombo] = React.useState(); | ||||
const [issueSelected, setIssueSelected] = React.useState({}); | const [issueSelected, setIssueSelected] = React.useState({}); | ||||
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); | ||||
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.proofStatus_GLD[0] | |||||
// }else{ | |||||
// setSelectedStatus(ComboData.proofStatus_GLD.find(item => item.type === searchCriteria.status)) | |||||
// } | |||||
// }else{ | |||||
// setSelectedStatus(ComboData.proofStatus_GLD[0]) | |||||
// } | |||||
// }, [searchCriteria]); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setFromDateValue(minDate); | setFromDateValue(minDate); | ||||
}, [minDate]); | }, [minDate]); | ||||
@@ -73,6 +85,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, | |||||
}; | }; | ||||
@@ -105,12 +118,18 @@ 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]); | ||||
@@ -122,7 +141,12 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
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:"", | |||||
contact:"" | |||||
}); | |||||
localStorage.setItem('searchCriteria',"") | |||||
} | } | ||||
function getIssueLabel(data) { | function getIssueLabel(data) { | ||||
@@ -354,7 +378,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); | ||||
@@ -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'))); | ||||
@@ -32,16 +33,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(() => { | ||||
@@ -72,6 +79,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) { | ||||
@@ -115,6 +123,7 @@ const UserSearchPage_Individual = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -18,7 +18,7 @@ import { useIntl } from "react-intl"; | |||||
import { clickableLink } from 'utils/CommonFunction'; | import { clickableLink } from 'utils/CommonFunction'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady }) { | |||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady, applySearch }) { | |||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
const theme = useTheme(); | const theme = useTheme(); | ||||
@@ -193,6 +193,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
getRowHeight={() => "auto"} | getRowHeight={() => "auto"} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
doLoad={React.useMemo(() => ({ | doLoad={React.useMemo(() => ({ | ||||
url: LIST_PROOF, | url: LIST_PROOF, | ||||
params: _searchCriteria, | params: _searchCriteria, | ||||
@@ -28,10 +28,10 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
const { locale } = intl; | const { locale } = intl; | ||||
const [type, setType] = React.useState([]); | const [type, setType] = React.useState([]); | ||||
const [status, setStatus] = React.useState(ComboData.proofStatus[0]); | |||||
const [status, setStatus] = React.useState(searchCriteria.statusKey!=undefined?ComboData.proofStatusFull[searchCriteria.statusKey]:ComboData.proofStatusFull[0]); | |||||
const [issueSelected, setIssueSelected] = React.useState({}); | const [issueSelected, setIssueSelected] = React.useState({}); | ||||
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); | ||||
@@ -84,6 +84,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
gazettGroup: groupSelected?.type, | gazettGroup: groupSelected?.type, | ||||
dateFrom: sentDateFrom, | dateFrom: sentDateFrom, | ||||
dateTo: sentDateTo, | dateTo: sentDateTo, | ||||
statusKey:status?.key, | |||||
}; | }; | ||||
if(status?.type && status?.type != 'all'){ | if(status?.type && status?.type != 'all'){ | ||||
if (status?.type == "Confirmed"){ | if (status?.type == "Confirmed"){ | ||||
@@ -108,6 +109,9 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
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]); | ||||
@@ -118,7 +122,11 @@ 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',"") | |||||
} | } | ||||
function getIssueLabel(data) { | function getIssueLabel(data) { | ||||
@@ -9,6 +9,7 @@ import * as UrlUtils from "utils/ApiPathConst"; | |||||
import * as React from "react"; | 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 { 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'))); | ||||
@@ -41,6 +42,11 @@ const UserSearchPage_Individual = () => { | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
getIssueCombo(); | getIssueCombo(); | ||||
if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||||
setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||||
}else{ | |||||
localStorage.setItem('searchCriteria',"") | |||||
} | |||||
}, []); | }, []); | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
@@ -62,6 +68,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) { | ||||
@@ -105,6 +112,7 @@ const UserSearchPage_Individual = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -56,6 +56,7 @@ const ApplicationDetailCard = ( | |||||
const [warningText, setWarningText] = useState(""); | const [warningText, setWarningText] = useState(""); | ||||
const [remarksPopUp, setRemarksPopUp] = useState(false); | const [remarksPopUp, setRemarksPopUp] = useState(false); | ||||
const [onDownload, setOnDownload] = useState(false); | |||||
useEffect(() => { | useEffect(() => { | ||||
//if user data from parent are not null | //if user data from parent are not null | ||||
@@ -84,12 +85,19 @@ const ApplicationDetailCard = ( | |||||
} | } | ||||
const onDownloadClick = () => () => { | const onDownloadClick = () => () => { | ||||
setOnDownload(true) | |||||
HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
fileId: fileDetail?.id, | fileId: fileDetail?.id, | ||||
skey: fileDetail?.skey, | skey: fileDetail?.skey, | ||||
filename: fileDetail?.filename, | filename: fileDetail?.filename, | ||||
onResponse:()=>{ | |||||
setOnDownload(false) | |||||
notifyDownloadSuccess() | |||||
}, | |||||
onError:()=>{ | |||||
setOnDownload(false) | |||||
} | |||||
}); | }); | ||||
notifyDownloadSuccess() | |||||
setUploadStatus(true) | setUploadStatus(true) | ||||
}; | }; | ||||
@@ -680,7 +688,7 @@ const ApplicationDetailCard = ( | |||||
size="small" | size="small" | ||||
variant="contained" | variant="contained" | ||||
onClick={onDownloadClick()} | onClick={onDownloadClick()} | ||||
disabled={!fileDetail?.filename} | |||||
disabled={!fileDetail?.filename||onDownload} | |||||
sx={{ | sx={{ | ||||
textTransform: 'capitalize', | textTransform: 'capitalize', | ||||
alignItems: 'end', | alignItems: 'end', | ||||
@@ -61,6 +61,8 @@ const ApplicationDetailCard = ( | |||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [issueNum, setIssueNum] = useState(""); | const [issueNum, setIssueNum] = useState(""); | ||||
const [issueDate, setIssueDate] = useState(""); | const [issueDate, setIssueDate] = useState(""); | ||||
const [onDownload, setOnDownload] = useState(false); | |||||
const { register, | const { register, | ||||
// getValues | // getValues | ||||
} = useForm(); | } = useForm(); | ||||
@@ -89,10 +91,17 @@ const ApplicationDetailCard = ( | |||||
}, [currentApplicationDetailData]); | }, [currentApplicationDetailData]); | ||||
const onDownloadClick = () => () => { | const onDownloadClick = () => () => { | ||||
setOnDownload(true) | |||||
HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
fileId: fileDetail?.id, | fileId: fileDetail?.id, | ||||
skey: fileDetail?.skey, | skey: fileDetail?.skey, | ||||
filename: fileDetail?.filename, | filename: fileDetail?.filename, | ||||
onResponse:()=>{ | |||||
setOnDownload(false) | |||||
}, | |||||
onError:()=>{ | |||||
setOnDownload(false) | |||||
} | |||||
}); | }); | ||||
}; | }; | ||||
@@ -646,7 +655,7 @@ const ApplicationDetailCard = ( | |||||
aria-label={intl.formatMessage({ id: 'download' })} | aria-label={intl.formatMessage({ id: 'download' })} | ||||
title={intl.formatMessage({ id: 'download' })} | title={intl.formatMessage({ id: 'download' })} | ||||
color="save" | color="save" | ||||
disabled={!fileDetail?.filename} | |||||
disabled={!fileDetail?.filename||onDownload} | |||||
startIcon={<DownloadIcon sx={{ alignItems: "center" }} />} | startIcon={<DownloadIcon sx={{ alignItems: "center" }} />} | ||||
> | > | ||||
<FormattedMessage id="download" /> | <FormattedMessage id="download" /> | ||||
@@ -24,7 +24,7 @@ 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 }) => { | |||||
const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => { | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const [type, setType] = React.useState([]); | const [type, setType] = React.useState([]); | ||||
const [status, setStatus] = React.useState(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); | const [status, setStatus] = React.useState(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); | ||||
@@ -38,6 +38,30 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
const marginBottom = 2.5; | const marginBottom = 2.5; | ||||
React.useEffect(() => { | |||||
if(searchCriteria.status!=undefined){ | |||||
if(localStorage.getItem('userData').creditor){ | |||||
if(searchCriteria.status === ""){ | |||||
ComboData.publicNoticeStatic_Creditor[0] | |||||
}else{ | |||||
setStatus(ComboData.publicNoticeStatic_Creditor.find(item => item.type === searchCriteria.status)) | |||||
} | |||||
}else{ | |||||
if(searchCriteria.status === ""){ | |||||
ComboData.publicNoticeStatic[0] | |||||
}else{ | |||||
setStatus(ComboData.publicNoticeStatic.find(item => item.type === searchCriteria.status)) | |||||
} | |||||
} | |||||
}else{ | |||||
if(localStorage.getItem('userData').creditor){ | |||||
setStatus(ComboData.publicNoticeStatic_Creditor[0]) | |||||
}else{ | |||||
setStatus(ComboData.publicNoticeStatic[0]) | |||||
} | |||||
} | |||||
}, [searchCriteria]); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setFromDateValue(minDate); | setFromDateValue(minDate); | ||||
}, [minDate]); | }, [minDate]); | ||||
@@ -77,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 ( | ||||
@@ -301,6 +328,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
<Button | <Button | ||||
variant="contained" | variant="contained" | ||||
type="submit" | type="submit" | ||||
disabled={onGridReady} | |||||
aria-label={intl.formatMessage({id: 'search'})} | aria-label={intl.formatMessage({id: 'search'})} | ||||
> | > | ||||
<Typography variant="pnspsButtonText"> | <Typography variant="pnspsButtonText"> | ||||
@@ -5,50 +5,85 @@ 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 SearchForm = Loadable(React.lazy(() => import('./SearchPublicNoticeForm'))); | const SearchForm = Loadable(React.lazy(() => import('./SearchPublicNoticeForm'))); | ||||
const EventTable = Loadable(React.lazy(() => import('./SearchPublicNoticeTable'))); | const EventTable = Loadable(React.lazy(() => import('./SearchPublicNoticeTable'))); | ||||
const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
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()-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(() => { | |||||
if(Object.keys(searchCriteria).length>0){ | |||||
setOnReady(true); | |||||
} | |||||
}, [searchCriteria]); | |||||
function applySearch(input) { | function applySearch(input) { | ||||
setGridOnReady(true); | |||||
setSearchCriteria(input); | setSearchCriteria(input); | ||||
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,tab:"application",data:input})) | |||||
} | |||||
function applyGridOnReady(input) { | |||||
setGridOnReady(input); | |||||
} | } | ||||
return ( | return ( | ||||
<Grid container sx={{ display: 'flex', flexDirection: 'column', height: '100%' }}> | |||||
{/*row 1*/} | |||||
<Grid item xs={12} md={12} lg={12} sx={{mb:-3}}> | |||||
<SearchForm | |||||
applySearch={applySearch} | |||||
searchCriteria={searchCriteria} | |||||
/> | |||||
</Grid> | |||||
{/*row 2*/} | |||||
<Grid item xs={12} md={12} lg={12} > | |||||
<MainCard elevation={0} | |||||
border={false} | |||||
content={false} | |||||
sx={{width: "-webkit-fill-available",height: "100%", minHeight:'100%'}} | |||||
> | |||||
<div style={{height: '100%', width: '100%' }}> | |||||
<EventTable | |||||
autoHeight | |||||
searchCriteria={searchCriteria} | |||||
/> | |||||
</div> | |||||
</MainCard> | |||||
!onReady ? | |||||
<Grid container sx={{ height: '100%' }} direction="column" justifyContent="center" alignItems="center"> | |||||
<Grid item> | |||||
<LoadingComponent /> | |||||
</Grid> | |||||
</Grid> | </Grid> | ||||
: | |||||
<Grid container sx={{ display: 'flex', flexDirection: 'column', height: '100%' }}> | |||||
{/*row 1*/} | |||||
<Grid item xs={12} md={12} lg={12} sx={{mb:-3}}> | |||||
<SearchForm | |||||
applySearch={applySearch} | |||||
searchCriteria={searchCriteria} | |||||
onGridReady={onGridReady} | |||||
/> | |||||
</Grid> | |||||
{/*row 2*/} | |||||
<Grid item xs={12} md={12} lg={12} > | |||||
<MainCard elevation={0} | |||||
border={false} | |||||
content={false} | |||||
sx={{width: "-webkit-fill-available",height: "100%", minHeight:'100%'}} | |||||
> | |||||
<div style={{height: '100%', width: '100%' }}> | |||||
<EventTable | |||||
autoHeight | |||||
searchCriteria={searchCriteria} | |||||
applyGridOnReady={applyGridOnReady} | |||||
applySearch={applySearch} | |||||
/> | |||||
</div> | |||||
</MainCard> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
); | ); | ||||
}; | }; | ||||
@@ -18,7 +18,7 @@ import { FormattedMessage, useIntl } from "react-intl"; | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria }) { | |||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady, applySearch }) { | |||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
const theme = useTheme(); | const theme = useTheme(); | ||||
const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | ||||
@@ -142,15 +142,19 @@ export default function SearchPublicNoticeTable({ searchCriteria }) { | |||||
<FiDataGrid | <FiDataGrid | ||||
columns={columns} | columns={columns} | ||||
customPageSize={10} | customPageSize={10} | ||||
onRowDoubleClick={handleRowDoubleClick} | |||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
// doLoad={{ | |||||
// url: GET_PUBLIC_NOTICE_LIST, | |||||
// params: _searchCriteria | |||||
// }} | |||||
onRowDoubleClick={handleRowDoubleClick} | |||||
applyGridOnReady = {applyGridOnReady} | |||||
applySearch={applySearch} | |||||
tab={"application"} | |||||
doLoad={React.useMemo(() => ({ | doLoad={React.useMemo(() => ({ | ||||
url: GET_PUBLIC_NOTICE_LIST, | url: GET_PUBLIC_NOTICE_LIST, | ||||
params: _searchCriteria, | params: _searchCriteria, | ||||
applyGridOnReady: applyGridOnReady, | |||||
// callback: function (responseData) { | |||||
// setRows(responseData?.records); | |||||
// // applyGridOnReady(false) | |||||
// } | |||||
}), [_searchCriteria])} | }), [_searchCriteria])} | ||||
/> | /> | ||||
</div> | </div> | ||||
@@ -21,7 +21,7 @@ import * as utils from "auth/utils" | |||||
import { isGrantedAny } from "auth/utils"; | import { isGrantedAny } from "auth/utils"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady }) { | |||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady, applySearch }) { | |||||
const [rows, setRows] = React.useState([]); | const [rows, setRows] = React.useState([]); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -192,6 +192,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady = {applyGridOnReady} | applyGridOnReady = {applyGridOnReady} | ||||
applySearch = {applySearch} | |||||
doLoad={React.useMemo(() => ({ | doLoad={React.useMemo(() => ({ | ||||
url: GET_PUBLIC_NOTICE_LIST, | url: GET_PUBLIC_NOTICE_LIST, | ||||
params: _searchCriteria, | params: _searchCriteria, | ||||
@@ -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,12 +96,18 @@ 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]); | ||||
@@ -102,7 +120,12 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
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:"" | |||||
}); | |||||
localStorage.setItem('searchCriteria',"") | |||||
} | } | ||||
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) { | ||||
@@ -112,7 +120,8 @@ const UserSearchPage_Individual = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
/> | |||||
applySearch={applySearch} | |||||
/> | |||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -23,7 +23,7 @@ import { FormattedMessage, useIntl } from "react-intl"; | |||||
import * as utils from "auth/utils" | import * as utils from "auth/utils" | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady }) { | |||||
export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnReady, applySearch }) { | |||||
const [rows, setRows] = React.useState([]); | const [rows, setRows] = React.useState([]); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -181,6 +181,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
doLoad={React.useMemo(() => ({ | doLoad={React.useMemo(() => ({ | ||||
url: GET_PUBLIC_NOTICE_OFFLINE_PAYMENT_LIST, | url: GET_PUBLIC_NOTICE_OFFLINE_PAYMENT_LIST, | ||||
params: _searchCriteria, | params: _searchCriteria, | ||||
@@ -37,6 +37,18 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
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]); | ||||
@@ -81,12 +93,18 @@ 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]); | ||||
@@ -98,7 +116,12 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
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:"" | |||||
}); | |||||
localStorage.setItem('searchCriteria',"") | |||||
} | } | ||||
const getIssueLabel=(data)=> { | const getIssueLabel=(data)=> { | ||||
@@ -299,7 +322,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); | ||||
@@ -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) { | ||||
@@ -112,6 +120,7 @@ const UserSearchPage_Individual = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -13,8 +13,8 @@ import {PNSPS_BUTTON_THEME} from "../../themes/buttonConst"; | |||||
import {ThemeProvider} from "@emotion/react"; | import {ThemeProvider} from "@emotion/react"; | ||||
import * as ComboData from "utils/ComboData"; | import * as ComboData from "utils/ComboData"; | ||||
import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
import Loadable from 'components/Loadable'; | |||||
const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||||
// import Loadable from 'components/Loadable'; | |||||
// const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||||
import {DatePicker} from "@mui/x-date-pickers/DatePicker"; | import {DatePicker} from "@mui/x-date-pickers/DatePicker"; | ||||
import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||
@@ -422,66 +422,63 @@ const SearchPublicNoticeForm = ({ applySearch, generateReport, onLoad }) => { | |||||
</Grid> | </Grid> | ||||
<Grid item> | <Grid item> | ||||
<Grid container justifyContent="flex-end" direction="row" alignItems="center" spacing={3}> | <Grid container justifyContent="flex-end" direction="row" alignItems="center" spacing={3}> | ||||
{onLoad? | |||||
<Grid item sx={{ ml: 3, mb: 3, mr:6 }} > | |||||
<LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
<ThemeProvider theme={PNSPS_BUTTON_THEME}> | |||||
<Grid item sx={{ mr: 3, mb: 3, }} > | |||||
<Button | |||||
variant="contained" | |||||
color="cancel" | |||||
onClick={clearHandler()} | |||||
> | |||||
Reset | |||||
</Button> | |||||
</Grid> | </Grid> | ||||
: | |||||
<ThemeProvider theme={PNSPS_BUTTON_THEME}> | |||||
<Grid item sx={{ mr: 3, mb: 3, }} > | |||||
<Grid item sx={{ ml: 3, mb: 3, }} > | |||||
<Button | <Button | ||||
variant="contained" | variant="contained" | ||||
color="cancel" | |||||
onClick={clearHandler()} | |||||
type="submit" | |||||
disabled={onLoad} | |||||
> | > | ||||
Reset | |||||
</Button> | |||||
</Grid> | |||||
<Grid item sx={{ ml: 3, mb: 3, }} > | |||||
View | |||||
</Button> | |||||
</Grid> | |||||
<Grid item sx={{ ml: 3, mb: 3, }} > | |||||
<Grid container spacing={3}> | |||||
<Grid item sx={{ ml: 3, mr:3 }} > | |||||
<Button | <Button | ||||
variant="contained" | variant="contained" | ||||
type="submit" | |||||
onClick={generateFileHandler("csv")} | |||||
disabled={onLoad} | |||||
> | > | ||||
View | |||||
Generate CSV | |||||
</Button> | </Button> | ||||
</Grid> | |||||
<Grid item sx={{ ml: 3, mb: 3, }} > | |||||
<Grid container spacing={3}> | |||||
<Grid item sx={{ ml: 3, mr:3 }} > | |||||
<Button | |||||
variant="contained" | |||||
onClick={generateFileHandler("csv")} | |||||
> | |||||
Generate CSV | |||||
</Button> | |||||
</Grid> | |||||
<Grid item sx={{ ml: 3, }} > | |||||
<Button | |||||
variant="contained" | |||||
onClick={generateFileHandler("pdf")} | |||||
> | |||||
Generate PDF | |||||
</Button> | |||||
</Grid> | |||||
</Grid> | </Grid> | ||||
</Grid> | |||||
{/* <Grid item sx={{ ml: 3, mr: 3, mb: 3, }} > | |||||
{onDownload? | |||||
<LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
: | |||||
<Grid item sx={{ ml: 3, }} > | |||||
<Button | <Button | ||||
variant="contained" | variant="contained" | ||||
onClick={generatePDFHandler} | |||||
onClick={generateFileHandler("pdf")} | |||||
disabled={onLoad} | |||||
> | > | ||||
Generate PDF | Generate PDF | ||||
</Button> | </Button> | ||||
} | |||||
</Grid> */} | |||||
</ThemeProvider> | |||||
} | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
{/* <Grid item sx={{ ml: 3, mr: 3, mb: 3, }} > | |||||
{onDownload? | |||||
<LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
: | |||||
<Button | |||||
variant="contained" | |||||
onClick={generatePDFHandler} | |||||
> | |||||
Generate PDF | |||||
</Button> | |||||
} | |||||
</Grid> */} | |||||
</ThemeProvider> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -81,6 +81,10 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
countryCode: values.tel_countryCode, | countryCode: values.tel_countryCode, | ||||
phoneNumber: values.phoneNumber | phoneNumber: values.phoneNumber | ||||
}, | }, | ||||
faxNo: { | |||||
countryCode: values.fax_countryCode, | |||||
faxNumber: values.faxNumber | |||||
}, | |||||
identification: values.identification, | identification: values.identification, | ||||
emailBus: values.emailBus, | emailBus: values.emailBus, | ||||
contactPerson: values.contactPerson, | contactPerson: values.contactPerson, | ||||
@@ -345,6 +349,39 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
})} */} | })} */} | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} sm={12} md={12} lg={4}> | |||||
{FieldUtils.getPhoneField({ | |||||
label: "Fax No.:", | |||||
valueName: { | |||||
code: "fax_countryCode", | |||||
num: "faxNumber" | |||||
}, | |||||
disabled: (!editMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | |||||
<Grid item lg={4}> | |||||
{FieldUtils.getTextField({ | |||||
label: "Last Login:", | |||||
valueName: "lastLoginDate", | |||||
disabled: true, | |||||
form: formik | |||||
})} | |||||
</Grid> | |||||
<Grid item xs={12} sm={12} md={12} lg={4}> | |||||
{FieldUtils.getComboField({ | |||||
label: intl.formatMessage({ id: 'language' }) + ":", | |||||
valueName: "preferLocale", | |||||
dataList: ComboData.Locale, | |||||
getOptionLabel: (option) => option.label ? option.label : "", | |||||
disabled: (!editMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | |||||
<Grid item lg={4}> | <Grid item lg={4}> | ||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={12} md={3} lg={3} sx={{ display: 'flex', alignItems: 'center' }}> | <Grid item xs={12} md={3} lg={3} sx={{ display: 'flex', alignItems: 'center' }}> | ||||
@@ -369,6 +406,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
form: formik, | form: formik, | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
<Grid item xs={1} md={1} lg={1}> | <Grid item xs={1} md={1} lg={1}> | ||||
<ThemeProvider theme={PNSPS_BUTTON_THEME}> | <ThemeProvider theme={PNSPS_BUTTON_THEME}> | ||||
<Button | <Button | ||||
@@ -385,26 +423,6 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
<Grid item lg={4}> | |||||
{FieldUtils.getTextField({ | |||||
label: "Last Login:", | |||||
valueName: "lastLoginDate", | |||||
disabled: true, | |||||
form: formik | |||||
})} | |||||
</Grid> | |||||
<Grid item xs={12} sm={12} md={12} lg={4}> | |||||
{FieldUtils.getComboField({ | |||||
label: intl.formatMessage({ id: 'language' }) + ":", | |||||
valueName: "preferLocale", | |||||
dataList: ComboData.Locale, | |||||
getOptionLabel: (option) => option.label ? option.label : "", | |||||
disabled: (!editMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | |||||
<Grid item lg={4}></Grid> | |||||
<Grid item lg={4}> | <Grid item lg={4}> | ||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={12} md={3} lg={3} sx={{ display: 'flex', alignItems: 'center' }}> | <Grid item xs={12} md={3} lg={3} sx={{ display: 'flex', alignItems: 'center' }}> | ||||
@@ -527,12 +545,12 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
<Grid item lg={4}> | <Grid item lg={4}> | ||||
{FieldUtils.getPhoneField({ | {FieldUtils.getPhoneField({ | ||||
label: "Fax No.:", | |||||
label: "Contact Tel:", | |||||
valueName: { | valueName: { | ||||
code: "fax_countryCode", | |||||
num: "faxNumber" | |||||
code: "org_tel_countryCode", | |||||
num: "orgPhoneNumber" | |||||
}, | }, | ||||
disabled: true, | |||||
disabled: (!editMode), | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -556,6 +574,19 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
<Grid item lg={4}> | |||||
{FieldUtils.getPhoneField({ | |||||
label: "Fax No.:", | |||||
valueName: { | |||||
code: "org_fax_countryCode", | |||||
num: "orgFaxNumber" | |||||
}, | |||||
disabled: true, | |||||
form: formik | |||||
})} | |||||
</Grid> | |||||
<Grid item lg={12}> | <Grid item lg={12}> | ||||
{FieldUtils.getAddressField({ | {FieldUtils.getAddressField({ | ||||
label: "Address:", | label: "Address:", | ||||
@@ -68,6 +68,10 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { | |||||
countryCode: values.tel_countryCode, | countryCode: values.tel_countryCode, | ||||
phoneNumber: values.phoneNumber | phoneNumber: values.phoneNumber | ||||
}, | }, | ||||
faxNo: { | |||||
countryCode: values.fax_countryCode, | |||||
faxNumber: values.faxNumber | |||||
}, | |||||
preferLocale: values.preferLocale.type | preferLocale: values.preferLocale.type | ||||
}, | }, | ||||
onSuccess: function () { | onSuccess: function () { | ||||
@@ -196,6 +200,18 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { | |||||
})} | })} | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} lg={12}> | |||||
{FieldUtils.getPhoneField({ | |||||
label: intl.formatMessage({id: 'contactFaxNumber'}) + ":", | |||||
valueName: { | |||||
code: "fax_countryCode", | |||||
num: "faxNumber" | |||||
}, | |||||
disabled: (!editMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | |||||
<Grid item xs={12} lg={12}> | <Grid item xs={12} lg={12}> | ||||
{FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
label: intl.formatMessage({id: 'primaryUser'}) + ":", | label: intl.formatMessage({id: 'primaryUser'}) + ":", | ||||
@@ -115,9 +115,12 @@ const UserMaintainPage_Organization = () => { | |||||
if (response.data.orgId != null) { | if (response.data.orgId != null) { | ||||
// console.log("1a") | // console.log("1a") | ||||
response.data["addressBus"] = response.orgDetail.data["addressTemp"]; | response.data["addressBus"] = response.orgDetail.data["addressTemp"]; | ||||
response.data["contactTel"] = response.orgDetail.data["contactTel"]; | |||||
response.data["faxNo"] = response.orgDetail.data["faxNo"]; | |||||
response.data["orgContactTel"] = response.orgDetail.data["contactTel"]; | |||||
response.data["orgFaxNo"] = response.orgDetail.data["faxNo"]; | |||||
response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | |||||
response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | |||||
response.data["brExpiryDate"] = response.orgDetail.data.brExpiryDate ? DateUtils.dateValue(response.orgDetail.data.brExpiryDate) : ""; | response.data["brExpiryDate"] = response.orgDetail.data.brExpiryDate ? DateUtils.dateValue(response.orgDetail.data.brExpiryDate) : ""; | ||||
response.data["brNo"] = response.orgDetail.data.brNo; | response.data["brNo"] = response.orgDetail.data.brNo; | ||||
response.data["enCompanyName"] = response.orgDetail.data.enCompanyName; | response.data["enCompanyName"] = response.orgDetail.data.enCompanyName; | ||||
@@ -128,6 +131,10 @@ const UserMaintainPage_Organization = () => { | |||||
response.data["addressBus"] = JSON.parse(response.data["addressBus"]); | response.data["addressBus"] = JSON.parse(response.data["addressBus"]); | ||||
response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | ||||
response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | ||||
response.data["orgContactTel"] = response.data["contactTel"]; | |||||
response.data["orgFaxNo"] = response.data["faxNo"]; | |||||
response.data["brExpiryDate"] = response.data.brExpiryDate ? DateUtils.dateValue(response.data.brExpiryDate) : ""; | response.data["brExpiryDate"] = response.data.brExpiryDate ? DateUtils.dateValue(response.data.brExpiryDate) : ""; | ||||
} | } | ||||
// console.log("2") | // console.log("2") | ||||
@@ -148,9 +155,14 @@ const UserMaintainPage_Organization = () => { | |||||
response.data["phoneNumber"] = response.data.contactTel?.phoneNumber; | response.data["phoneNumber"] = response.data.contactTel?.phoneNumber; | ||||
response.data["tel_countryCode"] = response.data.contactTel?.countryCode; | response.data["tel_countryCode"] = response.data.contactTel?.countryCode; | ||||
response.data["orgPhoneNumber"] = response.data.orgContactTel?.phoneNumber; | |||||
response.data["org_tel_countryCode"] = response.data.orgContactTel?.countryCode; | |||||
response.data["faxNumber"] = response.data.faxNo?.faxNumber; | response.data["faxNumber"] = response.data.faxNo?.faxNumber; | ||||
response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | ||||
response.data["orgFaxNumber"] = response.data.orgFaxNo?.faxNumber; | |||||
response.data["org_fax_countryCode"] = response.data.orgFaxNo?.countryCode; | |||||
// response.data["status"] = response.data?.locked?"locked":response.data?.status; | // response.data["status"] = response.data?.locked?"locked":response.data?.status; | ||||
response.data["preferLocale"] = getObjectByType(ComboData.Locale, "type", response.data?.preferLocale); | response.data["preferLocale"] = getObjectByType(ComboData.Locale, "type", response.data?.preferLocale); | ||||
@@ -170,6 +182,7 @@ const UserMaintainPage_Organization = () => { | |||||
onSuccess: function (response) { | onSuccess: function (response) { | ||||
// console.log(response) | // console.log(response) | ||||
response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | ||||
response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | |||||
response.data["primaryUser"] = response.data.primaryUser?isPrimaryLocale:notPrimaryLocale; | response.data["primaryUser"] = response.data.primaryUser?isPrimaryLocale:notPrimaryLocale; | ||||
response.data["phoneNumber"] = response.data.contactTel?.phoneNumber; | response.data["phoneNumber"] = response.data.contactTel?.phoneNumber; | ||||
@@ -11,8 +11,8 @@ import {useState} from "react"; | |||||
import Checkbox from "@mui/material/Checkbox"; | import Checkbox from "@mui/material/Checkbox"; | ||||
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; | import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; | ||||
import { useNavigate } from "react-router"; | 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 { PNSPS_BUTTON_THEME } from "themes/buttonConst"; | ||||
import { ThemeProvider } from "@emotion/react"; | import { ThemeProvider } from "@emotion/react"; | ||||
@@ -21,14 +21,13 @@ import { isGrantedAny } from "auth/utils"; | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserSearchForm = ({ applySearch, onGridReady }) => { | |||||
const UserSearchForm = ({ applySearch, onGridReady, searchCriteria }) => { | |||||
const navigate = useNavigate(); | const navigate = useNavigate(); | ||||
const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
const [locked, setLocked] = useState(false); | |||||
const [locked, setLocked] = useState(searchCriteria.locked); | |||||
const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
const onSubmit = (data) => { | const onSubmit = (data) => { | ||||
let typeArray = []; | let typeArray = []; | ||||
@@ -51,14 +50,20 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||||
function resetForm() { | function resetForm() { | ||||
setType([]); | setType([]); | ||||
setLocked(false); | 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 = () => { | const handleNewUserClick = () => { | ||||
@@ -70,7 +75,9 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||||
return ( | return ( | ||||
<MainCard xs={12} md={12} lg={12} | <MainCard xs={12} md={12} lg={12} | ||||
border={false} | border={false} | ||||
content={false}> | |||||
content={false} | |||||
sx={{ backgroundColor: '#fff' }} | |||||
> | |||||
<form onSubmit={handleSubmit(onSubmit)}> | <form onSubmit={handleSubmit(onSubmit)}> | ||||
<Grid container sx={{ backgroundColor: '#ffffff', ml: 2, mt: 1 }} width="98%"> | <Grid container sx={{ backgroundColor: '#ffffff', ml: 2, mt: 1 }} width="98%"> | ||||
@@ -89,6 +96,7 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("userName")} | {...register("userName")} | ||||
id='userName' | id='userName' | ||||
label="Username" | label="Username" | ||||
defaultValue={searchCriteria.username} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -101,6 +109,7 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("fullenName")} | {...register("fullenName")} | ||||
id="fullenName" | id="fullenName" | ||||
label="Full Name" | label="Full Name" | ||||
defaultValue={searchCriteria.enName} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -113,6 +122,7 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("post")} | {...register("post")} | ||||
id="post" | id="post" | ||||
label="Post" | label="Post" | ||||
defaultValue={searchCriteria.post} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -125,6 +135,7 @@ const UserSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("email")} | {...register("email")} | ||||
id="email" | id="email" | ||||
label="Email" | label="Email" | ||||
defaultValue={searchCriteria.email} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -11,7 +11,7 @@ import { isGrantedAny } from "auth/utils"; | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function UserTable({searchCriteria, applyGridOnReady}) { | |||||
export default function UserTable({searchCriteria, applyGridOnReady,applySearch}) { | |||||
const [_searchCriteria, set_searchCriteria] = useState(searchCriteria); | const [_searchCriteria, set_searchCriteria] = useState(searchCriteria); | ||||
const [reloadTime, setReloadTime] = useState(new Date()); | const [reloadTime, setReloadTime] = useState(new Date()); | ||||
const theme = useTheme(); | const theme = useTheme(); | ||||
@@ -138,6 +138,7 @@ export default function UserTable({searchCriteria, applyGridOnReady}) { | |||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: GLD_USER_PATH, | // url: GLD_USER_PATH, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -7,6 +7,7 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import { useEffect, useState, lazy } from "react"; | import { useEffect, useState, lazy } from "react"; | ||||
import { getSearchCriteria } from "auth/utils"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
@@ -37,6 +38,15 @@ const UserSettingPage = () => { | |||||
// getUserList(); | // getUserList(); | ||||
// }, [changelocked]); | // }, [changelocked]); | ||||
useEffect(() => { | |||||
if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||||
setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||||
}else{ | |||||
localStorage.setItem('searchCriteria',"") | |||||
setSearchCriteria({}) | |||||
} | |||||
}, []); | |||||
useEffect(() => { | useEffect(() => { | ||||
setOnReady(true); | setOnReady(true); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
@@ -63,6 +73,7 @@ const UserSettingPage = () => { | |||||
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) { | ||||
@@ -91,6 +102,7 @@ const UserSettingPage = () => { | |||||
<SearchForm | <SearchForm | ||||
applySearch={applySearch} | applySearch={applySearch} | ||||
onGridReady={onGridReady} | onGridReady={onGridReady} | ||||
searchCriteria={searchCriteria} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
@@ -102,6 +114,7 @@ const UserSettingPage = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// setChangeLocked={setChangeLocked} | // setChangeLocked={setChangeLocked} | ||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
@@ -7,18 +7,31 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
import { useForm } from "react-hook-form"; | import { useForm } from "react-hook-form"; | ||||
import { useState } from "react"; | |||||
import { useState,useEffect } from "react"; | |||||
import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; | import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; | ||||
import {ThemeProvider} from "@emotion/react"; | import {ThemeProvider} from "@emotion/react"; | ||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||||
const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) => { | |||||
const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
const [accountFilter, setAccountFilter] = useState("All"); | const [accountFilter, setAccountFilter] = useState("All"); | ||||
const { reset, register, handleSubmit } = useForm() | 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) => { | const onSubmit = (data) => { | ||||
let typeArray = []; | let typeArray = []; | ||||
@@ -42,7 +55,12 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||||
function resetForm() { | function resetForm() { | ||||
setType([]); | setType([]); | ||||
setAccountFilter("All"); | setAccountFilter("All"); | ||||
reset(); | |||||
reset({ | |||||
userName:"", | |||||
fullenName:"", | |||||
email:"", | |||||
phone:"", | |||||
}); | |||||
} | } | ||||
return ( | return ( | ||||
@@ -67,6 +85,7 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||||
{...register("userName")} | {...register("userName")} | ||||
id='userName' | id='userName' | ||||
label="Username" | label="Username" | ||||
defaultValue={searchCriteria.username} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -79,6 +98,7 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||||
{...register("fullenName")} | {...register("fullenName")} | ||||
id="fullenName" | id="fullenName" | ||||
label="Full Name" | label="Full Name" | ||||
defaultValue={searchCriteria.fullName} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -91,6 +111,7 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||||
{...register("email")} | {...register("email")} | ||||
id="email" | id="email" | ||||
label="Email" | label="Email" | ||||
defaultValue={searchCriteria.email} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -103,6 +124,7 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady }) => { | |||||
{...register("phone")} | {...register("phone")} | ||||
id="phone" | id="phone" | ||||
label="Phone" | label="Phone" | ||||
defaultValue={searchCriteria.phone} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -12,7 +12,7 @@ import { clickableLink} from 'utils/CommonFunction'; | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function UserTable_Individual({ searchCriteria, applyGridOnReady }) { | |||||
export default function UserTable_Individual({ searchCriteria, applyGridOnReady,applySearch }) { | |||||
const [_searchCriteria, set_searchCriteria] = useState(searchCriteria); | const [_searchCriteria, set_searchCriteria] = useState(searchCriteria); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -154,6 +154,7 @@ export default function UserTable_Individual({ searchCriteria, applyGridOnReady | |||||
customPageSize={10} | customPageSize={10} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: GET_IND_USER_PATH, | // url: GET_IND_USER_PATH, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -4,6 +4,8 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
import { useEffect, useState, lazy } from "react"; | import { useEffect, useState, lazy } from "react"; | ||||
import { getSearchCriteria } from "auth/utils"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
const LoadingComponent = Loadable(lazy(() => import('pages/extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('pages/extra-pages/LoadingComponent'))); | ||||
const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Individual'))); | const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Individual'))); | ||||
@@ -26,6 +28,15 @@ const UserSearchPage_Individual = () => { | |||||
const [searchCriteria, setSearchCriteria] = useState({}); | const [searchCriteria, setSearchCriteria] = useState({}); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [onGridReady, setGridOnReady] = 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(() => { | useEffect(() => { | ||||
setOnReady(true); | setOnReady(true); | ||||
@@ -34,6 +45,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) { | ||||
@@ -64,6 +76,7 @@ const UserSearchPage_Individual = () => { | |||||
<SearchForm | <SearchForm | ||||
applySearch={applySearch} | applySearch={applySearch} | ||||
onGridReady={onGridReady} | onGridReady={onGridReady} | ||||
searchCriteria={searchCriteria} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
@@ -75,6 +88,7 @@ const UserSearchPage_Individual = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -14,7 +14,7 @@ import {ThemeProvider} from "@emotion/react"; | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) => { | |||||
const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady, searchCriteria}) => { | |||||
const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
const [accountFilter, setAccountFilter] = useState("All"); | const [accountFilter, setAccountFilter] = useState("All"); | ||||
@@ -22,6 +22,19 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
const [orgSelected, setOrgSelected] = useState({}); | const [orgSelected, setOrgSelected] = useState({}); | ||||
const { reset, register, handleSubmit } = useForm() | 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) => { | const onSubmit = (data) => { | ||||
let typeArray = []; | let typeArray = []; | ||||
@@ -46,6 +59,9 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
useEffect(() => { | useEffect(() => { | ||||
if (orgComboData && orgComboData.length > 0) { | if (orgComboData && orgComboData.length > 0) { | ||||
setOrgCombo(orgComboData); | setOrgCombo(orgComboData); | ||||
if(searchCriteria.orgName!=undefined){ | |||||
setOrgSelected(orgComboData.find(item => item.name === searchCriteria.orgName)) | |||||
} | |||||
} | } | ||||
}, [orgComboData]); | }, [orgComboData]); | ||||
@@ -53,7 +69,14 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
setType([]); | setType([]); | ||||
setAccountFilter("All"); | setAccountFilter("All"); | ||||
setOrgSelected({}); | setOrgSelected({}); | ||||
reset(); | |||||
reset({ | |||||
userName:"", | |||||
fullenName:"", | |||||
email:"", | |||||
phone:"", | |||||
contactPerson:"", | |||||
brNoStr:"", | |||||
}); | |||||
} | } | ||||
return ( | return ( | ||||
@@ -84,7 +107,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); | ||||
@@ -119,6 +143,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
{...register("brNoStr")} | {...register("brNoStr")} | ||||
id="brNoStr" | id="brNoStr" | ||||
label="BR No." | label="BR No." | ||||
defaultValue={searchCriteria.brNoStr} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -131,6 +156,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
{...register("userName")} | {...register("userName")} | ||||
id='userName' | id='userName' | ||||
label="Username" | label="Username" | ||||
defaultValue={searchCriteria.username} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -143,6 +169,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
{...register("contactPerson")} | {...register("contactPerson")} | ||||
id="contactPerson" | id="contactPerson" | ||||
label="Name" | label="Name" | ||||
defaultValue={searchCriteria.contactPerson} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -155,6 +182,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
{...register("email")} | {...register("email")} | ||||
id="email" | id="email" | ||||
label="Email" | label="Email" | ||||
defaultValue={searchCriteria.email} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -167,6 +195,7 @@ const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) = | |||||
{...register("phone")} | {...register("phone")} | ||||
id="phone" | id="phone" | ||||
label="Phone" | label="Phone" | ||||
defaultValue={searchCriteria.contactTel} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -15,7 +15,7 @@ import { clickableLink} from 'utils/CommonFunction'; | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function UserTable_Organization({searchCriteria, applyGridOnReady}) { | |||||
export default function UserTable_Organization({searchCriteria, applyGridOnReady, applySearch}) { | |||||
const [_searchCriteria, set_searchCriteria] = useState(searchCriteria); | const [_searchCriteria, set_searchCriteria] = useState(searchCriteria); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -148,6 +148,7 @@ export default function UserTable_Organization({searchCriteria, applyGridOnReady | |||||
customPageSize={10} | customPageSize={10} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: GET_ORG_USER_PATH, | // url: GET_ORG_USER_PATH, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -7,6 +7,7 @@ import { useEffect, useState, lazy } from "react"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import * as HttpUtils from "utils/HttpUtils"; | import * as HttpUtils from "utils/HttpUtils"; | ||||
import {GET_ORG_COMBO} from "utils/ApiPathConst"; | import {GET_ORG_COMBO} from "utils/ApiPathConst"; | ||||
import { getSearchCriteria } from "auth/utils"; | |||||
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Organization'))); | const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Organization'))); | ||||
@@ -34,6 +35,12 @@ const UserSearchPage_Organization = () => { | |||||
useEffect(() => { | useEffect(() => { | ||||
getOrgCombo(); | getOrgCombo(); | ||||
// getIssueCombo(); | // getIssueCombo(); | ||||
if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ | |||||
setSearchCriteria(getSearchCriteria(window.location.pathname)) | |||||
}else{ | |||||
localStorage.setItem('searchCriteria',"") | |||||
setSearchCriteria({}) | |||||
} | |||||
}, []); | }, []); | ||||
function getOrgCombo() { | function getOrgCombo() { | ||||
@@ -53,6 +60,7 @@ const UserSearchPage_Organization = () => { | |||||
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) { | ||||
@@ -81,6 +89,7 @@ const UserSearchPage_Organization = () => { | |||||
applySearch={applySearch} | applySearch={applySearch} | ||||
orgComboData={orgCombo} | orgComboData={orgCombo} | ||||
onGridReady={onGridReady} | onGridReady={onGridReady} | ||||
searchCriteria={searchCriteria} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
@@ -92,6 +101,7 @@ const UserSearchPage_Organization = () => { | |||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -552,11 +552,11 @@ const BusCustomFormWizard = (props) => { | |||||
.matches(/^(?=.*\W)/, { message: displayErrorMsg(intl.formatMessage({id: 'atLeast1SpecialChar'})) }), | .matches(/^(?=.*\W)/, { message: displayErrorMsg(intl.formatMessage({id: 'atLeast1SpecialChar'})) }), | ||||
confirmPassword: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'atLeast8CharPassword'}))).required(displayErrorMsg(intl.formatMessage({id: 'pleaseConfirmPassword'}))).oneOf([yup.ref('password'), null], displayErrorMsg(intl.formatMessage({id: 'samePassword'}))), | confirmPassword: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'atLeast8CharPassword'}))).required(displayErrorMsg(intl.formatMessage({id: 'pleaseConfirmPassword'}))).oneOf([yup.ref('password'), null], displayErrorMsg(intl.formatMessage({id: 'samePassword'}))), | ||||
enName: yup.string().max(40,getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({id: 'userRequireEnglishName'}))), | enName: yup.string().max(40,getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({id: 'userRequireEnglishName'}))), | ||||
enCompanyName: yup.string().matches(/^[^$^*()]+$/, { message: displayErrorMsg('No special characters $/^/*/(/)') }).when('chCompanyName', { | |||||
enCompanyName: yup.string().matches(/^[^$^*]+$/, { message: displayErrorMsg('No special characters $/^/*') }).when('chCompanyName', { | |||||
is: (chCompanyName) => !chCompanyName || chCompanyName.length === 0, | is: (chCompanyName) => !chCompanyName || chCompanyName.length === 0, | ||||
then: yup.string().required(displayErrorMsg('Please enter either English or Chinese name')), | then: yup.string().required(displayErrorMsg('Please enter either English or Chinese name')), | ||||
}), | }), | ||||
chCompanyName: yup.string().matches(/^[^$^*()]+$/, { message: displayErrorMsg(intl.formatMessage({id: 'notContainSpecialChar'})) }).when('enCompanyName', { | |||||
chCompanyName: yup.string().matches(/^[^$^*]+$/, { message: displayErrorMsg(intl.formatMessage({id: 'notContainSpecialChar'})) }).when('enCompanyName', { | |||||
is: (enCompanyName) => !enCompanyName || enCompanyName.length === 0, | is: (enCompanyName) => !enCompanyName || enCompanyName.length === 0, | ||||
then: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'validateEngOrChiName'}))), | then: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'validateEngOrChiName'}))), | ||||
}), | }), | ||||
@@ -6,11 +6,18 @@ import { | |||||
Typography, | Typography, | ||||
Stack | Stack | ||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import * as React from "react"; | |||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const DashboardDefault = () => { | const DashboardDefault = () => { | ||||
const userData = JSON.parse(localStorage.getItem("userData")); | const userData = JSON.parse(localStorage.getItem("userData")); | ||||
React.useEffect(() => { | |||||
localStorage.setItem('searchCriteria',"") | |||||
}, []) | |||||
const BackgroundHead = { | const BackgroundHead = { | ||||
backgroundImage: `url(${titleBackgroundImg})`, | backgroundImage: `url(${titleBackgroundImg})`, | ||||
width: '100%', | width: '100%', | ||||
@@ -53,6 +53,7 @@ const DashboardDefault = () => { | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
loadMessageData() | loadMessageData() | ||||
loadNoticeData() | loadNoticeData() | ||||
localStorage.setItem('searchCriteria',"") | |||||
}, []); | }, []); | ||||
const getWelcomeMsg=()=>{ | const getWelcomeMsg=()=>{ | ||||
@@ -0,0 +1,33 @@ | |||||
import { useState, useEffect } from "react"; | |||||
import { get } from "utils/HttpUtils" | |||||
import {GET_SYS_CHECKING} from "utils/ApiPathConst" | |||||
const DatabaseHealthCheck = () => { | |||||
const [sysEnv, setSysEnv] = useState("'N/A"); | |||||
useEffect(() => { | |||||
loadSysSetting(); | |||||
}, []); | |||||
// useEffect(() => { | |||||
// setOnReady(true); | |||||
// }, [locale]); | |||||
const loadSysSetting = () => { | |||||
get({ | |||||
url: GET_SYS_CHECKING, | |||||
onSuccess: (responseData) => { | |||||
// console.log(responseData) | |||||
setSysEnv(responseData.sysEnv); | |||||
} | |||||
}); | |||||
} | |||||
return ( | |||||
<div>{sysEnv}</div> | |||||
); | |||||
} | |||||
export default DatabaseHealthCheck; |
@@ -14,7 +14,7 @@ import { ThemeProvider } from "@emotion/react"; | |||||
import { isGrantedAny } from "auth/utils"; | import { isGrantedAny } from "auth/utils"; | ||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserGroupSearchForm = ({ applySearch, onGridReady }) => { | |||||
const UserGroupSearchForm = ({ applySearch, onGridReady, searchCriteria }) => { | |||||
const navigate = useNavigate(); | const navigate = useNavigate(); | ||||
const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
@@ -23,7 +23,10 @@ const UserGroupSearchForm = ({ applySearch, onGridReady }) => { | |||||
}; | }; | ||||
function resetForm() { | function resetForm() { | ||||
reset(); | |||||
reset({ | |||||
name:"", | |||||
description:"" | |||||
}); | |||||
} | } | ||||
const handleNewGroupClick = (id) => { | const handleNewGroupClick = (id) => { | ||||
@@ -54,6 +57,7 @@ const UserGroupSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("name")} | {...register("name")} | ||||
id='userGroupName' | id='userGroupName' | ||||
label="User Group Name" | label="User Group Name" | ||||
defaultValue={searchCriteria.name} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -66,6 +70,7 @@ const UserGroupSearchForm = ({ applySearch, onGridReady }) => { | |||||
{...register("description")} | {...register("description")} | ||||
id="userGroupDescription" | id="userGroupDescription" | ||||
label="User Group Description" | label="User Group Description" | ||||
defaultValue={searchCriteria.description} | |||||
InputLabelProps={{ | InputLabelProps={{ | ||||
shrink: true | shrink: true | ||||
}} | }} | ||||
@@ -11,7 +11,7 @@ import { clickableLink} from 'utils/CommonFunction'; | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function UserGroupTable({searchCriteria, applyGridOnReady}) { | |||||
export default function UserGroupTable({searchCriteria, applyGridOnReady,applySearch}) { | |||||
const [_searchCriteria, set_searchCriteria] = useState(searchCriteria); | const [_searchCriteria, set_searchCriteria] = useState(searchCriteria); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -71,6 +71,7 @@ export default function UserGroupTable({searchCriteria, applyGridOnReady}) { | |||||
pageSizeOptions={[10, 15, 20]} | pageSizeOptions={[10, 15, 20]} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
// doLoad={{ | // doLoad={{ | ||||
// url: GET_GROUP_LIST_PATH, | // url: GET_GROUP_LIST_PATH, | ||||
// params: _searchCriteria, | // params: _searchCriteria, | ||||
@@ -8,6 +8,7 @@ import { | |||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
import { useEffect, useState } from "react"; | import { useEffect, useState } from "react"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import { getSearchCriteria } from "auth/utils"; | |||||
//import LoadingComponent from "../extra-pages/LoadingComponent"; | //import LoadingComponent from "../extra-pages/LoadingComponent"; | ||||
// import UserGroupSearchForm from "./UserGroupSearchForm"; | // import UserGroupSearchForm from "./UserGroupSearchForm"; | ||||
@@ -36,6 +37,15 @@ const UserGroupSearchPanel = () => { | |||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [onGridReady, setGridOnReady] = 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(() => { | useEffect(() => { | ||||
setOnReady(true); | setOnReady(true); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
@@ -43,6 +53,7 @@ const UserGroupSearchPanel = () => { | |||||
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) { | ||||
@@ -73,6 +84,7 @@ const UserGroupSearchPanel = () => { | |||||
<UserGroupSearchForm | <UserGroupSearchForm | ||||
applySearch={applySearch} | applySearch={applySearch} | ||||
onGridReady={onGridReady} | onGridReady={onGridReady} | ||||
searchCriteria={searchCriteria} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
@@ -84,6 +96,7 @@ const UserGroupSearchPanel = () => { | |||||
<UserGroupTable | <UserGroupTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
applyGridOnReady={applyGridOnReady} | applyGridOnReady={applyGridOnReady} | ||||
applySearch={applySearch} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -33,6 +33,7 @@ const DrImport = Loadable(lazy(() => import('pages/Setting/DrImport'))); | |||||
const AuditLogPage = Loadable(lazy(() => import('pages/AuditLog/index'))); | const AuditLogPage = Loadable(lazy(() => import('pages/AuditLog/index'))); | ||||
const ReconReportPage = Loadable(lazy(() => import('pages/Recon'))); | const ReconReportPage = Loadable(lazy(() => import('pages/Recon'))); | ||||
const ChangePasswordPage = Loadable(lazy(() => import('pages/User/ChangePasswordPage'))); | const ChangePasswordPage = Loadable(lazy(() => import('pages/User/ChangePasswordPage'))); | ||||
const JVMDefault = Loadable(lazy(() => import('pages/JVM'))); | |||||
// ==============================|| MAIN ROUTING ||============================== // | // ==============================|| MAIN ROUTING ||============================== // | ||||
@@ -192,6 +193,11 @@ const GLDUserRoutes = { | |||||
path: '/setting/auditLog', | path: '/setting/auditLog', | ||||
element: <AuditLogPage /> | element: <AuditLogPage /> | ||||
}:{}, | }:{}, | ||||
isGranted("MAINTAIN_SETTING")? | |||||
{ | |||||
path: '/jvm', | |||||
element: <JVMDefault /> | |||||
}:{}, | |||||
{ | { | ||||
path: '/user/changePassword', | path: '/user/changePassword', | ||||
@@ -17,6 +17,7 @@ const ImportantNoticePage = Loadable(lazy(() => import('pages/extra-pages/Import | |||||
const AboutUsPage = Loadable(lazy(() => import('pages/extra-pages/AboutUs'))); | const AboutUsPage = Loadable(lazy(() => import('pages/extra-pages/AboutUs'))); | ||||
const UserMenuPage = Loadable(lazy(() => import('pages/extra-pages/UserMenu'))); | const UserMenuPage = Loadable(lazy(() => import('pages/extra-pages/UserMenu'))); | ||||
const UserMenuPubPage = Loadable(lazy(() => import('pages/extra-pages/UserMenuPub'))); | const UserMenuPubPage = Loadable(lazy(() => import('pages/extra-pages/UserMenuPub'))); | ||||
const DatabaseHealthCheckPage = Loadable(lazy(() => import('pages/extra-pages/DatabaseHealthCheck'))); | |||||
const ForgotPassword = Loadable(lazy(() => import('pages/authentication/ForgotPassword'))); | const ForgotPassword = Loadable(lazy(() => import('pages/authentication/ForgotPassword'))); | ||||
@@ -41,8 +42,6 @@ const IAmSmart_PleaseLoginCallback = Loadable(lazy(() => import('pages/iAmSmart/ | |||||
const VerifyPage = Loadable(lazy(() => import('pages/authentication/Verify'))); | const VerifyPage = Loadable(lazy(() => import('pages/authentication/Verify'))); | ||||
const Testfps = Loadable(lazy(() => import('pages/Payment/FPS/FPSTest'))); | const Testfps = Loadable(lazy(() => import('pages/Payment/FPS/FPSTest'))); | ||||
const Payment_FPS_CallBack = Loadable(lazy(() => import('pages/Payment/FPS/fpscallback'))); | const Payment_FPS_CallBack = Loadable(lazy(() => import('pages/Payment/FPS/fpscallback'))); | ||||
// ==============================|| AUTH ROUTING ||============================== // | // ==============================|| AUTH ROUTING ||============================== // | ||||
const LoginRoutes = { | const LoginRoutes = { | ||||
@@ -93,6 +92,10 @@ const LoginRoutes = { | |||||
path: 'userGuidePub', | path: 'userGuidePub', | ||||
element: <UserMenuPubPage/> | element: <UserMenuPubPage/> | ||||
}, | }, | ||||
{ | |||||
path: 'databaseHealthCheck', | |||||
element: <DatabaseHealthCheckPage/> | |||||
}, | |||||
{ | { | ||||
path: 'iamsmart/logincallback', | path: 'iamsmart/logincallback', | ||||
element: <IAmSmart_DirectLoginCallback/> | element: <IAmSmart_DirectLoginCallback/> | ||||
@@ -300,7 +300,7 @@ | |||||
"validateAddressLine2": "Please enter the second line of address", | "validateAddressLine2": "Please enter the second line of address", | ||||
"validateAddressLine3": "Please enter the third line of address", | "validateAddressLine3": "Please enter the third line of address", | ||||
"validateEngOrChiName": "Please enter the English or Chinese name", | "validateEngOrChiName": "Please enter the English or Chinese name", | ||||
"notContainSpecialChar": "Does not contain special characters $/^/*/(/)", | |||||
"notContainSpecialChar": "Does not contain special characters $/^/*", | |||||
"samePassword": "Please enter the same password", | "samePassword": "Please enter the same password", | ||||
"atLeast8CharPassword": "Please enter a password of at least 8 digits", | "atLeast8CharPassword": "Please enter a password of at least 8 digits", | ||||
"atLeast1SpecialChar": "Please include at least 1 special character", | "atLeast1SpecialChar": "Please include at least 1 special character", | ||||
@@ -333,7 +333,7 @@ | |||||
"validateAddressLine2": "请输入第二行地址", | "validateAddressLine2": "请输入第二行地址", | ||||
"validateAddressLine3": "请输入第三行地址", | "validateAddressLine3": "请输入第三行地址", | ||||
"validateEngOrChiName": "请输入英文或中文名称", | "validateEngOrChiName": "请输入英文或中文名称", | ||||
"notContainSpecialChar": "不包含特殊字符 $/^/*/(/)", | |||||
"notContainSpecialChar": "不包含特殊字符 $/^/*", | |||||
"samePassword": "请输入相同密码", | "samePassword": "请输入相同密码", | ||||
"atLeast8CharPassword": "请输入最少8位密码", | "atLeast8CharPassword": "请输入最少8位密码", | ||||
"atLeast1SpecialChar": "请包括最少1个特殊字符", | "atLeast1SpecialChar": "请包括最少1个特殊字符", | ||||
@@ -334,7 +334,7 @@ | |||||
"validateAddressLine2": "請輸入第二行地址", | "validateAddressLine2": "請輸入第二行地址", | ||||
"validateAddressLine3": "請輸入第三行地址", | "validateAddressLine3": "請輸入第三行地址", | ||||
"validateEngOrChiName": "請輸入英文或中文名稱", | "validateEngOrChiName": "請輸入英文或中文名稱", | ||||
"notContainSpecialChar": "不包含特殊字符 $/^/*/(/)", | |||||
"notContainSpecialChar": "不包含特殊字符 $/^/*", | |||||
"samePassword": "請輸入相同密碼", | "samePassword": "請輸入相同密碼", | ||||
"atLeast8CharPassword": "請輸入最少8位密碼", | "atLeast8CharPassword": "請輸入最少8位密碼", | ||||
"atLeast1SpecialChar": "請包括最少1個特殊字符", | "atLeast1SpecialChar": "請包括最少1個特殊字符", | ||||
@@ -13,6 +13,7 @@ export const PRIVACY_POLICY_PATH = apiPath+'/privacyPolicy'; | |||||
export const I_AM_SMART_PATH = apiPath+'/smart/call/iAmSmart'; | export const I_AM_SMART_PATH = apiPath+'/smart/call/iAmSmart'; | ||||
export const I_AM_SMART_APP_PATH = apiPath+'/smart/call/app/iAmSmart'; | export const I_AM_SMART_APP_PATH = apiPath+'/smart/call/app/iAmSmart'; | ||||
export const GET_SYS_SETTING = apiPath+'/sys'; | export const GET_SYS_SETTING = apiPath+'/sys'; | ||||
export const GET_SYS_CHECKING = apiPath+'/sysCheck'; | |||||
//Group Config | //Group Config | ||||
export const GET_GROUP_LIST_PATH = apiPath+'/group'; | export const GET_GROUP_LIST_PATH = apiPath+'/group'; | ||||
@@ -237,3 +238,6 @@ export const GET_HOLIDAY = apiPath+'/holiday/list'; //GET | |||||
export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST | export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST | ||||
export const GET_HOLIDAY_COMBO = apiPath+'/holiday/combo'; //GET | export const GET_HOLIDAY_COMBO = apiPath+'/holiday/combo'; //GET | ||||
export const GET_HOLIDAY_TEMPLATE = apiPath+'/holiday/export'; //GET | export const GET_HOLIDAY_TEMPLATE = apiPath+'/holiday/export'; //GET | ||||
export const GET_JVM_INFO = apiPath+'/jvm-info'; //GET |