import { useEffect, useState } from 'react'; // import { Link as RouterLink } from 'react-router-dom'; // material-ui import { Box, Button, FormControl, FormHelperText, Grid, IconButton, InputAdornment, InputLabel, OutlinedInput, Stack, Typography, Select, FormGroup, // Paper // MenuItem } from '@mui/material'; import {useForm,} from 'react-hook-form' // third party import { Formik } from 'formik'; import * as Yup from 'yup'; // import axios from "axios"; // project import // import AnimateButton from 'components/@extended/AnimateButton'; import { strengthColorChi, strengthIndicator } from 'utils/password-strength'; import {apiPath} from "auth/utils"; import axios from "axios"; // assets import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; // import { Paper } from '../../../../node_modules/@mui/material/index'; // ============================|| FIREBASE - REGISTER ||============================ // const CustomFormWizard = (props) => { const [level, setLevel] = useState(); const [showPassword, setShowPassword] = useState(false); const [showConfirmPassword, setshowConfirmPassword] = useState(false); const handleClickShowPassword = () => { setShowPassword(!showPassword); }; const handleClickShowConfirmPassword = () => { setshowConfirmPassword(!showConfirmPassword); }; const handleMouseDownPassword = (event) => { event.preventDefault(); }; const changePassword = (value) => { const temp = strengthIndicator(value); setLevel(strengthColorChi(temp)); }; useEffect(() => { changePassword(''); }, []); // useEffect(() => { // tryAPI(); // }, []); 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 console.log(name) if (data.username !==""){ axios.post(`${apiPath}/user/register`, { username: data.username, password: data.password, name: data.username, fullname: name, enName: data.enName, chName: data.chName, email: data.email, fax: data.fax, address1: data.address1, address2: data.address2, address3: data.address3, address4: data.address4, address5: data.address5 }) .then((response) => { console.log("Success") console.log(response) }) .catch(error => { console.error(error); }); } } return ( {({ errors, handleBlur, handleChange, touched, values }) => ( //
成為新的個人用戶
註有*的項目必須輸入資料 你的登入資料 {/* Already have an account? */}
用戶登入名稱 * {touched.username && errors.username && ( {errors.username} )} 密碼 * 密碼規則 { handleChange(e); changePassword(e.target.value); }} endAdornment={ {showPassword ? : } } placeholder="密碼" inputProps={{}} /> {touched.password && errors.password && ( {errors.password} )} {level?.label} 確認密碼 * { handleChange(e); changePassword(e.target.value); }} endAdornment={ {showConfirmPassword ? : } } placeholder="確認密碼" fullWidth error={Boolean(touched.confirmPassword && errors.confirmPassword)} /> {touched.confirmPassword && errors.confirmPassword && ( {errors.confirmPassword} )} 你的個人資料 {/* Already have an account? */} 身份證明文件 * {/* {touched.enName && errors.enName && ( {errors.enName} )} */} {touched.idNo && errors.idNo && ( {errors.idNo} )} 英文姓名 * {touched.enName && errors.enName && ( {errors.enName} )} 中文姓名 {touched.chName && errors.chName && ( {errors.chName} )} 地址 * {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} )} 傳真號碼 身份證明文件 請上傳你的 有效身份證明文件 的數碼檔案,以驗證你的身份。 如: 香港身份證; 護照; 中國內地身份證等 如: 香港身份證; 護照; 中國內地身份證等 {/* By Signing up, you agree to our   Terms of Service   and   Privacy Policy */} {errors.submit && ( {errors.submit} )}
成為新的個人用戶
註有*的項目必須輸入資料 你的登入資料 {/* Already have an account? */}
用戶登入名稱 * {touched.username && errors.username && ( {errors.username} )} 密碼 * 密碼規則 { handleChange(e); changePassword(e.target.value); }} endAdornment={ {showPassword ? : } } placeholder="密碼" inputProps={{}} /> {touched.password && errors.password && ( {errors.password} )} {level?.label} 確認密碼 * { handleChange(e); changePassword(e.target.value); }} endAdornment={ {showConfirmPassword ? : } } placeholder="確認密碼" fullWidth error={Boolean(touched.confirmPassword && errors.confirmPassword)} /> {touched.confirmPassword && errors.confirmPassword && ( {errors.confirmPassword} )} 你的個人資料 {/* Already have an account? */} 英文姓名 * {touched.enName && errors.enName && ( {errors.enName} )} 中文姓名 {touched.chName && errors.chName && ( {errors.chName} )} 地址 * {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} )} 傳真號碼 身份證明文件 請上傳你的 有效身份證明文件 的數碼檔案,以驗證你的身份。 如: 香港身份證; 護照; 中國內地身份證等 如: 香港身份證; 護照; 中國內地身份證等 {/* By Signing up, you agree to our   Terms of Service   and   Privacy Policy */} {errors.submit && ( {errors.submit} )}
//
)}
); } export default CustomFormWizard;