From 2f2ef07d52bcf9de4fb023f021caff1c54728115 Mon Sep 17 00:00:00 2001 From: "jason.lam" Date: Thu, 11 Jan 2024 11:40:30 +0800 Subject: [PATCH] update form --- src/components/cards/AuthFooter.js | 4 +- .../DetailPage/OrganizationCard.js | 8 +- .../OrganizationCard_loadFromUser.js | 6 +- .../ApplyForm/PublicNoticeApplyForm.js | 8 +- .../Details_Public/ApplicationDetailCard.js | 9 ++- .../UserInformationCard_Individual.js | 14 ++-- .../UserInformationCard_Organization.js | 12 +-- .../auth-forms/BusCustomFormWizard.js | 81 ++++++++++--------- .../auth-forms/CustomFormWizard.js | 70 +++++++++------- .../auth-forms/IAmSmartFormWizard.js | 56 +++++++------ src/themes/buttonConst.js | 16 ++-- src/themes/themeConst.js | 2 +- src/translations/en.json | 34 +++++++- src/translations/zh-CN.json | 32 ++++++++ src/translations/zh-HK.json | 32 ++++++++ src/utils/ComboData.js | 6 +- src/utils/password-strength.js | 10 +-- 17 files changed, 263 insertions(+), 137 deletions(-) diff --git a/src/components/cards/AuthFooter.js b/src/components/cards/AuthFooter.js index aca9d0d..01f40be 100644 --- a/src/components/cards/AuthFooter.js +++ b/src/components/cards/AuthFooter.js @@ -32,8 +32,8 @@ const AuthFooter = () => { variant="subtitle2" color="secondary" component={Link} - // href="https://codedthemes.com" - href="/testMailPage" + href="https://www.gld.gov.hk/zh-hk/privacy-policy/" + //href="/testMailPage" target="_blank" underline="hover" > diff --git a/src/pages/Organization/DetailPage/OrganizationCard.js b/src/pages/Organization/DetailPage/OrganizationCard.js index 3768d63..5a41de4 100644 --- a/src/pages/Organization/DetailPage/OrganizationCard.js +++ b/src/pages/Organization/DetailPage/OrganizationCard.js @@ -52,10 +52,10 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { addressLine1: yup.string().max(255).required(displayErrorMsg('請輸入第一行地址')), addressLine2: yup.string().max(255, displayErrorMsg("length must <= 255")), addressLine3: yup.string().max(255, displayErrorMsg("length must <= 255")), - fax_countryCode: yup.string().min(3, displayErrorMsg('請輸入國際區號')).nullable(), - tel_countryCode: yup.string().min(3, displayErrorMsg('請輸入國際區號')), - phoneNumber: yup.string().min(8, displayErrorMsg('請輸入有效聯絡電話')).required(displayErrorMsg('請輸入聯絡電話')), - faxNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).nullable(), + 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'}))), + faxNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'require8Number'}))).nullable(), brExpiryDate: yup.string().min(8).required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertValidityDate'}))), brNo: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertNumber'}))).test('checkBrNoFormat', displayErrorMsg(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInValidBusinessRegCertNumber'}))), function (value) { var brNo_pattern = /[0-9]{8}/ diff --git a/src/pages/Organization/DetailPage_FromUser/OrganizationCard_loadFromUser.js b/src/pages/Organization/DetailPage_FromUser/OrganizationCard_loadFromUser.js index 9c5d49f..ed8991e 100644 --- a/src/pages/Organization/DetailPage_FromUser/OrganizationCard_loadFromUser.js +++ b/src/pages/Organization/DetailPage_FromUser/OrganizationCard_loadFromUser.js @@ -50,9 +50,9 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { addressLine1: yup.string().max(255).required(displayErrorMsg('請輸入第一行地址')), addressLine2: yup.string().max(255).nullable(), addressLine3: yup.string().max(255).nullable(), - fax_countryCode: yup.string().min(3, displayErrorMsg("請輸入國際區號")).nullable(), - tel_countryCode: yup.string().min(3, displayErrorMsg("請輸入國際區號")), - phoneNumber: yup.string().min(8, displayErrorMsg('請輸入有效聯絡電話')).required(displayErrorMsg('請輸入聯絡電話')), + 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'}))), faxNumber: yup.string().min(8).nullable(), brExpiryDate: yup.string().min(8).required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertValidityDate'}))), brNo: yup.string().max(8).required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertNumber'}))) diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index 4ec3444..e60c971 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -53,10 +53,10 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { initialValues: loadedData, validationSchema: yup.object().shape({ contactPerson: yup.string().max(40, "不得超過 40 個字符").required('請輸入聯絡人'), - tel_countryCode: yup.string().min(3, '請輸入3位數字').required('請輸入國際區號'), - fax_countryCode: yup.string().min(3, '請輸入3位數字'), - phoneNumber: yup.string().min(8, '請輸入8位數字').required('請輸入聯絡電話'), - faxNumber: yup.string().min(8, '請輸入8位數字'), + 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'})), remarks: yup.string().max(255, "不得超過 255 個字符").nullable(), }), onSubmit: values => { diff --git a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js index 572db9f..755461c 100644 --- a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js @@ -40,6 +40,7 @@ import DownloadIcon from '@mui/icons-material/Download'; import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; import * as React from "react"; +import {FormattedMessage} from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const ApplicationDetailCard = ( { applicationDetailData, @@ -390,7 +391,9 @@ const ApplicationDetailCard = ( - 聯絡電話: + + : + @@ -454,7 +457,9 @@ const ApplicationDetailCard = ( - 傳真號碼: + + : + diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js index 3213ec9..a8638de 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js @@ -38,19 +38,19 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { enableReinitialize: true, initialValues: currentUserData, validationSchema: yup.object().shape({ - enName: yup.string().max(255).required('請輸入英文姓名'), - chName: yup.string().max(255).required('請輸入中文姓名'), + enName: yup.string().max(255).required(intl.formatMessage({id: 'userRequireEnglishName'})), + chName: yup.string().max(255).required(intl.formatMessage({id: 'userRequireChineseName'})), addressLine1: yup.string().max(255).required('請輸入第一行地址'), addressLine2: yup.string().max(255).nullable(), addressLine3: yup.string().max(255).nullable(), - emailAddress: yup.string().email('請輸入電郵格式').max(255).required('請輸入電郵'), + emailAddress: yup.string().email(intl.formatMessage({id: 'validEmailFormat'})).max(255).required(intl.formatMessage({id: 'requireEmail'})), identification: yup.string().min(7, "請輸入證件號碼").required('請輸入證件號碼'), checkDigit: yup.string().max(1).required('請輸入括號內的數字或字母').nullable(), idDocType: yup.string().max(255).required('請輸入證件類別'), - tel_countryCode: yup.string().min(3, '請輸入3位數字').required('請輸入國際區號'), - fax_countryCode: yup.string().min(3, '請輸入3位數字'), - phoneNumber: yup.string().min(8, '請輸入8位數字').required('請輸入聯絡電話'), - faxNumber: yup.string().min(8, '請輸入8位數字').nullable(), + 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(), }), onSubmit: values => { console.log(values); diff --git a/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js b/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js index 7342f4d..c891efa 100644 --- a/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js +++ b/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js @@ -47,17 +47,17 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => enableReinitialize: true, initialValues: currentUserData, validationSchema: yup.object().shape({ - contactPerson: yup.string().max(255).required(displayErrorMsg('請輸入姓名')), + contactPerson: yup.string().max(255).required(displayErrorMsg(intl.formatMessage({id: 'userRequireName'}))), enCompanyName: yup.string().max(255).required(displayErrorMsg('請輸入英文名稱')), chCompanyName: yup.string().max(255).nullable(), addressLine1: yup.string().max(255).required(displayErrorMsg('請輸入第一行地址')), addressLine2: yup.string().max(255).nullable(), addressLine3: yup.string().max(255).nullable(), - emailBus: yup.string().max(255).required(displayErrorMsg('請輸入電郵')), - tel_countryCode: yup.string().min(3, displayErrorMsg('請輸入3位數字')).required(displayErrorMsg('請輸入國際區號')), - fax_countryCode: yup.string().min(3, displayErrorMsg('請輸入3位數字')).nullable(), - phoneNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).required(displayErrorMsg('請輸入聯絡電話')), - faxNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).nullable(), + emailBus: yup.string().max(255).required(displayErrorMsg(intl.formatMessage({id: 'requireEmail'}))), + tel_countryCode: yup.string().min(3, displayErrorMsg(intl.formatMessage({id: 'require3Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))), + fax_countryCode: yup.string().min(3, displayErrorMsg(intl.formatMessage({id: 'require3Number'}))).nullable(), + phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'require8Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))), + faxNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'require8Number'}))).nullable(), brExpiryDate: yup.string().min(8, 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) { diff --git a/src/pages/authentication/auth-forms/BusCustomFormWizard.js b/src/pages/authentication/auth-forms/BusCustomFormWizard.js index ec29456..bb6a298 100644 --- a/src/pages/authentication/auth-forms/BusCustomFormWizard.js +++ b/src/pages/authentication/auth-forms/BusCustomFormWizard.js @@ -89,7 +89,7 @@ const BusCustomFormWizard = (props) => { }; const [selectedAddress4, setSelectedAddress4] = useState(null); - const [selectedAddress5, setSelectedAddress5] = useState(ComboData.country[0]); + const [selectedAddress5, setSelectedAddress5] = useState(ComboData.country(intl)[0]); const [termsAndConAccept, setTermsAndConAccept] = useState(false); const [termsAndConNotAccept, setTermsAndConNotAccept] = useState(false); const [isValid, setisValid] = useState(false); @@ -102,7 +102,7 @@ const BusCustomFormWizard = (props) => { const [checkEmailBlur, setCheckEmailBlur] = useState(false) const address4ComboList = ComboData.district; - const address5ComboList = ComboData.country; + const address5ComboList = ComboData.country(intl); const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" + "但有絕對酌情權隨時刪除、暫停登載或編輯各項資料而無須給予任何理由。\n由於任何與網址" + "內資料有關的理由或原因,而導致出現申索、損失或損害,本署概不負責。\n使用者須自行評" @@ -506,7 +506,7 @@ const BusCustomFormWizard = (props) => { .matches(/^(?=.*[0-9])/, { message: displayErrorMsg('請包括最少1個數字') }) .matches(/^(?=.*[!@#%&])/, { message: displayErrorMsg('請包括最少1個特殊字符') }), confirmPassword: yup.string().min(8, displayErrorMsg('請最少輸入8位密碼')).required(displayErrorMsg(intl.formatMessage({id: 'pleaseConfirmPassword'}))).oneOf([yup.ref('password'), null], displayErrorMsg('請輸入相同密碼')), - enName: yup.string().max(255).required(displayErrorMsg('請輸入英文姓名')), + enName: yup.string().max(255).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')), @@ -515,16 +515,16 @@ const BusCustomFormWizard = (props) => { is: (enCompanyName) => !enCompanyName || enCompanyName.length === 0, then: yup.string().required(displayErrorMsg('請輸入英文或中文名稱')), }), - chName: yup.string().max(255).required(displayErrorMsg('請輸入中文姓名')), + chName: yup.string().max(255).required(displayErrorMsg(intl.formatMessage({id: 'userRequireChineseName'}))), address1: yup.string().max(255).required(displayErrorMsg('請輸入第一行地址')), address2: yup.string().max(255).required(displayErrorMsg('請輸入第二行地址')), address3: yup.string().max(255).required(displayErrorMsg('請輸入第三行地址')), - email: yup.string().email(displayErrorMsg('請輸入電郵格式')).max(255).required(displayErrorMsg('請輸入電郵')), - emailConfirm: yup.string().email(displayErrorMsg('請輸入電郵格式')).max(255).required(displayErrorMsg('請輸入電郵')).oneOf([yup.ref('email'), null], displayErrorMsg('請輸入相同電郵')), - phoneCountryCode: yup.string().min(2, displayErrorMsg('請輸入最少2位數字')).required(displayErrorMsg('請輸入國際區號')), - faxCountryCode: yup.string().min(2, displayErrorMsg('請輸入最少2位數字')), - phone: yup.string().min(8, displayErrorMsg('請輸入最少8位數字')).required(displayErrorMsg('請輸入聯絡電話')), - fax: yup.string().min(8, displayErrorMsg('請輸入最少8位數字')), + 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'}))), + 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'}))), + fax: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast8Number'}))), 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'}))), @@ -539,7 +539,7 @@ const BusCustomFormWizard = (props) => { } } }), - captchaField: yup.string().required(displayErrorMsg('請輸入驗證')),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')) + captchaField: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'requireVerify'}))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')) }, ['enCompanyName', 'chCompanyName']), }); @@ -547,7 +547,7 @@ const BusCustomFormWizard = (props) => { const handleReset = (resetForm) => { resetForm(); setSelectedAddress4("") - setSelectedAddress5(ComboData.country[0]) + setSelectedAddress5(ComboData.country(intl)[0]) setCheckCountry(false) setFileList([]) setFileListData([]) @@ -695,7 +695,7 @@ const BusCustomFormWizard = (props) => { - {level?.label} + @@ -976,9 +976,10 @@ const BusCustomFormWizard = (props) => { onChange={(event, newValue) => { setSelectedAddress4(newValue); }} - sx={{ "& .MuiInputBase-root": { height: "41px" }, "#address4-combo": { padding: "0px 0px 0px 3px" }, "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} - renderInput={(params) => } /> { onChange={(event, newValue) => { if (newValue !== null) { setSelectedAddress5(newValue); - if (newValue === '香港') { + if (newValue === intl.formatMessage({id: 'hongKong'})) { setCheckCountry(false) } else { setSelectedAddress4(""); @@ -1002,7 +1003,7 @@ const BusCustomFormWizard = (props) => { }} sx={{ "& .MuiInputBase-root": { height: "41px" }, "#address5-combo": { padding: "0px 0px 0px 3px" }, "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} - renderInput={(params) => } + renderInput={(params) => } /> {formik.touched.address1 && formik.errors.address1 && ( @@ -1023,14 +1024,16 @@ const BusCustomFormWizard = (props) => { - 你的聯絡資料 + + + - 姓名 + * @@ -1065,7 +1068,7 @@ const BusCustomFormWizard = (props) => { - 電郵 + * @@ -1077,7 +1080,7 @@ const BusCustomFormWizard = (props) => { value={formik.values.email.trim()} name="email" onChange={formik.handleChange} - placeholder="電郵" + placeholder={intl.formatMessage({id: 'userContactEmail'})} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -1094,7 +1097,7 @@ const BusCustomFormWizard = (props) => { )} {checkEmail && ( - 此電郵已被注冊,請使用其他電郵 + )} @@ -1103,7 +1106,7 @@ const BusCustomFormWizard = (props) => { - 確認電郵 + * @@ -1116,7 +1119,7 @@ const BusCustomFormWizard = (props) => { name="emailConfirm" // onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder="確認電郵" + placeholder={intl.formatMessage({id: 'confirmEmail'})} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -1143,7 +1146,7 @@ const BusCustomFormWizard = (props) => { - 聯絡電話 + * @@ -1163,7 +1166,7 @@ const BusCustomFormWizard = (props) => { formik.setFieldValue("phoneCountryCode", value); }} endAdornment={-} - placeholder="國際區號" + placeholder={intl.formatMessage({id: 'dialingCode'})} error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} inputProps={{ @@ -1190,7 +1193,7 @@ const BusCustomFormWizard = (props) => { } formik.setFieldValue("phone", value); }} - placeholder="聯絡電話" + placeholder={intl.formatMessage({id: 'userContactNumber'})} error={Boolean(formik.touched.phone && formik.errors.phone)} inputProps={{ maxLength: 11, @@ -1218,7 +1221,7 @@ const BusCustomFormWizard = (props) => { - 傳真號碼 + @@ -1237,7 +1240,7 @@ const BusCustomFormWizard = (props) => { } formik.setFieldValue("faxCountryCode", value); }} - placeholder="國際區號" + placeholder={intl.formatMessage({id: 'dialingCode'})} endAdornment={-} inputProps={{ maxLength: 3, @@ -1263,7 +1266,7 @@ const BusCustomFormWizard = (props) => { } formik.setFieldValue("fax", value); }} - placeholder="傳真號碼" + placeholder={intl.formatMessage({id: 'userFaxNumber'})} inputProps={{ maxLength: 8, onKeyDown: (e) => { @@ -1537,7 +1540,7 @@ const BusCustomFormWizard = (props) => { : null} - 國家/地區: + : {selectedAddress5} @@ -1548,7 +1551,9 @@ const BusCustomFormWizard = (props) => { - 你的聯絡資料 + + + @@ -1564,7 +1569,7 @@ const BusCustomFormWizard = (props) => { - 電郵: + : {formik.values.email} @@ -1574,7 +1579,7 @@ const BusCustomFormWizard = (props) => { - 聯絡電話: + : +{formik.values.phoneCountryCode} {formik.values.phone} @@ -1584,7 +1589,7 @@ const BusCustomFormWizard = (props) => { - 傳真號碼: + : +{formik.values.faxCountryCode} {formik.values.fax} @@ -1617,7 +1622,9 @@ const BusCustomFormWizard = (props) => { 帳戶申請已成功提交。 - 驗證電郵將發送到你的電郵地址,請依指示完成驗證及登入系統。 + + + : diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index 70fa476..a2d0c8c 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -89,7 +89,7 @@ const CustomFormWizard = (props) => { const [selectedIdDocInputType, setSelectedIdDocInputType] = useState(""); // const [selectedIdDocLabel, setSelectedIdDocLabel] = useState(null); const [selectedAddress4, setSelectedAddress4] = useState(null); - const [selectedAddress5, setSelectedAddress5] = useState(ComboData.country[0]); + const [selectedAddress5, setSelectedAddress5] = useState(ComboData.country(intl)[0]); const [termsAndConAccept, setTermsAndConAccept] = useState(false); const [termsAndConNotAccept, setTermsAndConNotAccept] = useState(false); const [isValid, setisValid] = useState(false); @@ -103,7 +103,7 @@ const CustomFormWizard = (props) => { const idDocTypeComboList = ComboData.idDocType; const address4ComboList = ComboData.district; - const address5ComboList = ComboData.country; + const address5ComboList = ComboData.country(intl); const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" + "但有絕對酌情權隨時刪除、暫停登載或編輯各項資料而無須給予任何理由。\n由於任何與網址" + "內資料有關的理由或原因,而導致出現申索、損失或損害,本署概不負責。\n使用者須自行評" @@ -564,13 +564,13 @@ const CustomFormWizard = (props) => { .matches(/^(?=.*[0-9])/, { message: displayErrorMsg('請包括最少1個數字') }) .matches(/^(?=.*[!@#%&])/, { message: displayErrorMsg('請包括最少1個特殊字符') }), confirmPassword: yup.string().min(8, displayErrorMsg('請最少輸入8位密碼')).required(displayErrorMsg(intl.formatMessage({id: 'pleaseConfirmPassword'}))).oneOf([yup.ref('password'), null], displayErrorMsg('請輸入相同密碼')), - enName: yup.string().max(255).required(displayErrorMsg('請輸入英文姓名')), - chName: yup.string().max(6).required(displayErrorMsg('請輸入中文姓名')), + 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(255).required(displayErrorMsg('請輸入第一行地址')), address2: yup.string().max(255).required(displayErrorMsg('請輸入第二行地址')), address3: yup.string().max(255).required(displayErrorMsg('請輸入第三行地址')), - email: yup.string().email(displayErrorMsg('請輸入電郵格式')).max(255).required(displayErrorMsg('請輸入電郵')), - emailConfirm: yup.string().email(displayErrorMsg('請輸入電郵格式')).max(255).required(displayErrorMsg('請輸入電郵')).oneOf([yup.ref('email'), null], displayErrorMsg('請輸入相同電郵')), + 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'}))), idNo: yup.string().required(displayErrorMsg(`請輸入${selectedIdDocInputType}號碼`)) .matches(/^[aA-zZ0-9\s]+$/, { message: displayErrorMsg(`${selectedIdDocInputType}號碼不包含特殊字符`) }) .matches(/^\S*$/, { message: displayErrorMsg(`${selectedIdDocInputType}號碼不包含空格`) }) @@ -627,18 +627,18 @@ const CustomFormWizard = (props) => { }), checkDigit: yup.string().max(1).required(displayErrorMsg('請輸入括號內的數字或字母')), idDocType: yup.string().max(255).required(displayErrorMsg('請輸入證件類別')), - phoneCountryCode: yup.string().min(2, displayErrorMsg('請輸入最少2位數字')).required(displayErrorMsg('請輸入國際區號')), + 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('請輸入最少8位數字')).required(displayErrorMsg('請輸入聯絡電話')), + 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('請輸入驗證')),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), + captchaField: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'requireVerify'}))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), }), }); const handleReset = (resetForm) => { resetForm(); setSelectedAddress4("") - setSelectedAddress5(ComboData.country[0]) + setSelectedAddress5(ComboData.country(intl)[0]) setCheckCountry(false) setSelectedIdDocType({}) setSelectedIdDocInputType(""); @@ -1181,7 +1181,9 @@ const CustomFormWizard = (props) => { onChange={(event, newValue) => { setSelectedAddress4(newValue); }} - sx={{ "& .MuiInputBase-root": { height: "41px" }, "#address4-combo": { padding: "0px 0px 0px 3px" }, "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} + sx={{ "& .MuiInputBase-root": { height: "41px" }, + "#address4-combo": { padding: "0px 0px 0px 3px" }, + "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} renderInput={(params) => } /> @@ -1193,7 +1195,7 @@ const CustomFormWizard = (props) => { onChange={(event, newValue) => { if (newValue !== null) { setSelectedAddress5(newValue); - if (newValue === '香港') { + if (newValue === intl.formatMessage({id: 'hongKong'})) { setCheckCountry(false) } else { setSelectedAddress4(""); @@ -1206,7 +1208,7 @@ const CustomFormWizard = (props) => { }} sx={{ "& .MuiInputBase-root": { height: "41px" }, "#address5-combo": { padding: "0px 0px 0px 3px" }, "& .MuiAutocomplete-endAdornment": { top: "auto" }, }} - renderInput={(params) => } + renderInput={(params) => } /> {formik.touched.address1 && formik.errors.address1 && ( @@ -1227,7 +1229,9 @@ const CustomFormWizard = (props) => { - 你的聯絡資料 + + + @@ -1236,7 +1240,7 @@ const CustomFormWizard = (props) => { - 電郵 + * @@ -1248,7 +1252,7 @@ const CustomFormWizard = (props) => { value={formik.values.email.trim()} name="email" onChange={formik.handleChange} - placeholder="電郵" + placeholder={intl.formatMessage({id: 'userContactEmail'})} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -1265,7 +1269,7 @@ const CustomFormWizard = (props) => { )} {checkEmail && ( - 此電郵已被注冊,請使用其他電郵 + )} @@ -1274,7 +1278,7 @@ const CustomFormWizard = (props) => { - 確認電郵 + * @@ -1287,7 +1291,7 @@ const CustomFormWizard = (props) => { name="emailConfirm" // onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder="確認電郵" + placeholder={intl.formatMessage({id: 'confirmEmail'})} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -1314,7 +1318,7 @@ const CustomFormWizard = (props) => { - 聯絡電話 + * @@ -1333,7 +1337,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("phoneCountryCode", value); }} - placeholder="國際區號" + placeholder={intl.formatMessage({id: 'dialingCode'})} error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} endAdornment={-} @@ -1361,7 +1365,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("phone", value); }} - placeholder="聯絡電話" + placeholder={intl.formatMessage({id: 'userContactNumber'})} error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} inputProps={{ @@ -1390,7 +1394,7 @@ const CustomFormWizard = (props) => { - 傳真號碼 + @@ -1408,7 +1412,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("faxCountryCode", value); }} - placeholder="國際區號" + placeholder={intl.formatMessage({id: 'dialingCode'})} onBlur={formik.handleBlur} endAdornment={-} inputProps={{ @@ -1435,7 +1439,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("fax", value); }} - placeholder="傳真號碼" + placeholder={intl.formatMessage({id: 'userFaxNumber'})} inputProps={{ maxLength: 8, onKeyDown: (e) => { @@ -1703,7 +1707,7 @@ const CustomFormWizard = (props) => { : null} - 國家/地區: + : {selectedAddress5} @@ -1712,13 +1716,15 @@ const CustomFormWizard = (props) => { - 你的聯絡資料 + + + - 電郵: + : {formik.values.email} @@ -1728,7 +1734,7 @@ const CustomFormWizard = (props) => { - 聯絡電話: + : +{formik.values.phoneCountryCode} {formik.values.phone} @@ -1739,7 +1745,7 @@ const CustomFormWizard = (props) => { - 傳真號碼: + : +{formik.values.faxCountryCode} {formik.values.fax} @@ -1773,7 +1779,9 @@ const CustomFormWizard = (props) => { 帳戶申請已成功提交。 - 驗證電郵將發送到你的電郵地址,請依指示完成驗證及登入系統。 + + + : diff --git a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js index b2e0f1b..ec8e177 100644 --- a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js +++ b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js @@ -366,11 +366,11 @@ const CustomFormWizard = (props) => { address1: yup.string().max(255).required(displayErrorMsg('請輸入第一行地址')), address2: yup.string().max(255).required(displayErrorMsg('請輸入第二行地址')), address3: yup.string().max(255).required(displayErrorMsg('請輸入第三行地址')), - email: yup.string().email(displayErrorMsg('請輸入電郵格式')).max(255).required(displayErrorMsg('請輸入電郵')), - emailConfirm: yup.string().email(displayErrorMsg('請輸入電郵格式')).max(255).required(displayErrorMsg('請輸入電郵')).oneOf([yup.ref('email'), null], displayErrorMsg('請輸入相同電郵')), - phoneCountryCode: yup.string().min(2, displayErrorMsg('請輸入最少2位數字')).required(displayErrorMsg('請輸入國際區號')), - phone: yup.string().min(8, displayErrorMsg('請輸入最少8位數字')).required(displayErrorMsg('請輸入聯絡電話')), - captchaField: yup.string().required(displayErrorMsg('請輸入驗證')),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), + 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('請輸入有效驗證')), }), }); @@ -522,7 +522,7 @@ const CustomFormWizard = (props) => { onChange={(event, newValue) => { if (newValue !== null) { setSelectedAddress5(newValue); - if (newValue == '香港') { + if (newValue === intl.formatMessage({id: 'hongKong'})) { setCheckCountry(false) } else { setSelectedAddress4(""); @@ -535,7 +535,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 && ( @@ -556,7 +556,9 @@ const CustomFormWizard = (props) => { - 你的聯絡資料 + + + @@ -565,7 +567,7 @@ const CustomFormWizard = (props) => { - 電郵 + * {iAmSmartData.email?iAM Smart:null} @@ -578,7 +580,7 @@ const CustomFormWizard = (props) => { value={formik.values.email.trim()} name="email" onChange={formik.handleChange} - placeholder="電郵" + placeholder={intl.formatMessage({id: 'userContactEmail'})} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -595,7 +597,7 @@ const CustomFormWizard = (props) => { )} {checkEmail && ( - 此電郵已被注冊,請使用其他電郵 + )} @@ -604,7 +606,7 @@ const CustomFormWizard = (props) => { - 確認電郵 + * @@ -617,7 +619,7 @@ const CustomFormWizard = (props) => { name="emailConfirm" // onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder="確認電郵" + placeholder={intl.formatMessage({id: 'confirmEmail'})} onBlur={formik.handleBlur} inputProps={{ onKeyDown: (e) => { @@ -644,7 +646,7 @@ const CustomFormWizard = (props) => { - 聯絡電話 + * {iAmSmartData.phone?iAM Smart:null} @@ -664,7 +666,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("phoneCountryCode", value); }} - placeholder="國際區號" + placeholder={intl.formatMessage({id: 'dialingCode'})} error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} inputProps={{ @@ -691,7 +693,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("phone", value); }} - placeholder="聯絡電話" + placeholder={intl.formatMessage({id: 'userContactNumber'})} error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} inputProps={{ @@ -720,7 +722,7 @@ const CustomFormWizard = (props) => { - 傳真號碼 + @@ -738,7 +740,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("faxCountryCode", value); }} - placeholder="國際區號" + placeholder={intl.formatMessage({id: 'dialingCode'})} onBlur={formik.handleBlur} inputProps={{ maxLength: 3, @@ -764,7 +766,7 @@ const CustomFormWizard = (props) => { } formik.setFieldValue("fax", value); }} - placeholder="傳真號碼" + placeholder={intl.formatMessage({id: 'userFaxNumber'})} inputProps={{ maxLength: 8, onKeyDown: (e) => { @@ -963,7 +965,7 @@ const CustomFormWizard = (props) => { : null} - 國家/地區: + : {selectedAddress5} @@ -972,13 +974,15 @@ const CustomFormWizard = (props) => { - 你的聯絡資料 + + + - 電郵: + : {formik.values.email} @@ -988,7 +992,7 @@ const CustomFormWizard = (props) => { - 聯絡電話: + : +{formik.values.phoneCountryCode} {formik.values.phone} @@ -999,7 +1003,7 @@ const CustomFormWizard = (props) => { - 傳真號碼: + : +{formik.values.faxCountryCode} {formik.values.fax} @@ -1022,7 +1026,9 @@ const CustomFormWizard = (props) => { 帳戶申請已成功提交。 - 驗證電郵將發送到你的電郵地址,請依指示完成驗證及登入系統。 + + + : diff --git a/src/themes/buttonConst.js b/src/themes/buttonConst.js index 30f37db..e803fe1 100644 --- a/src/themes/buttonConst.js +++ b/src/themes/buttonConst.js @@ -64,16 +64,16 @@ export const PNSPS_BUTTON_THEME = createTheme({ fontSize: '1.2rem', fontWeight: '600', height: '45px', - width: '35' + + minWidth: '35' + 'vw', // Default width for xs screen sizes '@media (min-width: 600px)': { // sm breakpoint - width: '20vw', + minWidth: '20vw', }, '@media (min-width: 960px)': { // md breakpoint - width: '15vw', + minWidth: '15vw', }, '@media (min-width: 1280px)': { // lg breakpoint - width: '9vw', + minWidth: '9vw', }, textTransform: "none", alignItems: 'normal', @@ -147,15 +147,15 @@ export const PNSPS_LONG_BUTTON_THEME = createTheme({ fontSize: '1.2rem', fontWeight: '600', height: '45px', - width: '60vw', // Default width for xs screen sizes + minWidth: '60vw', // Default width for xs screen sizes '@media (min-width: 600px)': { // sm breakpoint - width: '33vw', + minWidth: '33vw', }, '@media (min-width: 960px)': { // md breakpoint - width: '25vw', + minWidth: '25vw', }, '@media (min-width: 1280px)': { // lg breakpoint - width: '16vw', + minWidth: '16vw', }, textTransform: "none", alignItems: 'normal', diff --git a/src/themes/themeConst.js b/src/themes/themeConst.js index c5f1631..5de47c4 100644 --- a/src/themes/themeConst.js +++ b/src/themes/themeConst.js @@ -235,7 +235,7 @@ export const PNSPS_THEME = createTheme({ minHeight: ROW_HEIGHT, maxHeight: ROW_HEIGHT, boxSizing: 'border-box', // Ensure the background shape follows the size of the TextField - padding: '1px', // Adjust the padding as needed + //padding: '1px', // Adjust the padding as needed }, '& .MuiInputBase-input:disabled': { color: 'rgba(0, 0, 0, 0.8)', diff --git a/src/translations/en.json b/src/translations/en.json index db208e0..8642a68 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -43,10 +43,32 @@ "userName": "Username", "userChineseName": "Chinese Name", "userEnglishName": "English Name", + "userContactName": "Name", + "userRequireChineseName": "Please enter your Chinese name", + "userRequireEnglishName": "Please enter your English name", + "userRequireName": "Please enter your name", + "userContactEmail": "Email", + "confirmEmail": "Confirm Email", + "requireEmail": "Please enter your email", + "validEmailFormat": "Please enter a valid email", + "validSameEmail": "Please enter same email address", + "emailUsed": "This email has been registered, please use another email", + "emailSent": "A verification email will be sent to your email address. Please follow the instructions to complete the verification and log in to the system.", + "userContactNumber": "Contact Number", + "requiredValidNumber": "Please enter a valid contact number", + "requireContactNumber": "Please enter your contact number", + "require3Number": "Please enter an 3-digit number", + "require8Number": "Please enter an 8-digit number", + "requireAtLeast8Number": "Please enter at least 8 digits", + "requireAtLeast2Number": "Please enter at least 2 digits", + "requireDialingCode": "Please enter the international dialing code", + "requireVerify": "Please enter verification", + "dialingCode": "Global Code", + "userFaxNumber": "Fax number", "userIDNo": "ID Card Number", "userEmailAddress": "Email Address", "userPhoneNumber": "Mobile Phone Number", - "userAddress": "Residential Address", + "userAddress": "Address", "personalInformation": "Personal Information", "yourPersonalInformation": "Your Personal Information", @@ -72,6 +94,16 @@ "addressLine2": "Second line", "addressLine3": "Third line", "region": "Region (only applicable to Hong Kong)", + "regionOrCountry": "Country/Region", + "hongKong": "Hong Kong", + "mainland": "Mainland China", + "macau": "Macau", + "yourContact": "Your Contact Information", + + "pwWeak": "Weak", + "pwNormal": "Normal", + "pwGood": "Good", + "pwStrong": "Strong", "Dashboard": "Dashboard", "event": "Event" diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index ae4fb66..61ee66d 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -43,6 +43,28 @@ "userName": "用户名称", "userChineseName": "中文姓名", "userEnglishName": "英文姓名", + "userContactName": "姓名", + "userRequireChineseName": "請輸入中文姓名", + "userRequireEnglishName": "請輸入英文姓名", + "userRequireName": "請輸入姓名", + "userContactEmail": "电邮", + "confirmEmail": "确认电邮", + "requireEmail": "请输入电邮", + "validEmailFormat": "请输入电邮格式", + "validSameEmail": "请输入相同电邮", + "emailUsed": "此电邮已被注册,请使用其他电邮", + "emailSent": "验证电邮将发送到你的电邮地址,请依指示完成验证及登入系统。", + "userContactNumber": "联络电话", + "requiredValidNumber": "请输入有效联络电话", + "requireContactNumber": "请输入联络电话", + "require3Number": "请输入3位数字", + "require8Number": "请输入8位数字", + "requireAtLeast8Number": "请输入最少8位数字", + "requireAtLeast2Number": "请输入最少2位数字", + "requireDialingCode": "请输入国际区号", + "requireVerify": "请输入验证", + "dialingCode": "国际区号", + "userFaxNumber": "传真号码", "userIDNo": "身份证号码", "userEmailAddress": "电邮地址", "userPhoneNumber": "手机号码", @@ -72,6 +94,16 @@ "addressLine2": "第二行", "addressLine3": "第三行", "region": "区域 (只适用于香港)", + "region Or Country": "国家/地区", + "hong Kong": "香港", + "mainland": "内地", + "macau": "澳门", + "yourContact": "你的联络资料", + + "pwWeak": "弱", + "pwNormal": "普通", + "pwGood": "良好", + "pwStrong": "强", "Dashboard": "仪表板", "event": "活动" diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index e6164c0..422ede7 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -43,6 +43,28 @@ "userName": "用戶名稱", "userChineseName": "中文姓名", "userEnglishName": "英文姓名", + "userContactName": "姓名", + "userRequireChineseName": "請輸入中文姓名", + "userRequireEnglishName": "請輸入英文姓名", + "userRequireName": "請輸入姓名", + "userContactEmail": "電郵", + "confirmEmail": "確認電郵", + "requireEmail": "請輸入電郵", + "validEmailFormat": "請輸入電郵格式", + "validSameEmail": "請輸入相同電郵", + "emailUsed": "此電郵已被注冊,請使用其他電郵", + "emailSent": "驗證電郵將發送到你的電郵地址,請依指示完成驗證及登入系統。", + "userContactNumber": "聯絡電話", + "requiredValidNumber": "請輸入有效聯絡電話", + "requireContactNumber": "請輸入聯絡電話", + "require3Number": "請輸入3位數字", + "require8Number": "請輸入8位數字", + "requireAtLeast8Number": "請輸入最少8位數字", + "requireAtLeast2Number": "請輸入最少2位數字", + "requireDialingCode": "請輸入國際區號", + "requireVerify": "請輸入驗證", + "dialingCode": "國際區號", + "userFaxNumber": "傳真號碼", "userIDNo": "身份證號碼", "userEmailAddress": "電郵地址", "userPhoneNumber": "手機號碼", @@ -72,6 +94,16 @@ "addressLine2": "第二行", "addressLine3": "第三行", "region": "區域 (只適用於香港)", + "regionOrCountry": "國家/地區", + "hongKong": "香港", + "mainland": "內地", + "macau": "澳門", + "yourContact": "你的聯絡資料", + + "pwWeak": "弱", + "pwNormal": "普通", + "pwGood": "良好", + "pwStrong": "強", "Dashboard": "儀表板", "event": "活動" diff --git a/src/utils/ComboData.js b/src/utils/ComboData.js index 8bf4d40..bab6e29 100644 --- a/src/utils/ComboData.js +++ b/src/utils/ComboData.js @@ -7,7 +7,11 @@ export const idDocType = [ export const district = ['北區', '長洲區', '大埔區', '大嶼山區', '東區', '觀塘區', '黃大仙區', '九龍城區', '葵青區', '南區', '南丫島區', '坪洲區', '荃灣區', '沙田區', '深水埗區', '屯門區', '灣仔區', '西貢區', '油尖旺區', '元朗區', '中西區']; -export const country = ["香港","內地","澳門"]; + +export const country = (intl) => { + return ["hongKong", "mainland", "macau"] + .map((country) => intl.formatMessage({ id: country })); +}; export const accountFilter = [{ id: 1, key: 1, label: 'Active', type: 'active' }, { id: 2, key: 2, label: 'Locked', type: 'locked' }, { id: 3, key: 3, label: 'Not verified', type: 'notVerified' }]; diff --git a/src/utils/password-strength.js b/src/utils/password-strength.js index 170616c..1dd5fa1 100644 --- a/src/utils/password-strength.js +++ b/src/utils/password-strength.js @@ -18,11 +18,11 @@ export const strengthColorEng = (count) => { }; export const strengthColorChi = (count) => { - if (count < 3) return { label: '弱', color: 'error.main' }; - if (count < 4) return { label: '普通', color: 'warning.main' }; - if (count < 5) return { label: '良好', color: 'success.main' }; - if (count < 6) return { label: '強', color: 'success.dark' }; - return { label: '弱', color: 'error.main' }; + if (count < 3) return { label: 'pwWeak', color: 'error.main' }; + if (count < 4) return { label: 'pwNormal', color: 'warning.main' }; + if (count < 5) return { label: 'pwGood', color: 'success.main' }; + if (count < 6) return { label: 'pwStrong', color: 'success.dark' }; + return { label: 'pwWeak', color: 'error.main' }; }; // password strength indicator