From 2f349561feacceb45c519223ecfcc917f286e511 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 4 Mar 2024 10:27:53 +0800 Subject: [PATCH 01/12] add min proof Deadline --- src/pages/DemandNote/Search/SearchForm.js | 2 +- src/pages/Proof/Create_FromApp/ProofForm.js | 7 +++++++ src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/DemandNote/Search/SearchForm.js b/src/pages/DemandNote/Search/SearchForm.js index 6dbf6db..17b7c6e 100644 --- a/src/pages/DemandNote/Search/SearchForm.js +++ b/src/pages/DemandNote/Search/SearchForm.js @@ -156,7 +156,7 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue }} renderInput={(params) => ( { const [saving, setSaving] = React.useState(false); + const [proofPaymentDeadlineMin, setProofPaymentDeadlineMin] = React.useState({}); + const [reviseDeadlineMin, setReviseDeadlineMin] = React.useState({}); + const navigate = useNavigate() React.useEffect(() => { @@ -46,6 +49,8 @@ const FormPanel = ({ formData }) => { setColumnPrice(ComboData.proofPrice[1]) formData['length'] = 18; } + setProofPaymentDeadlineMin(formData.proofPaymentDeadline); + setReviseDeadlineMin(formData.reviseDeadline); } }, [formData]); @@ -206,6 +211,7 @@ const FormPanel = ({ formData }) => { onChange={formik.handleChange} name="reviseDeadline" value={formik.values["reviseDeadline"]} + InputProps={{ inputProps: { min: DateUtils.datetimeStr(reviseDeadlineMin) } }} variant="outlined" sx={ { @@ -232,6 +238,7 @@ const FormPanel = ({ formData }) => { onChange={formik.handleChange} name="proofPaymentDeadline" value={formik.values["proofPaymentDeadline"]} + InputProps={{ inputProps: { min: DateUtils.datetimeStr(proofPaymentDeadlineMin) } }} variant="outlined" sx={ { diff --git a/src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js b/src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js index c4e4b02..ba17d6e 100644 --- a/src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js +++ b/src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js @@ -119,6 +119,7 @@ const GazetteDetailCard = ( // size="large" variant="contained" onClick={groupDetailClick()} + disabled={applicationDetailData.data.status!="submitted"&&applicationDetailData.data.status!="reviewed"} sx={{ textTransform: 'capitalize', alignItems: 'end' From 8ff00d46c92feff9475b4606e1bf8f21be677291 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 4 Mar 2024 10:56:23 +0800 Subject: [PATCH 02/12] update label --- src/pages/Proof/Reply_GLD/ApplicationDetails.js | 4 ++-- src/translations/en.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Proof/Reply_GLD/ApplicationDetails.js b/src/pages/Proof/Reply_GLD/ApplicationDetails.js index 557113f..214cdbd 100644 --- a/src/pages/Proof/Reply_GLD/ApplicationDetails.js +++ b/src/pages/Proof/Reply_GLD/ApplicationDetails.js @@ -139,7 +139,7 @@ const ApplicationDetailCard = ({ - App No.: + App. No.: @@ -151,7 +151,7 @@ const ApplicationDetailCard = ({ - Status: + App. Status: diff --git a/src/translations/en.json b/src/translations/en.json index a8ae827..a7bcca3 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -354,7 +354,7 @@ "publicNoticeDetailTitle": "Public Notice Application Information", "applyPerson": "Applicant", - "applyStatus": "Application Status", + "applyStatus": "App. Status", "gazetteCount": "Gazette issues number", "gazetteCount2" :"Gazette issues number / Remarks", "gazetteCount2_1" :"Care Of / Remarks", From 35d9301c579f1e28b634f298788feff16e0f9a6a Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 4 Mar 2024 11:14:59 +0800 Subject: [PATCH 03/12] update label --- src/pages/dashboard/GLD/index.js | 15 ++++++++++++++- src/pages/dashboard/Public/index.js | 16 +++++++++++++++- src/translations/en.json | 5 ++++- src/translations/zh-CN.json | 4 +++- src/translations/zh-HK.json | 4 +++- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/pages/dashboard/GLD/index.js b/src/pages/dashboard/GLD/index.js index 9d60aac..42608f5 100644 --- a/src/pages/dashboard/GLD/index.js +++ b/src/pages/dashboard/GLD/index.js @@ -20,13 +20,26 @@ const DashboardDefault = () => { backgroundColor: '#0C489E', backgroundPosition: 'right' } + const getWelcomeMsg=()=>{ + var current = new Date() + var curHr = current.getHours() + + if (curHr < 12) { + return "Good Morning" + } else if (curHr < 18) { + return "Good Afternoon" + } else { + //evening + return "Good Evening" + } + } return (
- Morning, {userData.fullenName} + {getWelcomeMsg()}, {userData.fullenName}
diff --git a/src/pages/dashboard/Public/index.js b/src/pages/dashboard/Public/index.js index ee7f1df..00f3deb 100644 --- a/src/pages/dashboard/Public/index.js +++ b/src/pages/dashboard/Public/index.js @@ -35,6 +35,20 @@ const DashboardDefault = () => { backgroundColor: '#0C489E', backgroundPosition: 'right' } + + const getWelcomeMsg=()=>{ + var current = new Date() + var curHr = current.getHours() + + if (curHr < 12) { + return + } else if (curHr < 18) { + return + } else { + return + } + } + return ( @@ -42,7 +56,7 @@ const DashboardDefault = () => { {/* 我的公共啟事 */} - {isORGLoggedIn() ? userData.fullenName : userData.fullchName}, + {isORGLoggedIn() ? userData.fullenName : userData.fullchName}, {getWelcomeMsg()} diff --git a/src/translations/en.json b/src/translations/en.json index a7bcca3..03348c4 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -96,7 +96,10 @@ "onlinePaymentHistory": "Online Payment History", "setting": "Settings", "companyOrUserRecord": "Company/Institutional User Records", - "welcomeMsg": "Good afternoon! Please select the required service.", + "welcomeMsg_am": "Good morning! Please select the required service.", + "welcomeMsg_pm": "Good afternoon! Please select the required service.", + "welcomeMsg_night": "Good evening! Please select the required service.", + "login": "Login", "logout": "Logout", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index f398d5b..e617f24 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -95,7 +95,9 @@ "onlinePaymentHistory": "网上付款记录", "setting": "设置", "companyOrUserRecord": "公司/机构用户记录", - "welcomeMsg": "午安! 请选择所需服务。", + "welcomeMsg_am": "早安! 请选择所需服务。", + "welcomeMsg_pm": "午安! 请选择所需服务。", + "welcomeMsg_night": "晚安! 请选择所需服务。", "login": "登录", "logout": "登出", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 7c306b9..b524645 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -95,7 +95,9 @@ "onlinePaymentHistory": "網上付款記錄", "setting": "設定", "companyOrUserRecord": "公司/機構用戶記錄", - "welcomeMsg": "午安! 請選擇所需服務。", + "welcomeMsg_am": "早安! 請選擇所需服務。", + "welcomeMsga_pm": "午安! 請選擇所需服務。", + "welcomeMsg_night": "晚安! 請選擇所需服務。", "login": "登入", "logout": "登出", From 638ef90b46cb478c3ce2f48858dc366e8d777817 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 4 Mar 2024 12:14:22 +0800 Subject: [PATCH 04/12] allow input eng name or chi name --- .../auth-forms/CustomFormWizard.js | 46 +++++++++++-------- src/translations/en.json | 1 + src/translations/zh-CN.json | 1 + src/translations/zh-HK.json | 1 + 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index 22b5922..d59cde9 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -303,13 +303,13 @@ const CustomFormWizard = (props) => { selectedAddress4, selectedAddress5, termsAndConAccept, termsAndConNotAccept, fileList]) - useEffect(()=>{ + useEffect(() => { setDistrictErrStr(""); - if(selectedAddress5?.type === "hongKong"){ - if(selectedAddress4 ==null || selectedAddress4 == ""|| selectedAddress4 == {}) + if (selectedAddress5?.type === "hongKong") { + if (selectedAddress4 == null || selectedAddress4 == "" || selectedAddress4 == {}) setDistrictErrStr(getRequiredErrStr("district")) } - },[selectedAddress4, selectedAddress5]) + }, [selectedAddress4, selectedAddress5]) useEffect(() => { props.step == 2 ? _onSubmit() : null; @@ -541,11 +541,11 @@ const CustomFormWizard = (props) => { return {errorMsg} } - function getMaxErrStr(num, fieldname){ - return displayErrorMsg(intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""})); + function getMaxErrStr(num, fieldname) { + return displayErrorMsg(intl.formatMessage({ id: 'noMoreThenNWords' }, { num: num, fieldname: fieldname ? intl.formatMessage({ id: fieldname }) + ": " : "" })); } - function getRequiredErrStr(fieldname){ - return displayErrorMsg(intl.formatMessage({ id: 'require'},{fieldname:fieldname?intl.formatMessage({ id: fieldname}):""})); + function getRequiredErrStr(fieldname) { + return displayErrorMsg(intl.formatMessage({ id: 'require' }, { fieldname: fieldname ? intl.formatMessage({ id: fieldname }) : "" })); } const formik = useFormik({ @@ -581,14 +581,17 @@ const CustomFormWizard = (props) => { .matches(/^(?=.*[0-9])/, { message: displayErrorMsg(intl.formatMessage({ id: 'atLeast1Number' })) }) .matches(/^(?=.*[!@#%&])/, { 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' }))), - enName: yup.string().max(40, getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({ id: 'userRequireEnglishName' }))), - chName: yup.string().max(6, getMaxErrStr(6)).required(displayErrorMsg(intl.formatMessage({ id: 'userRequireChineseName' }))), + enName: yup.string().max(40, getMaxErrStr(40)), + chName: yup.string().max(6, getMaxErrStr(6)).when('enName', { + is: (enName) => enName?false:true, + then: yup.string().required(displayErrorMsg(intl.formatMessage({ id: 'userRequireChineseName' }))) + }), address1: yup.string().max(40, getMaxErrStr(40, "addressLine1")).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))), address2: yup.string().max(40, getMaxErrStr(40, "addressLine2")), address3: yup.string().max(40, getMaxErrStr(40, "addressLine3")), email: yup.string().email(displayErrorMsg(intl.formatMessage({ id: 'validEmailFormat' }))).max(128, getMaxErrStr(128)).required(displayErrorMsg(intl.formatMessage({ id: 'requireEmail' }))), emailConfirm: yup.string().email(displayErrorMsg(intl.formatMessage({ id: 'validEmailFormat' }))).max(128, getMaxErrStr(128)).required(displayErrorMsg(intl.formatMessage({ id: 'requireEmail' }))).oneOf([yup.ref('email'), null], displayErrorMsg(intl.formatMessage({ id: 'validSameEmail' }))), - idNo: yup.string().required(displayErrorMsg(`${intl.formatMessage({ id: 'require' })}${selectedIdDocInputType}${intl.formatMessage({ id: 'number' })}`)) + idNo: yup.string().required(getRequiredErrStr('number')) .matches(/^[aA-zZ0-9\s]+$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpecialCharacter' })}`) }) .matches(/^\S*$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpace' })}`) }) .test('checkIDCardFormat', displayErrorMsg(`${intl.formatMessage({ id: 'requiredValid' })}${selectedIdDocInputType}${intl.formatMessage({ id: 'number' })}`), function (value) { @@ -648,7 +651,7 @@ const CustomFormWizard = (props) => { // faxCountryCode: yup.string().min(3,'請輸入3位數字'), phone: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'requireAtLeast8Number' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireContactNumber' }))), // fax: yup.string().min(8,'請輸入8位數字'), - captchaField: yup.string().max(5, getMaxErrStr(5)).required(displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), + captchaField: yup.string().max(5, getMaxErrStr(5)).required(displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), }), }); @@ -934,7 +937,7 @@ const CustomFormWizard = (props) => { /> {formik.touched.idDocType && ( selectedIdDocType === null || selectedIdDocType?.type == null ? - + : '' )} @@ -1067,12 +1070,17 @@ const CustomFormWizard = (props) => { } + + + () + + - {selectedIdDocType.type === "CNID" ? "" : *} + {selectedIdDocType.type === "CNID" ? "" : } { - * + { value={selectedAddress4} options={ComboData.district} disabled={checkCountry} - error={Boolean(districtErrStr!="")} + error={Boolean(districtErrStr != "")} onBlur={formik.handleBlur} getOptionLabel={(option) => option.type ? intl.formatMessage({ id: option.type }) : ""} onChange={(event, newValue) => { @@ -1252,7 +1260,7 @@ const CustomFormWizard = (props) => { {formik.errors.address3} )} - {districtErrStr!= "" && ( + {districtErrStr != "" && ( {districtErrStr} @@ -1685,8 +1693,8 @@ const CustomFormWizard = (props) => { : - {intl.formatMessage({ id: selectedIdDocType?.label??" " })} - + {intl.formatMessage({ id: selectedIdDocType?.label ?? " " })} + diff --git a/src/translations/en.json b/src/translations/en.json index 03348c4..ddac5d4 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -150,6 +150,7 @@ "registerNewBusinessUser": "Apply as organisation/company user", "becomeNewBusinessUser": "Become New Organisation/Company user", "userName": "Username", + "registerNameLabel": "Please provide either an English name or a Chinese name, at a minimum.", "userChineseName": "Chinese Name", "userEnglishName": "English Name", "userContactName": "Name", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index e617f24..fa30fa9 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -144,6 +144,7 @@ "registerNewBusinessUser": "申请机构/公司用户", "becomeNewBusinessUser": "成为新的机构/公司用户", "userName": "用户名称", + "registerNameLabel": "请至少输入英文姓名或中文姓名。", "userChineseName": "中文姓名", "userEnglishName": "英文姓名", "userContactName": "姓名", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index b524645..a641af8 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -147,6 +147,7 @@ "registerNewBusinessUser": "申請機構/公司用戶", "becomeNewBusinessUser": "成為新的機構/公司用戶", "userName": "用戶名稱", + "registerNameLabel": "請至少輸入英文姓名或中文姓名。", "userChineseName": "中文姓名", "userEnglishName": "英文姓名", "userContactName": "姓名", From 59c51da07172d5944bd573b12e2d656967fd1037 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 4 Mar 2024 14:10:11 +0800 Subject: [PATCH 05/12] update label --- src/translations/en.json | 2 +- src/translations/zh-CN.json | 2 +- src/translations/zh-HK.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/translations/en.json b/src/translations/en.json index 6cbc602..c9f0312 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -246,7 +246,7 @@ "mainlandIDCard": "Mainland ID card", "proCert": "Professional Practice Certificate", "idDocType": "Document Category", - "requireIdDocType": "Please enter the document type", + "requireIdDocType": "Please select the document type", "idDocNumber": "ID number", "requireIdDocNumber": "Please enter the document ID", "requiredNumberInQuote": "Please enter the numbers or letters in brackets", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index dae5511..72d0ef9 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -241,7 +241,7 @@ "mainlandIDCard": "内地身份证", "proCert": "专业执业证书", "idDocType": "证件类别", - "requireIdDocType": "请输入证件类别", + "requireIdDocType": "请选择证件类别", "idDocNumber": "证件号码", "requireIdDocNumber": "请输入证件号码", "requiredNumberInQuote": "请输入括号内的数字或字母", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 0280d50..d80cf84 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -246,7 +246,7 @@ "mainlandIDCard": "內地身份證", "proCert": "專業執業證書", "idDocType": "證件類別", - "requireIdDocType": "請輸入證件類別", + "requireIdDocType": "請選擇證件類別", "idDocNumber": "證件號碼", "requireIdDocNumber": "請輸入證件號碼", "requiredNumberInQuote": "請輸入括號內的數字或字母", From 823cfcc0112094d70825b8d9615dc2fe5a077ab6 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 4 Mar 2024 14:35:18 +0800 Subject: [PATCH 06/12] update label --- src/pages/authentication/auth-forms/CustomFormWizard.js | 2 +- src/translations/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index d59cde9..db3ed52 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -1072,7 +1072,7 @@ const CustomFormWizard = (props) => {
- () + diff --git a/src/translations/en.json b/src/translations/en.json index 85a3d29..7454dfc 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -440,7 +440,7 @@ "noRecordFound": "No record found", "rowsPerPage": "Rows Per Page", "date" : "Date", - "keyword": "Key word", + "keyword": "Keyword", "dateFrom": "Date(From)", "dateTo": "Date(To)", "of": "of", From 1de8ae14c74772b8968fe278078435930a84a50c Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 4 Mar 2024 15:52:27 +0800 Subject: [PATCH 07/12] update label --- src/pages/Payment/MultiPaymentWindow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Payment/MultiPaymentWindow.js b/src/pages/Payment/MultiPaymentWindow.js index 85e2cda..85f06f2 100644 --- a/src/pages/Payment/MultiPaymentWindow.js +++ b/src/pages/Payment/MultiPaymentWindow.js @@ -387,7 +387,7 @@ const MultiPaymentWindow = (props) => { From 0d1cec77bfa43febddc07e3026a7b000f1df049e Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Mon, 4 Mar 2024 17:18:07 +0800 Subject: [PATCH 08/12] add payment holding check and report layout fix --- .../Payment/Details_GLD/PaymentDetails.js | 6 +- src/pages/Payment/Details_GLD/index.js | 21 +- src/pages/Payment/index.js | 366 +++++++++--------- .../ListPanel/PendingPaymentTab.js | 69 +++- src/translations/en.json | 1 + src/translations/zh-CN.json | 3 +- src/translations/zh-HK.json | 1 + src/utils/ApiPathConst.js | 3 +- 8 files changed, 282 insertions(+), 188 deletions(-) diff --git a/src/pages/Payment/Details_GLD/PaymentDetails.js b/src/pages/Payment/Details_GLD/PaymentDetails.js index b8b6714..de9e10a 100644 --- a/src/pages/Payment/Details_GLD/PaymentDetails.js +++ b/src/pages/Payment/Details_GLD/PaymentDetails.js @@ -14,7 +14,7 @@ const MainCard = Loadable(React.lazy(() => import('components/MainCard'))); const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); import DownloadIcon from '@mui/icons-material/Download'; // ==============================|| DASHBOARD - DEFAULT ||============================== // -const PaymentDetails = ({ formData,doPrint }) => { +const PaymentDetails = ({ formData,doPrint,onDownload }) => { const [data, setData] = React.useState({}); const [onReady, setOnReady] = React.useState(false); @@ -158,10 +158,14 @@ const PaymentDetails = ({ formData,doPrint }) => { + {onDownload? + + : + }
diff --git a/src/pages/Payment/Details_GLD/index.js b/src/pages/Payment/Details_GLD/index.js index 302b87c..114cc82 100644 --- a/src/pages/Payment/Details_GLD/index.js +++ b/src/pages/Payment/Details_GLD/index.js @@ -4,7 +4,7 @@ import { Typography, Stack, Box, - // Button + Button } from '@mui/material'; import * as UrlUtils from "utils/ApiPathConst"; import * as React from "react"; @@ -12,6 +12,7 @@ import * as HttpUtils from "utils/HttpUtils"; import * as DateUtils from "utils/DateUtils"; import { useParams } from "react-router-dom"; import { useNavigate } from "react-router-dom"; +import ForwardIcon from '@mui/icons-material/Forward'; import Loadable from 'components/Loadable'; const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); @@ -37,6 +38,7 @@ const Index = () => { const [record, setRecord] = React.useState(); const [itemList, setItemList] = React.useState([]); const [onReady, setOnReady] = React.useState(false); + const [onDownload, setOnDownload] = React.useState(false); // const [detailsOrder, setDetailsOrder] = React.useState(2); React.useEffect(() => { @@ -54,8 +56,15 @@ const Index = () => { const doPrint = () => { // window.print(); + setOnDownload(true) HttpUtils.fileDownload({ url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+params.id, + onResponse:()=>{ + setOnDownload(false) + }, + onError:()=>{ + setOnDownload(false) + } }); }; @@ -98,6 +107,15 @@ const Index = () => {
+ + + {/*row 1*/} @@ -106,6 +124,7 @@ const Index = () => { { paymentMethod = "01,PPSB,PPS"; } - if (paymentMethod != "") { - HttpUtils.post({ - url: UrlUtils.PAYMENT_CREATE, - params: { - transNo: transactionData.transactionid, - payMethod: paymentMethod, - payAmount: totalAmount, - appIdList: location.state?.appIdList ?? [] - }, - onSuccess: function (responData) { - localStorage.removeItem("paymentId"); - localStorage.setItem("paymentId", responData.id) - navigate(page, stateParams); - } - }); - } - - // //For testing // if (paymentMethod != "") { // HttpUtils.post({ // url: UrlUtils.PAYMENT_CREATE, // params: { - // transNo: "test0001", + // transNo: transactionData.transactionid, // payMethod: paymentMethod, // payAmount: totalAmount, // appIdList: location.state?.appIdList ?? [] @@ -174,181 +156,199 @@ const Index = () => { // } // }); // } - } - }, [afterConfirmPayment]); - const getAvailablePayment = () =>{ - HttpUtils.post({ - url: UrlUtils.PAYMENT_AVAILABLE_PAYMENT, - params: { - "locale": locale === 'en' ?Utils.local.en:locale === 'zh-HK' ?Utils.local.zh:Utils.local.cn, - "amount": totalAmount, - // "eserviceids": [ - // "", "" - // ], - "preferpaymentmethods": Utils.preferpaymentmethods - }, - onSuccess: (responseData) => { - let availableMethods = responseData.availablepaymentmethods; - setAvailableMethods(availableMethods); - HttpUtils.get({ - url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST, - params: {}, - onSuccess: (responseData) => { - // console.log(responseData) - setPaymentLimit(responseData) - + //For testing + if (paymentMethod != "") { + HttpUtils.post({ + url: UrlUtils.PAYMENT_CREATE, + params: { + transNo: "test0002", + payMethod: paymentMethod, + payAmount: totalAmount, + appIdList: location.state?.appIdList ?? [] }, - onError: () =>{ - // setOnReady(true) + onSuccess: function (responData) { + localStorage.removeItem("paymentId"); + localStorage.setItem("paymentId", responData.id) + navigate(page, stateParams); } }); - }, - onError: () =>{ - setOnReady(true) } - }); - - // HttpUtils.get({ - // url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST, - // params: {}, - // onSuccess: (responseData) => { - // // console.log(responseData) - // setPaymentLimit(responseData) + } + }, [afterConfirmPayment]); + const getAvailablePayment = () =>{ + // HttpUtils.post({ + // url: UrlUtils.PAYMENT_AVAILABLE_PAYMENT, + // params: { + // "locale": locale === 'en' ?Utils.local.en:locale === 'zh-HK' ?Utils.local.zh:Utils.local.cn, + // "amount": totalAmount, + // // "eserviceids": [ + // // "", "" + // // ], + // "preferpaymentmethods": Utils.preferpaymentmethods + // }, + // onSuccess: (responseData) => { + // let availableMethods = responseData.availablepaymentmethods; + // setAvailableMethods(availableMethods); + // HttpUtils.get({ + // url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST, + // params: {}, + // onSuccess: (responseData) => { + // // console.log(responseData) + // setPaymentLimit(responseData) + + // }, + // onError: () =>{ + // // setOnReady(true) + // } + // }); // }, // onError: () =>{ - // // setOnReady(true) + // setOnReady(true) // } // }); + + HttpUtils.get({ + url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST, + params: {}, + onSuccess: (responseData) => { + // console.log(responseData) + setPaymentLimit(responseData) + + }, + onError: () =>{ + // setOnReady(true) + } + }); - // const responseData = { - // "availablepaymentmethods": [ - // { - // "active": "Y", - // "code": "04,BCFP,FPS", - // "pointstonote": [ - // { - // "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", - // "order": 10, - // "type": "INFO" - // }, - // { - // "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", - // "order": 11, - // "type": "INFO" - // } - // ], - // "subtype": "FPS" - // }, - // { - // "active": "Y", - // "code": "02,BCMP,CreditCard", - // "pointstonote": [ - // { - // "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", - // "order": 10, - // "type": "INFO" - // }, - // { - // "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", - // "order": 11, - // "type": "INFO" - // }, - // { - // "content": "Merchant Name is applicable to credit card payment method only.", - // "order": 40, - // "type": "INFO" - // }, - // { - // "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.", - // "order": 41, - // "type": "INFO" - // }, - // { - // "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.", - // "order": 42, - // "type": "INFO" - // }, - // { - // "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ", - // "order": 43, - // "type": "INFO" - // } - // ], - // "subtype": "CreditCard", - // "supportedcard": [ - // "JCB", - // "MasterCard", - // "Visa" - // ] - // }, - // { - // "active": "Y", - // "code": "03,BCMP,CreditCard", - // "pointstonote": [ - // { - // "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", - // "order": 10, - // "type": "INFO" - // }, - // { - // "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", - // "order": 11, - // "type": "INFO" - // }, - // { - // "content": "Merchant Name is applicable to credit card payment method only.", - // "order": 40, - // "type": "INFO" - // }, - // { - // "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.", - // "order": 41, - // "type": "INFO" - // }, - // { - // "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.", - // "order": 42, - // "type": "INFO" - // }, - // { - // "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ", - // "order": 43, - // "type": "INFO" - // } - // ], - // "subtype": "CreditCard", - // "supportedcard": [ - // "UnionPay" - // ] - // }, - // { - // "active": "Y", - // "code": "01,PPSB,PPS", - // "pointstonote": [ - // { - // "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", - // "order": 10, - // "type": "INFO" - // }, - // { - // "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", - // "order": 11, - // "type": "INFO" - // }, - // { - // "content": "PPS Shop&Buy (PPS) does not support payment via browsers of mobile devices (including mobile phones and tablets) at the moment. If you wish to pay by PPS, please change to use desktop computer. ", - // "order": 21, - // "type": "INFO" - // } - // ], - // "subtype": "PPS" - // } - // ] - // }; - // let availableMethods = responseData.availablepaymentmethods; - // setAvailableMethods(availableMethods); + const responseData = { + "availablepaymentmethods": [ + { + "active": "Y", + "code": "04,BCFP,FPS", + "pointstonote": [ + { + "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", + "order": 10, + "type": "INFO" + }, + { + "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", + "order": 11, + "type": "INFO" + } + ], + "subtype": "FPS" + }, + { + "active": "Y", + "code": "02,BCMP,CreditCard", + "pointstonote": [ + { + "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", + "order": 10, + "type": "INFO" + }, + { + "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", + "order": 11, + "type": "INFO" + }, + { + "content": "Merchant Name is applicable to credit card payment method only.", + "order": 40, + "type": "INFO" + }, + { + "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.", + "order": 41, + "type": "INFO" + }, + { + "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.", + "order": 42, + "type": "INFO" + }, + { + "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ", + "order": 43, + "type": "INFO" + } + ], + "subtype": "CreditCard", + "supportedcard": [ + "JCB", + "MasterCard", + "Visa" + ] + }, + { + "active": "Y", + "code": "03,BCMP,CreditCard", + "pointstonote": [ + { + "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", + "order": 10, + "type": "INFO" + }, + { + "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", + "order": 11, + "type": "INFO" + }, + { + "content": "Merchant Name is applicable to credit card payment method only.", + "order": 40, + "type": "INFO" + }, + { + "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.", + "order": 41, + "type": "INFO" + }, + { + "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.", + "order": 42, + "type": "INFO" + }, + { + "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ", + "order": 43, + "type": "INFO" + } + ], + "subtype": "CreditCard", + "supportedcard": [ + "UnionPay" + ] + }, + { + "active": "Y", + "code": "01,PPSB,PPS", + "pointstonote": [ + { + "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", + "order": 10, + "type": "INFO" + }, + { + "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", + "order": 11, + "type": "INFO" + }, + { + "content": "PPS Shop&Buy (PPS) does not support payment via browsers of mobile devices (including mobile phones and tablets) at the moment. If you wish to pay by PPS, please change to use desktop computer. ", + "order": 21, + "type": "INFO" + } + ], + "subtype": "PPS" + } + ] + }; + let availableMethods = responseData.availablepaymentmethods; + setAvailableMethods(availableMethods); } useEffect(() => { diff --git a/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js b/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js index 7581c20..8c61bd8 100644 --- a/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js +++ b/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js @@ -34,6 +34,8 @@ export default function SubmittedTab({ rows }) { const [selectedCareOf, setSelectedCareOf] = React.useState(null); const [expiryDateErrText, setExpiryDateErrText] = React.useState(""); const [expiryDateErr, setExpiryDateErr] = React.useState(false); + const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); + const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); const theme = useTheme(); const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); const intl = useIntl(); @@ -103,7 +105,8 @@ export default function SubmittedTab({ rows }) { }, onSuccess: (responData) => { if (responData.success == true) { - setIsPopUp(true); + // setIsPopUp(true); + handlePaymentCheck(appIdList) return; } let str = ""; @@ -114,8 +117,45 @@ export default function SubmittedTab({ rows }) { setExpiryDateErr(true); } }); + }; + const handlePaymentCheck = (appIdList) => { + HttpUtils.post({ + url: UrlUtils.PAYMENT_CHECK, + params: { + appIds: appIdList + }, + onSuccess: (responseData) => { + const latestData = {}; + responseData.forEach(item => { + const { appId, timeDiff } = item; + if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { + latestData[appId] = item; + } + }); + const latestDataObjects = Object.values(latestData); + + const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 && item.status !== "APPR"); + const filteredAppIds = filteredData.map(item => item.appId); + + const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); + const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; + + const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); + if (readyToPayment){ + setIsPopUp(true); + return; + }else{ + const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); + const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); + const resultString = HoldingApplication.map(item => item.appNo).join(' , '); + setPaymentHoldedErrText(resultString); + // setPaymentHoldedErrText(intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: record.appNo })); + setPaymentHoldedErr(true); + } + } + }); }; const columns = [ @@ -405,6 +445,33 @@ export default function SubmittedTab({ rows }) { +
+ setPaymentHoldedErr(false)} + PaperProps={{ + sx: { + minWidth: '40vw', + maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, + maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } + } + }} + > + + + + +
+ + + + + +
+
); diff --git a/src/translations/en.json b/src/translations/en.json index a7bcca3..eedc6e4 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -67,6 +67,7 @@ "MSG.proofOutOfTime": "Response out of time, please apply again.", "MSG.plzSelectApp": "Please select application", "MSG.actionFail": "Action failed", + "MSG.paymentHolded": "Application number {appNo} is currently in the process of payment. If the payment is unsuccessful, please try again after 20 minutes. We apologise for any inconvenience caused.", "registerTitle1": "Become", "registerTitle2": "Gazette Notice", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index f398d5b..a9b0982 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -66,7 +66,8 @@ "MSG.proofOutOfTime": "回覆逾时,请重新申请。", "MSG.plzSelectApp": "请选择公共启事。", "MSG.actionFail": "行动失败", - + "MSG.paymentHolded": "申请编号 {appNo} 已正在付款的流程中,如相关付款没有成功,请于20分钟后再尝试付款,不便之处,请见谅!", + "registerTitle1": "立即成为", "registerTitle2": "宪报刊登公共启事", "registerTitle3": "用户", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 7c306b9..50a8a43 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -66,6 +66,7 @@ "MSG.proofOutOfTime": "回覆逾時,請重新申請。", "MSG.plzSelectApp": "請選擇公共啟事。", "MSG.actionFail": "行動失敗", + "MSG.paymentHolded": "申請編號 {appNo} 已正在付款的流程中,如相關付款沒有成功,請於20分鐘後再嘗試付款,不便之處,請見諒!", "registerTitle1": "立即成為", "registerTitle2": "憲報刊登公共啟事", diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 55ccdee..8b5311b 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -133,12 +133,13 @@ export const PROOF_CHECK_PRICE = apiPath+'/proof/check-price';//GET export const GET_PROOF_PAY = apiPath+'/proof/pay-details';//GET export const CANCEL_PROOF = apiPath+'/proof/cancel';//GET - +//payment export const PAYMENT_CREATE = apiPath+'/payment/create';//POST export const PAYMENT_SAVE = apiPath+'/payment/save';//POST export const PAYMENT_LIST = apiPath+'/payment/list';//GET export const PAYMENT_LOAD = apiPath+'/payment/load';//GET export const PAYMENT_APP_LIST = apiPath+'/payment/applist';//POST +export const PAYMENT_CHECK = apiPath+'/payment/check-payment';//GET export const PAYMENT_LIMIT_SETTING_LIST = apiPath+'/settings/payment';//GET export const PAYMENT_AVAILABLE_PAYMENT = paymentPath+'/api/payment/availability';//POST From b74da8676ab7c7ca8818b7ee33eeb316b963d17a Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 4 Mar 2024 17:42:50 +0800 Subject: [PATCH 09/12] user fullname i18n --- src/pages/dashboard/Public/index.js | 4 +++- src/translations/zh-HK.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/dashboard/Public/index.js b/src/pages/dashboard/Public/index.js index 00f3deb..e3de4e4 100644 --- a/src/pages/dashboard/Public/index.js +++ b/src/pages/dashboard/Public/index.js @@ -36,6 +36,8 @@ const DashboardDefault = () => { backgroundPosition: 'right' } + const { locale } = intl; + const getWelcomeMsg=()=>{ var current = new Date() var curHr = current.getHours() @@ -56,7 +58,7 @@ const DashboardDefault = () => { {/* 我的公共啟事 */} - {isORGLoggedIn() ? userData.fullenName : userData.fullchName}, {getWelcomeMsg()} + {isORGLoggedIn() ? userData.fullenName: (locale === 'en' ?userData.fullenName: userData.fullchName)}, {getWelcomeMsg()} diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 6b2d6dd..8c12694 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -97,7 +97,7 @@ "setting": "設定", "companyOrUserRecord": "公司/機構用戶記錄", "welcomeMsg_am": "早安! 請選擇所需服務。", - "welcomeMsga_pm": "午安! 請選擇所需服務。", + "welcomeMsg_pm": "午安! 請選擇所需服務。", "welcomeMsg_night": "晚安! 請選擇所需服務。", "login": "登入", From b0571125f474263ebb561bd03d989297f214032b Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Mon, 4 Mar 2024 17:52:33 +0800 Subject: [PATCH 10/12] add check payment holded after selected payment method --- src/pages/Payment/MultiPaymentWindow.js | 78 ++++++++++++++++++- src/pages/Payment/index.js | 2 + src/pages/Proof/Payment/Pay.js | 70 ++++++++++++++++- .../Details_Public/ApplicationDetailCard.js | 74 +++++++++++++++++- .../ListPanel/PendingPaymentTab.js | 2 + 5 files changed, 221 insertions(+), 5 deletions(-) diff --git a/src/pages/Payment/MultiPaymentWindow.js b/src/pages/Payment/MultiPaymentWindow.js index 85f06f2..70cb778 100644 --- a/src/pages/Payment/MultiPaymentWindow.js +++ b/src/pages/Payment/MultiPaymentWindow.js @@ -32,6 +32,8 @@ import UnionPayIcon from "assets/images/icons/unionpay.svg"; import PpsIcon from "assets/images/icons/ppshk.svg"; import FpsIcon from "assets/images/icons/fps.svg"; import {FormattedMessage, useIntl} from "react-intl"; +import * as HttpUtils from "utils/HttpUtils" +import * as UrlUtils from "utils/ApiPathConst" const MultiPaymentWindow = (props) => { const intl = useIntl(); @@ -52,7 +54,10 @@ const MultiPaymentWindow = (props) => { const [pPSClass, setPPSlass] = useState(""); const [filteredPaymentMethod, setFilteredPaymentMethod] = useState([]); const [onReady, setOnReady] = useState(false); - + + const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); + const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); + useEffect(() => { // console.log(props.transactionData) if(Object.keys(props.transactionData).length > 0){ @@ -185,7 +190,49 @@ const MultiPaymentWindow = (props) => { }; const confirmPaymentHandle = () => () =>{ - props.setConfirmPayment(true); + handlePaymentCheck() + }; + + const handlePaymentCheck = () => { + let appIdList = props.appIds + // console.log(props.appIds) + // console.log(appIdList) + HttpUtils.post({ + url: UrlUtils.PAYMENT_CHECK, + params: { + appIds: appIdList + }, + onSuccess: (responseData) => { + const latestData = {}; + + responseData.forEach(item => { + const { appId, timeDiff } = item; + if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { + latestData[appId] = item; + } + }); + const latestDataObjects = Object.values(latestData); + + const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 && item.status !== "APPR"); + const filteredAppIds = filteredData.map(item => item.appId); + + const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); + const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; + + const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); + if (readyToPayment){ + // props.setConfirmPayment(true); + return; + }else{ + const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); + const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); + const resultString = HoldingApplication.map(item => item.appNo).join(' , '); + setPaymentHoldedErrText(resultString); + // setPaymentHoldedErrText(intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: record.appNo })); + setPaymentHoldedErr(true); + } + } + }); }; const closeHandle = () => () =>{ @@ -391,6 +438,33 @@ const MultiPaymentWindow = (props) => { +
+ setPaymentHoldedErr(false)} + PaperProps={{ + sx: { + minWidth: '40vw', + maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, + maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } + } + }} + > + + + + +
+ + + + + +
+
); }; diff --git a/src/pages/Payment/index.js b/src/pages/Payment/index.js index e920b89..56d6653 100644 --- a/src/pages/Payment/index.js +++ b/src/pages/Payment/index.js @@ -540,6 +540,8 @@ const Index = () => { onReady = {onReady} locale = {locale} isFullScreen={isFullScreen} + appIds={appIds} + // appNo={itemList.appNo} />
); diff --git a/src/pages/Proof/Payment/Pay.js b/src/pages/Proof/Payment/Pay.js index 5f88e61..265ed7a 100644 --- a/src/pages/Proof/Payment/Pay.js +++ b/src/pages/Proof/Payment/Pay.js @@ -45,6 +45,8 @@ const Index = () => { const [record, setRecord] = React.useState({}); const [onReady, setOnReady] = React.useState(false); const [isPopUp, setIsPopUp] = useState(false); + const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); + const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); const intl = useIntl(); @@ -77,9 +79,48 @@ const Index = () => { function doPayment() { setIsPopUp(false); - navigate('/paymentPage', { state: { amount: fee, appIdList: [record?.appId] } }); + let appIdList = [record?.appId] + handlePaymentCheck(appIdList) } + const handlePaymentCheck = (appIdList) => { + HttpUtils.post({ + url: UrlUtils.PAYMENT_CHECK, + params: { + appIds: appIdList + }, + onSuccess: (responseData) => { + const latestData = {}; + + responseData.forEach(item => { + const { appId, timeDiff } = item; + if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { + latestData[appId] = item; + } + }); + const latestDataObjects = Object.values(latestData); + + const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 && item.status !== "APPR"); + const filteredAppIds = filteredData.map(item => item.appId); + + const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); + const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; + + const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); + if (readyToPayment){ + navigate('/paymentPage', { state: { amount: fee, appIdList: appIdList } }); + }else{ + const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); + const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); + const resultString = HoldingApplication.map(item => item.appNo).join(' , '); + setPaymentHoldedErrText(resultString); + // setPaymentHoldedErrText(intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: record.appNo })); + setPaymentHoldedErr(true); + } + } + }); + }; + return ( !onReady ? @@ -200,6 +241,33 @@ const Index = () => { {/*row 2*/} +
+ setPaymentHoldedErr(false)} + PaperProps={{ + sx: { + minWidth: '40vw', + maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, + maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } + } + }} + > + + + + +
+ + + + + +
+
diff --git a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js index ab689a5..e2b7701 100644 --- a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js @@ -52,6 +52,8 @@ const ApplicationDetailCard = ( const [isPopUp, setIsPopUp] = useState(false); const [errorText, setErrorText] = useState(""); const [errorPopUp, setErrorPopUp] = useState(false); + const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); + const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); // const params = useParams(); const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({}); const [fee, setFee] = useState(0); @@ -113,7 +115,8 @@ const ApplicationDetailCard = ( }, onSuccess: (responData) => { if (responData.success == true) { - setIsPopUp(true); + let appIdList = [currentApplicationDetailData.id] + handlePaymentCheck(appIdList) return; } setErrorText("公共啟事申請已過期"); @@ -125,9 +128,49 @@ const ApplicationDetailCard = ( function doPayment() { setIsPopUp(false); - navigate('/paymentPage', { state: { amount: fee, appIdList: [currentApplicationDetailData.id] } }); + let appIdList = [currentApplicationDetailData.id] + navigate('/paymentPage', { state: { amount: fee, appIdList: appIdList } }); } + const handlePaymentCheck = (appIdList) => { + HttpUtils.post({ + url: UrlUtils.PAYMENT_CHECK, + params: { + appIds: appIdList + }, + onSuccess: (responseData) => { + const latestData = {}; + + responseData.forEach(item => { + const { appId, timeDiff } = item; + if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { + latestData[appId] = item; + } + }); + const latestDataObjects = Object.values(latestData); + + const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 && item.status !== "APPR"); + const filteredAppIds = filteredData.map(item => item.appId); + + const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); + const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; + + const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); + if (readyToPayment){ + setIsPopUp(true); + return; + }else{ + const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); + const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); + const resultString = HoldingApplication.map(item => item.appNo).join(' , '); + setPaymentHoldedErrText(resultString); + // setPaymentHoldedErrText(intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: record.appNo })); + setPaymentHoldedErr(true); + } + } + }); + }; + return ( !onReady ? @@ -669,6 +712,33 @@ const ApplicationDetailCard = ( +
+ setPaymentHoldedErr(false)} + PaperProps={{ + sx: { + minWidth: '40vw', + maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, + maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } + } + }} + > + + + + +
+ + + + + +
+
); diff --git a/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js b/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js index 8c61bd8..ad38114 100644 --- a/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js +++ b/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js @@ -34,8 +34,10 @@ export default function SubmittedTab({ rows }) { const [selectedCareOf, setSelectedCareOf] = React.useState(null); const [expiryDateErrText, setExpiryDateErrText] = React.useState(""); const [expiryDateErr, setExpiryDateErr] = React.useState(false); + const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); + const theme = useTheme(); const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); const intl = useIntl(); From a7fe39cf6298c3fc62b78daf99f1a085a30774dc Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Mon, 4 Mar 2024 17:59:17 +0800 Subject: [PATCH 11/12] payment update --- src/pages/Payment/index.js | 350 ++++++++++++++++++------------------- 1 file changed, 175 insertions(+), 175 deletions(-) diff --git a/src/pages/Payment/index.js b/src/pages/Payment/index.js index 56d6653..eefedba 100644 --- a/src/pages/Payment/index.js +++ b/src/pages/Payment/index.js @@ -140,29 +140,11 @@ const Index = () => { paymentMethod = "01,PPSB,PPS"; } - // if (paymentMethod != "") { - // HttpUtils.post({ - // url: UrlUtils.PAYMENT_CREATE, - // params: { - // transNo: transactionData.transactionid, - // payMethod: paymentMethod, - // payAmount: totalAmount, - // appIdList: location.state?.appIdList ?? [] - // }, - // onSuccess: function (responData) { - // localStorage.removeItem("paymentId"); - // localStorage.setItem("paymentId", responData.id) - // navigate(page, stateParams); - // } - // }); - // } - - //For testing if (paymentMethod != "") { HttpUtils.post({ url: UrlUtils.PAYMENT_CREATE, params: { - transNo: "test0002", + transNo: transactionData.transactionid, payMethod: paymentMethod, payAmount: totalAmount, appIdList: location.state?.appIdList ?? [] @@ -174,40 +156,58 @@ const Index = () => { } }); } + + //For testing + // if (paymentMethod != "") { + // HttpUtils.post({ + // url: UrlUtils.PAYMENT_CREATE, + // params: { + // transNo: "test0002", + // payMethod: paymentMethod, + // payAmount: totalAmount, + // appIdList: location.state?.appIdList ?? [] + // }, + // onSuccess: function (responData) { + // localStorage.removeItem("paymentId"); + // localStorage.setItem("paymentId", responData.id) + // navigate(page, stateParams); + // } + // }); + // } } }, [afterConfirmPayment]); const getAvailablePayment = () =>{ - // HttpUtils.post({ - // url: UrlUtils.PAYMENT_AVAILABLE_PAYMENT, - // params: { - // "locale": locale === 'en' ?Utils.local.en:locale === 'zh-HK' ?Utils.local.zh:Utils.local.cn, - // "amount": totalAmount, - // // "eserviceids": [ - // // "", "" - // // ], - // "preferpaymentmethods": Utils.preferpaymentmethods - // }, - // onSuccess: (responseData) => { - // let availableMethods = responseData.availablepaymentmethods; - // setAvailableMethods(availableMethods); - // HttpUtils.get({ - // url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST, - // params: {}, - // onSuccess: (responseData) => { - // // console.log(responseData) - // setPaymentLimit(responseData) + HttpUtils.post({ + url: UrlUtils.PAYMENT_AVAILABLE_PAYMENT, + params: { + "locale": locale === 'en' ?Utils.local.en:locale === 'zh-HK' ?Utils.local.zh:Utils.local.cn, + "amount": totalAmount, + // "eserviceids": [ + // "", "" + // ], + "preferpaymentmethods": Utils.preferpaymentmethods + }, + onSuccess: (responseData) => { + let availableMethods = responseData.availablepaymentmethods; + setAvailableMethods(availableMethods); + HttpUtils.get({ + url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST, + params: {}, + onSuccess: (responseData) => { + // console.log(responseData) + setPaymentLimit(responseData) - // }, - // onError: () =>{ - // // setOnReady(true) - // } - // }); - // }, - // onError: () =>{ - // setOnReady(true) - // } - // }); + }, + onError: () =>{ + // setOnReady(true) + } + }); + }, + onError: () =>{ + setOnReady(true) + } + }); HttpUtils.get({ url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST, @@ -222,133 +222,133 @@ const Index = () => { } }); - const responseData = { - "availablepaymentmethods": [ - { - "active": "Y", - "code": "04,BCFP,FPS", - "pointstonote": [ - { - "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", - "order": 10, - "type": "INFO" - }, - { - "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", - "order": 11, - "type": "INFO" - } - ], - "subtype": "FPS" - }, - { - "active": "Y", - "code": "02,BCMP,CreditCard", - "pointstonote": [ - { - "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", - "order": 10, - "type": "INFO" - }, - { - "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", - "order": 11, - "type": "INFO" - }, - { - "content": "Merchant Name is applicable to credit card payment method only.", - "order": 40, - "type": "INFO" - }, - { - "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.", - "order": 41, - "type": "INFO" - }, - { - "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.", - "order": 42, - "type": "INFO" - }, - { - "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ", - "order": 43, - "type": "INFO" - } - ], - "subtype": "CreditCard", - "supportedcard": [ - "JCB", - "MasterCard", - "Visa" - ] - }, - { - "active": "Y", - "code": "03,BCMP,CreditCard", - "pointstonote": [ - { - "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", - "order": 10, - "type": "INFO" - }, - { - "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", - "order": 11, - "type": "INFO" - }, - { - "content": "Merchant Name is applicable to credit card payment method only.", - "order": 40, - "type": "INFO" - }, - { - "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.", - "order": 41, - "type": "INFO" - }, - { - "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.", - "order": 42, - "type": "INFO" - }, - { - "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ", - "order": 43, - "type": "INFO" - } - ], - "subtype": "CreditCard", - "supportedcard": [ - "UnionPay" - ] - }, - { - "active": "Y", - "code": "01,PPSB,PPS", - "pointstonote": [ - { - "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", - "order": 10, - "type": "INFO" - }, - { - "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", - "order": 11, - "type": "INFO" - }, - { - "content": "PPS Shop&Buy (PPS) does not support payment via browsers of mobile devices (including mobile phones and tablets) at the moment. If you wish to pay by PPS, please change to use desktop computer. ", - "order": 21, - "type": "INFO" - } - ], - "subtype": "PPS" - } - ] - }; - let availableMethods = responseData.availablepaymentmethods; - setAvailableMethods(availableMethods); + // const responseData = { + // "availablepaymentmethods": [ + // { + // "active": "Y", + // "code": "04,BCFP,FPS", + // "pointstonote": [ + // { + // "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", + // "order": 10, + // "type": "INFO" + // }, + // { + // "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", + // "order": 11, + // "type": "INFO" + // } + // ], + // "subtype": "FPS" + // }, + // { + // "active": "Y", + // "code": "02,BCMP,CreditCard", + // "pointstonote": [ + // { + // "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", + // "order": 10, + // "type": "INFO" + // }, + // { + // "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", + // "order": 11, + // "type": "INFO" + // }, + // { + // "content": "Merchant Name is applicable to credit card payment method only.", + // "order": 40, + // "type": "INFO" + // }, + // { + // "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.", + // "order": 41, + // "type": "INFO" + // }, + // { + // "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.", + // "order": 42, + // "type": "INFO" + // }, + // { + // "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ", + // "order": 43, + // "type": "INFO" + // } + // ], + // "subtype": "CreditCard", + // "supportedcard": [ + // "JCB", + // "MasterCard", + // "Visa" + // ] + // }, + // { + // "active": "Y", + // "code": "03,BCMP,CreditCard", + // "pointstonote": [ + // { + // "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", + // "order": 10, + // "type": "INFO" + // }, + // { + // "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", + // "order": 11, + // "type": "INFO" + // }, + // { + // "content": "Merchant Name is applicable to credit card payment method only.", + // "order": 40, + // "type": "INFO" + // }, + // { + // "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.", + // "order": 41, + // "type": "INFO" + // }, + // { + // "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.", + // "order": 42, + // "type": "INFO" + // }, + // { + // "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ", + // "order": 43, + // "type": "INFO" + // } + // ], + // "subtype": "CreditCard", + // "supportedcard": [ + // "UnionPay" + // ] + // }, + // { + // "active": "Y", + // "code": "01,PPSB,PPS", + // "pointstonote": [ + // { + // "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.", + // "order": 10, + // "type": "INFO" + // }, + // { + // "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.", + // "order": 11, + // "type": "INFO" + // }, + // { + // "content": "PPS Shop&Buy (PPS) does not support payment via browsers of mobile devices (including mobile phones and tablets) at the moment. If you wish to pay by PPS, please change to use desktop computer. ", + // "order": 21, + // "type": "INFO" + // } + // ], + // "subtype": "PPS" + // } + // ] + // }; + // let availableMethods = responseData.availablepaymentmethods; + // setAvailableMethods(availableMethods); } useEffect(() => { From 7598191160587f3e03888acbd63c1b9d1a429b2e Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 4 Mar 2024 17:58:59 +0800 Subject: [PATCH 12/12] update label --- src/pages/Proof/Reply_Public/ApplicationDetails.js | 4 +++- .../PublicNotice/Details_Public/tabTableDetail/PaymentTab.js | 4 +++- src/translations/en.json | 2 ++ src/translations/zh-CN.json | 2 ++ src/translations/zh-HK.json | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pages/Proof/Reply_Public/ApplicationDetails.js b/src/pages/Proof/Reply_Public/ApplicationDetails.js index e00e020..b55938a 100644 --- a/src/pages/Proof/Reply_Public/ApplicationDetails.js +++ b/src/pages/Proof/Reply_Public/ApplicationDetails.js @@ -278,7 +278,9 @@ const ApplicationDetailCard = ({ formData, }) => { ? ( {data.noOfPages} {intl.formatMessage({id: 'page'})} x $6,552 ) : - ( {data.length} cm x {data.colCount === 2 ? "$364 二格位" : "$182 一格位"} ) + ( {data.length} cm x {data.colCount === 2 ? + "$364 "+intl.formatMessage({id: 'doubleCol'}) : + "$182 "+intl.formatMessage({id: 'singleCol'})} ) }
diff --git a/src/pages/PublicNotice/Details_Public/tabTableDetail/PaymentTab.js b/src/pages/PublicNotice/Details_Public/tabTableDetail/PaymentTab.js index 6a78c58..9ac0af1 100644 --- a/src/pages/PublicNotice/Details_Public/tabTableDetail/PaymentTab.js +++ b/src/pages/PublicNotice/Details_Public/tabTableDetail/PaymentTab.js @@ -19,6 +19,8 @@ export default function SubmittedTab({ rows }) { const theme = useTheme(); const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); const intl = useIntl(); + + const { locale } = intl; const handleEditClick = (params) => () => { navigate('/paymentPage/details/' + params.row.id); @@ -52,7 +54,7 @@ export default function SubmittedTab({ rows }) { width: isMdOrLg ? 'auto' : 160, flex: isMdOrLg ? 1 : undefined, renderCell: (params) => { - return PaymentStatus.getStatus_Cht(params); + return locale === 'en' ? PaymentStatus.getStatus_Eng(params):PaymentStatus.getStatus_Cht(params); } }, { diff --git a/src/translations/en.json b/src/translations/en.json index d9a70a5..411de36 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -396,6 +396,8 @@ "upload": "Upload", "actionFail": "Action failed: Please check the content and submit the reply again", "issueInvalidMsg": "Action failed: The Gazette Issue invalid, please apply again", + "singleCol":"Single Column", + "doubleCol":"Double Column", "transactionNo": "Transaction number", "transactionDate": "Transaction date", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 8da15bc..2402ffb 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -390,6 +390,8 @@ "upload": "上载", "actionFail": "行动失败: 请检查内容并再次提交回覆", "issueInvalidMsg": "行动失败: 无效宪报期数,请重新申请", + "singleCol":"一格位", + "doubleCol":"二格位", "transactionNo": "交易号码", "transactionDate": "交易日期", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 8c12694..86a95ae 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -393,6 +393,8 @@ "upload": "上載", "actionFail": "行動失敗: 請檢查內容並再次提交回覆", "issueInvalidMsg": "行動失敗: 無效憲報期數,請重新申請", + "singleCol":"一格位", + "doubleCol":"二格位", "transactionNo": "交易號碼", "transactionDate": "交易日期",