diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index 94fcab7..ff23778 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -57,6 +57,12 @@ const CustomFormWizard = (props) => { setLevel(strengthColorChi(temp)); }; + // const checkFormData = (data) =>{ + // const dataStatus = false; + // if (data.username) + // return + // } + useEffect(() => { changePassword(''); }, []); @@ -66,31 +72,40 @@ const CustomFormWizard = (props) => { // }, []); const {handleSubmit,register} = useForm({}) - const _onSubmit = (data) => { - console.log("test") console.log(data) - console.log(data.fax) - console.log(data.phone) - const name = data.ehName +" "+ data.enName const userAddress = { "addressLine1":data.address1, "addressLine2":data.address2, "addressLine3":data.address3, "country":data.address5 } - console.log(name) + const userFaxNo = { + "countryCode":data.faxCountryCode, + "faxNumber":data.fax, + } + const userMobileNumber = { + "countryCode":data.phoneCountryCode, + "phoneNumber":data.phone, + } + console.log(userAddress) + console.log(userFaxNo) + console.log(userMobileNumber) if (data.username !==""){ axios.post(`${apiPath}/user/register`, { username: data.username, password: data.password, name: data.username, - fullname: name, - enName: data.enName, + enName: name, chName: data.chName, emailAddress: data.email, - fax: data.fax, - userAddress:userAddress + idDocType:idDocType, + identification:idNo, + checkDigit:data.checkDigit, + userFaxNo:userFaxNo, + userMobileNumber:userMobileNumber, + userAddress:userAddress, + tncFlag:true }) .then((response) => { console.log("Success") @@ -119,6 +134,7 @@ const CustomFormWizard = (props) => { confirmPassword: '', phone:'', idNo:'', + idDocType :'', checkDigit:'', submit: null }} @@ -139,20 +155,20 @@ const CustomFormWizard = (props) => { > {({ errors, handleBlur, handleChange, touched, values }) => ( // -
+ - -
- 成為新的個人用戶 -
- 註有*的項目必須輸入資料 - 你的登入資料 - {/* - Already have an account? - */} -
+ +
+ 成為新的個人用戶 +
+ 註有*的項目必須輸入資料 + 你的登入資料 + {/* + Already have an account? + */} +
@@ -171,6 +187,13 @@ const CustomFormWizard = (props) => { placeholder="用戶登入名稱" fullWidth error={Boolean(touched.username && errors.username)} + inputProps={{ + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} /> {touched.username && errors.username && ( @@ -180,9 +203,9 @@ const CustomFormWizard = (props) => { - + - + 密碼 * @@ -215,7 +238,13 @@ const CustomFormWizard = (props) => { } placeholder="密碼" - inputProps={{}} + inputProps={{ + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} /> {touched.password && errors.password && ( @@ -251,6 +280,13 @@ const CustomFormWizard = (props) => { handleChange(e); changePassword(e.target.value); }} + inputProps={{ + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} endAdornment={ { - 你的個人資料 - {/* - Already have an account? - */} + 你的個人資料 + {/* + Already have an account? + */} - + 身份證明文件 * @@ -299,7 +335,7 @@ const CustomFormWizard = (props) => { - + } - {...register("address4")} - renderValue={(selected) => { - if (selected.length === 0) { - return "區域 (只適用於香港)"; - } + 地址 + * + + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + /> + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + /> + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + /> + - + - {touched.address1 && errors.address1 && ( - - {errors.address1} - - )} - {touched.address2 && errors.address2 && ( - - {errors.address2} - - )} - {touched.address3 && errors.address3 && ( - - {errors.address3} - - )} + return selected.join(', '); + }} + // MenuProps={MenuProps} + inputProps={{ 'aria-label': 'Without label' }} + > + + {touched.address1 && errors.address1 && ( + + {errors.address1} + + )} + {touched.address2 && errors.address2 && ( + + {errors.address2} + + )} + {touched.address3 && errors.address3 && ( + + {errors.address3} + + )} - 你的聯絡資料 - - - - - 電郵 - * - - - {touched.email && errors.email && ( - - {errors.email} - - )} - - - - - 確認電郵 - * - - - {touched.emailConfirm && errors.emailConfirm && ( - - {errors.emailConfirm} - - )} + 你的聯絡資料 - - - 聯絡電話 - * - - - {touched.phone && errors.phone && ( - - {errors.phone} - - )} - + + + + + 電郵 + * + + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + /> + {touched.email && errors.email && ( + + {errors.email} + + )} + + + + + 確認電郵 + * + + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + /> + {touched.emailConfirm && errors.emailConfirm && ( + + {errors.emailConfirm} + + )} + + + - - - 傳真號碼 - - + + + + + + + 聯絡電話 + * + + + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + sx={{width:'20%'}} + /> + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + /> + {touched.phone && errors.phone && ( + + {errors.phone} + + )} + + + + {/* + + + + + */} + + + + + + + 傳真號碼 + + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + sx={{width:'20%'}} + /> + { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + /> + + + + + + - 身份證明文件 - 請上傳你的 有效身份證明文件 的數碼檔案,以驗證你的身份。 - 如: 香港身份證; 護照; 中國內地身份證等 - - - 如: 香港身份證; 護照; 中國內地身份證等 - - - - + 身份證明文件 + 請上傳你的 有效身份證明文件 的數碼檔案,以驗證你的身份。 + 如: 香港身份證; 護照; 中國內地身份證等 + + + 如: 香港身份證; 護照; 中國內地身份證等 + + + + {/* - By Signing up, you agree to our   - - Terms of Service - -   and   - - Privacy Policy - + By Signing up, you agree to our   + + Terms of Service + +   and   + + Privacy Policy + */} {errors.submit && ( @@ -655,120 +827,110 @@ const CustomFormWizard = (props) => { - 用戶登入名稱 - * - - - {touched.username && errors.username && ( - - {errors.username} - - )} - - - - - - 密碼 + 用戶登入名稱 * - 密碼規則 - - { - handleChange(e); - changePassword(e.target.value); - }} - endAdornment={ - - - {showPassword ? : } - - - } - placeholder="密碼" - inputProps={{}} - /> - {touched.password && errors.password && ( - - {errors.password} - - )} + + {touched.username && errors.username && ( + + {errors.username} + + )} - - - - - - - - {level?.label} - + + + + + + + 密碼 + * + + 密碼規則 + + { + handleChange(e); + changePassword(e.target.value); + }} + endAdornment={ + + + {showPassword ? : } + + + } + placeholder="密碼" + readOnly + /> + + + + 確認密碼 + * + + { + handleChange(e); + changePassword(e.target.value); + }} + inputProps={{ + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} + endAdornment={ + + + {showConfirmPassword ? : } + + + } + placeholder="確認密碼" + fullWidth + readOnly + /> + + - - - - - 確認密碼 - * - - { - handleChange(e); - changePassword(e.target.value); - }} - endAdornment={ - - - {showConfirmPassword ? : } - - - } - placeholder="確認密碼" - fullWidth - error={Boolean(touched.confirmPassword && errors.confirmPassword)} - /> - {touched.confirmPassword && errors.confirmPassword && ( - - {errors.confirmPassword} - - )} - @@ -792,6 +954,7 @@ const CustomFormWizard = (props) => { onChange={handleChange} placeholder="與你的身份證明文件相同" fullWidth + readOnly error={Boolean(touched.enName && errors.enName)} /> {touched.enName && errors.enName && ( @@ -813,7 +976,14 @@ const CustomFormWizard = (props) => { name="chName" onChange={handleChange} placeholder="與你的身份證明文件相同" - inputProps={{}} + readOnly + inputProps={{ + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} /> {touched.chName && errors.chName && ( @@ -836,7 +1006,14 @@ const CustomFormWizard = (props) => { onBlur={handleBlur} onChange={handleChange} placeholder="第一行" - inputProps={{}} + readOnly + inputProps={{ + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} /> { onBlur={handleBlur} onChange={handleChange} placeholder="第二行" - inputProps={{}} + readOnly + inputProps={{ + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} /> { onBlur={handleBlur} onChange={handleChange} placeholder="第三行" - inputProps={{}} + readOnly + inputProps={{ + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + }} />