您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

1022 行
60 KiB

  1. import { useEffect, useState } from 'react';
  2. // import { Link as RouterLink } from 'react-router-dom';
  3. // material-ui
  4. import {
  5. Box,
  6. Button,
  7. FormControl,
  8. FormHelperText,
  9. Grid, IconButton,
  10. InputAdornment,
  11. InputLabel, OutlinedInput,
  12. Stack,
  13. Typography,
  14. Select,
  15. FormGroup,
  16. // Paper
  17. // MenuItem
  18. } from '@mui/material';
  19. import {useForm,} from 'react-hook-form'
  20. // third party
  21. import { Formik } from 'formik';
  22. import * as Yup from 'yup';
  23. // import axios from "axios";
  24. // project import
  25. // import AnimateButton from 'components/@extended/AnimateButton';
  26. import { strengthColorChi, strengthIndicator } from 'utils/password-strength';
  27. import {apiPath} from "auth/utils";
  28. import axios from "axios";
  29. // assets
  30. import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons';
  31. // import { Paper } from '../../../../node_modules/@mui/material/index';
  32. // ============================|| FIREBASE - REGISTER ||============================ //
  33. const CustomFormWizard = (props) => {
  34. const [level, setLevel] = useState();
  35. const [showPassword, setShowPassword] = useState(false);
  36. const [showConfirmPassword, setshowConfirmPassword] = useState(false);
  37. const handleClickShowPassword = () => {
  38. setShowPassword(!showPassword);
  39. };
  40. const handleClickShowConfirmPassword = () => {
  41. setshowConfirmPassword(!showConfirmPassword);
  42. };
  43. const handleMouseDownPassword = (event) => {
  44. event.preventDefault();
  45. };
  46. const changePassword = (value) => {
  47. const temp = strengthIndicator(value);
  48. setLevel(strengthColorChi(temp));
  49. };
  50. useEffect(() => {
  51. changePassword('');
  52. }, []);
  53. // useEffect(() => {
  54. // tryAPI();
  55. // }, []);
  56. const {handleSubmit,register} = useForm({})
  57. const _onSubmit = (data) => {
  58. console.log("test")
  59. console.log(data)
  60. console.log(data.fax)
  61. console.log(data.phone)
  62. const name = data.ehName +" "+ data.enName
  63. console.log(name)
  64. if (data.username !==""){
  65. axios.post(`${apiPath}/user/register`, {
  66. username: data.username,
  67. password: data.password,
  68. name: data.username,
  69. fullname: name,
  70. enName: data.enName,
  71. chName: data.chName,
  72. email: data.email,
  73. fax: data.fax,
  74. address1: data.address1,
  75. address2: data.address2,
  76. address3: data.address3,
  77. address4: data.address4,
  78. address5: data.address5
  79. })
  80. .then((response) => {
  81. console.log("Success")
  82. console.log(response)
  83. })
  84. .catch(error => {
  85. console.error(error);
  86. });
  87. }
  88. }
  89. return (
  90. <Formik
  91. initialValues={{
  92. username:'',
  93. enName: '',
  94. chName: '',
  95. email: '',
  96. address1: '',
  97. address2: '',
  98. address3: '',
  99. address4: '',
  100. address5: '',
  101. password: '',
  102. confirmPassword: '',
  103. phone:'',
  104. idNo:'',
  105. submit: null
  106. }}
  107. validationSchema={Yup.object().shape({
  108. username: Yup.string().max(255).required('請輸入用戶名稱'),
  109. password: Yup.string().max(255).required('請輸入密碼'),
  110. confirmPassword: Yup.string().max(255).required('請確認密碼'),
  111. enName: Yup.string().max(255).required('請輸入英文姓名'),
  112. chName: Yup.string().max(255).required('請輸入中文姓名'),
  113. address1: Yup.string().max(255).required('請輸入第一行地址'),
  114. address2: Yup.string().max(255).required('請輸入第二行地址'),
  115. address3: Yup.string().max(255).required('請輸入第三行地址'),
  116. email: Yup.string().email('Must be a valid email').max(255).required('Email is required'),
  117. idNo: Yup.string().max(255).required('請輸入身證件號碼'),
  118. idType: Yup.string().max(255).required('請輸入第三行地址'),
  119. })}
  120. >
  121. {({ errors, handleBlur, handleChange, touched, values }) => (
  122. // <Paper>
  123. <form onSubmit={handleSubmit(_onSubmit)}>
  124. <FormGroup id={"inputForm"} sx={{ display: props.step === 0 ? "" : "none" }}>
  125. <Grid container spacing={3}>
  126. <Grid item xs={12}>
  127. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  128. <div style={{borderBottom: "3px solid #1A4399", width:"100%", margin_right: "15px"}}>
  129. <Typography display="inline" variant="h3" sx={{ color: '#1A4399'}}>成為新的個人用戶</Typography>
  130. </div>
  131. <Typography mt={0.25} variant="h6" sx={{ fontSize: 12,color: '#f10000'}}>註有*的項目必須輸入資料</Typography>
  132. <Typography mt={0.25} variant="h4" sx={{ color: 'primary.primary'}}>你的登入資料</Typography>
  133. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  134. Already have an account?
  135. </Typography> */}
  136. </Stack>
  137. </Grid>
  138. <Grid item xs={12}>
  139. <Grid container spacing={1}>
  140. <Grid item xs={12} >
  141. <Stack spacing={1}>
  142. <InputLabel htmlFor="username-signup">用戶登入名稱
  143. <span style={{color: '#f10000'}}>*</span>
  144. </InputLabel>
  145. <OutlinedInput
  146. id="username-login"
  147. type="text"
  148. value={values.username}
  149. name="username"
  150. {...register("username")}
  151. onChange={handleChange}
  152. placeholder="用戶登入名稱"
  153. fullWidth
  154. error={Boolean(touched.username && errors.username)}
  155. />
  156. {touched.username && errors.username && (
  157. <FormHelperText error id="helper-text-username-signup">
  158. {errors.username}
  159. </FormHelperText>
  160. )}
  161. </Stack>
  162. </Grid>
  163. <Grid item xs={12} md={6}>
  164. <Stack spacing={1}>
  165. <Stack direction="row" justifyContent="space-between">
  166. <InputLabel htmlFor="password-signup">密碼
  167. <span style={{color: '#f10000'}}>*</span>
  168. </InputLabel>
  169. <InputLabel htmlFor="password-rule">密碼規則</InputLabel>
  170. </Stack>
  171. <OutlinedInput
  172. fullWidth
  173. error={Boolean(touched.password && errors.password)}
  174. id="password-signup"
  175. type={showPassword ? 'text' : 'password'}
  176. value={values.password}
  177. name="password"
  178. {...register("password")}
  179. onChange={(e) => {
  180. handleChange(e);
  181. changePassword(e.target.value);
  182. }}
  183. endAdornment={
  184. <InputAdornment position="end">
  185. <IconButton
  186. aria-label="toggle password visibility"
  187. onClick={handleClickShowPassword}
  188. onMouseDown={handleMouseDownPassword}
  189. edge="end"
  190. size="large"
  191. >
  192. {showPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  193. </IconButton>
  194. </InputAdornment>
  195. }
  196. placeholder="密碼"
  197. inputProps={{}}
  198. />
  199. {touched.password && errors.password && (
  200. <FormHelperText error id="helper-text-password-signup">
  201. {errors.password}
  202. </FormHelperText>
  203. )}
  204. </Stack>
  205. <FormControl fullWidth sx={{ mt: 2 }}>
  206. <Grid container spacing={2} alignItems="center">
  207. <Grid item>
  208. <Box sx={{ bgcolor: level?.color, width: 85, height: 8, borderRadius: '7px' }} />
  209. </Grid>
  210. <Grid item>
  211. <Typography variant="subtitle1" fontSize="0.75rem">
  212. {level?.label}
  213. </Typography>
  214. </Grid>
  215. </Grid>
  216. </FormControl>
  217. </Grid>
  218. <Grid item xs={12} md={6} >
  219. <Stack spacing={1}>
  220. <InputLabel htmlFor="confirmPassword-signup">確認密碼
  221. <span style={{color: '#f10000'}}>*</span>
  222. </InputLabel>
  223. <OutlinedInput
  224. id="confirmPassword-login"
  225. type={showConfirmPassword ? 'text' : 'password'}
  226. value={values.confirmPassword}
  227. name="confirmPassword"
  228. {...register("confirmPassword")}
  229. onChange={(e) => {
  230. handleChange(e);
  231. changePassword(e.target.value);
  232. }}
  233. endAdornment={
  234. <InputAdornment position="end">
  235. <IconButton
  236. aria-label="toggle password visibility"
  237. onClick={handleClickShowConfirmPassword}
  238. onMouseDown={handleMouseDownPassword}
  239. edge="end"
  240. size="large"
  241. >
  242. {showConfirmPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  243. </IconButton>
  244. </InputAdornment>
  245. }
  246. placeholder="確認密碼"
  247. fullWidth
  248. error={Boolean(touched.confirmPassword && errors.confirmPassword)}
  249. />
  250. {touched.confirmPassword && errors.confirmPassword && (
  251. <FormHelperText error id="helper-text-confirmPassword-signup">
  252. {errors.confirmPassword}
  253. </FormHelperText>
  254. )}
  255. </Stack>
  256. </Grid>
  257. <Grid item xs={12} mt={1} mb={1}>
  258. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  259. <Typography display="inline" variant="h4" sx={{ color: '#1A4399'}}>你的個人資料</Typography>
  260. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  261. Already have an account?
  262. </Typography> */}
  263. </Stack>
  264. </Grid>
  265. <Grid item xs={12} md={12} >
  266. <Grid container xs={12} md={12} sx={{mb:1}}>
  267. <Stack spacing={1}>
  268. <InputLabel htmlFor="idDocType-signup">身份證明文件
  269. <span style={{color: '#f10000'}}>*</span>
  270. </InputLabel>
  271. {/* {touched.enName && errors.enName && (
  272. <FormHelperText error id="helper-text-enName-signup">
  273. {errors.enName}
  274. </FormHelperText>
  275. )} */}
  276. </Stack>
  277. </Grid>
  278. <Grid container xs={12} md={12}>
  279. <Grid item xs={12} md={6} >
  280. <Stack spacing={1} sx={{mr:{md:1},mb:{xs:1}}}>
  281. <Select
  282. name = "idDocType"
  283. multiple
  284. displayEmpty
  285. value={""}
  286. onChange={handleChange}
  287. input={<OutlinedInput />}
  288. {...register("idDocType")}
  289. renderValue={(selected) => {
  290. if (selected.length === 0) {
  291. return "證件類別";
  292. }
  293. return selected.join(', ');
  294. }}
  295. // MenuProps={MenuProps}
  296. inputProps={{ 'aria-label': 'Without label' }}
  297. >
  298. </Select>
  299. </Stack>
  300. </Grid>
  301. <Grid item xs={12} md={6}>
  302. <Stack spacing={1}>
  303. <OutlinedInput
  304. id="idNo-login"
  305. type="text"
  306. value={values.idNo}
  307. name="idNo"
  308. {...register("idNo")}
  309. onChange={handleChange}
  310. placeholder="證件號碼"
  311. fullWidth
  312. error={Boolean(touched.idNo && errors.idNo)}
  313. />
  314. {touched.idNo && errors.idNo && (
  315. <FormHelperText error id="helper-text-enName-signup">
  316. {errors.idNo}
  317. </FormHelperText>
  318. )}
  319. </Stack>
  320. </Grid>
  321. </Grid>
  322. </Grid>
  323. <Grid item xs={12} md={6}>
  324. <Stack spacing={1}>
  325. <InputLabel htmlFor="enName-signup">英文姓名
  326. <span style={{color: '#f10000'}}>*</span>
  327. </InputLabel>
  328. <OutlinedInput
  329. id="enName-login"
  330. type="enName"
  331. value={values.enName}
  332. name="enName"
  333. {...register("enName")}
  334. onChange={handleChange}
  335. placeholder="與你的身份證明文件相同"
  336. fullWidth
  337. error={Boolean(touched.enName && errors.enName)}
  338. />
  339. {touched.enName && errors.enName && (
  340. <FormHelperText error id="helper-text-enName-signup">
  341. {errors.enName}
  342. </FormHelperText>
  343. )}
  344. </Stack>
  345. </Grid>
  346. <Grid item xs={12} md={6}>
  347. <Stack spacing={1}>
  348. <InputLabel htmlFor="chName-signup">中文姓名</InputLabel>
  349. <OutlinedInput
  350. fullWidth
  351. error={Boolean(touched.chName && errors.chName)}
  352. id="chName-signup"
  353. type="text"
  354. {...register("chName")}
  355. value={values.chName}
  356. name="chName"
  357. onChange={handleChange}
  358. placeholder="與你的身份證明文件相同"
  359. inputProps={{}}
  360. />
  361. {touched.chName && errors.chName && (
  362. <FormHelperText error id="helper-text-chName-signup">
  363. {errors.chName}
  364. </FormHelperText>
  365. )}
  366. </Stack>
  367. </Grid>
  368. <Grid item xs={12}>
  369. <Stack spacing={1}>
  370. <InputLabel htmlFor="address1-signup">地址
  371. <span style={{color: '#f10000'}}>*</span>
  372. </InputLabel>
  373. <OutlinedInput
  374. fullWidth
  375. error={Boolean(touched.address1 && errors.address1)}
  376. id="address1-signup"
  377. value={values.address1}
  378. name="address1"
  379. {...register("address1")}
  380. onChange={handleChange}
  381. placeholder="第一行"
  382. inputProps={{}}
  383. />
  384. <OutlinedInput
  385. fullWidth
  386. error={Boolean(touched.address2 && errors.address2)}
  387. id="address2-signup"
  388. value={values.address2}
  389. name="address2"
  390. {...register("address2")}
  391. onChange={handleChange}
  392. placeholder="第二行"
  393. inputProps={{}}
  394. />
  395. <OutlinedInput
  396. fullWidth
  397. error={Boolean(touched.address3 && errors.address3)}
  398. id="address3-signup"
  399. value={values.address3}
  400. name="address3"
  401. {...register("address3")}
  402. onChange={handleChange}
  403. placeholder="第三行"
  404. inputProps={{}}
  405. />
  406. <Select
  407. name ="address4"
  408. multiple
  409. displayEmpty
  410. value={""}
  411. onChange={handleChange}
  412. input={<OutlinedInput />}
  413. {...register("address4")}
  414. renderValue={(selected) => {
  415. if (selected.length === 0) {
  416. return "區域 (只適用於香港)";
  417. }
  418. return selected.join(', ');
  419. }}
  420. // MenuProps={MenuProps}
  421. inputProps={{ 'aria-label': 'Without label' }}
  422. >
  423. </Select>
  424. <Select
  425. name = "address5"
  426. multiple
  427. displayEmpty
  428. value={""}
  429. onChange={handleChange}
  430. input={<OutlinedInput />}
  431. {...register("address5")}
  432. renderValue={(selected) => {
  433. if (selected.length === 0) {
  434. return "國家/地區";
  435. }
  436. return selected.join(', ');
  437. }}
  438. // MenuProps={MenuProps}
  439. inputProps={{ 'aria-label': 'Without label' }}
  440. >
  441. </Select>
  442. {touched.address1 && errors.address1 && (
  443. <FormHelperText error id="helper-text-address1-signup">
  444. {errors.address1}
  445. </FormHelperText>
  446. )}
  447. {touched.address2 && errors.address2 && (
  448. <FormHelperText error id="helper-text-address2-signup">
  449. {errors.address2}
  450. </FormHelperText>
  451. )}
  452. {touched.address3 && errors.address3 && (
  453. <FormHelperText error id="helper-text-address3-signup">
  454. {errors.address3}
  455. </FormHelperText>
  456. )}
  457. </Stack>
  458. </Grid>
  459. <Grid item xs={12} mt={1} mb={1}>
  460. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  461. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary'}}>你的聯絡資料</Typography>
  462. </Stack>
  463. </Grid>
  464. <Grid item xs={12} md={6}>
  465. <Stack spacing={1}>
  466. <InputLabel htmlFor="email-signup">電郵
  467. <span style={{color: '#f10000'}}>*</span>
  468. </InputLabel>
  469. <OutlinedInput
  470. fullWidth
  471. error={Boolean(touched.email && errors.email)}
  472. id="email-login"
  473. type="email"
  474. value={values.email}
  475. name="email"
  476. {...register("email")}
  477. onChange={handleChange}
  478. placeholder="電郵"
  479. inputProps={{}}
  480. />
  481. {touched.email && errors.email && (
  482. <FormHelperText error id="helper-text-email-signup">
  483. {errors.email}
  484. </FormHelperText>
  485. )}
  486. </Stack>
  487. </Grid>
  488. <Grid item xs={12} md={6}>
  489. <Stack spacing={1}>
  490. <InputLabel htmlFor="emailConfirm-signup">確認電郵
  491. <span style={{color: '#f10000'}}>*</span>
  492. </InputLabel>
  493. <OutlinedInput
  494. fullWidth
  495. error={Boolean(touched.emailConfirm && errors.emailConfirm)}
  496. id="emailConfirm-login"
  497. type="emailConfirm"
  498. value={values.emailConfirm}
  499. name="emailConfirm"
  500. onBlur={handleBlur}
  501. onChange={handleChange}
  502. placeholder="確認電郵"
  503. inputProps={{}}
  504. />
  505. {touched.emailConfirm && errors.emailConfirm && (
  506. <FormHelperText error id="helper-text-emailConfirm-signup">
  507. {errors.emailConfirm}
  508. </FormHelperText>
  509. )}
  510. </Stack>
  511. </Grid>
  512. <Grid item xs={12} md={6}>
  513. <Stack spacing={1}>
  514. <InputLabel htmlFor="phone-signup">聯絡電話
  515. <span style={{color: '#f10000'}}>*</span>
  516. </InputLabel>
  517. <OutlinedInput
  518. fullWidth
  519. error={Boolean(touched.phone && errors.phone)}
  520. id="phone-login"
  521. type="phone"
  522. value={values.phone}
  523. name="phone"
  524. {...register("phone")}
  525. onBlur={handleBlur}
  526. onChange={handleChange}
  527. placeholder="聯絡電話"
  528. inputProps={{}}
  529. />
  530. {touched.phone && errors.phone && (
  531. <FormHelperText error id="helper-text-phone-signup">
  532. {errors.phone}
  533. </FormHelperText>
  534. )}
  535. </Stack>
  536. </Grid>
  537. <Grid item xs={12} md={6}>
  538. <Stack spacing={1}>
  539. <InputLabel htmlFor="fax-signup">傳真號碼</InputLabel>
  540. <OutlinedInput
  541. fullWidth
  542. id="fax-login"
  543. type="fax"
  544. value={values.fax}
  545. name="fax"
  546. {...register("fax")}
  547. onBlur={handleBlur}
  548. onChange={handleChange}
  549. placeholder="傳真號碼"
  550. inputProps={{}}
  551. />
  552. </Stack>
  553. </Grid>
  554. <Grid item xs={12} mt={1} mb={1}>
  555. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  556. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary'}}>身份證明文件</Typography>
  557. <Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>請上傳你的 有效身份證明文件 的數碼檔案,以驗證你的身份。</Typography>
  558. <Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography>
  559. <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
  560. <Button variant="contained" component="label" sx={{ fontSize: 12,height:'25px'}}>上傳身份證明文件
  561. <input type="file" accept=".csv" hidden />
  562. </Button>
  563. <Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography>
  564. </Stack>
  565. <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
  566. <Button variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button>
  567. </Stack>
  568. </Stack>
  569. </Grid>
  570. {/* <Grid item xs={12}>
  571. <Typography variant="body2">
  572. By Signing up, you agree to our &nbsp;
  573. <Link variant="subtitle2" component={RouterLink} to="#">
  574. Terms of Service
  575. </Link>
  576. &nbsp; and &nbsp;
  577. <Link variant="subtitle2" component={RouterLink} to="#">
  578. Privacy Policy
  579. </Link>
  580. </Typography>
  581. </Grid> */}
  582. {errors.submit && (
  583. <Grid item xs={12}>
  584. <FormHelperText error>{errors.submit}</FormHelperText>
  585. </Grid>
  586. )}
  587. </Grid>
  588. </Grid>
  589. </Grid>
  590. </FormGroup>
  591. <FormGroup id={"previewForm"} sx={{ display: props.step === 1 ? "" : "none"}}>
  592. <Grid container spacing={3}>
  593. <Grid item xs={12}>
  594. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  595. <div style={{borderBottom: "3px solid #1A4399", width:"100%", margin_right: "15px"}}>
  596. <Typography display="inline" variant="h3" sx={{ color: '#1A4399'}}>成為新的個人用戶</Typography>
  597. </div>
  598. <Typography mt={0.25} variant="h6" sx={{ fontSize: 12,color: '#f10000'}}>註有*的項目必須輸入資料</Typography>
  599. <Typography mt={0.25} variant="h4" sx={{ color: 'primary.primary'}}>你的登入資料</Typography>
  600. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  601. Already have an account?
  602. </Typography> */}
  603. </Stack>
  604. </Grid>
  605. <Grid item xs={12}>
  606. <Grid container spacing={1}>
  607. <Grid item xs={12} >
  608. <Stack spacing={1}>
  609. <InputLabel htmlFor="username-signup">用戶登入名稱
  610. <span style={{color: '#f10000'}}>*</span>
  611. </InputLabel>
  612. <OutlinedInput
  613. id="username-login"
  614. type="username"
  615. value={values.username}
  616. name="username"
  617. onBlur={handleBlur}
  618. onChange={handleChange}
  619. placeholder="用戶登入名稱"
  620. fullWidth
  621. error={Boolean(touched.username && errors.username)}
  622. />
  623. {touched.username && errors.username && (
  624. <FormHelperText error id="helper-text-username-signup">
  625. {errors.username}
  626. </FormHelperText>
  627. )}
  628. </Stack>
  629. </Grid>
  630. <Grid item xs={12} md={6}>
  631. <Stack spacing={1}>
  632. <Stack direction="row" justifyContent="space-between">
  633. <InputLabel htmlFor="password-signup">密碼
  634. <span style={{color: '#f10000'}}>*</span>
  635. </InputLabel>
  636. <InputLabel htmlFor="password-rule">密碼規則</InputLabel>
  637. </Stack>
  638. <OutlinedInput
  639. fullWidth
  640. error={Boolean(touched.password && errors.password)}
  641. id="password-signup"
  642. type={showPassword ? 'text' : 'password'}
  643. value={values.password}
  644. name="password"
  645. onBlur={handleBlur}
  646. onChange={(e) => {
  647. handleChange(e);
  648. changePassword(e.target.value);
  649. }}
  650. endAdornment={
  651. <InputAdornment position="end">
  652. <IconButton
  653. aria-label="toggle password visibility"
  654. onClick={handleClickShowPassword}
  655. onMouseDown={handleMouseDownPassword}
  656. edge="end"
  657. size="large"
  658. >
  659. {showPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  660. </IconButton>
  661. </InputAdornment>
  662. }
  663. placeholder="密碼"
  664. inputProps={{}}
  665. />
  666. {touched.password && errors.password && (
  667. <FormHelperText error id="helper-text-password-signup">
  668. {errors.password}
  669. </FormHelperText>
  670. )}
  671. </Stack>
  672. <FormControl fullWidth sx={{ mt: 2 }}>
  673. <Grid container spacing={2} alignItems="center">
  674. <Grid item>
  675. <Box sx={{ bgcolor: level?.color, width: 85, height: 8, borderRadius: '7px' }} />
  676. </Grid>
  677. <Grid item>
  678. <Typography variant="subtitle1" fontSize="0.75rem">
  679. {level?.label}
  680. </Typography>
  681. </Grid>
  682. </Grid>
  683. </FormControl>
  684. </Grid>
  685. <Grid item xs={12} md={6} >
  686. <Stack spacing={1}>
  687. <InputLabel htmlFor="confirmPassword-signup">確認密碼
  688. <span style={{color: '#f10000'}}>*</span>
  689. </InputLabel>
  690. <OutlinedInput
  691. id="confirmPassword-login"
  692. type={showConfirmPassword ? 'text' : 'password'}
  693. value={values.confirmPassword}
  694. name="confirmPassword"
  695. onBlur={handleBlur}
  696. onChange={(e) => {
  697. handleChange(e);
  698. changePassword(e.target.value);
  699. }}
  700. endAdornment={
  701. <InputAdornment position="end">
  702. <IconButton
  703. aria-label="toggle password visibility"
  704. onClick={handleClickShowConfirmPassword}
  705. onMouseDown={handleMouseDownPassword}
  706. edge="end"
  707. size="large"
  708. >
  709. {showConfirmPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  710. </IconButton>
  711. </InputAdornment>
  712. }
  713. placeholder="確認密碼"
  714. fullWidth
  715. error={Boolean(touched.confirmPassword && errors.confirmPassword)}
  716. />
  717. {touched.confirmPassword && errors.confirmPassword && (
  718. <FormHelperText error id="helper-text-confirmPassword-signup">
  719. {errors.confirmPassword}
  720. </FormHelperText>
  721. )}
  722. </Stack>
  723. </Grid>
  724. <Grid item xs={12} mt={1} mb={1}>
  725. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  726. <Typography display="inline" variant="h4" sx={{ color: '#1A4399'}}>你的個人資料</Typography>
  727. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  728. Already have an account?
  729. </Typography> */}
  730. </Stack>
  731. </Grid>
  732. <Grid item xs={12} md={6}>
  733. <Stack spacing={1}>
  734. <InputLabel htmlFor="enName-signup">英文姓名
  735. <span style={{color: '#f10000'}}>*</span>
  736. </InputLabel>
  737. <OutlinedInput
  738. id="enName-login"
  739. type="enName"
  740. value={values.enName}
  741. name="enName"
  742. onBlur={handleBlur}
  743. onChange={handleChange}
  744. placeholder="與你的身份證明文件相同"
  745. fullWidth
  746. error={Boolean(touched.enName && errors.enName)}
  747. />
  748. {touched.enName && errors.enName && (
  749. <FormHelperText error id="helper-text-enName-signup">
  750. {errors.enName}
  751. </FormHelperText>
  752. )}
  753. </Stack>
  754. </Grid>
  755. <Grid item xs={12} md={6}>
  756. <Stack spacing={1}>
  757. <InputLabel htmlFor="chName-signup">中文姓名</InputLabel>
  758. <OutlinedInput
  759. fullWidth
  760. error={Boolean(touched.chName && errors.chName)}
  761. id="chName-signup"
  762. type="text"
  763. value={values.chName}
  764. name="chName"
  765. onChange={handleChange}
  766. placeholder="與你的身份證明文件相同"
  767. inputProps={{}}
  768. />
  769. {touched.chName && errors.chName && (
  770. <FormHelperText error id="helper-text-chName-signup">
  771. {errors.chName}
  772. </FormHelperText>
  773. )}
  774. </Stack>
  775. </Grid>
  776. <Grid item xs={12}>
  777. <Stack spacing={1}>
  778. <InputLabel htmlFor="address1-signup">地址
  779. <span style={{color: '#f10000'}}>*</span>
  780. </InputLabel>
  781. <OutlinedInput
  782. fullWidth
  783. error={Boolean(touched.address1 && errors.address1)}
  784. id="address1-signup"
  785. value={values.address1}
  786. name="address1"
  787. onBlur={handleBlur}
  788. onChange={handleChange}
  789. placeholder="第一行"
  790. inputProps={{}}
  791. />
  792. <OutlinedInput
  793. fullWidth
  794. error={Boolean(touched.address2 && errors.address2)}
  795. id="address2-signup"
  796. value={values.address2}
  797. name="address2"
  798. onBlur={handleBlur}
  799. onChange={handleChange}
  800. placeholder="第二行"
  801. inputProps={{}}
  802. />
  803. <OutlinedInput
  804. fullWidth
  805. error={Boolean(touched.address3 && errors.address3)}
  806. id="address3-signup"
  807. value={values.address3}
  808. name="address3"
  809. onBlur={handleBlur}
  810. onChange={handleChange}
  811. placeholder="第三行"
  812. inputProps={{}}
  813. />
  814. <Select
  815. name ="adress4"
  816. multiple
  817. displayEmpty
  818. value={""}
  819. onChange={handleChange}
  820. input={<OutlinedInput />}
  821. renderValue={(selected) => {
  822. if (selected.length === 0) {
  823. return "區域 (只適用於香港)";
  824. }
  825. return selected.join(', ');
  826. }}
  827. // MenuProps={MenuProps}
  828. inputProps={{ 'aria-label': 'Without label' }}
  829. >
  830. </Select>
  831. <Select
  832. name = "adress5"
  833. multiple
  834. displayEmpty
  835. value={""}
  836. onChange={handleChange}
  837. input={<OutlinedInput />}
  838. renderValue={(selected) => {
  839. if (selected.length === 0) {
  840. return "國家/地區";
  841. }
  842. return selected.join(', ');
  843. }}
  844. // MenuProps={MenuProps}
  845. inputProps={{ 'aria-label': 'Without label' }}
  846. >
  847. </Select>
  848. {touched.address1 && errors.address1 && (
  849. <FormHelperText error id="helper-text-address1-signup">
  850. {errors.address1}
  851. </FormHelperText>
  852. )}
  853. {touched.address2 && errors.address2 && (
  854. <FormHelperText error id="helper-text-address2-signup">
  855. {errors.address2}
  856. </FormHelperText>
  857. )}
  858. {touched.address3 && errors.address3 && (
  859. <FormHelperText error id="helper-text-address3-signup">
  860. {errors.address3}
  861. </FormHelperText>
  862. )}
  863. </Stack>
  864. </Grid>
  865. <Grid item xs={12} mt={1} mb={1}>
  866. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  867. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary'}}>你的聯絡資料</Typography>
  868. </Stack>
  869. </Grid>
  870. <Grid item xs={12} md={6}>
  871. <Stack spacing={1}>
  872. <InputLabel htmlFor="email-signup">電郵
  873. <span style={{color: '#f10000'}}>*</span>
  874. </InputLabel>
  875. <OutlinedInput
  876. fullWidth
  877. error={Boolean(touched.email && errors.email)}
  878. id="email-login"
  879. type="email"
  880. value={values.email}
  881. name="email"
  882. onBlur={handleBlur}
  883. onChange={handleChange}
  884. placeholder="電郵"
  885. inputProps={{}}
  886. />
  887. {touched.email && errors.email && (
  888. <FormHelperText error id="helper-text-email-signup">
  889. {errors.email}
  890. </FormHelperText>
  891. )}
  892. </Stack>
  893. </Grid>
  894. <Grid item xs={12} md={6}>
  895. <Stack spacing={1}>
  896. <InputLabel htmlFor="emailConfirm-signup">確認電郵
  897. <span style={{color: '#f10000'}}>*</span>
  898. </InputLabel>
  899. <OutlinedInput
  900. fullWidth
  901. error={Boolean(touched.emailConfirm && errors.emailConfirm)}
  902. id="emailConfirm-login"
  903. type="email"
  904. value={values.emailConfirm}
  905. name="emailConfirm"
  906. onBlur={handleBlur}
  907. onChange={handleChange}
  908. placeholder="確認電郵"
  909. inputProps={{}}
  910. />
  911. {touched.emailConfirm && errors.emailConfirm && (
  912. <FormHelperText error id="helper-text-emailConfirm-signup">
  913. {errors.emailConfirm}
  914. </FormHelperText>
  915. )}
  916. </Stack>
  917. </Grid>
  918. <Grid item xs={12} md={6}>
  919. <Stack spacing={1}>
  920. <InputLabel htmlFor="phone-signup">聯絡電話
  921. <span style={{color: '#f10000'}}>*</span>
  922. </InputLabel>
  923. <OutlinedInput
  924. fullWidth
  925. error={Boolean(touched.phone && errors.phone)}
  926. id="phone-login"
  927. type="tel"
  928. value={values.phone}
  929. name="phone"
  930. onBlur={handleBlur}
  931. onChange={handleChange}
  932. placeholder="聯絡電話"
  933. inputProps={{}}
  934. />
  935. {touched.phone && errors.phone && (
  936. <FormHelperText error id="helper-text-phone-signup">
  937. {errors.phone}
  938. </FormHelperText>
  939. )}
  940. </Stack>
  941. </Grid>
  942. <Grid item xs={12} md={6}>
  943. <Stack spacing={1}>
  944. <InputLabel htmlFor="fax-signup">傳真號碼</InputLabel>
  945. <OutlinedInput
  946. fullWidth
  947. id="fax-login"
  948. type="tel"
  949. value={values.fax}
  950. name="fax"
  951. onBlur={handleBlur}
  952. onChange={handleChange}
  953. placeholder="聯絡電話"
  954. inputProps={{}}
  955. />
  956. </Stack>
  957. </Grid>
  958. <Grid item xs={12} mt={1} mb={1}>
  959. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  960. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary'}}>身份證明文件</Typography>
  961. <Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>請上傳你的 有效身份證明文件 的數碼檔案,以驗證你的身份。</Typography>
  962. <Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography>
  963. <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
  964. <Button variant="contained" component="label" sx={{ fontSize: 12,height:'25px'}}>上傳身份證明文件
  965. <input type="file" accept=".csv" hidden />
  966. </Button>
  967. <Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography>
  968. </Stack>
  969. </Stack>
  970. </Grid>
  971. {/* <Grid item xs={12}>
  972. <Typography variant="body2">
  973. By Signing up, you agree to our &nbsp;
  974. <Link variant="subtitle2" component={RouterLink} to="#">
  975. Terms of Service
  976. </Link>
  977. &nbsp; and &nbsp;
  978. <Link variant="subtitle2" component={RouterLink} to="#">
  979. Privacy Policy
  980. </Link>
  981. </Typography>
  982. </Grid> */}
  983. {errors.submit && (
  984. <Grid item xs={12}>
  985. <FormHelperText error>{errors.submit}</FormHelperText>
  986. </Grid>
  987. )}
  988. </Grid>
  989. </Grid>
  990. </Grid>
  991. </FormGroup>
  992. </form>
  993. // </Paper>
  994. )}
  995. </Formik>
  996. );
  997. }
  998. export default CustomFormWizard;