From d94a603775349a76598e0db1e89dac6b9fd7a92d Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Sun, 13 Jul 2025 22:55:37 +0800 Subject: [PATCH] update application payment with issueDate show --- .../ApplyForm/PublicNoticeApplyForm.js | 8 ++++++-- src/pages/PublicNotice/ApplyForm/index.js | 12 ++++++------ src/utils/Utils.js | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index bffd396..fbe2860 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -19,7 +19,8 @@ import ForwardIcon from '@mui/icons-material/Forward'; import { isORGLoggedIn, isDummyLoggedIn, - isCreditorLoggedIn + isCreditorLoggedIn, + checkIsOnlyOnlinePaymentByIssueDate } from "utils/Utils"; import { useNavigate } from "react-router-dom"; @@ -33,7 +34,7 @@ const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingCo // ==============================|| DASHBOARD - DEFAULT ||============================== // -const PublicNoticeApplyForm = ({ loadedData, _selections, gazetteIssueList, isOnlyOnlinePayment }) => { +const PublicNoticeApplyForm = ({ loadedData, _selections, gazetteIssueList }) => { const [isWarningPopUp, setIsWarningPopUp] = useState(false); const [warningTitle, setWarningTitle] = useState(""); const [warningText, setWarningText] = useState(""); @@ -51,6 +52,7 @@ const PublicNoticeApplyForm = ({ loadedData, _selections, gazetteIssueList, isOn const [issueId, setIssueId] = useState(loadedData.issueId); const [closeDate, setCloseDate] = useState(null); const [closingDateOff, setClosingDateOff] = useState(null); + const [isOnlyOnlinePayment, setOnlyOnlinePayment] = useState(); const navigate = useNavigate(); const BackgroundHead = { @@ -83,6 +85,8 @@ const PublicNoticeApplyForm = ({ loadedData, _selections, gazetteIssueList, isOn if (data.id == issueId) { setCloseDate(data.closingDate) setClosingDateOff(data.closingDateOff) + setOnlyOnlinePayment(checkIsOnlyOnlinePaymentByIssueDate(data.issueDate)) + break; } } diff --git a/src/pages/PublicNotice/ApplyForm/index.js b/src/pages/PublicNotice/ApplyForm/index.js index 0286ad0..b445939 100644 --- a/src/pages/PublicNotice/ApplyForm/index.js +++ b/src/pages/PublicNotice/ApplyForm/index.js @@ -20,7 +20,7 @@ const PublicNoticeApplyForm = Loadable(lazy(() => import('./PublicNoticeApplyFor import { // isORGLoggedIn, isDummyLoggedIn, - checkIsOnlyOnlinePayment + // checkIsOnlyOnlinePaymentByIssueDate // isCreditorLoggedIn } from "utils/Utils"; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -30,7 +30,7 @@ const ApplyForm = () => { const [gazetteIssueList, setGazetteIssueList] = React.useState([]); const [selections, setSelection] = React.useState([]); - const [isOnlyOnlinePayment, setOnlyOnlinePayment] = React.useState(); + const [isLoading, setLoding] = React.useState(true); const intl = useIntl(); @@ -66,7 +66,7 @@ const ApplyForm = () => { setGazetteIssueList(response?.gazetteIssueList); setSelection(selection); setUserData(response); - setOnlyOnlinePayment(checkIsOnlyOnlinePayment()) + // setOnlyOnlinePayment(checkIsOnlyOnlinePayment()) } }); }; @@ -109,11 +109,11 @@ const ApplyForm = () => { React.useEffect(() => { - if (userData !== null&& isOnlyOnlinePayment !== null){ + if (userData !== null){ setLoding(false); // console.log(isOnlyOnlinePayment) } - }, [userData,isOnlyOnlinePayment]); + }, [userData]); return ( isLoading ? @@ -127,7 +127,7 @@ const ApplyForm = () => { loadedData={userData} _selections={selections} gazetteIssueList = {gazetteIssueList} - isOnlyOnlinePayment = {isOnlyOnlinePayment} + // isOnlyOnlinePayment = {isOnlyOnlinePayment} /> ); }; diff --git a/src/utils/Utils.js b/src/utils/Utils.js index 591aa92..c90574c 100644 --- a/src/utils/Utils.js +++ b/src/utils/Utils.js @@ -183,6 +183,21 @@ export const isPasswordExpiry = () =>{ } +export const checkIsOnlyOnlinePaymentByIssueDate = (date) => { + const targetDate = new Date(2026, 0, 28, 8, 0, 0) + const checkDate = DateUtils.convertToDate(date) + if (isDummyLoggedIn()){ + return false; + } + // console.log(checkDate) + // console.log(targetDate) + if (checkDate >= targetDate) { + return true + } else { + return false; + } +} + export const checkIsOnlyOnlinePayment = () => { const targetDate = new Date(2026, 0, 28, 8, 0, 0) const checkDate = DateUtils.convertToDate(new Date())