From 51dce719c36c9c9ba8196e60fba5562db450ef4e Mon Sep 17 00:00:00 2001 From: Terence Hui Date: Thu, 4 Jul 2024 14:01:38 +0800 Subject: [PATCH 1/4] update route case sensitive --- src/routes/GLDUserRoutes.js | 2 +- src/routes/PublicUserRoutes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/GLDUserRoutes.js b/src/routes/GLDUserRoutes.js index 685bfd4..ef2c352 100644 --- a/src/routes/GLDUserRoutes.js +++ b/src/routes/GLDUserRoutes.js @@ -7,7 +7,7 @@ const MainLayout = Loadable(lazy(() => import('layout/MainLayout'))); import {isGranted, isGrantedAny} from "auth/utils"; // import { isPasswordExpiry } from "utils/Utils"; // render - dashboard -const DashboardDefault = Loadable(lazy(() => import('pages/Dashboard/GLD'))); +const DashboardDefault = Loadable(lazy(() => import('pages/dashboard/GLD'))); const ApplicationDetail = Loadable(lazy(() => import('pages/PublicNotice/Details_GLD'))); const ApplicationSearch = Loadable(lazy(() => import('pages/PublicNotice/Search_GLD'))); const ApplicationMarkAsPaidSearch = Loadable(lazy(() => import('pages/PublicNotice/Search_Mark_As_Paid_GLD'))); diff --git a/src/routes/PublicUserRoutes.js b/src/routes/PublicUserRoutes.js index f12c742..c3f614d 100644 --- a/src/routes/PublicUserRoutes.js +++ b/src/routes/PublicUserRoutes.js @@ -7,7 +7,7 @@ const MainLayout = Loadable(lazy(() => import('layout/MainLayout'))); // import { isPasswordExpiry } from "utils/Utils"; // render - dashboard -const DashboardDefault = Loadable(lazy(() => import('pages/Dashboard/Public'))); +const DashboardDefault = Loadable(lazy(() => import('pages/dashboard/Public'))); const ManageOrgUser = Loadable(lazy(() => import('pages/User/ManagePage_OrgPublic'))); const PublicNotice = Loadable(lazy(() => import('pages/PublicNotice/ListPanel'))); const PublicNoticeApplyForm = Loadable(lazy(() => import('pages/PublicNotice/ApplyForm'))); From f8d82db96dde99c83de41c81ae42b766fb245911 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Thu, 18 Jul 2024 16:55:01 +0800 Subject: [PATCH 2/4] update user HKid and checkdigi --- .../DetailsPage_Individual/UserInformationCard_Individual.js | 4 ++-- src/routes/GLDUserRoutes.js | 2 +- src/routes/PublicUserRoutes.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js index dcbe535..7491c93 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js @@ -411,10 +411,10 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { : - {formik.values.identification.slice(0, 4)} + {formik.values.identification?.slice(0, 4)} - {showId ? formik.values.identification.slice(4) : "****"}{showId ? '(' + formik.values.checkDigit + ')' : null} + {showId ? formik.values.identification?.slice(4) : "****"}{showId ? '(' + formik.values.checkDigit?formik.values.checkDigit:"" + ')' : ""} import('layout/MainLayout'))); import {isGranted, isGrantedAny} from "auth/utils"; // import { isPasswordExpiry } from "utils/Utils"; // render - dashboard -const DashboardDefault = Loadable(lazy(() => import('pages/dashboard/GLD'))); +const DashboardDefault = Loadable(lazy(() => import('pages/Dashboard/GLD'))); const ApplicationDetail = Loadable(lazy(() => import('pages/PublicNotice/Details_GLD'))); const ApplicationSearch = Loadable(lazy(() => import('pages/PublicNotice/Search_GLD'))); const ApplicationMarkAsPaidSearch = Loadable(lazy(() => import('pages/PublicNotice/Search_Mark_As_Paid_GLD'))); diff --git a/src/routes/PublicUserRoutes.js b/src/routes/PublicUserRoutes.js index c3f614d..f12c742 100644 --- a/src/routes/PublicUserRoutes.js +++ b/src/routes/PublicUserRoutes.js @@ -7,7 +7,7 @@ const MainLayout = Loadable(lazy(() => import('layout/MainLayout'))); // import { isPasswordExpiry } from "utils/Utils"; // render - dashboard -const DashboardDefault = Loadable(lazy(() => import('pages/dashboard/Public'))); +const DashboardDefault = Loadable(lazy(() => import('pages/Dashboard/Public'))); const ManageOrgUser = Loadable(lazy(() => import('pages/User/ManagePage_OrgPublic'))); const PublicNotice = Loadable(lazy(() => import('pages/PublicNotice/ListPanel'))); const PublicNoticeApplyForm = Loadable(lazy(() => import('pages/PublicNotice/ApplyForm'))); From a640af8c79778f4a290aff385b287a126602a093 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Thu, 18 Jul 2024 17:46:18 +0800 Subject: [PATCH 3/4] update change password page add text --- src/pages/User/ChangePasswordPage/index.js | 15 +++++++++++++-- .../ForgotPassword/AuthCallback/index.js | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/pages/User/ChangePasswordPage/index.js b/src/pages/User/ChangePasswordPage/index.js index 0868bd0..b9b6367 100644 --- a/src/pages/User/ChangePasswordPage/index.js +++ b/src/pages/User/ChangePasswordPage/index.js @@ -196,13 +196,13 @@ const Index = () => {
{isPasswordExpiry()? - + : - + @@ -370,6 +370,17 @@ const Index = () => { )} + + + + •
+ •
+ •
+ •
+ •
+
+
+
diff --git a/src/pages/authentication/ForgotPassword/AuthCallback/index.js b/src/pages/authentication/ForgotPassword/AuthCallback/index.js index 8d290cc..6f813df 100644 --- a/src/pages/authentication/ForgotPassword/AuthCallback/index.js +++ b/src/pages/authentication/ForgotPassword/AuthCallback/index.js @@ -186,6 +186,10 @@ const Index = () => { } }); + const handleCCPChange = (e) => { + e.preventDefault(); + }; + return ( isLoading || verifyState == null ? @@ -380,6 +384,9 @@ const Index = () => { value={formik.values.confirmPassword.trim()} error={Boolean(formik.touched.confirmPassword && formik.errors.confirmPassword)} onBlur={formik.handleBlur} + onCut={handleCCPChange} + onCopy={handleCCPChange} + onPaste={handleCCPChange} inputProps={{ maxLength: 50, onKeyDown: (e) => { @@ -414,6 +421,17 @@ const Index = () => { )} + + + + •
+ •
+ •
+ •
+ •
+
+
+
From f1af83023b1193d14f587e0d4bd01a4d41828d1b Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Fri, 19 Jul 2024 13:09:46 +0800 Subject: [PATCH 4/4] fix cnid cannot save --- .../UserInformationCard_Individual.js | 117 ++++++++++++++++-- 1 file changed, 105 insertions(+), 12 deletions(-) diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js index 7491c93..b5e08d7 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js @@ -34,6 +34,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { const [onReady, setOnReady] = useState(false); const [errorMsg, setErrorMsg] = useState(""); const [showId, setshowId] = useState(false); + const [selectedIdDocInputType, setSelectedIdDocInputType] = useState(""); const handleClickShowId = () => { setshowId(!showId); @@ -47,6 +48,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { //if state data are ready and assign to different field // console.log(currentApplicationDetailData) if (Object.keys(currentUserData).length > 0) { + setSelectedIdDocInputType(currentUserData.idDocType) setOnReady(true); } }, [currentUserData]); @@ -56,6 +58,14 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { return intl.formatMessage({ id: 'noMoreThenNWords' }, { num: num, fieldname: fieldname ? intl.formatMessage({ id: fieldname }) + ": " : "" }); } + function getRequiredErrStr(fieldname) { + return displayErrorMsg(intl.formatMessage({ id: 'require' }, { fieldname: fieldname ? intl.formatMessage({ id: fieldname }) : "" })); + } + + function displayErrorMsg(errorMsg) { + return {errorMsg} + } + const formik = useFormik({ enableReinitialize: true, initialValues: currentUserData, @@ -69,9 +79,89 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { 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, getMaxErrStr(1)).required(intl.formatMessage({ id: 'requiredNumberInQuote' })).nullable(), idDocType: yup.string().max(255, getMaxErrStr(255)).required(intl.formatMessage({ id: 'requireIdDocType' })), + identification: yup.string().required(getRequiredErrStr('number')) + .matches(/^[aA-zZ0-9\s]+$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpecialCharacter' })}`) }) + .matches(/^\S*$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpace' })}`) }) + .test('checkIDCardFormat', displayErrorMsg(`${intl.formatMessage({ id: 'requiredValid' })}${selectedIdDocInputType}${intl.formatMessage({ id: 'number' })}`), function (value) { + var pattern_HKIDv1 = /^[A-Z]{1}[0-9]{6}$/; + var pattern_HKIDv2 = /^[A-Z]{2}[0-9]{6}$/; + var pattern_passport = /^[A-Z]{1}[0-9]{8}$/; + var pattern_CHID = /^[0-9]{6}(20|19)[0-9]{2}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])[0-9]{3}[0-9X]{1}/; + var pattern_otherCert = /^[A-Z]{1}[0-9]{5,}/; + if (value !== undefined) { + switch (selectedIdDocInputType) { + case "HKID": + if (value.match(pattern_HKIDv1)) { + return true + } else if (value.match(pattern_HKIDv2)) { + return true + } else { + return false + } + case "passport": + if (value.match(pattern_passport)) { + return true + } else { + return false + } + case "CNID": + if (value.match(pattern_CHID)) { + const subStr_year = value.substring(6, 10) + const subStr_month = value.substring(10, 12) + const subStr_date = value.substring(12, 14) + + const today = new Date() + const inputDate = new Date(`${subStr_year}-${subStr_month}-${subStr_date}`) + + if (inputDate > today || inputDate === "Invalid Date" || inputDate.getFullYear().toString() !== subStr_year || (inputDate.getMonth() + 1).toString().padStart(2, "0") !== subStr_month || inputDate.getDate().toString().padStart(2, "0") !== subStr_date) { + return false + } else { + return true + } + } else { + return false + } + case "otherCert": + if (value.match(pattern_otherCert)) { + return true + } else { + return false + } + default: + break; + } + } + }), + checkDigit: yup.string().max(1, getMaxErrStr(1)).nullable() + .matches(/^[A-Z0-9\s]+$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpecialCharacter' })}`) }) + .test('checkIDCardFormat', displayErrorMsg(`${intl.formatMessage({ id: 'requiredNumberInQuote' })}`), function (value) { + console.log(selectedIdDocInputType) + if (value != undefined || value != null) { + switch (selectedIdDocInputType) { + case "HKID": + if (value.length == 1) { + return true + } else { + return false + } + case "passport": + return true + case "CNID": + return true + case "otherCert": + return true + default: + break; + } + } else { + if (selectedIdDocInputType != "HKID"){ + return true + } else { + return false + } + } + }), 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' })), @@ -313,6 +403,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { return; } formik.setFieldValue("idDocType", newValue.type); + setSelectedIdDocInputType(newValue.type); if (newValue.type !== "HKID") { formik.setFieldValue("checkDigit", "") } @@ -414,7 +505,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { {formik.values.identification?.slice(0, 4)} - {showId ? formik.values.identification?.slice(4) : "****"}{showId ? '(' + formik.values.checkDigit?formik.values.checkDigit:"" + ')' : ""} + {showId ? formik.values.identification?.slice(4) : "****"}{showId ? formik.values.checkDigit?'(' +formik.values.checkDigit+ ')': "()" : ""} { : editMode ? - - {FieldUtils.initField({ - valueName: "identification", - disabled: (!editMode), - form: formik - })} - + <> + + {FieldUtils.initField({ + valueName: "identification", + disabled: (!editMode), + form: formik + })} + + : - {formik.values.identification.slice(0, 4)} + {formik.values.identification?.slice(0, 4)} - {showId ? formik.values.identification.slice(4) : "****"} + {showId ? formik.values.identification?.slice(4) : "****"}