From fd53b5f1087ada7cb5fccd12c587fb0298cf45d0 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 10:12:36 +0800 Subject: [PATCH 01/11] "Proof Record" Label Alignment & a white thin line --- src/pages/Proof/Reply_GLD/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pages/Proof/Reply_GLD/index.js b/src/pages/Proof/Reply_GLD/index.js index a22c395..9e6e1eb 100644 --- a/src/pages/Proof/Reply_GLD/index.js +++ b/src/pages/Proof/Reply_GLD/index.js @@ -60,7 +60,7 @@ const Index = () => { if (!responseData.data?.id) { navigate("/proof/search"); } - setShowProofBtn(responseData.data.action != null && responseData.data.action===true); + setShowProofBtn(responseData.data.action != null && responseData.data.action === true); responseData.data["phoneNumber"] = JSON.parse(responseData.data.contactTelNo).phoneNumber; responseData.data["tel_countryCode"] = JSON.parse(responseData.data.contactTelNo).countryCode; @@ -81,7 +81,7 @@ const Index = () => { setIsOverTime(current.getTime() > returnBeforeDate.getTime()); setShowCancelBtn(responseData.data.cancelled || responseData.data.replyDate || current.getTime() > returnBeforeDate.getTime()) - + setRecord(responseData.data); } @@ -122,10 +122,8 @@ const Index = () => {
- - - Proof Record - + + Proof Record
From 66793a68ce361babd6d20f1ee72fcff05daa3ac5 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 11:00:03 +0800 Subject: [PATCH 02/11] idDocType show error label --- src/pages/authentication/auth-forms/CustomFormWizard.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index b3f85f1..159edc4 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -907,12 +907,13 @@ const CustomFormWizard = (props) => { sx={{ "#address4-combo": { padding: "0px 0px 0px 0px" }, "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} renderInput={(params) => } /> {formik.touched.idDocType && ( - selectedIdDocType === null ? - + selectedIdDocType === null || selectedIdDocType?.type == null ? + : '' )} From 8b33cde3c4124937793e5d99101ea190d710c4fb Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 11:02:26 +0800 Subject: [PATCH 03/11] fix bug --- src/pages/authentication/auth-forms/CustomFormWizard.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index 159edc4..efc324e 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -902,6 +902,7 @@ const CustomFormWizard = (props) => { } } else { setSelectedIdDocInputType(""); + setSelectedIdDocType({}); } }} sx={{ "#address4-combo": { padding: "0px 0px 0px 0px" }, "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} From 36cd5b6107a5fcb1be09677d35f46efee0617416 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 15:06:21 +0800 Subject: [PATCH 04/11] District is mandatory for HK --- .../auth-forms/CustomFormWizard.js | 53 ++++++++++++++----- src/translations/en.json | 10 ++-- src/translations/zh-CN.json | 10 ++-- src/translations/zh-HK.json | 10 ++-- 4 files changed, 59 insertions(+), 24 deletions(-) diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index efc324e..6e88e2d 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -96,6 +96,7 @@ const CustomFormWizard = (props) => { const email = document.getElementById("email-login") const [checkEmail, setCheckEmail] = useState(false) const [checkEmailBlur, setCheckEmailBlur] = useState(false) + const [districtErrStr, setDistrictErrStr] = useState("") const idDocTypeComboList = ComboData.idDocType; const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" @@ -291,6 +292,10 @@ const CustomFormWizard = (props) => { props.setUpdateValid(isValid) }, [isValid]) + useEffect(() => { + props.setUpdateValid(isValid) + }, [isValid]) + useEffect(() => { checkDataField(values) }, [ @@ -298,6 +303,14 @@ const CustomFormWizard = (props) => { selectedAddress4, selectedAddress5, termsAndConAccept, termsAndConNotAccept, fileList]) + useEffect(()=>{ + setDistrictErrStr(""); + if(selectedAddress5?.type === "hongKong"){ + if(selectedAddress4 ==null || selectedAddress4 == ""|| selectedAddress4 == {}) + setDistrictErrStr(getRequiredErrStr("district")) + } + },[selectedAddress4, selectedAddress5]) + useEffect(() => { props.step == 2 ? _onSubmit() : null; if (captchaImg == "") @@ -528,6 +541,13 @@ const CustomFormWizard = (props) => { return {errorMsg} } + 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}):""})); + } + const formik = useFormik({ initialValues: ({ username: '', @@ -551,23 +571,23 @@ const CustomFormWizard = (props) => { captchaField: '' }), validationSchema: yup.object().shape({ - username: yup.string().min(6, displayErrorMsg(intl.formatMessage({ id: 'atLeast6CharAccount' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireUsername' }))) + username: yup.string().min(6, displayErrorMsg(intl.formatMessage({ id: 'atLeast6CharAccount' }))).max(30, getMaxErrStr(30)).required(displayErrorMsg(intl.formatMessage({ id: 'requireUsername' }))) .matches(/^[aA-zZ0-9\s]+$/, { message: displayErrorMsg(intl.formatMessage({ id: 'noSpecialCharAccount' })) }) .matches(/^\S*$/, { message: displayErrorMsg(intl.formatMessage({ id: 'noSpaceAccount' })) }), - password: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'atLeast8CharPassword' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requirePassword' }))) + password: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'atLeast8CharPassword' }))).max(60, getMaxErrStr(60)).required(displayErrorMsg(intl.formatMessage({ id: 'requirePassword' }))) .matches(/^\S*$/, { message: displayErrorMsg(intl.formatMessage({ id: 'noSpacePassword' })) }) .matches(/^(?=.*[a-z])/, { message: displayErrorMsg(intl.formatMessage({ id: 'atLeastOneSmallLetter' })) }) .matches(/^(?=.*[A-Z])/, { message: displayErrorMsg(intl.formatMessage({ id: 'atLeastOneCapLetter' })) }) .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(255).required(displayErrorMsg(intl.formatMessage({ id: 'userRequireEnglishName' }))), - chName: yup.string().max(6).required(displayErrorMsg(intl.formatMessage({ id: 'userRequireChineseName' }))), - address1: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))), - address2: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine2' }))), - address3: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine3' }))), - email: yup.string().email(displayErrorMsg(intl.formatMessage({ id: 'validEmailFormat' }))).max(255).required(displayErrorMsg(intl.formatMessage({ id: 'requireEmail' }))), - emailConfirm: yup.string().email(displayErrorMsg(intl.formatMessage({ id: 'validEmailFormat' }))).max(255).required(displayErrorMsg(intl.formatMessage({ id: 'requireEmail' }))).oneOf([yup.ref('email'), null], displayErrorMsg(intl.formatMessage({ id: 'validSameEmail' }))), + 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' }))), + 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' })}`)) .matches(/^[aA-zZ0-9\s]+$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpecialCharacter' })}`) }) .matches(/^\S*$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpace' })}`) }) @@ -622,8 +642,8 @@ const CustomFormWizard = (props) => { } } }), - checkDigit: yup.string().max(1).required(displayErrorMsg(intl.formatMessage({ id: 'requiredNumberInQuote' }))), - idDocType: yup.string().max(255).required(displayErrorMsg(intl.formatMessage({ id: 'requireIdDocType' }))), + checkDigit: yup.string().max(1, getMaxErrStr(1)).required(displayErrorMsg(intl.formatMessage({ id: 'requiredNumberInQuote' }))), + idDocType: yup.string().max(255, getMaxErrStr(255)).required(displayErrorMsg(intl.formatMessage({ id: 'requireIdDocType' }))), phoneCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({ id: 'requireAtLeast2Number' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireDialingCode' }))), // faxCountryCode: yup.string().min(3,'請輸入3位數字'), phone: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'requireAtLeast8Number' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireContactNumber' }))), @@ -1146,6 +1166,7 @@ const CustomFormWizard = (props) => { value={formik.values.address2} name="address2" onChange={formik.handleChange} + onBlur={formik.handleBlur} placeholder={intl.formatMessage({ id: 'addressLine2' })} inputProps={{ onKeyDown: (e) => { @@ -1162,6 +1183,7 @@ const CustomFormWizard = (props) => { value={formik.values.address3} name="address3" onChange={formik.handleChange} + onBlur={formik.handleBlur} placeholder={intl.formatMessage({ id: 'addressLine3' })} inputProps={{ onKeyDown: (e) => { @@ -1177,6 +1199,8 @@ const CustomFormWizard = (props) => { value={selectedAddress4} options={ComboData.district} disabled={checkCountry} + error={Boolean(districtErrStr)} + onBlur={formik.handleBlur} getOptionLabel={(option) => option.type ? intl.formatMessage({ id: option.type }) : ""} onChange={(event, newValue) => { setSelectedAddress4(newValue); @@ -1228,6 +1252,11 @@ const CustomFormWizard = (props) => { {formik.errors.address3} )} + {districtErrStr!= "" && ( + + {districtErrStr} + + )}
@@ -1711,7 +1740,7 @@ const CustomFormWizard = (props) => { {formik.values.address3} : null} - {selectedAddress5.label === "hongKong" ? + {selectedAddress5.type === "hongKong" ? : diff --git a/src/translations/en.json b/src/translations/en.json index 16c964a..4be6f6d 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -28,6 +28,8 @@ "submissionSuccess": "Application submitted successfully", "noMoreThen40Words": "Must not exceed 40 characters", "noMoreThen255Words": "Must not exceed 255 characters", + "noMoreThenNWords": "{fieldname} Must not exceed {num} characters", + "atLeastNCharAccount": "{fieldname} Please enter at least {num} digits", "MSG.registerIAmSmart": "You may click the \"iAM Smart\" button to fill the personal information automatically or enter the information manually to activate the PNSPS account now.
If you want to use \"iAM Smart\" to fill the personal information, please download the \"iAM Smart\" mobile app and register as an \"iAM Smart\" user first.", "MSG.registerPersonal": "To complete the online application, you need to upload digital copies of identification documents.
e.g. Hong Kong Identity Card, Passport, Mainland China Identity Card, Professional Practicing Certificate, etc.", @@ -199,7 +201,7 @@ "verifyFail": "Verification failed, please contact the relevant system administrator for assistance.", "validVerify": "Please enter valid verification", "requiredValid": "Please enter valid ", - "require": "Please enter ", + "require": "Please enter {fieldname}", "number": " number", "noSpecialCharacter": " number cannot contain special characters", "noSpace": " number cannot contain spaces", @@ -209,9 +211,9 @@ "businessRegCertValidityDate": "Business Reg Cert validity date", "pleaseFillInBusinessRegCertValidityDate": "Please fill in Business Reg Cert validity date", "formAddress": "Address", - "addressLine1": "First line", - "addressLine2": "Second line", - "addressLine3": "Third line", + "addressLine1": "First line of address", + "addressLine2": "Second line of address", + "addressLine3": "Third line of address", "region": "Region (only applicable to Hong Kong)", "validateAddressLine1": "Please enter the first line of address", "validateAddressLine2": "Please enter the second line of address", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index f3b8c67..e63ff8e 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -28,6 +28,8 @@ "submissionSuccess": "申请提交成功", "noMoreThen40Words": "不得超过 40 个字符", "noMoreThen255Words": "不得超过 255 个字符", + "noMoreThenNWords": "{fieldname}不得超过 {num} 个字符", + "atLeastNCharAccount": "{fieldname}最少{num}个字符", "MSG.registerIAmSmart": "你可点击「智方便」按钮,系统会自动输入个人资料,或自行输入个人资料,以即时启动 公共启事提交及缴费系统 帐户。
如欲使用「智方便」提供个人资料,请先下载「智方便」流动应用程式并登记成为「智方便」用户。", "MSG.registerPersonal": "需上载身份证明文件数码档案以进行网上申请。
如:香港身份证; 护照; 中国内地身份证; 专业执业证书等", @@ -194,7 +196,7 @@ "verify": "验证", "validVerify": "请输入有效验证", "requiredValid": "请输入有效的", - "require": "请输入", + "require": "请输入{fieldname}", "number": "号码", "noSpecialCharacter": "号码不包含特殊字符", "noSpace": "号码不包含空格", @@ -204,9 +206,9 @@ "businessRegCertValidityDate": "商业登记证有效日期", "pleaseFillInBusinessRegCertValidityDate": "请输入商业登记证有效日期", "formAddress": "地址", - "addressLine1": "第一行", - "addressLine2": "第二行", - "addressLine3": "第三行", + "addressLine1": "第一行地址", + "addressLine2": "第二行地址", + "addressLine3": "第三行地址", "validateAddressLine1": "请输入第一行地址", "validateAddressLine2": "请输入第二行地址", "validateAddressLine3": "请输入第三行地址", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index b10243c..3d8e8a1 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -28,6 +28,8 @@ "submissionSuccess": "申請提交成功", "noMoreThen40Words": "不得超過 40 個字符", "noMoreThen255Words": "不得超過 255 個字符", + "noMoreThenNWords": "{fieldname}不得超過 {num} 個字符", + "atLeastNCharAccount": "{fieldname}最少{num}個字符", "MSG.registerIAmSmart": "你可點擊「智方便」按鈕,系統會自動輸入個人資料,或自行輸入個人資料,以即時啟動 公共啟事提交及繳費系統 帳戶。
如欲使用「智方便」提供個人資料,請先下載「智方便」流動應用程式並登記成為「智方便」用戶。", "MSG.registerPersonal": "需上載身份證明文件數碼檔案以進行網上申請。
如:香港身份證; 護照; 中國內地身份證; 專業執業証書等", @@ -199,7 +201,7 @@ "verifyFail": "驗證失敗,請聯絡相關的系統管理員協助。", "validVerify": "請輸入有效驗證", "requiredValid": "請輸入有效的", - "require": "請輸入", + "require": "請輸入{fieldname}", "number": "號碼", "noSpecialCharacter": "號碼不包含特殊字符", "noSpace": "號碼不包含空格", @@ -209,9 +211,9 @@ "businessRegCertValidityDate": "商業登記證有效日期", "pleaseFillInBusinessRegCertValidityDate": "請輸入商業登記證有效日期", "formAddress": "地址", - "addressLine1": "第一行", - "addressLine2": "第二行", - "addressLine3": "第三行", + "addressLine1": "第一行地址", + "addressLine2": "第二行地址", + "addressLine3": "第三行地址", "validateAddressLine1": "請輸入第一行地址", "validateAddressLine2": "請輸入第二行地址", "validateAddressLine3": "請輸入第三行地址", From b3bf86ddecdf728bc6080faabcc0c317b98cfb7e Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 15:28:18 +0800 Subject: [PATCH 05/11] max i18n label --- .../auth-forms/BusCustomFormWizard.js | 46 ++++- .../auth-forms/CustomFormWizard.js | 4 +- .../auth-forms/IAmSmartFormWizard.js | 192 ++++++++++-------- 3 files changed, 148 insertions(+), 94 deletions(-) diff --git a/src/pages/authentication/auth-forms/BusCustomFormWizard.js b/src/pages/authentication/auth-forms/BusCustomFormWizard.js index 13de4e4..04c1d0e 100644 --- a/src/pages/authentication/auth-forms/BusCustomFormWizard.js +++ b/src/pages/authentication/auth-forms/BusCustomFormWizard.js @@ -100,6 +100,7 @@ const BusCustomFormWizard = (props) => { const email = document.getElementById("email-login") const [checkEmail, setCheckEmail] = useState(false) const [checkEmailBlur, setCheckEmailBlur] = useState(false) + const [districtErrStr, setDistrictErrStr] = useState("") const address4ComboList = ComboData.district; const address5ComboList = ComboData.country; @@ -171,6 +172,22 @@ const BusCustomFormWizard = (props) => { } }, [checkEmailBlur]) + useEffect(()=>{ + setDistrictErrStr(""); + if(selectedAddress5?.type === "hongKong"){ + if(selectedAddress4 ==null || selectedAddress4 == ""|| selectedAddress4 == {}) + setDistrictErrStr(getRequiredErrStr("district")) + } + },[selectedAddress4, selectedAddress5]) + + function getRequiredErrStr(fieldname){ + return displayErrorMsg(intl.formatMessage({ id: 'require'},{fieldname:fieldname?intl.formatMessage({ id: fieldname}):""})); + } + + function getMaxErrStr(num, fieldname){ + return displayErrorMsg(intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""})); + } + const onCaptchaChange = () => { HttpUtils.post({ url: POST_CAPTCHA, @@ -497,17 +514,17 @@ const BusCustomFormWizard = (props) => { }), validationSchema: yup.object().shape({ - username: yup.string().min(6, displayErrorMsg(intl.formatMessage({id: 'atLeast6CharAccount'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireUsername'}))) + username: yup.string().min(6, displayErrorMsg(intl.formatMessage({id: 'atLeast6CharAccount'}))).max(30,getMaxErrStr(30)).required(displayErrorMsg(intl.formatMessage({id: 'requireUsername'}))) .matches(/^[aA-zZ0-9\s]+$/, { message: displayErrorMsg(intl.formatMessage({id: 'noSpecialCharAccount'})) }) .matches(/^\S*$/, { message: displayErrorMsg(intl.formatMessage({id: 'noSpaceAccount'})) }), - password: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'atLeast8CharPassword'}))).required(displayErrorMsg(intl.formatMessage({id: 'requirePassword'}))) + password: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'atLeast8CharPassword'}))).max(60,getMaxErrStr(60)).required(displayErrorMsg(intl.formatMessage({id: 'requirePassword'}))) .matches(/^\S*$/, { message: displayErrorMsg(intl.formatMessage({id: 'noSpacePassword'})) }) .matches(/^(?=.*[a-z])/, { message: displayErrorMsg(intl.formatMessage({id: 'atLeastOneSmallLetter'})) }) .matches(/^(?=.*[A-Z])/, { message: displayErrorMsg(intl.formatMessage({id: 'atLeastOneCapLetter'})) }) .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(255).required(displayErrorMsg(intl.formatMessage({id: 'userRequireEnglishName'}))), + enName: yup.string().max(40,getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({id: 'userRequireEnglishName'}))), enCompanyName: yup.string().matches(/^[^$^*()]+$/, { message: displayErrorMsg('No special characters $/^/*/(/)') }).when('chCompanyName', { is: (chCompanyName) => !chCompanyName || chCompanyName.length === 0, then: yup.string().required(displayErrorMsg('Please enter either English or Chinese name')), @@ -517,11 +534,11 @@ const BusCustomFormWizard = (props) => { then: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'validateEngOrChiName'}))), }), chName: yup.string().max(255).required(displayErrorMsg(intl.formatMessage({id: 'userRequireChineseName'}))), - address1: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine1'}))), - address2: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine2'}))), - address3: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine3'}))), - email: yup.string().email(displayErrorMsg(intl.formatMessage({id: 'validEmailFormat'}))).max(255).required(displayErrorMsg(intl.formatMessage({id: 'requireEmail'}))), - emailConfirm: yup.string().email(displayErrorMsg(intl.formatMessage({id: 'validEmailFormat'}))).max(255).required(displayErrorMsg(intl.formatMessage({id: 'requireEmail'}))).oneOf([yup.ref('email'), null], displayErrorMsg(intl.formatMessage({id: 'validSameEmail'}))), + address1: yup.string().max(40, getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine1'}))), + address2: yup.string().max(40, getMaxErrStr(40)), + address3: yup.string().max(40, getMaxErrStr(40)), + email: yup.string().email(displayErrorMsg(intl.formatMessage({id: 'validEmailFormat'}))).max(255, 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'}))), phoneCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast2Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))), faxCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast2Number'}))), phone: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast8Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))), @@ -529,7 +546,7 @@ const BusCustomFormWizard = (props) => { brExpiryDate: yup.date().min(new Date().toISOString().split("T")[0], displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertValidityDate'}))) .max("2099-12-31", displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertValidityDate'}))). required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertValidityDate'}))), - brNo: yup.string().max(8).required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertNumber'}))).test('checkBrNoFormat', displayErrorMsg(`${intl.formatMessage({id: 'pleaseFillInValidBusinessRegCertNumber'})} (e.g. 12341234)`), function (value) { + brNo: yup.string().max(8, getMaxErrStr(8)).required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertNumber'}))).test('checkBrNoFormat', displayErrorMsg(`${intl.formatMessage({id: 'pleaseFillInValidBusinessRegCertNumber'})} (e.g. 12341234)`), function (value) { // var brNo_pattern = /[0-9]{8}-[0-9]{3}-(0[1-9]|1[012])-[0-9]{2}-[0-9A-Z]{1}/ var brNo_pattern = /[0-9]{8}/ if (value !== undefined) { @@ -540,7 +557,7 @@ const BusCustomFormWizard = (props) => { } } }), - captchaField: yup.string().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('請輸入有效驗證')) }, ['enCompanyName', 'chCompanyName']), }); @@ -942,6 +959,7 @@ const BusCustomFormWizard = (props) => { id="address2-signup" value={formik.values.address2} name="address2" + onBlur={formik.handleBlur} onChange={formik.handleChange} placeholder={intl.formatMessage({id: 'addressLine2'})} inputProps={{ @@ -958,6 +976,7 @@ const BusCustomFormWizard = (props) => { id="address3-signup" value={formik.values.address3} name="address3" + onBlur={formik.handleBlur} onChange={formik.handleChange} placeholder={intl.formatMessage({id: 'addressLine3'})} inputProps={{ @@ -974,6 +993,8 @@ const BusCustomFormWizard = (props) => { value={selectedAddress4} options={address4ComboList} disabled={checkCountry} + error={Boolean(districtErrStr!="")} + onBlur={formik.handleBlur} getOptionLabel={(option) => option.type? intl.formatMessage({ id: option.type }) : ""} onChange={(event, newValue) => { setSelectedAddress4(newValue); @@ -1023,6 +1044,11 @@ const BusCustomFormWizard = (props) => { {formik.errors.address3} )} + {districtErrStr!= "" && ( + + {districtErrStr} + + )}
diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index 6e88e2d..22b5922 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -648,7 +648,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().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('請輸入有效驗證')), }), }); @@ -1199,7 +1199,7 @@ const CustomFormWizard = (props) => { 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) => { diff --git a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js index dba69f3..51f452c 100644 --- a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js +++ b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js @@ -38,7 +38,7 @@ import * as HttpUtils from "../../../utils/HttpUtils"; import LoopIcon from '@mui/icons-material/Loop'; import { useTheme } from '@mui/material/styles'; import { useLocation } from "react-router-dom"; -import {FormattedMessage, useIntl} from "react-intl"; +import { FormattedMessage, useIntl } from "react-intl"; // ============================|| FIREBASE - REGISTER ||============================ // @@ -63,6 +63,7 @@ const CustomFormWizard = (props) => { const email = document.getElementById("email-login") const [checkEmail, setCheckEmail] = useState(false) const [checkEmailBlur, setCheckEmailBlur] = useState(false) + const [districtErrStr, setDistrictErrStr] = useState("") const address4ComboList = ComboData.district; const address5ComboList = ComboData.country; @@ -78,11 +79,28 @@ const CustomFormWizard = (props) => { useEffect(() => { location.state?.responseData ?? {} - if(captchaImg=="") - onCaptchaChange(); + if (captchaImg == "") + onCaptchaChange(); responseToData(); }, []); + useEffect(() => { + setDistrictErrStr(""); + if (selectedAddress5?.type === "hongKong") { + if (selectedAddress4 == null || selectedAddress4 == "" || selectedAddress4 == {}) + setDistrictErrStr(getRequiredErrStr("district")) + } + }, [selectedAddress4, selectedAddress5]) + + function getRequiredErrStr(fieldname){ + return displayErrorMsg(intl.formatMessage({ id: 'require'},{fieldname:fieldname?intl.formatMessage({ id: fieldname}):""})); + } + + function getMaxErrStr(num, fieldname){ + return displayErrorMsg(intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""})); + } + + const responseToData = () => { //let rd = JSON.parse("{\"emailAddress\":\"test@gmail.com\",\"postalAddress\":{\"EngPremisesAddress\":{\"EngDistrict\":{\"DcDistrict\":\"KC\",\"Sub-district\":\"TSING YI\"},\"EngEstate\":{\"EstateName\":\"Cheung Hang Estate\",\"EngPhase\":{\"PhaseName\":\"N/A\"}},\"BuildingName\":\"Hang Lai House\",\"EngBlock\":{\"BlockDescriptor\":\"Block\",\"BlockNo\":\"2\"},\"Region\":\"NT\",\"EngStreet\":{\"StreetName\":\"Liu To Road\",\"BuildingNoFrom\":\"6\"},\"Eng3dAddress\":{\"EngFloor\":{\"FloorNum\":\"33\"},\"EngUnit\":{\"UnitDescriptor\":\"Room\",\"UnitNo\":\"3301\"}}}},\"mobileNumber\":{\"CountryCode\":\"852\",\"SubscriberNumber\":\"99999999\"},\"residentialAddress\":{\"ChiPremisesAddress\":{\"Chi3dAddress\":{\"ChiUnit\":{\"UnitDescriptor\":\"室\",\"UnitNo\":\"1010\"},\"ChiFloor\":{\"FloorNum\":\"10\"}},\"ChiBlock\":{\"BlockDescriptor\":\"座\",\"BlockNo\":\"2\"},\"BuildingName\":\"亨麗樓(第2座)\",\"ChiDistrict\":{\"DcDistrict\":\"KC\",\"Sub-district\":\"青衣\"},\"Region\":\"新界\",\"ChiEstate\":{\"EstateName\":\"長亨邨\"},\"ChiStreet\":{\"StreetName\":\"寮肚路\",\"BuildingNoFrom\":\"6\"}}},\"enName\":{\"UnstructuredName\":\"Testing Co One\"},\"idNo\":{\"Identification\":\"G561107\",\"CheckDigit\":\"4\"},\"chName\":{\"ChineseName\":\"測試商一\"}}"); let rd = JSON.parse(location.state?.responseData.data); @@ -91,7 +109,7 @@ const CustomFormWizard = (props) => { "chName": rd?.chName?.ChineseName ?? "", "idNo": rd?.idNo?.Identification ?? "", "checkDigit": rd?.idNo?.CheckDigit ?? "", - "email": rd?.emailAddress ?? "", + "email": rd?.emailAddress ?? "", "phone": rd?.mobileNumber?.SubscriberNumber ?? "", "phoneCountryCode": rd?.mobileNumber?.CountryCode ?? "", }; @@ -136,7 +154,7 @@ const CustomFormWizard = (props) => { let buildingName = pAdd.BuildingName ?? ""; let estate = pAdd.ChiEstate?.EstateName ?? ""; let district = pAdd.ChiDistrict["Sub - district"] ?? ""; - return getAddressStr([district, street, estate, buildingName, street, floor, block, unit ]); + return getAddressStr([district, street, estate, buildingName, street, floor, block, unit]); } const getAddressStr = (strs) => { @@ -180,22 +198,22 @@ const CustomFormWizard = (props) => { useEffect(() => { if (iAmSmartData) { - formik.setFieldValue("enName", iAmSmartData.enName??""); - formik.setFieldValue("chName", iAmSmartData.chName??""); - formik.setFieldValue("idNo", iAmSmartData.idNo??""); - formik.setFieldValue("checkDigit", iAmSmartData.checkDigit??""); - formik.setFieldValue("email", iAmSmartData.email??""); - formik.setFieldValue("phone", iAmSmartData.phone??""); - formik.setFieldValue("phoneCountryCode", iAmSmartData.phoneCountryCode??""); - formik.setFieldValue("address1", iAmSmartData.address1??""); - props.setIdNo(iAmSmartData.idNo??""); + formik.setFieldValue("enName", iAmSmartData.enName ?? ""); + formik.setFieldValue("chName", iAmSmartData.chName ?? ""); + formik.setFieldValue("idNo", iAmSmartData.idNo ?? ""); + formik.setFieldValue("checkDigit", iAmSmartData.checkDigit ?? ""); + formik.setFieldValue("email", iAmSmartData.email ?? ""); + formik.setFieldValue("phone", iAmSmartData.phone ?? ""); + formik.setFieldValue("phoneCountryCode", iAmSmartData.phoneCountryCode ?? ""); + formik.setFieldValue("address1", iAmSmartData.address1 ?? ""); + props.setIdNo(iAmSmartData.idNo ?? ""); } }, [iAmSmartData]) const onCaptchaChange = () => { HttpUtils.post({ url: POST_CAPTCHA, - params: { width: 130, height: 40, captcha: captchaImg}, + params: { width: 130, height: 40, captcha: captchaImg }, onSuccess: (responseData) => { props.setBase64Url(responseData.base64Url) localStorage.setItem("base64Url", responseData.base64Url); @@ -250,8 +268,8 @@ const CustomFormWizard = (props) => { useEffect(() => { props.step == 2 ? _onSubmit() : null; - if(captchaImg=="") - onCaptchaChange(); + if (captchaImg == "") + onCaptchaChange(); checkDataField(values) }, [props.step]) @@ -350,27 +368,27 @@ const CustomFormWizard = (props) => { const formik = useFormik({ initialValues: ({ - email: iAmSmartData.email??"", - emailConfirm: iAmSmartData.email??"", - address1: iAmSmartData.address1??"", + email: iAmSmartData.email ?? "", + emailConfirm: iAmSmartData.email ?? "", + address1: iAmSmartData.address1 ?? "", address2: '', address3: '', - phone: iAmSmartData.phone??"", - phoneCountryCode: iAmSmartData.phoneCountryCode??"852", + phone: iAmSmartData.phone ?? "", + phoneCountryCode: iAmSmartData.phoneCountryCode ?? "852", submit: null, fax: '', faxCountryCode: '852', captchaField: '' }), validationSchema: yup.object().shape({ - address1: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine1'}))), - address2: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine2'}))), - address3: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine3'}))), - email: yup.string().email(displayErrorMsg(intl.formatMessage({id: 'validEmailFormat'}))).max(255).required(displayErrorMsg(intl.formatMessage({id: 'requireEmail'}))), - emailConfirm: yup.string().email(displayErrorMsg(intl.formatMessage({id: 'validEmailFormat'}))).max(255).required(displayErrorMsg(intl.formatMessage({id: 'requireEmail'}))).oneOf([yup.ref('email'), null], displayErrorMsg(intl.formatMessage({id: 'validSameEmail'}))), - phoneCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast2Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))), - phone: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast8Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))), - captchaField: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'requireVerify'}))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), + address1: yup.string().max(40, getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))), + address2: yup.string().max(40), + address3: yup.string().max(40), + 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' }))), + phoneCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({ id: 'requireAtLeast2Number' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireDialingCode' }))), + phone: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'requireAtLeast8Number' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireContactNumber' }))), + captchaField: yup.string().max(5, getMaxErrStr(5)).required(displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), }), }); @@ -393,12 +411,12 @@ const CustomFormWizard = (props) => {
- + iAM Smart
- 。 + iAM Smart: 表示該項由「智方便」提供。 @@ -409,7 +427,7 @@ const CustomFormWizard = (props) => { - + @@ -418,7 +436,7 @@ const CustomFormWizard = (props) => { - 香港身份證: {iAmSmartData.idNo+"("+iAmSmartData.checkDigit+")"} + 香港身份證: {iAmSmartData.idNo + "(" + iAmSmartData.checkDigit + ")"} @@ -428,7 +446,7 @@ const CustomFormWizard = (props) => { - : {iAmSmartData.enName} + : {iAmSmartData.enName} @@ -438,7 +456,7 @@ const CustomFormWizard = (props) => { - {intl.formatMessage({id: 'userChineseName'})}: {iAmSmartData.chName} + {intl.formatMessage({ id: 'userChineseName' })}: {iAmSmartData.chName} @@ -447,9 +465,9 @@ const CustomFormWizard = (props) => { - + * - {iAmSmartData.address1?iAM Smart:null} + {iAmSmartData.address1 ? iAM Smart : null} { value={formik.values.address1} name="address1" onChange={formik.handleChange} - placeholder={intl.formatMessage({id: 'addressLine1'})} + placeholder={intl.formatMessage({ id: 'addressLine1' })} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -475,8 +493,9 @@ const CustomFormWizard = (props) => { id="address2-signup" value={formik.values.address2} name="address2" + onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder={intl.formatMessage({id: 'addressLine2'})} + placeholder={intl.formatMessage({ id: 'addressLine2' })} inputProps={{ onKeyDown: (e) => { if (e.key === 'Enter') { @@ -491,8 +510,9 @@ const CustomFormWizard = (props) => { id="address3-signup" value={formik.values.address3} name="address3" + onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder={intl.formatMessage({id: 'addressLine3'})} + placeholder={intl.formatMessage({ id: 'addressLine3' })} inputProps={{ onKeyDown: (e) => { if (e.key === 'Enter') { @@ -507,12 +527,14 @@ const CustomFormWizard = (props) => { value={selectedAddress4} options={address4ComboList} disabled={checkCountry} - getOptionLabel={(option) => option.type? intl.formatMessage({ id: option.type }) : ""} + error={Boolean(districtErrStr!="")} + onBlur={formik.handleBlur} + getOptionLabel={(option) => option.type ? intl.formatMessage({ id: option.type }) : ""} onChange={(event, newValue) => { setSelectedAddress4(newValue); }} sx={{ "& .MuiInputBase-root": { height: "41px" }, "#address4-combo": { padding: "0px 0px 0px 0px" }, "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} - renderInput={(params) => } /> { id="address5-combo" value={selectedAddress5} options={address5ComboList} - getOptionLabel={(option) => option.type? intl.formatMessage({ id: option.type }) : ""} + getOptionLabel={(option) => option.type ? intl.formatMessage({ id: option.type }) : ""} onChange={(event, newValue) => { if (newValue !== null) { setSelectedAddress5(newValue); @@ -537,7 +559,7 @@ const CustomFormWizard = (props) => { }} sx={{ "& .MuiInputBase-root": { height: "41px" }, "#address5-combo": { padding: "0px 0px 0px 0px" }, "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} - renderInput={(params) => } + renderInput={(params) => } /> {formik.touched.address1 && formik.errors.address1 && ( @@ -554,12 +576,18 @@ const CustomFormWizard = (props) => { {formik.errors.address3} )} + + {districtErrStr != "" && ( + + {districtErrStr} + + )}
- + @@ -569,9 +597,9 @@ const CustomFormWizard = (props) => { - + * - {iAmSmartData.email?iAM Smart:null} + {iAmSmartData.email ? iAM Smart : null} { value={formik.values.email.trim()} name="email" onChange={formik.handleChange} - placeholder={intl.formatMessage({id: 'userContactEmail'})} + placeholder={intl.formatMessage({ id: 'userContactEmail' })} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -599,7 +627,7 @@ const CustomFormWizard = (props) => { )} {checkEmail && ( - + )} @@ -608,7 +636,7 @@ const CustomFormWizard = (props) => { - + * @@ -621,7 +649,7 @@ const CustomFormWizard = (props) => { name="emailConfirm" // onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder={intl.formatMessage({id: 'confirmEmail'})} + placeholder={intl.formatMessage({ id: 'confirmEmail' })} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -648,9 +676,9 @@ const CustomFormWizard = (props) => { - + * - {iAmSmartData.phone?iAM Smart:null} + {iAmSmartData.phone ? iAM Smart : null} @@ -668,7 +696,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("phoneCountryCode", value); }} - placeholder={intl.formatMessage({id: 'dialingCode'})} + placeholder={intl.formatMessage({ id: 'dialingCode' })} error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} inputProps={{ @@ -695,7 +723,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("phone", value); }} - placeholder={intl.formatMessage({id: 'userContactNumber'})} + placeholder={intl.formatMessage({ id: 'userContactNumber' })} error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} inputProps={{ @@ -724,7 +752,7 @@ const CustomFormWizard = (props) => { - + @@ -742,7 +770,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("faxCountryCode", value); }} - placeholder={intl.formatMessage({id: 'dialingCode'})} + placeholder={intl.formatMessage({ id: 'dialingCode' })} onBlur={formik.handleBlur} inputProps={{ maxLength: 3, @@ -768,7 +796,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("fax", value); }} - placeholder={intl.formatMessage({id: 'userFaxNumber'})} + placeholder={intl.formatMessage({ id: 'userFaxNumber' })} inputProps={{ maxLength: 8, onKeyDown: (e) => { @@ -791,7 +819,7 @@ const CustomFormWizard = (props) => { - + * @@ -816,7 +844,7 @@ const CustomFormWizard = (props) => { size="small" /> - + @@ -832,7 +860,7 @@ const CustomFormWizard = (props) => { size="small" /> - + @@ -846,7 +874,7 @@ const CustomFormWizard = (props) => { - + * @@ -894,7 +922,7 @@ const CustomFormWizard = (props) => {
- +
@@ -904,7 +932,7 @@ const CustomFormWizard = (props) => { - + {/* Already have an account? @@ -914,10 +942,10 @@ const CustomFormWizard = (props) => { - + - {formik.values.idNo+"("+formik.values.checkDigit+")"} + {formik.values.idNo + "(" + formik.values.checkDigit + ")"} @@ -925,7 +953,7 @@ const CustomFormWizard = (props) => { - : + : {formik.values.enName} @@ -935,7 +963,7 @@ const CustomFormWizard = (props) => { - : + : {formik.values.chName} @@ -945,7 +973,7 @@ const CustomFormWizard = (props) => { - : + : @@ -964,19 +992,19 @@ const CustomFormWizard = (props) => { {selectedAddress5.type === "hongKong" ? - : + : - {!selectedAddress4? "" : intl.formatMessage({id: selectedAddress4.type})} + {!selectedAddress4 ? "" : intl.formatMessage({ id: selectedAddress4.type })} : null} - : + : - {intl.formatMessage({id: selectedAddress5.type})} + {intl.formatMessage({ id: selectedAddress5.type })} @@ -985,14 +1013,14 @@ const CustomFormWizard = (props) => { - + - : + : {formik.values.email} @@ -1002,7 +1030,7 @@ const CustomFormWizard = (props) => { - : + : +{formik.values.phoneCountryCode} {formik.values.phone} @@ -1013,7 +1041,7 @@ const CustomFormWizard = (props) => { - : + : +{formik.values.faxCountryCode} {formik.values.fax} @@ -1036,13 +1064,13 @@ const CustomFormWizard = (props) => { - + - + : @@ -1054,7 +1082,7 @@ const CustomFormWizard = (props) => { } From b24eb3757c9ddea4b1ff2d2957d0965674cd5f4e Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 15:41:59 +0800 Subject: [PATCH 06/11] Contact Person is mandatory --- .../Organization/DetailPage/OrganizationCard.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/pages/Organization/DetailPage/OrganizationCard.js b/src/pages/Organization/DetailPage/OrganizationCard.js index 3a4026f..4b92881 100644 --- a/src/pages/Organization/DetailPage/OrganizationCard.js +++ b/src/pages/Organization/DetailPage/OrganizationCard.js @@ -48,15 +48,24 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { return {errorMsg} } + 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}):""})); + } + const formik = useFormik({ enableReinitialize: true, initialValues: currentUserData, validationSchema: yup.object().shape({ - enCompanyName: yup.string().max(255).required(displayErrorMsg(intl.formatMessage({ id: 'userRequireEnglishName' }))), + enCompanyName: yup.string().max(255, getMaxErrStr(255)).required(displayErrorMsg(intl.formatMessage({ id: 'userRequireEnglishName' }))), chCompanyName: yup.string().max(255, displayErrorMsg(intl.formatMessage({ id: 'userRequireChineseName' }))).nullable(), - addressLine1: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))), - addressLine2: yup.string().max(40, displayErrorMsg(intl.formatMessage({ id: 'noMoreThen40Words' }))), - addressLine3: yup.string().max(40, displayErrorMsg(intl.formatMessage({ id: 'noMoreThen40Words' }))), + addressLine1: yup.string().max(40, getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))), + addressLine2: yup.string().max(40, getMaxErrStr(40)), + addressLine3: yup.string().max(40, getMaxErrStr(40)), + contactPerson: yup.string().max(60, getMaxErrStr(60)).required(getRequiredErrStr("contactPerson")), fax_countryCode: yup.string().min(3, displayErrorMsg(intl.formatMessage({ id: 'requireDialingCode' }))).nullable(), tel_countryCode: yup.string().min(3, displayErrorMsg(intl.formatMessage({ id: 'requireDialingCode' }))), phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'requiredValidNumber' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireContactNumber' }))), From 43af5c2099552895828f9e514979c89d523645ab Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 16:37:38 +0800 Subject: [PATCH 07/11] My Remarks max 100 characters --- .../ApplyForm/PublicNoticeApplyForm.js | 7 ++++- .../UserInformationCard_Individual.js | 26 ++++++++++++++----- .../UserInformationCard_Individual_Pub.js | 15 +++++++++-- .../auth-forms/BusCustomFormWizard.js | 2 +- src/utils/FieldUtils.js | 3 +++ 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index 5d5cd95..31a9b83 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -52,6 +52,10 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { // loadedData.careOf = loadedData.contactPerson // },[]); + function getMaxErrStr(num, fieldname){ + return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}); + } + const formik = useFormik({ enableReinitialize: true, initialValues: loadedData, @@ -61,7 +65,8 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { fax_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})), phoneNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).required(intl.formatMessage({id: 'requireContactNumber'})), faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})), - remarks: yup.string().max(255,intl.formatMessage({id: 'noMoreThen255Words'})).nullable(), + remarks: yup.string().max(100,getMaxErrStr(100)).nullable(), + careOf: yup.string().max(30,getMaxErrStr(30)).nullable(), }), onSubmit: values => { if (!values.issueId) { diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js index 6b47d89..97c31f3 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js @@ -40,23 +40,35 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { } }, [currentUserData]); + + function getMaxErrStr(num, fieldname){ + return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}); + } + + function getRequiredErrStr(fieldname){ + return intl.formatMessage({ id: 'require'},{fieldname:fieldname?intl.formatMessage({ id: fieldname}):""}); + } + + + const formik = useFormik({ enableReinitialize: true, initialValues: currentUserData, validationSchema: yup.object().shape({ - enName: yup.string().max(255).required(intl.formatMessage({id: 'userRequireEnglishName'})), - chName: yup.string().max(255).required(intl.formatMessage({id: 'userRequireChineseName'})), - addressLine1: yup.string().max(40).required(intl.formatMessage({id: 'validateAddressLine1'})), - addressLine2: yup.string().max(40).nullable(), - addressLine3: yup.string().max(40).nullable(), + enName: yup.string().max(40, getMaxErrStr(40)).required(intl.formatMessage({id: 'userRequireEnglishName'})), + chName: yup.string().max(6, getMaxErrStr(6)).required(intl.formatMessage({id: 'userRequireChineseName'})), + addressLine1: yup.string().max(40, getMaxErrStr(40)).required(intl.formatMessage({id: 'validateAddressLine1'})), + addressLine2: yup.string().max(40, getMaxErrStr(40)).nullable(), + addressLine3: yup.string().max(40, getMaxErrStr(40)).nullable(), emailAddress: yup.string().email(intl.formatMessage({id: 'validEmailFormat'})).max(255).required(intl.formatMessage({id: 'requireEmail'})), identification: yup.string().min(7, intl.formatMessage({id: 'requireIdDocNumber'})).required(intl.formatMessage({id: 'requireIdDocNumber'})), - checkDigit: yup.string().max(1).required(intl.formatMessage({id: 'requiredNumberInQuote'})).nullable(), - idDocType: yup.string().max(255).required(intl.formatMessage({id: 'requireIdDocType'})), + checkDigit: yup.string().max(1, getMaxErrStr(1)).required(intl.formatMessage({id: 'requiredNumberInQuote'})).nullable(), + idDocType: yup.string().max(255, getMaxErrStr(255)).required(intl.formatMessage({id: 'requireIdDocType'})), tel_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})).required(intl.formatMessage({id: 'requireDialingCode'})), fax_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})), phoneNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).required(intl.formatMessage({id: 'requireContactNumber'})), faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).nullable(), + district: yup.string().required(getRequiredErrStr("district")), }), onSubmit: values => { if (values.country==null){ diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js index 3f677f7..0422ab0 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js @@ -39,12 +39,22 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { } }, [currentUserData]); + + function getMaxErrStr(num, fieldname){ + return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}); + } + + function getRequiredErrStr(fieldname){ + return intl.formatMessage({ id: 'require'},{fieldname:fieldname?intl.formatMessage({ id: fieldname}):""}); + } + + const formik = useFormik({ enableReinitialize: true, initialValues: currentUserData, validationSchema: yup.object().shape({ - enName: yup.string().max(255).required(intl.formatMessage({id: 'userRequireEnglishName'})), - chName: yup.string().max(255).required(intl.formatMessage({id: 'userRequireChineseName'})), + enName: yup.string().max(40, getMaxErrStr(40)).required(intl.formatMessage({id: 'userRequireEnglishName'})), + chName: yup.string().max(6, getMaxErrStr(6)).required(intl.formatMessage({id: 'userRequireChineseName'})), addressLine1: yup.string().max(40).required(intl.formatMessage({id: 'validateAddressLine1'})), addressLine2: yup.string().max(40).nullable(), addressLine3: yup.string().max(40).nullable(), @@ -53,6 +63,7 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { fax_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})), phoneNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).required(intl.formatMessage({id: 'requireContactNumber'})), faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).nullable(), + district: yup.string().required(getRequiredErrStr("district")), }), onSubmit: values => { if (values.country==null){ diff --git a/src/pages/authentication/auth-forms/BusCustomFormWizard.js b/src/pages/authentication/auth-forms/BusCustomFormWizard.js index 04c1d0e..2217fbb 100644 --- a/src/pages/authentication/auth-forms/BusCustomFormWizard.js +++ b/src/pages/authentication/auth-forms/BusCustomFormWizard.js @@ -533,7 +533,7 @@ const BusCustomFormWizard = (props) => { is: (enCompanyName) => !enCompanyName || enCompanyName.length === 0, then: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'validateEngOrChiName'}))), }), - chName: yup.string().max(255).required(displayErrorMsg(intl.formatMessage({id: 'userRequireChineseName'}))), + chName: yup.string().max(6, getMaxErrStr(6)).required(displayErrorMsg(intl.formatMessage({id: 'userRequireChineseName'}))), address1: yup.string().max(40, getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine1'}))), address2: yup.string().max(40, getMaxErrStr(40)), address3: yup.string().max(40, getMaxErrStr(40)), diff --git a/src/utils/FieldUtils.js b/src/utils/FieldUtils.js index 5e08b63..96e742e 100644 --- a/src/utils/FieldUtils.js +++ b/src/utils/FieldUtils.js @@ -153,6 +153,7 @@ export const getAddressField = ({ label, valueName, form, disabled }) => { } export const getComboField = ({ label, dataList, valueName, form, disabled, getOptionLabel, onInputChange, onChange, filterOptions, ...props }) => { + let err = Boolean(form.errors[valueName]); return {label} @@ -163,6 +164,8 @@ export const getComboField = ({ label, dataList, valueName, form, disabled, getO disabled={disabled} dataList={dataList} form={form} + error={err} + helperText={form.errors[valueName] ? form.errors[valueName] : ''} filterOptions={filterOptions} getOptionLabel={getOptionLabel} onInputChange={onInputChange} From 0c66d7f506488c1939f46b9f9d0122723fc1f42d Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 16:48:30 +0800 Subject: [PATCH 08/11] password & enName & chName & email set length --- src/pages/_Test/Mail/index.js | 6 +++++- .../ForgotUsername/AuthCallback/index.js | 7 +++++++ src/pages/authentication/auth-forms/AuthLogin.js | 9 +++++++-- src/pages/authentication/auth-forms/AuthRegister.js | 13 +++++++++---- .../auth-forms/BusCustomFormWizard.js | 2 +- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/pages/_Test/Mail/index.js b/src/pages/_Test/Mail/index.js index e469905..2af30a0 100644 --- a/src/pages/_Test/Mail/index.js +++ b/src/pages/_Test/Mail/index.js @@ -24,11 +24,15 @@ const Mail = () => { const [isResponsPopUp, setIsResponsPopUp] = React.useState(false); const [responsText, setResponsText] = React.useState(""); + function getMaxErrStr(num, fieldname){ + return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}); + } + const formik = useFormik({ enableReinitialize:true, initialValues:{email:""}, validationSchema:yup.object().shape({ - email: yup.string().max(255).required(intl.formatMessage({id: 'require'}) + 'e-Mail') + email: yup.string().max(128, getMaxErrStr(128)).required(intl.formatMessage({id: 'require'}) + 'e-Mail') }), onSubmit:values=>{ console.log(values); diff --git a/src/pages/authentication/ForgotUsername/AuthCallback/index.js b/src/pages/authentication/ForgotUsername/AuthCallback/index.js index ea9a78c..739ad95 100644 --- a/src/pages/authentication/ForgotUsername/AuthCallback/index.js +++ b/src/pages/authentication/ForgotUsername/AuthCallback/index.js @@ -158,6 +158,11 @@ const Index = () => { // setLevel(strengthColorChi(temp)); }; + function getMaxErrStr(num, fieldname){ + return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}); + } + + const formik = useFormik({ enableReinitialize: true, initialValues: { @@ -170,6 +175,7 @@ const Index = () => { // emailVerifyHash: yup.string().required(intl.formatMessage({id: 'requireSecurityCode'})), // username: yup.string().required(intl.formatMessage({id: 'requireUsername'})), password: yup.string().min(8, intl.formatMessage({id: 'atLeast8CharPassword'})) + .max(60, getMaxErrStr(60)) .required(intl.formatMessage({id: 'requirePassword'})) .matches(/^\S*$/, { message: (intl.formatMessage({id: 'noSpacePassword'}))}) .matches(/^(?=.*[a-z])/, { message: intl.formatMessage({id: 'atLeastOneSmallLetter'})}) @@ -177,6 +183,7 @@ const Index = () => { .matches(/^(?=.*[0-9])/, { message: intl.formatMessage({id: 'atLeast1Number'})}) .matches(/^(?=.*[!@#%&])/, { message: intl.formatMessage({id: 'atLeast1SpecialChar'})}), confirmPassword: yup.string().min(8, intl.formatMessage({id: 'atLeast8CharPassword'})) + .max(60, getMaxErrStr(60)) .required(intl.formatMessage({id: 'pleaseConfirmPassword'})) .oneOf([yup.ref('password'), null], intl.formatMessage({id: 'samePassword'})), }), diff --git a/src/pages/authentication/auth-forms/AuthLogin.js b/src/pages/authentication/auth-forms/AuthLogin.js index 4eb1de5..5812737 100644 --- a/src/pages/authentication/auth-forms/AuthLogin.js +++ b/src/pages/authentication/auth-forms/AuthLogin.js @@ -103,6 +103,11 @@ const AuthLogin = () => { const onPasswordChange = (event) => { setUserPassword(event.target.value); } + + function getMaxErrStr(num, fieldname){ + return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}); +} + return ( <> { submit: null }} validationSchema={Yup.object().shape({ - email: Yup.string().email('Must be a valid email').max(255).required('Email is required'), - password: Yup.string().max(255).required('Password is required') + email: Yup.string().max(128,getMaxErrStr(128)).email('Must be a valid email').required('Email is required'), + password: Yup.string().max(60, getMaxErrStr(60)).required('Password is required') })} onSubmit={async (values, { setErrors, setStatus, setSubmitting }) => { try { diff --git a/src/pages/authentication/auth-forms/AuthRegister.js b/src/pages/authentication/auth-forms/AuthRegister.js index d0bb0be..c0c626d 100644 --- a/src/pages/authentication/auth-forms/AuthRegister.js +++ b/src/pages/authentication/auth-forms/AuthRegister.js @@ -52,6 +52,11 @@ const AuthRegister = () => { changePassword(''); }, []); + function getMaxErrStr(num, fieldname){ + return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}); +} + + return ( <> { submit: null }} validationSchema={Yup.object().shape({ - firstname: Yup.string().max(255).required('First Name is required'), - lastname: Yup.string().max(255).required('Last Name is required'), - email: Yup.string().email('Must be a valid email').max(255).required('Email is required'), - password: Yup.string().max(255).required('Password is required') + firstname: Yup.string().max(30, getMaxErrStr(30)).required('First Name is required'), + lastname: Yup.string().max(30, getMaxErrStr(30)).required('Last Name is required'), + email: Yup.string().email('Must be a valid email').max(128, getMaxErrStr(128)).required('Email is required'), + password: Yup.string().max(60, getMaxErrStr(60)).required('Password is required') })} onSubmit={async (values, { setErrors, setStatus, setSubmitting }) => { try { diff --git a/src/pages/authentication/auth-forms/BusCustomFormWizard.js b/src/pages/authentication/auth-forms/BusCustomFormWizard.js index 2217fbb..10191cc 100644 --- a/src/pages/authentication/auth-forms/BusCustomFormWizard.js +++ b/src/pages/authentication/auth-forms/BusCustomFormWizard.js @@ -537,7 +537,7 @@ const BusCustomFormWizard = (props) => { address1: yup.string().max(40, getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine1'}))), address2: yup.string().max(40, getMaxErrStr(40)), address3: yup.string().max(40, getMaxErrStr(40)), - email: yup.string().email(displayErrorMsg(intl.formatMessage({id: 'validEmailFormat'}))).max(255, getMaxErrStr(128)).required(displayErrorMsg(intl.formatMessage({id: 'requireEmail'}))), + 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'}))), phoneCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast2Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))), faxCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast2Number'}))), From aea423335c60c01bf70b68056af3c0d00f97451a Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 17:10:01 +0800 Subject: [PATCH 09/11] fix The cursor is moved up. --- .../Details_GLD/StatusChangeDialog.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/pages/PublicNotice/Details_GLD/StatusChangeDialog.js b/src/pages/PublicNotice/Details_GLD/StatusChangeDialog.js index 2c96ae6..86222af 100644 --- a/src/pages/PublicNotice/Details_GLD/StatusChangeDialog.js +++ b/src/pages/PublicNotice/Details_GLD/StatusChangeDialog.js @@ -88,22 +88,25 @@ const StatusChangeDialog = (props) => { const getNotAcceptedContent = () => { setContent( - + + { setRemarks(newValues.target.value); setHelperText(""); }} - > - + variant="outlined" + InputProps={ + { + style: { minHeight: '42.5px', maxHeight: '50vh', height: 'auto' }, + } + } + /> ); @@ -119,7 +122,7 @@ const StatusChangeDialog = (props) => { - {props.gazetteIssue + ", "}{props.issueNum + ", "}{props.issueDate} + {props.gazetteIssue + ", "}{props.issueNum + ", "}{props.issueDate} From da1dc822cb7189916be94a448032b3ac9bbc3c6c Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 17:16:09 +0800 Subject: [PATCH 10/11] update app clientDetail type --- src/pages/PublicNotice/Details_GLD/ClientDetailCard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/PublicNotice/Details_GLD/ClientDetailCard.js b/src/pages/PublicNotice/Details_GLD/ClientDetailCard.js index 5145ed7..999abe8 100644 --- a/src/pages/PublicNotice/Details_GLD/ClientDetailCard.js +++ b/src/pages/PublicNotice/Details_GLD/ClientDetailCard.js @@ -154,7 +154,7 @@ const ClientDetailCard = ( size="small" {...register("type", { - value: currentApplicationDetailData.type, + value: currentApplicationDetailData.type == "ORG" ? "Organisation":"Individual", })} id='type' sx={{ From 959bd2a16b14274081ac558ada47b639f5bcaf9a Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 20 Feb 2024 17:34:03 +0800 Subject: [PATCH 11/11] update public reason --- .../Details_Public/ApplicationDetailCard.js | 163 +++++++++--------- src/translations/en.json | 1 + src/translations/zh-CN.json | 1 + src/translations/zh-HK.json | 1 + 4 files changed, 85 insertions(+), 81 deletions(-) diff --git a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js index e2f1516..71a8ec2 100644 --- a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js @@ -37,10 +37,10 @@ import { import CloseIcon from '@mui/icons-material/Close'; import EditNoteIcon from '@mui/icons-material/EditNote'; import DownloadIcon from '@mui/icons-material/Download'; -import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; -import {ThemeProvider} from "@emotion/react"; +import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst"; +import { ThemeProvider } from "@emotion/react"; import * as React from "react"; -import {FormattedMessage, useIntl} from "react-intl"; +import { FormattedMessage, useIntl } from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const ApplicationDetailCard = ( { applicationDetailData, @@ -146,40 +146,40 @@ const ApplicationDetailCard = ( mb={2} > - { - currentApplicationDetailData.status == "confirmed" ? - - : null - } - + { + currentApplicationDetailData.status == "confirmed" ? + + : null + } + - +
@@ -191,7 +191,7 @@ const ApplicationDetailCard = ( - : + : @@ -221,36 +221,37 @@ const ApplicationDetailCard = ( - : + : - {currentApplicationDetailData.status? StatusUtils.getStatusByTextIntl(currentApplicationDetailData.status, false,intl) : ""} + {currentApplicationDetailData.status ? StatusUtils.getStatusByTextIntl(currentApplicationDetailData.status, false, intl) : ""} - { - currentApplicationDetailData.reason ? - - - - - 原因: - - - - - {currentApplicationDetailData.reason} - - - - + + + { + currentApplicationDetailData.reason ? + + + + + : + + + + {currentApplicationDetailData.reason} + + + + - : "" - } - + + : "" + } - : + : @@ -302,12 +303,12 @@ const ApplicationDetailCard = ( - + - : + : @@ -341,7 +342,7 @@ const ApplicationDetailCard = ( - : + : @@ -366,12 +367,12 @@ const ApplicationDetailCard = ( - + - : + : @@ -406,7 +407,7 @@ const ApplicationDetailCard = ( - : + : @@ -455,7 +456,7 @@ const ApplicationDetailCard = ( - (HK$): + (HK$): @@ -474,7 +475,7 @@ const ApplicationDetailCard = ( - : + : @@ -525,12 +526,12 @@ const ApplicationDetailCard = ( - : + : - + @@ -577,7 +578,7 @@ const ApplicationDetailCard = ( - : + : @@ -601,31 +602,31 @@ const ApplicationDetailCard = ( > - + - (HK$): {FormatUtils.currencyFormat(fee)} + (HK$): {FormatUtils.currencyFormat(fee)} + + + + @@ -653,10 +654,10 @@ const ApplicationDetailCard = ( diff --git a/src/translations/en.json b/src/translations/en.json index 4be6f6d..ccfaf82 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -12,6 +12,7 @@ "gazetteDate": "GazetteDate", "gazetteLength": "length", "gazetteSampleName": "Gazette Supplement No. 6", + "reason": "Reason", "payInstantly": "Instant online payment", "payLater": "Pay later", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index e63ff8e..6058668 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -12,6 +12,7 @@ "gazetteDate": "宪报日期", "gazetteLength": "长度", "gazetteSampleName": "宪报第6号副刊公告", + "reason": "原因", "payInstantly": "即时网上缴费", "payLater": "稍后缴费", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 3d8e8a1..d3cbdfd 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -12,6 +12,7 @@ "gazetteDate": "憲報日期", "gazetteLength": "長度", "gazetteSampleName": "憲報第6號副刊公告", + "reason": "原因", "payInstantly": "即時網上繳費", "payLater": "稍後繳費",