| @@ -80,7 +80,10 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||
| addressLine3: yup.string().max(40, getMaxErrStr(40)).nullable(), | |||
| emailAddress: yup.string().email(intl.formatMessage({ id: 'validEmailFormat' })).max(255).required(intl.formatMessage({ id: 'requireEmail' })), | |||
| idDocType: yup.string().max(255, getMaxErrStr(255)).required(intl.formatMessage({ id: 'requireIdDocType' })), | |||
| identification: yup.string().required(getRequiredErrStr('number')) | |||
| identification: yup.string().when('verifiedBy', { | |||
| is: (verifiedBy) => verifiedBy != null, | |||
| then: (schema) => schema.notRequired(), | |||
| otherwise: (schema) => schema.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) { | |||
| @@ -132,8 +135,12 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||
| break; | |||
| } | |||
| } | |||
| }) | |||
| }), | |||
| checkDigit: yup.string().max(1, getMaxErrStr(1)).nullable() | |||
| checkDigit: yup.string().when('verifiedBy', { | |||
| is: (verifiedBy) => verifiedBy != null, | |||
| then: (schema) => schema.notRequired(), | |||
| otherwise: (schema) => schema.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) | |||
| @@ -161,7 +168,8 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||
| 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' })), | |||
| @@ -185,8 +193,10 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||
| countryCode: values.tel_countryCode, | |||
| phoneNumber: values.phoneNumber | |||
| }, | |||
| identification: values.identification, | |||
| checkDigit: values.checkDigit, | |||
| ...(values.verifiedBy == null ? { | |||
| identification: values.identification, | |||
| checkDigit: values.checkDigit, | |||
| } : {}), | |||
| faxNo: { | |||
| countryCode: values.fax_countryCode, | |||
| faxNumber: values.faxNumber | |||
| @@ -470,6 +480,11 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||
| </Grid> | |||
| <Grid item xs={12} sm={12} md={9} lg={6}> | |||
| {currentUserData.verifiedBy ? | |||
| <Typography variant="h5" mt={1}> | |||
| Hidden for security purpose | |||
| </Typography> | |||
| : | |||
| <Grid container> | |||
| {formik.values.idDocType === "HKID" ? | |||
| editMode ? | |||
| @@ -548,6 +563,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||
| </Stack> | |||
| } | |||
| </Grid> | |||
| } | |||
| </Grid> | |||
| </Grid> | |||
| </Grid> | |||
| @@ -2,8 +2,6 @@ | |||
| import { | |||
| Grid, Button, Typography, | |||
| FormHelperText, | |||
| Stack, | |||
| IconButton | |||
| } from '@mui/material'; | |||
| import MainCard from "components/MainCard"; | |||
| import * as React from "react"; | |||
| @@ -22,7 +20,6 @@ import {notifySaveSuccess,} from 'utils/CommonFunction'; | |||
| import {FormattedMessage, useIntl} from "react-intl"; | |||
| import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; | |||
| import {ThemeProvider} from "@emotion/react"; | |||
| import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| @@ -33,15 +30,6 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { | |||
| const [editMode, setEditMode] = useState(false); | |||
| const [onReady, setOnReady] = useState(false); | |||
| const [errorMsg, setErrorMsg] = useState(""); | |||
| const [showId, setshowId] = useState(false); | |||
| const handleClickShowId = () => { | |||
| setshowId(!showId); | |||
| }; | |||
| const handleMouseDownId = (event) => { | |||
| event.preventDefault(); | |||
| }; | |||
| useEffect(() => { | |||
| if (Object.keys(formData).length > 0) { | |||
| @@ -251,79 +239,9 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { | |||
| </Grid> | |||
| <Grid item xs={12} sm={12} md={9} lg={6}> | |||
| <Grid container> | |||
| {formik.values.idDocType === "HKID" ? | |||
| // <> | |||
| // <Grid item xs={6} sm={6} md={6} lg={7.5} sx={{mr:1}}> | |||
| // {FieldUtils.initField({ | |||
| // valueName: "identification", | |||
| // disabled: true, | |||
| // form: formik, | |||
| // placeholder: intl.formatMessage({id: 'idDocNumber'}), | |||
| // inputProps: { | |||
| // maxLength: 7, | |||
| // onKeyDown: (e) => { | |||
| // if (e.key === 'Enter') { | |||
| // e.preventDefault(); | |||
| // } | |||
| // }, | |||
| // } | |||
| // })} | |||
| // </Grid> | |||
| // <Grid item xs={2} sm={2} md={2} lg={2} style={{minWidth:40}}> | |||
| // {FieldUtils.initField({ | |||
| // valueName: "checkDigit", | |||
| // disabled: true, | |||
| // form: formik, | |||
| // })} | |||
| // </Grid> | |||
| // </> | |||
| <Stack direction="row"> | |||
| <Typography variant="h5" mt={1}> | |||
| {formik.values.identification?.slice(0, 4)} | |||
| </Typography> | |||
| <Typography variant="h5"mt={1}> | |||
| {/* {showId ?formik.values.identification.slice(4):"****"}{showId ? '(' + formik.values.checkDigit + ')' :null} */} | |||
| {showId ? formik.values.identification?.slice(4) : "****"}{showId ? formik.values.checkDigit?'(' +formik.values.checkDigit+ ')': "()" : ""} | |||
| </Typography> | |||
| <IconButton | |||
| aria-label={intl.formatMessage({ id: 'ariaToggleIdVisibility' })} | |||
| onClick={handleClickShowId} | |||
| onMouseDown={handleMouseDownId} | |||
| edge="end" | |||
| size="large" | |||
| > | |||
| {showId ? <EyeOutlined /> : <EyeInvisibleOutlined />} | |||
| </IconButton> | |||
| </Stack> | |||
| : | |||
| // <Grid item xs={10} sm={4} md={4} lg={10}> | |||
| // {FieldUtils.initField({ | |||
| // valueName: "identification", | |||
| // disabled: true, | |||
| // form: formik | |||
| // })} | |||
| // </Grid> | |||
| <Stack direction="row"> | |||
| <Typography variant="h5" mt={1}> | |||
| {formik.values.identification?.slice(0, 4)} | |||
| </Typography> | |||
| <Typography variant="h5"mt={1}> | |||
| {showId ?formik.values.identification?.slice(4):"****"} | |||
| </Typography> | |||
| <IconButton | |||
| aria-label={intl.formatMessage({ id: 'ariaToggleIdVisibility' })} | |||
| onClick={handleClickShowId} | |||
| onMouseDown={handleMouseDownId} | |||
| edge="end" | |||
| size="large" | |||
| > | |||
| {showId ? <EyeOutlined /> : <EyeInvisibleOutlined />} | |||
| </IconButton> | |||
| </Stack> | |||
| } | |||
| </Grid> | |||
| <Typography variant="h5" mt={1}> | |||
| {formik.values.identification?.slice(0, 4)} | |||
| </Typography> | |||
| </Grid> | |||
| </Grid> | |||
| </Grid> | |||