@@ -40,7 +40,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
const [rowCount, setRowCount] = React.useState(0); | const [rowCount, setRowCount] = React.useState(0); | ||||
const [myHideFooterSelectedRowCount, setMyHideFooterSelectedRowCount] = React.useState(true); | const [myHideFooterSelectedRowCount, setMyHideFooterSelectedRowCount] = React.useState(true); | ||||
React.useEffect(() => { set_doLoad(doLoad); }, [doLoad]); | |||||
React.useMemo(() => { set_doLoad(doLoad); }, [doLoad]); | |||||
React.useEffect(()=>{ | React.useEffect(()=>{ | ||||
getDataList(); | getDataList(); | ||||
@@ -11,9 +11,10 @@ import {GET_ANNOUNCE_LIST} from "utils/ApiPathConst"; | |||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria }) { | export default function SearchPublicNoticeTable({ searchCriteria }) { | ||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | |||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
set_searchCriteria(searchCriteria); | set_searchCriteria(searchCriteria); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
@@ -3,16 +3,18 @@ import * as React from 'react'; | |||||
import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
import { FiDataGrid } from "components/FiDataGrid"; | import { FiDataGrid } from "components/FiDataGrid"; | ||||
import { FormattedMessage, useIntl } from "react-intl"; | import { FormattedMessage, useIntl } from "react-intl"; | ||||
import {GET_ANNOUNCE_LIST} from "utils/ApiPathConst"; | |||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ recordList }) { | |||||
const [rows, setRows] = React.useState(recordList); | |||||
export default function SearchPublicNoticeTable({ searchCriteria }) { | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const { locale } = intl; | const { locale } = intl; | ||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setRows(recordList); | |||||
}, [recordList]); | |||||
set_searchCriteria(searchCriteria); | |||||
}, [searchCriteria]); | |||||
const columns = [ | const columns = [ | ||||
{ | { | ||||
@@ -52,10 +54,13 @@ export default function SearchPublicNoticeTable({ recordList }) { | |||||
return ( | return ( | ||||
<div style={{ width: '100%' }}> | <div style={{ width: '100%' }}> | ||||
<FiDataGrid | <FiDataGrid | ||||
rows={rows} | |||||
columns={columns} | columns={columns} | ||||
customPageSize={10} | customPageSize={10} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
doLoad={{ | |||||
url: GET_ANNOUNCE_LIST, | |||||
params: _searchCriteria | |||||
}} | |||||
/> | /> | ||||
</div> | </div> | ||||
); | ); | ||||
@@ -5,9 +5,7 @@ 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 React from "react"; | import * as React from "react"; | ||||
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'; | ||||
@@ -30,34 +28,17 @@ const BackgroundHead = { | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserSearchPage_Individual = () => { | const UserSearchPage_Individual = () => { | ||||
const [record, setRecord] = React.useState([]); | |||||
const [searchCriteria, setSearchCriteria] = React.useState({ | const [searchCriteria, setSearchCriteria] = React.useState({ | ||||
dateTo: DateUtils.dateValue(new Date()), | dateTo: DateUtils.dateValue(new Date()), | ||||
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 90)), | dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 90)), | ||||
}); | }); | ||||
const [onReady, setOnReady] = React.useState(false); | const [onReady, setOnReady] = React.useState(false); | ||||
React.useEffect(() => { | |||||
getDataList(); | |||||
}, []); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setOnReady(true); | setOnReady(true); | ||||
}, [record]); | |||||
React.useEffect(() => { | |||||
getDataList(); | |||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
function getDataList() { | |||||
HttpUtils.get({ | |||||
url: UrlUtils.GET_ANNOUNCE_LIST, | |||||
params: searchCriteria, | |||||
onSuccess: function (responseData) { | |||||
setRecord(responseData); | |||||
} | |||||
}); | |||||
} | |||||
function applySearch(input) { | function applySearch(input) { | ||||
setSearchCriteria(input); | setSearchCriteria(input); | ||||
@@ -94,7 +75,7 @@ const UserSearchPage_Individual = () => { | |||||
sx={{ backgroundColor: '#fff' }} | sx={{ backgroundColor: '#fff' }} | ||||
> | > | ||||
<EventTable | <EventTable | ||||
recordList={record} | |||||
searchCriteria={searchCriteria} | |||||
/> | /> | ||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
@@ -9,8 +9,6 @@ import { clickableLink } from 'utils/CommonFunction'; | |||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria, setPaymentCount, setPublishCount }) { | export default function SearchPublicNoticeTable({ searchCriteria, setPaymentCount, setPublishCount }) { | ||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | |||||
const _sx = { | const _sx = { | ||||
padding: "4 2 4 2", | padding: "4 2 4 2", | ||||
boxShadow: 1, | boxShadow: 1, | ||||
@@ -26,7 +24,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, setPaymentCoun | |||||
borderColor: "#EEE" | borderColor: "#EEE" | ||||
} | } | ||||
} | } | ||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
set_searchCriteria(searchCriteria); | set_searchCriteria(searchCriteria); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
@@ -14,13 +14,9 @@ import * as React from "react"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
const LoadingComponent = Loadable(lazy(() => import('../../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../../extra-pages/LoadingComponent'))); | ||||
// const ProofTab = Loadable(lazy(() => import('./ProofTab'))); | |||||
// const PaymentTab = Loadable(lazy(() => import('./PaymentTab'))); | |||||
// const StatusHistoryTab = Loadable(lazy(() => import('./StatusHistoryTab'))); | |||||
import ProofTab from './ProofTab'; | |||||
import PaymentTab from './PaymentTab'; | |||||
import StatusHistoryTab from './StatusHistoryTab'; | |||||
const ProofTab = Loadable(lazy(() => import('./ProofTab'))); | |||||
const PaymentTab = Loadable(lazy(() => import('./PaymentTab'))); | |||||
const StatusHistoryTab = Loadable(lazy(() => import('./StatusHistoryTab'))); | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
@@ -16,7 +16,7 @@ import {getStatusIntl} from "utils/statusUtils/PublicNoteStatusUtils"; | |||||
import {FormattedMessage, useIntl} from "react-intl"; | import {FormattedMessage, useIntl} from "react-intl"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function BaseGrid({rows}) { | |||||
export default function BaseGrid({setCount, url}) { | |||||
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')); | ||||
@@ -99,11 +99,17 @@ export default function BaseGrid({rows}) { | |||||
return ( | return ( | ||||
<div style={{minHeight: 400, height:"100%", width: '100%', padding: 4}}> | <div style={{minHeight: 400, height:"100%", width: '100%', padding: 4}}> | ||||
<FiDataGrid | <FiDataGrid | ||||
rows={rows} | |||||
columns={columns} | columns={columns} | ||||
customPageSize={10} | customPageSize={10} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
doLoad={React.useMemo(() => ({ | |||||
url: url, | |||||
params:{}, | |||||
callback:(responseData)=>{ | |||||
setCount(responseData.count??0); | |||||
} | |||||
}))} | |||||
/> | /> | ||||
</div> | </div> | ||||
); | ); | ||||
@@ -11,7 +11,11 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import { FiDataGrid } from "components/FiDataGrid"; | import { FiDataGrid } from "components/FiDataGrid"; | ||||
import * as HttpUtils from "utils/HttpUtils" | import * as HttpUtils from "utils/HttpUtils" | ||||
import * as UrlUtils from "utils/ApiPathConst" | |||||
import { | |||||
PAYMENT_CHECK, | |||||
POST_CHECK_APP_EXPRITY_DATE, | |||||
GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPayment_careOfCombo | |||||
} from "utils/ApiPathConst" | |||||
import * as DateUtils from "utils/DateUtils" | import * as DateUtils from "utils/DateUtils" | ||||
import * as FormatUtils from "utils/FormatUtils" | import * as FormatUtils from "utils/FormatUtils" | ||||
import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; | import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; | ||||
@@ -24,20 +28,20 @@ import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst"; | |||||
import { FormattedMessage, useIntl } from "react-intl"; | import { FormattedMessage, useIntl } from "react-intl"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SubmittedTab({ rows }) { | |||||
export default function SubmittedTab({ setCount, url }) { | |||||
const [rowList, setRowList] = React.useState([]); | const [rowList, setRowList] = React.useState([]); | ||||
const [selectedRowItems, setSelectedRowItems] = React.useState([]); | const [selectedRowItems, setSelectedRowItems] = React.useState([]); | ||||
const [isPopUp, setIsPopUp] = React.useState(false); | const [isPopUp, setIsPopUp] = React.useState(false); | ||||
const [checkCareOf, setCheckCareOf] = React.useState(false); | const [checkCareOf, setCheckCareOf] = React.useState(false); | ||||
const [getCareOfList, setCareOfList] = React.useState([]); | |||||
const [careOfComboList, setCareOfComboList] = React.useState([{}]); | |||||
const [careOfComboList, setCareOfComboList] = React.useState([]); | |||||
const [selectedCareOf, setSelectedCareOf] = React.useState(null); | const [selectedCareOf, setSelectedCareOf] = React.useState(null); | ||||
const [expiryDateErrText, setExpiryDateErrText] = React.useState(""); | const [expiryDateErrText, setExpiryDateErrText] = React.useState(""); | ||||
const [expiryDateErr, setExpiryDateErr] = React.useState(false); | const [expiryDateErr, setExpiryDateErr] = React.useState(false); | ||||
const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); | const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); | ||||
const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); | const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); | ||||
const [_searchCriteria, set_searchCriteria] = React.useState({}); | |||||
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(); | ||||
@@ -46,41 +50,27 @@ export default function SubmittedTab({ rows }) { | |||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
// const careOfList = rows.map(obj => obj.careOf); | |||||
// console.log(rows) | |||||
// console.log(careOfList) | |||||
setRowList(rows) | |||||
const formattedData = Array.from(new Set(rows.filter(obj => obj.careOf !== null).map(obj => obj.careOf))).map((careOf, index) => ({ | |||||
key: index, | |||||
id: rows.find(obj => obj.careOf === careOf).id, | |||||
label: careOf | |||||
})); | |||||
// console.log(formattedData) | |||||
setCareOfList(formattedData) | |||||
getCareOfList(); | |||||
}, []); | }, []); | ||||
React.useEffect(() => { | |||||
// console.log(getCareOfList) | |||||
setCareOfComboList(getCareOfList) | |||||
}, [getCareOfList]); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
if (selectedCareOf != null) { | if (selectedCareOf != null) { | ||||
const afteSelectedList = []; | |||||
console.log(rows) | |||||
console.log(selectedCareOf) | |||||
rows.forEach((element) => { | |||||
if (element.careOf === selectedCareOf.label) { | |||||
afteSelectedList.push(element) | |||||
} | |||||
}); | |||||
// afteSelectedList.push(rows.find(obj => obj.careOf ===(selectedCareOf.label))); | |||||
console.log(afteSelectedList) | |||||
setRowList(afteSelectedList) | |||||
set_searchCriteria({ "careOf": selectedCareOf.label }); | |||||
} else { | } else { | ||||
setRowList(rows) | |||||
set_searchCriteria({}); | |||||
} | } | ||||
}, [selectedCareOf]); | }, [selectedCareOf]); | ||||
const getCareOfList = () => { | |||||
HttpUtils.get({ | |||||
url: GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPayment_careOfCombo, | |||||
params: {}, | |||||
onSuccess: function (responData) { | |||||
setCareOfComboList(responData); | |||||
} | |||||
}); | |||||
} | |||||
const handleDetailClick = (params) => () => { | const handleDetailClick = (params) => () => { | ||||
navigate('/publicNotice/' + params.id); | navigate('/publicNotice/' + params.id); | ||||
@@ -88,20 +78,21 @@ export default function SubmittedTab({ rows }) { | |||||
const handlePaymentBtn = () => { | const handlePaymentBtn = () => { | ||||
let appIdList = []; | let appIdList = []; | ||||
const datas = rows?.filter((row) => | |||||
const _datas = rowList; | |||||
const datas = _datas?.filter((row) => | |||||
selectedRowItems.includes(row.id) | selectedRowItems.includes(row.id) | ||||
); | ); | ||||
// console.log(datas) | // console.log(datas) | ||||
for (var i = 0; i < datas?.length; i++) { | for (var i = 0; i < datas?.length; i++) { | ||||
appIdList.push(datas[i].id); | appIdList.push(datas[i].id); | ||||
} | } | ||||
if(appIdList.length<1){ | |||||
if (appIdList.length < 1) { | |||||
setExpiryDateErrText(intl.formatMessage({ id: 'MSG.plzSelectApp' })); | setExpiryDateErrText(intl.formatMessage({ id: 'MSG.plzSelectApp' })); | ||||
setExpiryDateErr(true); | setExpiryDateErr(true); | ||||
return; | return; | ||||
} | } | ||||
HttpUtils.post({ | HttpUtils.post({ | ||||
url: UrlUtils.POST_CHECK_APP_EXPRITY_DATE, | |||||
url: POST_CHECK_APP_EXPRITY_DATE, | |||||
params: { | params: { | ||||
ids: appIdList | ids: appIdList | ||||
}, | }, | ||||
@@ -123,7 +114,7 @@ export default function SubmittedTab({ rows }) { | |||||
const handlePaymentCheck = (appIdList) => { | const handlePaymentCheck = (appIdList) => { | ||||
HttpUtils.post({ | HttpUtils.post({ | ||||
url: UrlUtils.PAYMENT_CHECK, | |||||
url: PAYMENT_CHECK, | |||||
params: { | params: { | ||||
appIds: appIdList | appIds: appIdList | ||||
}, | }, | ||||
@@ -131,24 +122,24 @@ export default function SubmittedTab({ rows }) { | |||||
const latestData = {}; | const latestData = {}; | ||||
responseData.forEach(item => { | responseData.forEach(item => { | ||||
const { appId, timeDiff } = item; | |||||
if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { | |||||
latestData[appId] = item; | |||||
} | |||||
const { appId, timeDiff } = item; | |||||
if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { | |||||
latestData[appId] = item; | |||||
} | |||||
}); | }); | ||||
const latestDataObjects = Object.values(latestData); | const latestDataObjects = Object.values(latestData); | ||||
const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 || item.status !== "APPR"); | const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 || item.status !== "APPR"); | ||||
const filteredAppIds = filteredData.map(item => item.appId); | const filteredAppIds = filteredData.map(item => item.appId); | ||||
const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); | const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); | ||||
const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; | const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; | ||||
const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); | const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); | ||||
if (readyToPayment){ | |||||
if (readyToPayment) { | |||||
setIsPopUp(true); | setIsPopUp(true); | ||||
return; | |||||
}else{ | |||||
return; | |||||
} else { | |||||
const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); | const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); | ||||
const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); | const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); | ||||
const resultString = HoldingApplication.map(item => item.appNo).join(' , '); | const resultString = HoldingApplication.map(item => item.appNo).join(' , '); | ||||
@@ -232,7 +223,8 @@ export default function SubmittedTab({ rows }) { | |||||
const getWindowContent = () => { | const getWindowContent = () => { | ||||
var content = []; | var content = []; | ||||
let totalAmount = 0; | let totalAmount = 0; | ||||
const datas = rows?.filter((row) => | |||||
const _datas = rowList; | |||||
const datas = _datas?.filter((row) => | |||||
selectedRowItems.includes(row.id) | selectedRowItems.includes(row.id) | ||||
); | ); | ||||
for (var i = 0; i < datas?.length; i++) { | for (var i = 0; i < datas?.length; i++) { | ||||
@@ -264,7 +256,8 @@ export default function SubmittedTab({ rows }) { | |||||
setIsPopUp(false); | setIsPopUp(false); | ||||
let totalAmount = 0; | let totalAmount = 0; | ||||
let appIdList = []; | let appIdList = []; | ||||
const datas = rows?.filter((row) => | |||||
const _datas = rowList; | |||||
const datas = _datas?.filter((row) => | |||||
selectedRowItems.includes(row.id) | selectedRowItems.includes(row.id) | ||||
); | ); | ||||
// console.log(datas) | // console.log(datas) | ||||
@@ -287,7 +280,8 @@ export default function SubmittedTab({ rows }) { | |||||
function afterWarningPayment() { | function afterWarningPayment() { | ||||
let totalAmount = 0; | let totalAmount = 0; | ||||
let appIdList = []; | let appIdList = []; | ||||
const datas = rows?.filter((row) => | |||||
const _datas = rowList; | |||||
const datas = _datas?.filter((row) => | |||||
selectedRowItems.includes(row.id) | selectedRowItems.includes(row.id) | ||||
); | ); | ||||
// console.log(datas) | // console.log(datas) | ||||
@@ -324,14 +318,21 @@ export default function SubmittedTab({ rows }) { | |||||
<FiDataGrid | <FiDataGrid | ||||
checkboxSelection | checkboxSelection | ||||
disableRowSelectionOnClick | disableRowSelectionOnClick | ||||
rows={rowList} | |||||
columns={columns} | columns={columns} | ||||
customPageSize={20} | |||||
customPageSize={2} | |||||
onRowSelectionModelChange={(newSelection) => { | onRowSelectionModelChange={(newSelection) => { | ||||
setSelectedRowItems(newSelection); | setSelectedRowItems(newSelection); | ||||
}} | }} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
doLoad={React.useMemo(() => ({ | |||||
url: url, | |||||
params: _searchCriteria, | |||||
callback: function (responseData) { | |||||
setCount(responseData?.count ?? 0); | |||||
setRowList(responseData?.records); | |||||
} | |||||
}))} | |||||
/> | /> | ||||
<ThemeProvider theme={PNSPS_BUTTON_THEME}> | <ThemeProvider theme={PNSPS_BUTTON_THEME}> | ||||
@@ -396,7 +397,7 @@ export default function SubmittedTab({ rows }) { | |||||
}} | }} | ||||
> | > | ||||
<DialogTitle></DialogTitle> | <DialogTitle></DialogTitle> | ||||
<Typography variant="h2" style={{ padding: '16px' }}> | |||||
<Typography variant="h2" style={{ padding: '16px' }}> | |||||
<FormattedMessage id="warning" /> | <FormattedMessage id="warning" /> | ||||
</Typography> | </Typography> | ||||
<DialogContent style={{ display: 'flex', }}> | <DialogContent style={{ display: 'flex', }}> | ||||
@@ -3,9 +3,7 @@ import { | |||||
Grid | Grid | ||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
import {GET_PUBLIC_NOTICE_LIST} from "utils/ApiPathConst"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
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,30 +14,11 @@ const EventTable = Loadable(React.lazy(() => import('./SearchPublicNoticeTable') | |||||
const UserSearchPage_Individual = () => { | const UserSearchPage_Individual = () => { | ||||
const [record,setRecord] = React.useState([]); | |||||
const [searchCriteria, setSearchCriteria] = React.useState({ | const [searchCriteria, setSearchCriteria] = React.useState({ | ||||
dateTo: DateUtils.dateValue(new Date()), | dateTo: DateUtils.dateValue(new Date()), | ||||
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), | dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)), | ||||
}); | }); | ||||
React.useEffect(() => { | |||||
getUserList(); | |||||
}, []); | |||||
React.useEffect(() => { | |||||
getUserList(); | |||||
}, [searchCriteria]); | |||||
function getUserList(){ | |||||
HttpUtils.get({ | |||||
url: GET_PUBLIC_NOTICE_LIST, | |||||
params: searchCriteria, | |||||
onSuccess: function(responseData){ | |||||
setRecord(responseData); | |||||
} | |||||
}); | |||||
} | |||||
function applySearch(input) { | function applySearch(input) { | ||||
setSearchCriteria(input); | setSearchCriteria(input); | ||||
} | } | ||||
@@ -63,7 +42,7 @@ const UserSearchPage_Individual = () => { | |||||
<div style={{height: '100%', width: '100%' }}> | <div style={{height: '100%', width: '100%' }}> | ||||
<EventTable | <EventTable | ||||
autoHeight | autoHeight | ||||
recordList={record} | |||||
searchCriteria={searchCriteria} | |||||
/> | /> | ||||
</div> | </div> | ||||
</MainCard> | </MainCard> | ||||
@@ -11,24 +11,28 @@ import { FiDataGrid } from "components/FiDataGrid"; | |||||
import { | import { | ||||
isORGLoggedIn, | isORGLoggedIn, | ||||
} from "utils/Utils"; | } from "utils/Utils"; | ||||
import {GET_PUBLIC_NOTICE_LIST} from "utils/ApiPathConst"; | |||||
import { useTheme } from "@emotion/react"; | import { useTheme } from "@emotion/react"; | ||||
import { FormattedMessage, useIntl } from "react-intl"; | import { FormattedMessage, useIntl } from "react-intl"; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ recordList }) { | |||||
const [rows, setRows] = React.useState([]); | |||||
export default function SearchPublicNoticeTable({ searchCriteria }) { | |||||
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')); | ||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); | |||||
React.useEffect(() => { | |||||
set_searchCriteria(searchCriteria); | |||||
}, [searchCriteria]); | |||||
const handleDetailClick = (params) => () => { | const handleDetailClick = (params) => () => { | ||||
navigate('/publicNotice/' + params.id); | navigate('/publicNotice/' + params.id); | ||||
}; | }; | ||||
React.useEffect(() => { | |||||
setRows(recordList); | |||||
}, [recordList]); | |||||
const columns = [ | const columns = [ | ||||
{ | { | ||||
@@ -127,11 +131,14 @@ export default function SearchPublicNoticeTable({ recordList }) { | |||||
return ( | return ( | ||||
<div style={{ minHeight: 400, height: "100%", width: '100%' }}> | <div style={{ minHeight: 400, height: "100%", width: '100%' }}> | ||||
<FiDataGrid | <FiDataGrid | ||||
rows={rows} | |||||
columns={columns} | columns={columns} | ||||
customPageSize={20} | customPageSize={20} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
doLoad={{ | |||||
url: GET_PUBLIC_NOTICE_LIST, | |||||
params: _searchCriteria | |||||
}} | |||||
/> | /> | ||||
</div> | </div> | ||||
); | ); | ||||
@@ -12,8 +12,13 @@ import { TabPanel, TabContext, TabList } from '@mui/lab'; | |||||
import { useEffect, useState } from "react"; | import { useEffect, useState } from "react"; | ||||
import { useNavigate } from "react-router-dom"; | import { useNavigate } from "react-router-dom"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import * as HttpUtils from "../../../utils/HttpUtils"; | |||||
import * as UrlUtils from "../../../utils/ApiPathConst"; | |||||
import * as HttpUtils from "utils/HttpUtils"; | |||||
import { | |||||
GET_PUBLIC_NOTICE_LIST_ListByStatus, | |||||
GET_PUBLIC_NOTICE_LIST_ListByStatus_submitted, | |||||
GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPayment, | |||||
GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPublish | |||||
} from "utils/ApiPathConst"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
@@ -23,17 +28,17 @@ const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingCo | |||||
const SearchTab = Loadable(lazy(() => import('./SearchPublicNoticeTab'))); | const SearchTab = Loadable(lazy(() => import('./SearchPublicNoticeTab'))); | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
import {PNSPS_LONG_BUTTON_THEME} from "../../../themes/buttonConst"; | |||||
import {ThemeProvider} from "@emotion/react"; | |||||
import {FormattedMessage, useIntl} from "react-intl"; | |||||
import { PNSPS_LONG_BUTTON_THEME } from "../../../themes/buttonConst"; | |||||
import { ThemeProvider } from "@emotion/react"; | |||||
import { FormattedMessage, useIntl } from "react-intl"; | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const PublicNotice = () => { | const PublicNotice = () => { | ||||
const [submittedList, setSubmittedList] = useState([]); | |||||
const [pendingPaymentList, setPendingPaymentList] = useState([]); | |||||
const [pendingPublishList, setPendingPublishList] = useState([]); | |||||
const [submittedCount, setSubmittedCount] = useState(0); | |||||
const [pendingPaymentCount, setPendingPaymentCount] = useState(0); | |||||
const [pendingPublishCount, setPendingPublishCount] = useState(0); | |||||
const [isLoading, setLoding] = useState(true); | const [isLoading, setLoding] = useState(true); | ||||
const [selectedTab, setSelectedTab] = useState("1"); | const [selectedTab, setSelectedTab] = useState("1"); | ||||
const navigate = useNavigate(); | const navigate = useNavigate(); | ||||
@@ -72,25 +77,21 @@ const PublicNotice = () => { | |||||
loadData(); | loadData(); | ||||
}, []); | }, []); | ||||
const reloadPage = () => { | |||||
window.location.reload(false); | |||||
} | |||||
const loadData = () => { | const loadData = () => { | ||||
setLoding(true); | setLoding(true); | ||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: `${UrlUtils.GET_PUBLIC_NOTICE_LIST_ListByStatus}`, | |||||
url: GET_PUBLIC_NOTICE_LIST_ListByStatus, | |||||
onSuccess: function (response) { | onSuccess: function (response) { | ||||
setSubmittedList(response["submitted"]); | |||||
setPendingPaymentList(response["pendingPayment"]); | |||||
setPendingPublishList(response["pendingPublish"]); | |||||
setSubmittedCount(response.submitted ?? 0); | |||||
setPendingPaymentCount(response.pendingPayment ?? 0); | |||||
setPendingPublishCount(response.pendingPublish ?? 0); | |||||
} | } | ||||
}); | }); | ||||
}; | }; | ||||
useEffect(() => { | useEffect(() => { | ||||
setLoding(false); | setLoding(false); | ||||
}, [submittedList]); | |||||
}, [submittedCount]); | |||||
const handleChange = (event, newValue) => { | const handleChange = (event, newValue) => { | ||||
setSelectedTab(newValue); | setSelectedTab(newValue); | ||||
@@ -108,24 +109,24 @@ const PublicNotice = () => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
: | : | ||||
<Grid container sx={{ minHeight: '87vh', backgroundColor:'backgroundColor.default'}} direction="column"> | |||||
<Grid container sx={{ minHeight: '87vh', 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"> | ||||
<Typography ml={15} color='#FFF' variant="h4" sx={{display: { xs: 'none', sm: 'none', md: 'block' }}}> | |||||
<FormattedMessage id="myPublicNotice"/> | |||||
<Typography ml={15} color='#FFF' variant="h4" sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}> | |||||
<FormattedMessage id="myPublicNotice" /> | |||||
</Typography> | </Typography> | ||||
</Stack> | </Stack> | ||||
</div> | </div> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} sm={12} md={12} lg={12} mt={1} sx={{ mt: 3,mr:{xs:3, sm:3, md:0 }}} > | |||||
<Grid item xs={12} sm={12} md={12} lg={12} mt={1} sx={{ mt: 3, mr: { xs: 3, sm: 3, md: 0 } }} > | |||||
<Stack direction="row" justifyContent="flex-end" alignItems="center"> | <Stack direction="row" justifyContent="flex-end" alignItems="center"> | ||||
<ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> | <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> | ||||
<Box sx={{ mr: { md: "47px" } }}> | |||||
<Button aria-label={intl.formatMessage({id: 'applyPublicNotice'})} variant="contained" onClick={() => { onBtnClick() }}> | |||||
<FormattedMessage id="applyPublicNotice"/> | |||||
</Button> | |||||
</Box> | |||||
<Box sx={{ mr: { md: "47px" } }}> | |||||
<Button aria-label={intl.formatMessage({ id: 'applyPublicNotice' })} variant="contained" onClick={() => { onBtnClick() }}> | |||||
<FormattedMessage id="applyPublicNotice" /> | |||||
</Button> | |||||
</Box> | |||||
</ThemeProvider> | </ThemeProvider> | ||||
</Stack> | </Stack> | ||||
</Grid> | </Grid> | ||||
@@ -133,76 +134,70 @@ const PublicNotice = () => { | |||||
{ | { | ||||
JSON.parse(localStorage.getItem('userData')).creditor ? ( | JSON.parse(localStorage.getItem('userData')).creditor ? ( | ||||
<Grid item xs={12} sm={12} md={12} lg={12} sx={{ height:'100%', maxWidth: '100%',width: "-webkit-fill-available", backgroundColor: "#fff", mt: 3, mr:{xs:1,md:3}, ml:{xs:1,md:3}, mb: 3, ..._sx }}> | |||||
<Grid item xs={12} sm={12} md={12} lg={12} sx={{ height: '100%', maxWidth: '100%', width: "-webkit-fill-available", backgroundColor: "#fff", mt: 3, mr: { xs: 1, md: 3 }, ml: { xs: 1, md: 3 }, mb: 3, ..._sx }}> | |||||
<TabContext value={selectedTab}> | <TabContext value={selectedTab}> | ||||
<Box sx={{ borderBottom: 1, borderColor: 'divider', overflowX: 'auto', overflowY:'auto' }}> | |||||
<Box sx={{ borderBottom: 1, borderColor: 'divider', overflowX: 'auto', overflowY: 'auto' }}> | |||||
<TabList variant="scrollable" onChange={handleChange} aria-label="lab API tabs example" sx={{ display: 'flex', flexDirection: 'row' }}> | <TabList variant="scrollable" onChange={handleChange} aria-label="lab API tabs example" sx={{ display: 'flex', flexDirection: 'row' }}> | ||||
<Tab aria-label={intl.formatMessage({id: 'processing'})} label={intl.formatMessage({id: 'processing'}) + " (" + submittedList?.length + ")"} value="1" /> | |||||
<Tab aria-label={intl.formatMessage({id: 'pendingPublish'})} label={intl.formatMessage({id: 'pendingPublish'}) + " (" + pendingPublishList?.length + ")"} value="3" /> | |||||
<Tab aria-label={intl.formatMessage({id: 'pendingPayment'})} label={intl.formatMessage({id: 'pendingPayment'}) + " (" + pendingPaymentList?.length + ")"} value="4" /> | |||||
<Tab aria-label={intl.formatMessage({id: 'searchApplyRecord'})} label={intl.formatMessage({id: 'searchApplyRecord'})} value="5" /> | |||||
<Tab aria-label={intl.formatMessage({ id: 'processing' })} label={intl.formatMessage({ id: 'processing' }) + " (" + submittedCount + ")"} value="1" /> | |||||
<Tab aria-label={intl.formatMessage({ id: 'pendingPublish' })} label={intl.formatMessage({ id: 'pendingPublish' }) + " (" + pendingPublishCount + ")"} value="3" /> | |||||
<Tab aria-label={intl.formatMessage({ id: 'pendingPayment' })} label={intl.formatMessage({ id: 'pendingPayment' }) + " (" + pendingPaymentCount + ")"} value="4" /> | |||||
<Tab aria-label={intl.formatMessage({ id: 'searchApplyRecord' })} label={intl.formatMessage({ id: 'searchApplyRecord' })} value="5" /> | |||||
</TabList> | </TabList> | ||||
</Box> | </Box> | ||||
<TabPanel value="1"> | <TabPanel value="1"> | ||||
<BaseGrid | <BaseGrid | ||||
rows={submittedList} | |||||
reloadFunction={reloadPage} | |||||
url={GET_PUBLIC_NOTICE_LIST_ListByStatus_submitted} | |||||
setCount={setSubmittedCount} | |||||
/> | /> | ||||
</TabPanel> | </TabPanel> | ||||
<TabPanel value="3"> | <TabPanel value="3"> | ||||
<BaseGrid | <BaseGrid | ||||
rows={pendingPublishList} | |||||
reloadFunction={reloadPage} | |||||
url={GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPublish} | |||||
setCount={setPendingPublishCount} | |||||
/> | /> | ||||
</TabPanel> | </TabPanel> | ||||
<TabPanel value="4"> | <TabPanel value="4"> | ||||
<BaseGrid | <BaseGrid | ||||
rows={pendingPaymentList} | |||||
reloadFunction={reloadPage} | |||||
url={GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPayment} | |||||
setCount={setPendingPaymentCount} | |||||
/> | /> | ||||
</TabPanel> | </TabPanel> | ||||
<TabPanel value="5"> | <TabPanel value="5"> | ||||
<SearchTab | |||||
rows={pendingPublishList} | |||||
reloadFunction={reloadPage} | |||||
/> | |||||
<SearchTab /> | |||||
</TabPanel> | </TabPanel> | ||||
</TabContext> | </TabContext> | ||||
</Grid> | </Grid> | ||||
) : ( | ) : ( | ||||
<Grid item xs={12} sx={{ minHeight: '80vh',height:"100%", maxHeight:'300vh', maxWidth: '95%', width: "-webkit-fill-available", backgroundColor: "#fff", mt: 3, mr:{xs:1,md:3}, ml:{xs:1,md:3}, mb: 3, ..._sx }}> | |||||
<Grid item xs={12} sx={{ minHeight: '80vh', height: "100%", maxHeight: '300vh', maxWidth: '95%', width: "-webkit-fill-available", backgroundColor: "#fff", mt: 3, mr: { xs: 1, md: 3 }, ml: { xs: 1, md: 3 }, mb: 3, ..._sx }}> | |||||
<TabContext value={selectedTab}> | <TabContext value={selectedTab}> | ||||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | <Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | ||||
<TabList variant="scrollable" onChange={handleChange} aria-label="lab API tabs example"> | <TabList variant="scrollable" onChange={handleChange} aria-label="lab API tabs example"> | ||||
<Tab aria-label={intl.formatMessage({id: 'processing'})} label={intl.formatMessage({id: 'processing'}) + " (" + submittedList.length + ")"} value="1" /> | |||||
<Tab aria-label={intl.formatMessage({id: 'pendingPayment'})} label={intl.formatMessage({id: 'pendingPayment'}) + " (" + pendingPaymentList.length + ")"} value="3" /> | |||||
<Tab aria-label={intl.formatMessage({id: 'pendingPublish'})} label={intl.formatMessage({id: 'pendingPublish'}) + " (" + pendingPublishList.length + ")"} value="4" /> | |||||
<Tab aria-label={intl.formatMessage({id: 'searchApplyRecord'})} label={intl.formatMessage({id: 'searchApplyRecord'})} value="5" /> | |||||
<Tab aria-label={intl.formatMessage({ id: 'processing' })} label={intl.formatMessage({ id: 'processing' }) + " (" + submittedCount + ")"} value="1" /> | |||||
<Tab aria-label={intl.formatMessage({ id: 'pendingPayment' })} label={intl.formatMessage({ id: 'pendingPayment' }) + " (" + pendingPaymentCount + ")"} value="3" /> | |||||
<Tab aria-label={intl.formatMessage({ id: 'pendingPublish' })} label={intl.formatMessage({ id: 'pendingPublish' }) + " (" + pendingPublishCount + ")"} value="4" /> | |||||
<Tab aria-label={intl.formatMessage({ id: 'searchApplyRecord' })} label={intl.formatMessage({ id: 'searchApplyRecord' })} value="5" /> | |||||
</TabList> | </TabList> | ||||
</Box> | </Box> | ||||
<TabPanel value="1"> | <TabPanel value="1"> | ||||
<BaseGrid | <BaseGrid | ||||
rows={submittedList} | |||||
reloadFunction={reloadPage} | |||||
url={GET_PUBLIC_NOTICE_LIST_ListByStatus_submitted} | |||||
setCount={setSubmittedCount} | |||||
/> | /> | ||||
</TabPanel> | </TabPanel> | ||||
<TabPanel value="3"> | <TabPanel value="3"> | ||||
<PendingPaymentTab | <PendingPaymentTab | ||||
rows={pendingPaymentList} | |||||
reloadFunction={reloadPage} | |||||
url={GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPayment} | |||||
setCount={setPendingPaymentCount} | |||||
/> | /> | ||||
</TabPanel> | </TabPanel> | ||||
<TabPanel value="4"> | <TabPanel value="4"> | ||||
<BaseGrid | <BaseGrid | ||||
rows={pendingPublishList} | |||||
reloadFunction={reloadPage} | |||||
url={GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPublish} | |||||
setCount={setPendingPublishCount} | |||||
/> | /> | ||||
</TabPanel> | </TabPanel> | ||||
<TabPanel value="5"> | <TabPanel value="5"> | ||||
<SearchTab | |||||
rows={pendingPublishList} | |||||
reloadFunction={reloadPage} | |||||
/> | |||||
<SearchTab /> | |||||
</TabPanel> | </TabPanel> | ||||
</TabContext> | </TabContext> | ||||
</Grid> | </Grid> | ||||
@@ -101,6 +101,10 @@ export const GET_SET_UN_PRIMARY_USER = apiPath+'/user/un-primary'; | |||||
export const GET_PUBLIC_NOTICE_LIST = apiPath+'/application/list'; | export const GET_PUBLIC_NOTICE_LIST = apiPath+'/application/list'; | ||||
export const GET_PUBLIC_NOTICE_LIST_ListByStatus = apiPath+'/application/status-list'; | export const GET_PUBLIC_NOTICE_LIST_ListByStatus = apiPath+'/application/status-list'; | ||||
export const GET_PUBLIC_NOTICE_LIST_ListByStatus_submitted = apiPath+'/application/status-list/submitted'; | |||||
export const GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPayment = apiPath+'/application/status-list/pendingPayment'; | |||||
export const GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPayment_careOfCombo = apiPath+'/application/status-list/pendingPayment/careOfCombo'; | |||||
export const GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPublish = apiPath+'/application/status-list/pendingPublish'; | |||||
export const GET_PUBLIC_NOTICE_getApplyUser = apiPath+'/application/get-apply-user'; | export const GET_PUBLIC_NOTICE_getApplyUser = apiPath+'/application/get-apply-user'; | ||||
export const POST_PUBLIC_NOTICE_APPLY = apiPath+'/application/apply'; | export const POST_PUBLIC_NOTICE_APPLY = apiPath+'/application/apply'; | ||||
export const POST_CHECK_APP_EXPRITY_DATE = apiPath+'/application/checkExprityDate'; | export const POST_CHECK_APP_EXPRITY_DATE = apiPath+'/application/checkExprityDate'; | ||||