diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index f2d5e63..b3ed9de 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -20,7 +20,8 @@ import { isORGLoggedIn, isDummyLoggedIn, // isCreditorLoggedIn, - checkIsOnlyOnlinePaymentByIssueDate + checkIsOnlyOnlinePaymentByIssueDate, + checkIsOnlyOnlinePaymentApply, } from "utils/Utils"; import { useNavigate } from "react-router-dom"; @@ -582,7 +583,7 @@ const PublicNoticeApplyForm = ({ loadedData, _selections, gazetteIssueList }) => aria-label={intl.formatMessage({ id: 'applyPublicNotice' })} variant="contained" type="submit" - disabled={!tickAccept} + disabled={checkIsOnlyOnlinePaymentApply(tickAccept)} > diff --git a/src/pages/PublicNotice/ApplyForm/index.js b/src/pages/PublicNotice/ApplyForm/index.js index d7b38e8..b5ed6a6 100644 --- a/src/pages/PublicNotice/ApplyForm/index.js +++ b/src/pages/PublicNotice/ApplyForm/index.js @@ -20,7 +20,8 @@ const PublicNoticeApplyForm = Loadable(lazy(() => import('./PublicNoticeApplyFor import { // isORGLoggedIn, isDummyLoggedIn, - checkIsOnlyOnlinePaymentByIssueDate + checkIsOnlyOnlinePaymentByIssueDate, + checkIsOnlyOnlinePayment // isCreditorLoggedIn } from "utils/Utils"; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -80,22 +81,24 @@ const ApplyForm = () => { setSelection(selection); } else { let selection = []; - for (let i = 0; i < response.gazetteIssueList.length; i++) { - let data = response.gazetteIssueList[i]; - // only add if false - if (!checkIsOnlyOnlinePaymentByIssueDate(data.issueDate)) { - selection.push( - } - label={getIssueLabel(data)} - /> - ); + if (checkIsOnlyOnlinePayment()){ + for (let i = 0; i < response.gazetteIssueList.length; i++) { + let data = response.gazetteIssueList[i]; + // only add if false + if (!checkIsOnlyOnlinePaymentByIssueDate(data.issueDate)) { + selection.push( + } + label={getIssueLabel(data)} + /> + ); + } } + setGazetteIssueList(issueList); + setSelection(selection); } - setGazetteIssueList(issueList); - setSelection(selection); } } setUserData(response); diff --git a/src/utils/Utils.js b/src/utils/Utils.js index 50e948c..89fa95e 100644 --- a/src/utils/Utils.js +++ b/src/utils/Utils.js @@ -210,7 +210,8 @@ export const checkIsOnlyOnlinePaymentByIssueDate = (date) => { } export const checkIsOnlyOnlinePayment = () => { - const targetDate = new Date(2025, 9, 17, 8, 0, 0) // hardcode + // const targetDate = new Date(2025, 28, 0, 0, 0, 0) // hardcode + const targetDate = new Date(2025, 9, 10, 0, 0, 0) // hardcode const checkDate = DateUtils.convertToDate(new Date()) if (isDummyLoggedIn()){ return false; @@ -224,6 +225,26 @@ export const checkIsOnlyOnlinePayment = () => { } } +export const checkIsOnlyOnlinePaymentApply = (tickAccept) => { + // const targetDate = new Date(2025, 28, 0, 0, 0, 0) // hardcode + const targetDate = new Date(2025, 9, 10, 0, 0, 0) // hardcode + const checkDate = DateUtils.convertToDate(new Date()) + if (isDummyLoggedIn()){ + return false; + } + // console.log(checkDate) + // console.log(targetDate) + if(tickAccept){ + if (checkDate >= targetDate) { + return false + } else{ + return true; + } + }else { + return true; + } +} + export const checkMarkAsCreditClient = () => { const targetDate = new Date(2025, 9, 17, 8, 0, 0) // hardcode const checkDate = DateUtils.convertToDate(new Date())