| @@ -136,8 +136,8 @@ const BusCustomFormWizard = (props) => { | |||||
| data.password !==""&& | data.password !==""&& | ||||
| data.confirmPassword !==""&& | data.confirmPassword !==""&& | ||||
| data.password == data.confirmPassword&& | data.password == data.confirmPassword&& | ||||
| (data.enCompanyName !=="" || selectedAddress5 ==="內地")&& | |||||
| data.chCompanyName !==""&& | |||||
| // (data.enCompanyName !=="" || selectedAddress5 ==="內地")&& | |||||
| (data.chCompanyName !=="" || data.enCompanyName !== "")&& | |||||
| data.enName !==""&& | data.enName !==""&& | ||||
| data.chName !==""&& | data.chName !==""&& | ||||
| data.address1 !==""&& | data.address1 !==""&& | ||||
| @@ -400,6 +400,7 @@ const BusCustomFormWizard = (props) => { | |||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| const formik = useFormik({ | const formik = useFormik({ | ||||
| initialValues:({ | initialValues:({ | ||||
| @@ -423,6 +424,7 @@ const BusCustomFormWizard = (props) => { | |||||
| emailConfirm:'', | emailConfirm:'', | ||||
| captchaField:'' | captchaField:'' | ||||
| }), | }), | ||||
| validationSchema:yup.object().shape({ | validationSchema:yup.object().shape({ | ||||
| username: yup.string().min(6,'用戶名稱最少6位').required('請輸入用戶名稱') | username: yup.string().min(6,'用戶名稱最少6位').required('請輸入用戶名稱') | ||||
| .matches(/^[aA-zZ0-9\s]+$/, "用戶名稱不包含特殊字符") | .matches(/^[aA-zZ0-9\s]+$/, "用戶名稱不包含特殊字符") | ||||
| @@ -435,8 +437,14 @@ const BusCustomFormWizard = (props) => { | |||||
| .matches(/^(?=.*[!@#%&])/, '請包括最少1個特殊字符'), | .matches(/^(?=.*[!@#%&])/, '請包括最少1個特殊字符'), | ||||
| confirmPassword: yup.string().min(8,'請最少輸入8位密碼').required('請確認密碼').oneOf([yup.ref('password'), null], '請輸入相同密碼'), | confirmPassword: yup.string().min(8,'請最少輸入8位密碼').required('請確認密碼').oneOf([yup.ref('password'), null], '請輸入相同密碼'), | ||||
| enName: yup.string().max(255).required('請輸入英文姓名'), | enName: yup.string().max(255).required('請輸入英文姓名'), | ||||
| enCompanyName: yup.string().max(255).required('請輸入英文名稱'), | |||||
| chCompanyName: yup.string().max(255).required('請輸入中文名稱'), | |||||
| enCompanyName: yup.string().matches(/^[^$^*()]+$/, 'No special characters $/^/*/(/)').when('chCompanyName', { | |||||
| is: (chCompanyName) => !chCompanyName || chCompanyName.length === 0, | |||||
| then: yup.string().required('Please enter either English or Chinese name'), | |||||
| }), | |||||
| chCompanyName: yup.string().matches(/^[^$^*()]+$/, '不包含特殊字符 $/^/*/(/)').when('enCompanyName', { | |||||
| is: (enCompanyName) => !enCompanyName || enCompanyName.length === 0, | |||||
| then: yup.string().required('請輸入英文或中文名稱'), | |||||
| }), | |||||
| chName: yup.string().max(255).required('請輸入中文姓名'), | chName: yup.string().max(255).required('請輸入中文姓名'), | ||||
| address1: yup.string().max(255).required('請輸入第一行地址'), | address1: yup.string().max(255).required('請輸入第一行地址'), | ||||
| address2: yup.string().max(255).required('請輸入第二行地址'), | address2: yup.string().max(255).required('請輸入第二行地址'), | ||||
| @@ -450,7 +458,7 @@ const BusCustomFormWizard = (props) => { | |||||
| brExpiryDate: yup.date().min(new Date().toISOString().split("T")[0], '請輸入商業登記證有效日期').max("2099-12-31", '請輸入商業登記證有效日期').required('請輸入商業登記證有效日期'), | brExpiryDate: yup.date().min(new Date().toISOString().split("T")[0], '請輸入商業登記證有效日期').max("2099-12-31", '請輸入商業登記證有效日期').required('請輸入商業登記證有效日期'), | ||||
| brNo: yup.string().min(8,'請輸入商業登記證號碼').required('請輸入商業登記證號碼'), | brNo: yup.string().min(8,'請輸入商業登記證號碼').required('請輸入商業登記證號碼'), | ||||
| captchaField: yup.string().required('請輸入驗證').oneOf([captcha], '請輸入有效驗證'), | captchaField: yup.string().required('請輸入驗證').oneOf([captcha], '請輸入有效驗證'), | ||||
| }) | |||||
| }, ['enCompanyName', 'chCompanyName']), | |||||
| }); | }); | ||||
| @@ -650,10 +658,16 @@ const BusCustomFormWizard = (props) => { | |||||
| </Stack> | </Stack> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={12}> | |||||
| <Typography fontSize="0.75rem"> | |||||
| <br/> | |||||
| •請輸入機構/公司英文名稱或中文名稱<br/> | |||||
| •Please enter the English/Chinese name of the organisation/company | |||||
| </Typography> | |||||
| </Grid> | |||||
| <Grid item xs={12} md={6}> | <Grid item xs={12} md={6}> | ||||
| <Stack spacing={1}> | <Stack spacing={1}> | ||||
| <InputLabel htmlFor="enCompanyName-signup">機構/公司英文名稱 | <InputLabel htmlFor="enCompanyName-signup">機構/公司英文名稱 | ||||
| {selectedAddress5 === "內地" ? "" : <span style={{color: '#f10000'}}>*</span>} | |||||
| </InputLabel> | </InputLabel> | ||||
| <OutlinedInput | <OutlinedInput | ||||
| id="enCompanyName-login" | id="enCompanyName-login" | ||||
| @@ -683,7 +697,6 @@ const BusCustomFormWizard = (props) => { | |||||
| <Grid item xs={12} md={6}> | <Grid item xs={12} md={6}> | ||||
| <Stack spacing={1}> | <Stack spacing={1}> | ||||
| <InputLabel htmlFor="chCompanyName-signup">機構/公司中文名稱 | <InputLabel htmlFor="chCompanyName-signup">機構/公司中文名稱 | ||||
| <span style={{color: '#f10000'}}>*</span> | |||||
| </InputLabel> | </InputLabel> | ||||
| <OutlinedInput | <OutlinedInput | ||||
| fullWidth | fullWidth | ||||