diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js
index a854f22..9ddb480 100644
--- a/src/layout/MainLayout/Header/index.js
+++ b/src/layout/MainLayout/Header/index.js
@@ -96,7 +96,6 @@ function Header(props) {
PNSPS
-
@@ -113,7 +112,6 @@ function Header(props) {
PNSPS
-
diff --git a/src/pages/authentication/Register.js b/src/pages/authentication/Register.js
index 1d04d25..fa8e75f 100644
--- a/src/pages/authentication/Register.js
+++ b/src/pages/authentication/Register.js
@@ -48,6 +48,12 @@ const steps = ['個人資料', '預覽', '完成提交'];
const Register = () => {
const [activeStep, setActiveStep] = useState(0);
const [completed, setCompleted] = useState([false]);
+ // const [isValid, setisValid] = useState(false);
+
+ // const handleIsValidChange = (value) => {
+ // setisValid(value);
+ // console.log(value)
+ // };
const totalSteps = () => {
return steps.length;
@@ -133,6 +139,7 @@ const Register = () => {
) : (
+ {/* */}
diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js
index 69db761..f249c57 100644
--- a/src/pages/authentication/auth-forms/CustomFormWizard.js
+++ b/src/pages/authentication/auth-forms/CustomFormWizard.js
@@ -1,4 +1,4 @@
-import { useEffect, useState } from 'react';
+import { useEffect, useState, useRef } from 'react';
// import { Link as RouterLink } from 'react-router-dom';
// material-ui
@@ -12,7 +12,6 @@ import {
InputLabel, OutlinedInput,
Stack,
Typography,
- Select,
FormGroup,
TextField,
// Paper
@@ -39,11 +38,13 @@ import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons';
// ============================|| FIREBASE - REGISTER ||============================ //
-const CustomFormWizard = (props) => {
+const CustomFormWizard = (props, ) => {
const [level, setLevel] = useState();
const [showPassword, setShowPassword] = useState(false);
const [showConfirmPassword, setshowConfirmPassword] = useState(false);
+ // const [values, setValues] = useState({});
+
const handleClickShowPassword = () => {
setShowPassword(!showPassword);
};
@@ -61,39 +62,48 @@ const CustomFormWizard = (props) => {
};
const [selectedIdDocType, setSelectedIdDocType] = useState(null);
- // const [idDocTypeComboList, setIdDocTypeComboList] = useState([]);
+ const [selectedAddress4, setSelectedAddress4] = useState(null);
+ const [selectedAddress5, setSelectedAddress5] = useState(null);
const idDocTypeComboList = ["passport","HKID","CNID","BR","otherCert"];
- // function updateUserList (){
- // const idList = getIdList(groupUserData);
- // if(!idList.includes(selectedUser.id)){
- // const userList = [...groupUserData, selectedUser];
- // setGroupUserData(userList);
- // console.log(userList);
- // }
- // }
-
- // const checkFormData = (data) =>{
- // const dataStatus = false;
- // if (data.username)
- // return
- // }
+ const address4ComboList =
+ ["北區","長洲區","大埔區","大嶼山區","東區","觀塘區","黃大仙區","九龍城區","葵青區","南區","南丫島區",
+ "坪洲區","荃灣區","沙田區","深水埗區","屯門區","灣仔區","西貢區","油尖旺區","元朗區","中西區"];
+ const address5ComboList = ["香港","內地","澳門"];
useEffect(() => {
changePassword('');
}, []);
+
+ const formRef = useRef(null);
+ useEffect(() => {
+ console.log("formRef changed", formRef.current);
+ // onIsValidChange(true);
+ }, [formRef.current]);
- // useEffect(() => {
- // tryAPI();
- // }, []);
+ const checkDataField = (data)=>{
+ if (data.username !=="",
+ data.password !=="",
+ data.enName !=="",
+ data.email !=="",
+ data.password !=="",
+ data.password !==""
+ )
+ {
+ return true
+ }
+ };
const {handleSubmit,register} = useForm({})
const _onSubmit = (data) => {
+ data.idDocType = selectedIdDocType
+ data.address4 = selectedAddress4
+ data.address5 = selectedAddress5
console.log(data)
const userAddress = {
"addressLine1":data.address1,
"addressLine2":data.address2,
- "addressLine3":data.address3,
+ "addressLine3":data.address4,
"country":data.address5
}
const userFaxNo = {
@@ -107,7 +117,7 @@ const CustomFormWizard = (props) => {
console.log(userAddress)
console.log(userFaxNo)
console.log(userMobileNumber)
- if (data.username !==""){
+ if (checkDataField(data)){
axios.post(`${apiPath}${POST_PUBLIC_USER_REGISTER}`, {
username: data.username,
password: data.password,
@@ -136,6 +146,8 @@ const CustomFormWizard = (props) => {
return (
(formRef.current = f)}
initialValues={{
username:'',
enName: '',
@@ -144,13 +156,10 @@ const CustomFormWizard = (props) => {
address1: '',
address2: '',
address3: '',
- address4: '',
- address5: '',
password: '',
confirmPassword: '',
phone:'',
idNo:'',
- idDocType :'',
checkDigit:'',
submit: null
}}
@@ -169,9 +178,12 @@ const CustomFormWizard = (props) => {
idType: Yup.string().max(255).required('請輸入第三行地址'),
})}
>
- {({ errors, handleBlur, handleChange, touched, values }) => (
- //
+ {({ errors, handleBlur, handleChange, touched, values, isValid }) =>
+ // console.log(Boolean(touched.password && errors.password))
+ // addFieldError(Boolean(touched.password && errors.password))
+ (
-
+
@@ -813,6 +849,7 @@ const CustomFormWizard = (props) => {
+ {/* Preview Form */}
@@ -974,7 +1011,6 @@ const CustomFormWizard = (props) => {
- //
)}
);