Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1270 рядки
80 KiB

  1. import { useEffect, useState, } from 'react';
  2. // material-ui
  3. import {
  4. Button,
  5. FormHelperText,
  6. Grid, IconButton,
  7. InputLabel, OutlinedInput,
  8. Stack,
  9. Typography,
  10. FormGroup,
  11. TextField,
  12. Checkbox
  13. // MenuItem
  14. } from '@mui/material';
  15. import { useForm, } from 'react-hook-form'
  16. import Autocomplete from "@mui/material/Autocomplete";
  17. // third party
  18. import { useFormik, FormikProvider } from 'formik';
  19. import * as yup from 'yup';
  20. import axios from "axios";
  21. import { POST_IAMSMART_USER_REGISTER, POST_CAPTCHA, POST_USER_EMAIL, POST_CAPTCHA_AUDIO} from "utils/ApiPathConst";
  22. import * as ComboData from "utils/ComboData";
  23. import Loadable from 'components/Loadable';
  24. import { lazy } from 'react';
  25. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  26. import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
  27. import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined';
  28. import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png';
  29. import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons';
  30. import { Link } from 'react-router-dom';
  31. import * as HttpUtils from "../../../utils/HttpUtils";
  32. import LoopIcon from '@mui/icons-material/Loop';
  33. import { useTheme } from '@mui/material/styles';
  34. import { useLocation } from "react-router-dom";
  35. import { FormattedMessage, useIntl } from "react-intl";
  36. import { notifyActionError } from 'utils/CommonFunction';
  37. // ============================|| FIREBASE - REGISTER ||============================ //
  38. const CustomFormWizard = (props) => {
  39. const location = useLocation();
  40. const theme = useTheme();
  41. const intl = useIntl();
  42. const { locale } = intl;
  43. const [iAmSmartData, setIAmSmartData] = useState({});
  44. const [checkUpload, setCheckUpload] = useState(false);
  45. const [isLoading, setLoding] = useState(true);
  46. const [isLoadingData, setLodingData] = useState(true);
  47. const [captchaImg, setCaptchaImage] = useState("");
  48. const [selectedAddress4, setSelectedAddress4] = useState(null);
  49. const [selectedAddress5, setSelectedAddress5] = useState(ComboData.country[0]);
  50. const [termsAndConAccept, setTermsAndConAccept] = useState(false);
  51. const [termsAndConNotAccept, setTermsAndConNotAccept] = useState(false);
  52. const [isValid, setisValid] = useState(false);
  53. const [checkCountry, setCheckCountry] = useState(false);
  54. const email = document.getElementById("email-login")
  55. const [checkEmail, setCheckEmail] = useState(false)
  56. const [checkEmailBlur, setCheckEmailBlur] = useState(false)
  57. const district = document.getElementById("address4-combo")
  58. const [checkDistrict, setCheckDistrict] = useState(false)
  59. const [checkDistrictBlur, setCheckDistrictBlur] = useState(false)
  60. const [districtErrStr, setDistrictErrStr] = useState("")
  61. const address4ComboList = ComboData.district;
  62. const address5ComboList = ComboData.country;
  63. const [showId, setshowId] = useState(false);
  64. const [showComId, setshowComId] = useState(false);
  65. const [base64Url, setBase64Url] = useState("")
  66. const [checkCode, setCheckCode] = useState("")
  67. useEffect(() => {
  68. location.state?.responseData ?? window.location.assign("/login");
  69. if (captchaImg == "")
  70. onCaptchaChange();
  71. responseToData();
  72. }, []);
  73. const playCaptchaAudio = async () => {
  74. try {
  75. const resp = await axios.post(
  76. `${POST_CAPTCHA_AUDIO}`,
  77. { base64Url, lang: intl.locale },
  78. { responseType: "arraybuffer" }
  79. );
  80. const blob = new Blob([resp.data], { type: "audio/wav" });
  81. const url = URL.createObjectURL(blob);
  82. const audio = new Audio(url);
  83. await audio.play();
  84. } catch (error) {
  85. let message = intl.formatMessage({ id: "captchaAudioError" });
  86. if (error.response) {
  87. if (error.response.status === 404) {
  88. message = intl.formatMessage({ id: "captchaExpired" });
  89. } else if (error.response.status === 500) {
  90. message = intl.formatMessage({ id: "captchaAudioServerError" });
  91. }
  92. } else if (error.request) {
  93. message = intl.formatMessage({ id: "connectionError" });
  94. }
  95. notifyActionError(message);
  96. }
  97. };
  98. const handleClickShowId = () => {
  99. setshowId(!showId);
  100. };
  101. const handleMouseDownId = (event) => {
  102. event.preventDefault();
  103. };
  104. const handleClickShowComId = () => {
  105. setshowComId(!showId);
  106. };
  107. const handleMouseDownComId = (event) => {
  108. event.preventDefault();
  109. };
  110. useEffect(() => {
  111. if (district) {
  112. district.addEventListener("blur", function () {
  113. setCheckDistrictBlur(true)
  114. })
  115. }
  116. }, [district])
  117. useEffect(() => {
  118. if (checkDistrictBlur) {
  119. handleCheckDistrict()
  120. setCheckDistrictBlur(false)
  121. }
  122. }, [checkDistrictBlur])
  123. const handleCheckDistrict = async () => {
  124. setDistrictErrStr("");
  125. if (selectedAddress5?.type === "hongKong") {
  126. if (selectedAddress4 == null || selectedAddress4 == "" || selectedAddress4 == {}){
  127. setCheckDistrict(true)
  128. setDistrictErrStr(getRequiredErrStr("district"))
  129. }else {
  130. setCheckDistrict(false)
  131. }
  132. }
  133. }
  134. function getRequiredErrStr(fieldname) {
  135. return displayErrorMsg(intl.formatMessage({ id: 'require' }, { fieldname: fieldname ? intl.formatMessage({ id: fieldname }) : "" }));
  136. }
  137. function getMaxErrStr(num, fieldname) {
  138. return displayErrorMsg(intl.formatMessage({ id: 'noMoreThenNWords' }, { num: num, fieldname: fieldname ? intl.formatMessage({ id: fieldname }) + ": " : "" }));
  139. }
  140. const responseToData = () => {
  141. //let rd = JSON.parse("{\"emailAddress\":\"[email protected]\",\"postalAddress\":{\"EngPremisesAddress\":{\"EngDistrict\":{\"DcDistrict\":\"KC\",\"Sub-district\":\"TSING YI\"},\"EngEstate\":{\"EstateName\":\"Cheung Hang Estate\",\"EngPhase\":{\"PhaseName\":\"N/A\"}},\"BuildingName\":\"Hang Lai House\",\"EngBlock\":{\"BlockDescriptor\":\"Block\",\"BlockNo\":\"2\"},\"Region\":\"NT\",\"EngStreet\":{\"StreetName\":\"Liu To Road\",\"BuildingNoFrom\":\"6\"},\"Eng3dAddress\":{\"EngFloor\":{\"FloorNum\":\"33\"},\"EngUnit\":{\"UnitDescriptor\":\"Room\",\"UnitNo\":\"3301\"}}}},\"mobileNumber\":{\"CountryCode\":\"852\",\"SubscriberNumber\":\"99999999\"},\"residentialAddress\":{\"ChiPremisesAddress\":{\"Chi3dAddress\":{\"ChiUnit\":{\"UnitDescriptor\":\"室\",\"UnitNo\":\"1010\"},\"ChiFloor\":{\"FloorNum\":\"10\"}},\"ChiBlock\":{\"BlockDescriptor\":\"座\",\"BlockNo\":\"2\"},\"BuildingName\":\"亨麗樓(第2座)\",\"ChiDistrict\":{\"DcDistrict\":\"KC\",\"Sub-district\":\"青衣\"},\"Region\":\"新界\",\"ChiEstate\":{\"EstateName\":\"長亨邨\"},\"ChiStreet\":{\"StreetName\":\"寮肚路\",\"BuildingNoFrom\":\"6\"}}},\"enName\":{\"UnstructuredName\":\"Testing Co One\"},\"idNo\":{\"Identification\":\"G561107\",\"CheckDigit\":\"4\"},\"chName\":{\"ChineseName\":\"測試商一\"}}");
  142. let rd = JSON.parse(location.state?.responseData.data);
  143. let data = {
  144. "enName": rd?.enName?.UnstructuredName ?? "",
  145. "chName": rd?.chName?.ChineseName ?? "",
  146. "idNo": rd?.idNo?.Identification ?? "",
  147. "checkDigit": rd?.idNo?.CheckDigit ?? "",
  148. "email": rd?.emailAddress ?? "",
  149. "phone": rd?.mobileNumber?.SubscriberNumber ?? "",
  150. "phoneCountryCode": rd?.mobileNumber?.CountryCode ?? "",
  151. };
  152. if (rd?.postalAddress) {
  153. if (rd?.postalAddress?.EngPremisesAddress) {
  154. data["address1"] = getAddressEng(rd?.postalAddress?.EngPremisesAddress);
  155. } else if (rd.postalAddress.ChiPremisesAddress) {
  156. data["address1"] = getAddressChi(rd?.postalAddress?.ChiPremisesAddress);
  157. }
  158. } else if (rd?.residentialAddress) {
  159. if (rd?.residentialAddress?.EngPremisesAddress) {
  160. data["address1"] = getAddressEng(rd?.residentialAddress?.EngPremisesAddress);
  161. } else if (rd?.residentialAddress?.ChiPremisesAddress) {
  162. data["address1"] = getAddressChi(rd?.residentialAddress?.ChiPremisesAddress);
  163. }
  164. }
  165. setIAmSmartData(data);
  166. }
  167. const getAddressEng = (pAdd) => {
  168. let unit = (pAdd.Eng3dAddress?.EngUnit?.UnitDescriptor ?? "") + " " + (pAdd.Eng3dAddress?.EngUnit?.UnitNo ?? "");
  169. let block = (pAdd.EngBlock?.BlockDescriptor ?? "") + " " + (pAdd.EngBlock?.BlockNo ?? "");
  170. let floor = pAdd.Eng3dAddress?.EngFloor?.FloorNum ? pAdd.Eng3dAddress?.EngFloor?.FloorNum + "/F " : "";
  171. let street = (pAdd.EngStreet?.EngUnit?.UnitDescriptor ?? "") + " " + (pAdd.Eng3dAddress?.EngUnit?.UnitNo ?? "");
  172. //let region = pAdd.Region ?? "";
  173. let buildingName = pAdd.BuildingName ?? "";
  174. let estate = pAdd.EngEstate?.EstateName ?? "";
  175. let district = pAdd.EngDistrict["Sub - district"] ?? "";
  176. return getAddressStr([unit, block, floor, buildingName, estate, street, district]);
  177. }
  178. const getAddressChi = (pAdd) => {
  179. let unit = (pAdd.Chi3dAddress?.ChiUnit?.UnitDescriptor ?? "") + " " + (pAdd.Chi3dAddress?.ChiUnit?.UnitNo ?? "");
  180. let block = (pAdd.ChiBlock?.BlockDescriptor ?? "") + " " + (pAdd.ChiBlock?.BlockNo ?? "");
  181. let floor = pAdd.Chi3dAddress?.ChiFloor?.FloorNum ? pAdd.Chi3dAddress?.ChiFloor?.FloorNum + "樓 " : "";
  182. let street = (pAdd.ChiStreet?.ChiUnit?.UnitDescriptor ?? "") + " " + (pAdd.Chi3dAddress?.ChiUnit?.UnitNo ?? "");
  183. //let region = pAdd.Region ?? "";
  184. let buildingName = pAdd.BuildingName ?? "";
  185. let estate = pAdd.ChiEstate?.EstateName ?? "";
  186. let district = pAdd.ChiDistrict["Sub - district"] ?? "";
  187. return getAddressStr([district, street, estate, buildingName, street, floor, block, unit]);
  188. }
  189. const getAddressStr = (strs) => {
  190. let add = ""
  191. strs.forEach(str => {
  192. add += str.trim() ? str.trim() + ", " : "";
  193. });
  194. add = add.trim();
  195. if (add?.slice(- 1) == ",") {
  196. add = add.substring(0, add.length - 1);
  197. }
  198. return add;
  199. }
  200. const handleCheckEmail = async () => {
  201. if (values?.email) {
  202. const response = await axios.post(`${POST_USER_EMAIL}`, {
  203. e1: values.email,
  204. })
  205. setCheckEmail((Number(response.data[0]) === 1))
  206. return Number(response.data[0]) === 1
  207. }
  208. }
  209. useEffect(() => {
  210. if (email) {
  211. email.addEventListener("blur", function () {
  212. setCheckEmailBlur(true)
  213. })
  214. }
  215. }, [email])
  216. useEffect(() => {
  217. if (checkEmailBlur) {
  218. handleCheckEmail()
  219. setCheckEmailBlur(false)
  220. }
  221. }, [checkEmailBlur])
  222. useEffect(() => {
  223. if (iAmSmartData) {
  224. formik.setFieldValue("enName", iAmSmartData.enName ?? "");
  225. formik.setFieldValue("chName", iAmSmartData.chName ?? "");
  226. formik.setFieldValue("idNo", iAmSmartData.idNo ?? "");
  227. formik.setFieldValue("checkDigit", iAmSmartData.checkDigit ?? "");
  228. formik.setFieldValue("email", iAmSmartData.email ?? "");
  229. formik.setFieldValue("emailConfirm", iAmSmartData.email ?? "");
  230. formik.setFieldValue("phone", iAmSmartData.phone ?? "");
  231. formik.setFieldValue("phoneCountryCode", iAmSmartData.phoneCountryCode ?? "");
  232. formik.setFieldValue("address1", iAmSmartData.address1 ?? "");
  233. props.setIdNo(iAmSmartData.idNo ?? "");
  234. setLodingData(false)
  235. }
  236. }, [iAmSmartData])
  237. const onCaptchaChange = () => {
  238. HttpUtils.post({
  239. url: POST_CAPTCHA,
  240. params: { width: 130, height: 40, captcha: captchaImg },
  241. onSuccess: (responseData) => {
  242. props.setBase64Url(responseData.base64Url)
  243. setBase64Url(responseData.base64Url)
  244. localStorage.setItem("base64Url", responseData.base64Url);
  245. setCaptchaImage(localStorage.getItem('base64Url'));
  246. }
  247. });
  248. }
  249. const checkDataField = (data) => {
  250. if (data.address1 !== "" &&
  251. data.email !== "" &&
  252. data.emailConfirm !== "" &&
  253. data.email == data.emailConfirm &&
  254. data.phone !== "" &&
  255. data.phoneCountryCode !== "" &&
  256. termsAndConAccept == true &&
  257. data.captchaField &&
  258. handleEmail(data.email) &&
  259. handlePhone(data.phone) &&
  260. handleCaptcha(data.captchaField) &&
  261. handleCheckDistrict()&&
  262. !checkEmail&&
  263. !checkDistrict
  264. ) {
  265. setisValid(true)
  266. return isValid
  267. } else {
  268. setisValid(false)
  269. return isValid
  270. }
  271. };
  272. const handleCheckBoxChange = (event) => {
  273. if (event.target.name == 'termsAndConAccept') {
  274. setTermsAndConAccept(event.target.checked)
  275. setTermsAndConNotAccept(!event.target.checked)
  276. }
  277. if (event.target.name == 'termsAndConNotAccept') {
  278. setTermsAndConNotAccept(event.target.checked)
  279. setTermsAndConAccept(!event.target.checked)
  280. }
  281. };
  282. useEffect(() => {
  283. props.setUpdateValid(isValid)
  284. }, [isValid])
  285. useEffect(() => {
  286. checkDataField(values)
  287. }, [
  288. selectedAddress4, selectedAddress5,
  289. termsAndConAccept, termsAndConNotAccept])
  290. useEffect(() => {
  291. props.step == 2 ? _onSubmit() : null;
  292. if (captchaImg == "")
  293. onCaptchaChange();
  294. checkDataField(values)
  295. }, [props.step])
  296. const { handleSubmit } = useForm({})
  297. const _onSubmit = () => {
  298. setLoding(true);
  299. const userAddress = {
  300. "addressLine1": "",
  301. "addressLine2": "",
  302. "addressLine3": "",
  303. "district": "",
  304. "country": ""
  305. };
  306. userAddress.addressLine1 = values.address1
  307. userAddress.addressLine2 = values.address2
  308. userAddress.addressLine3 = values.address3
  309. userAddress.district = selectedAddress4 == null ? "" : selectedAddress4.type
  310. userAddress.country = selectedAddress5.type
  311. const userFaxNo = {
  312. "countryCode": values.faxCountryCode,
  313. "faxNumber": values.fax,
  314. };
  315. const userMobileNumber = {
  316. "countryCode": values.phoneCountryCode,
  317. "phoneNumber": values.phone,
  318. };
  319. let tncFlag = false;
  320. if (termsAndConAccept) {
  321. tncFlag = true
  322. }
  323. if (termsAndConNotAccept) {
  324. tncFlag = false
  325. }
  326. const preferLocale = locale === 'en' ? 'en' : locale === 'zh-HK' ? 'zh_HK' : 'zh-CN'
  327. const formData = {
  328. enName: iAmSmartData.enName,
  329. chName: iAmSmartData.chName,
  330. emailAddress: values.email,
  331. idDocType: "HKID",
  332. identification: iAmSmartData.idNo,
  333. checkDigit: iAmSmartData.checkDigit,
  334. tncFlag: tncFlag,
  335. type: "IND",
  336. userFaxNo: JSON.stringify(userFaxNo),
  337. userMobileNumber: JSON.stringify(userMobileNumber),
  338. userAddress: JSON.stringify(userAddress),
  339. captcha: base64Url,
  340. checkCode: checkCode,
  341. preferLocale: preferLocale
  342. };
  343. if (isValid) {
  344. axios.post(POST_IAMSMART_USER_REGISTER, formData, {
  345. headers: {
  346. "Content-Type": "multipart/form-data"
  347. }
  348. })
  349. .then((response) => {
  350. console.log(response)
  351. setCheckUpload(true)
  352. setLoding(false);
  353. })
  354. .catch(error => {
  355. console.error(error);
  356. setLoding(false);
  357. });
  358. } else {
  359. setLoding(false);
  360. }
  361. }
  362. function handlePhone(phone) {
  363. if (phone.length < 8) {
  364. return false;
  365. } else {
  366. return true;
  367. }
  368. }
  369. function handleCaptcha(captchaField) {
  370. if (captchaField.length == 5) {
  371. return true
  372. } else {
  373. return false
  374. }
  375. }
  376. function handleEmail(email) {
  377. var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
  378. if (!email.match(validRegex)) {
  379. return false;
  380. } else {
  381. return true;
  382. }
  383. }
  384. function displayErrorMsg(errorMsg) {
  385. return <Typography variant="errorMessage1">{errorMsg}</Typography>
  386. }
  387. const formik = useFormik({
  388. initialValues: ({
  389. email: iAmSmartData.email ?? "",
  390. emailConfirm: iAmSmartData.email ?? "",
  391. address1: iAmSmartData.address1 ?? "",
  392. address2: '',
  393. address3: '',
  394. phone: iAmSmartData.phone ?? "",
  395. phoneCountryCode: iAmSmartData.phoneCountryCode ?? "852",
  396. submit: null,
  397. fax: '',
  398. faxCountryCode: '852',
  399. captchaField: ''
  400. }),
  401. validationSchema: yup.object().shape({
  402. address1: yup.string().max(40, getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))),
  403. address2: yup.string().max(40),
  404. address3: yup.string().max(40),
  405. email: yup.string().email(displayErrorMsg(intl.formatMessage({ id: 'validEmailFormat' }))).max(128, getMaxErrStr(128)).required(displayErrorMsg(intl.formatMessage({ id: 'requireEmail' }))),
  406. emailConfirm: yup.string().email(displayErrorMsg(intl.formatMessage({ id: 'validEmailFormat' }))).max(128, getMaxErrStr(128)).required(displayErrorMsg(intl.formatMessage({ id: 'requireEmail' }))).oneOf([yup.ref('email'), null], displayErrorMsg(intl.formatMessage({ id: 'validSameEmail' }))),
  407. phoneCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({ id: 'requireAtLeast2Number' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireDialingCode' }))),
  408. phone: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'requireAtLeast8Number' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireContactNumber' }))),
  409. captchaField: yup.string().max(5, getMaxErrStr(5)).required(displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))).min(5, displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')),
  410. }),
  411. });
  412. const handleCCPChange = (e) => {
  413. e.preventDefault();
  414. };
  415. const { values } = formik
  416. useEffect(() => {
  417. checkDataField(values)
  418. }, [values])
  419. return (
  420. isLoadingData ?
  421. <LoadingComponent /> :
  422. <FormikProvider value={formik}>
  423. <form onSubmit={handleSubmit(_onSubmit)}>
  424. {/* Input Form */}
  425. <FormGroup id={"inputForm"} sx={{ display: props.step === 0 ? "" : "none" }}>
  426. <Grid container spacing={3}>
  427. <Grid item xs={12} md={12}>
  428. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  429. <div style={{ borderBottom: "3px solid #1A4399", width: "100%", margin_right: "15px" }}>
  430. <Typography display="inline" variant="h3" sx={{ color: '#1A4399' }}>
  431. <FormattedMessage id="becomeNewPersonalUser" />
  432. </Typography>
  433. </div>
  434. <Typography mt={0.25} variant="h6" sx={{ color: '#B00020' }}>
  435. <FormattedMessage id="requireString" />。
  436. </Typography>
  437. <Stack mt={1} direction="row" style={{ alignItems: "center" }}><img src={iAmSmartICon} alt="iAM Smart" width="25" /><Typography mt={0.25} variant="h6" >: <FormattedMessage id="MSG.providedByIAmSmart" /></Typography></Stack>
  438. </Stack>
  439. </Grid>
  440. <Grid item xs={12} md={12}>
  441. <Grid container spacing={1}>
  442. <Grid item xs={12} mt={1} mb={1}>
  443. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  444. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  445. <FormattedMessage id="yourPersonalInformation" />
  446. </Typography>
  447. </Stack>
  448. </Grid>
  449. <Grid item xs={12} md={12} >
  450. <Grid container sx={{ mb: 1 }}>
  451. <InputLabel htmlFor="idDocType-signup">
  452. <Typography variant="h5" sx={{ mr: 1 }}>
  453. <FormattedMessage id="HKIDcard" />: {iAmSmartData.idNo ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : <></>}
  454. {/* {iAmSmartData.idNo + "(" + iAmSmartData.checkDigit + ")"} */}
  455. </Typography>
  456. <Stack direction="row">
  457. <Typography variant="h5">
  458. {iAmSmartData?.idNo?.slice(0, 4)}{showId ? iAmSmartData?.idNo?.slice(4) : "****"}{showId ? '(' + iAmSmartData.checkDigit + ')' : null}
  459. </Typography>
  460. <IconButton
  461. aria-label="toggle id visibility"
  462. onClick={handleClickShowId}
  463. onMouseDown={handleMouseDownId}
  464. edge="end"
  465. size="medium"
  466. >
  467. {showId ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  468. </IconButton>
  469. </Stack>
  470. </InputLabel>
  471. </Grid>
  472. </Grid>
  473. <Grid item xs={12} md={6}>
  474. <Stack spacing={1}>
  475. <InputLabel htmlFor="enName-signup">
  476. <Typography variant="h5">
  477. <FormattedMessage id="userEnglishName" />: {iAmSmartData.enName}{iAmSmartData.enName ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : <></>}
  478. </Typography>
  479. </InputLabel>
  480. </Stack>
  481. </Grid>
  482. <Grid item xs={12} md={6}>
  483. <Stack spacing={1}>
  484. <InputLabel htmlFor="chName-signup">
  485. <Typography variant="h5">
  486. {intl.formatMessage({ id: 'userChineseName' })}: {iAmSmartData.chName}{iAmSmartData.chName ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : <></>}
  487. </Typography>
  488. </InputLabel>
  489. </Stack>
  490. </Grid>
  491. <Grid item xs={12}>
  492. <Stack spacing={1}>
  493. <InputLabel htmlFor="address1-signup">
  494. <Typography variant="h5">
  495. <FormattedMessage id="formAddress" />
  496. <span style={{ color: '#B00020' }}>*</span>
  497. </Typography>
  498. </InputLabel>
  499. <Stack direction="row" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  500. <OutlinedInput
  501. fullWidth
  502. autoFocus
  503. error={Boolean(formik.touched.address1 && formik.errors.address1)}
  504. id="address1-signup"
  505. value={formik.values.address1}
  506. name="address1"
  507. onChange={formik.handleChange}
  508. placeholder={intl.formatMessage({ id: 'addressLine1' })}
  509. onBlur={formik.handleBlur}
  510. inputProps={{
  511. onKeyDown: (e) => {
  512. if (e.key === 'Enter') {
  513. e.preventDefault();
  514. }
  515. },
  516. }}
  517. />
  518. {iAmSmartData.address1 != "" && iAmSmartData.address1 == formik.values.address1 ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : null}
  519. </Stack>
  520. <Stack direction="row" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  521. <OutlinedInput
  522. fullWidth
  523. error={Boolean(formik.touched.address2 && formik.errors.address2)}
  524. id="address2-signup"
  525. value={formik.values.address2}
  526. name="address2"
  527. onBlur={formik.handleBlur}
  528. onChange={formik.handleChange}
  529. placeholder={intl.formatMessage({ id: 'addressLine2' })}
  530. inputProps={{
  531. onKeyDown: (e) => {
  532. if (e.key === 'Enter') {
  533. e.preventDefault();
  534. }
  535. },
  536. }}
  537. />
  538. {iAmSmartData.address2 != "" && iAmSmartData.address2 == formik.values.address2 ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : null}
  539. </Stack>
  540. <Stack direction="row" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  541. <OutlinedInput
  542. fullWidth
  543. error={Boolean(formik.touched.address3 && formik.errors.address3)}
  544. id="address3-signup"
  545. value={formik.values.address3}
  546. name="address3"
  547. onBlur={formik.handleBlur}
  548. onChange={formik.handleChange}
  549. placeholder={intl.formatMessage({ id: 'addressLine3' })}
  550. inputProps={{
  551. onKeyDown: (e) => {
  552. if (e.key === 'Enter') {
  553. e.preventDefault();
  554. }
  555. },
  556. }}
  557. />
  558. {iAmSmartData.address3 != "" && iAmSmartData.address3 == formik.values.address3 ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : null}
  559. </Stack>
  560. <Autocomplete
  561. disablePortal
  562. id="address4-combo"
  563. value={selectedAddress4}
  564. options={address4ComboList}
  565. disabled={checkCountry}
  566. // error={Boolean(districtErrStr != "")}
  567. onBlur={formik.handleBlur}
  568. getOptionLabel={(option) => option.type ? intl.formatMessage({ id: option.type }) : ""}
  569. onChange={(event, newValue) => {
  570. setSelectedAddress4(newValue);
  571. }}
  572. sx={{
  573. '& .MuiInputBase-root': { alignItems: 'center' },
  574. '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' },
  575. '& .MuiOutlinedInput-root': { height: 40 }
  576. }}
  577. renderInput={(params) => <TextField error={checkDistrict} {...params} placeholder={intl.formatMessage({ id: 'region' })}
  578. />}
  579. clearText={intl.formatMessage({ id: "muiClear" })}
  580. closeText={intl.formatMessage({ id: "muiClose" })}
  581. openText={intl.formatMessage({ id: "muiOpen" })}
  582. noOptionsText={intl.formatMessage({ id: "muiNoOptions" })}
  583. />
  584. <Autocomplete
  585. disablePortal
  586. id="address5-combo"
  587. value={selectedAddress5}
  588. options={address5ComboList}
  589. disabled= {true}
  590. getOptionLabel={(option) => option.type ? intl.formatMessage({ id: option.type }) : ""}
  591. onChange={(event, newValue) => {
  592. if (newValue !== null) {
  593. setSelectedAddress5(newValue);
  594. if (newValue.type === 'hongKong') {
  595. setCheckCountry(false)
  596. } else {
  597. setSelectedAddress4("");
  598. setCheckCountry(true)
  599. }
  600. } else {
  601. setSelectedAddress4("");
  602. setCheckCountry(true)
  603. }
  604. }}
  605. sx={{
  606. '& .MuiInputBase-root': { alignItems: 'center' },
  607. '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' },
  608. '& .MuiOutlinedInput-root': { height: 40 }
  609. }}
  610. renderInput={(params) => <TextField {...params} placeholder={intl.formatMessage({ id: 'regionOrCountry' })} />}
  611. clearText={intl.formatMessage({ id: "muiClear" })}
  612. closeText={intl.formatMessage({ id: "muiClose" })}
  613. openText={intl.formatMessage({ id: "muiOpen" })}
  614. noOptionsText={intl.formatMessage({ id: "muiNoOptions" })}
  615. />
  616. {formik.touched.address1 && formik.errors.address1 && (
  617. <FormHelperText error id="helper-text-address1-signup">
  618. {formik.errors.address1}
  619. </FormHelperText>
  620. )}
  621. {formik.touched.address2 && formik.errors.address2 && (
  622. <FormHelperText error id="helper-text-address2-signup">
  623. {formik.errors.address2}
  624. </FormHelperText>
  625. )}
  626. {formik.touched.address3 && formik.errors.address3 && (
  627. <FormHelperText error id="helper-text-address3-signup">
  628. {formik.errors.address3}
  629. </FormHelperText>
  630. )}
  631. {checkDistrict && (
  632. <FormHelperText error >
  633. {districtErrStr}
  634. </FormHelperText>
  635. )}
  636. </Stack>
  637. </Grid>
  638. <Grid item xs={12} mt={1} mb={1}>
  639. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  640. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  641. <FormattedMessage id="yourContact" />
  642. </Typography>
  643. </Stack>
  644. </Grid>
  645. <Grid item xs={12} md={12}>
  646. <Grid container>
  647. <Grid item xs={12} md={6}>
  648. <Stack spacing={1} sx={{ mr: { md: 1 }, mb: 1 }}>
  649. <InputLabel htmlFor="email-signup">
  650. <Typography variant="h5">
  651. <FormattedMessage id="userContactEmail" />
  652. <span style={{ color: '#B00020' }}>*</span>
  653. </Typography>
  654. </InputLabel>
  655. <Stack direction="row" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  656. <OutlinedInput
  657. fullWidth
  658. error={Boolean((formik.touched.email && formik.errors.email) || checkEmail)}
  659. id="email-login"
  660. type="email"
  661. value={formik.values.email.trim()}
  662. name="email"
  663. onChange={formik.handleChange}
  664. placeholder={intl.formatMessage({ id: 'userContactEmail' })}
  665. onBlur={formik.handleBlur}
  666. inputProps={{
  667. "aria-describedby": "helper-text-email-signup",
  668. "aria-label": intl.formatMessage({ id: "userContactEmail" }),
  669. onKeyDown: (e) => {
  670. if (e.key === 'Enter') {
  671. e.preventDefault();
  672. }
  673. },
  674. }}
  675. />
  676. {iAmSmartData.email && iAmSmartData.email == formik.values.email ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : null}
  677. </Stack>
  678. {formik.touched.email && formik.errors.email && (
  679. <FormHelperText error id="helper-text-email-signup">
  680. {formik.errors.email}
  681. </FormHelperText>
  682. )}
  683. {checkEmail && (
  684. <FormHelperText error id="helper-text-email-signup">
  685. <FormattedMessage id="emailUsed" />
  686. </FormHelperText>
  687. )}
  688. </Stack>
  689. </Grid>
  690. <Grid item xs={12} md={6}>
  691. <Stack spacing={1} >
  692. <InputLabel htmlFor="emailConfirm-signup">
  693. <Typography variant="h5">
  694. <FormattedMessage id="confirmEmail" />
  695. <span style={{ color: '#B00020' }}>*</span>
  696. </Typography>
  697. </InputLabel>
  698. <Stack direction="row" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  699. <OutlinedInput
  700. fullWidth
  701. error={Boolean(formik.touched.emailConfirm && formik.errors.emailConfirm)}
  702. id="emailConfirm-login"
  703. type="email"
  704. value={formik.values.emailConfirm}
  705. name="emailConfirm"
  706. // onBlur={formik.handleBlur}
  707. onChange={formik.handleChange}
  708. placeholder={intl.formatMessage({ id: 'confirmEmail' })}
  709. onBlur={formik.handleBlur}
  710. onCut={handleCCPChange}
  711. onCopy={handleCCPChange}
  712. onPaste={handleCCPChange}
  713. inputProps={{
  714. "aria-label": intl.formatMessage({ id: "confirmEmail" }),
  715. "aria-describedby": "helper-text-emailConfirm-signup",
  716. onKeyDown: (e) => {
  717. if (e.key === 'Enter') {
  718. e.preventDefault();
  719. }
  720. },
  721. }}
  722. />
  723. {iAmSmartData.email && iAmSmartData.email == formik.values.emailConfirm ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : null}
  724. </Stack>
  725. {formik.touched.emailConfirm && formik.errors.emailConfirm && (
  726. <FormHelperText error id="helper-text-emailConfirm-signup">
  727. {formik.errors.emailConfirm}
  728. </FormHelperText>
  729. )}
  730. </Stack>
  731. </Grid>
  732. </Grid>
  733. </Grid>
  734. <Grid item xs={12} md={12}>
  735. <Grid container>
  736. <Grid item xs={12} md={6}>
  737. <Grid container>
  738. <Grid item xs={12} md={12}>
  739. <Stack direction="column" spacing={1} sx={{ mr: { md: 1 }, mb: 1 }}>
  740. <InputLabel htmlFor="phone-signup">
  741. <Typography variant="h5">
  742. <FormattedMessage id="userContactNumber" />
  743. <span style={{ color: '#B00020' }}>*</span>
  744. </Typography>
  745. </InputLabel>
  746. <Stack direction="row" ustifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  747. <OutlinedInput
  748. id="phoneCountryCode-login"
  749. type="phoneCountryCode"
  750. value={formik.values.phoneCountryCode.trim()}
  751. name="phoneCountryCode"
  752. // onBlur={formik.handleBlur}
  753. // onChange={formik.handleChange}
  754. onChange={(event) => {
  755. const value = event.target.value;
  756. if (value.match(/[^0-9]/)) {
  757. return event.preventDefault();
  758. }
  759. formik.setFieldValue("phoneCountryCode", value);
  760. }}
  761. placeholder={intl.formatMessage({ id: 'dialingCode' })}
  762. error={Boolean(formik.touched.phone && formik.errors.phone)}
  763. onBlur={formik.handleBlur}
  764. inputProps={{
  765. maxLength: 3,
  766. onKeyDown: (e) => {
  767. if (e.key === 'Enter') {
  768. e.preventDefault();
  769. }
  770. },
  771. }}
  772. sx={{ width: '25%' }}
  773. />
  774. <OutlinedInput
  775. id="phone-login"
  776. type="phone"
  777. value={formik.values.phone.trim()}
  778. name="phone"
  779. // onBlur={formik.handleBlur}
  780. // onChange={formik.handleChange}
  781. onChange={(event) => {
  782. const value = event.target.value;
  783. if (value.match(/[^0-9]/)) {
  784. return event.preventDefault();
  785. }
  786. formik.setFieldValue("phone", value);
  787. }}
  788. placeholder={intl.formatMessage({ id: 'userContactNumber' })}
  789. error={Boolean(formik.touched.phone && formik.errors.phone)}
  790. onBlur={formik.handleBlur}
  791. inputProps={{
  792. "aria-label": intl.formatMessage({ id: "userContactNumber" }),
  793. "aria-describedby": 'helper-text-phone-signup',
  794. maxLength: 11,
  795. onKeyDown: (e) => {
  796. if (e.key === 'Enter') {
  797. e.preventDefault();
  798. }
  799. },
  800. }}
  801. fullWidth
  802. />
  803. {iAmSmartData.phone && iAmSmartData.phone == formik.values.phone && iAmSmartData.phoneCountryCode == formik.values.phoneCountryCode ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : null}
  804. </Stack>
  805. {formik.touched.phone && formik.errors.phone && (
  806. <FormHelperText error id="helper-text-phone-signup">
  807. {formik.errors.phone}
  808. </FormHelperText>
  809. )}
  810. </Stack>
  811. </Grid>
  812. </Grid>
  813. </Grid>
  814. <Grid item xs={12} md={6}>
  815. <Grid container>
  816. <Grid item xs={12} md={12}>
  817. <Stack spacing={1} direction="column">
  818. <InputLabel htmlFor="fax-signup">
  819. <Typography variant="h5">
  820. <FormattedMessage id="userFaxNumber" />
  821. </Typography>
  822. </InputLabel>
  823. <Stack direction="row" ustifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  824. <OutlinedInput
  825. error={Boolean(formik.touched.fax && formik.errors.fax)}
  826. id="faxCountryCode-login"
  827. type="faxCountryCode"
  828. value={formik.values.faxCountryCode.trim()}
  829. name="faxCountryCode"
  830. // onChange={formik.handleChange}
  831. onChange={(event) => {
  832. const value = event.target.value;
  833. if (value.match(/[^0-9]/)) {
  834. return event.preventDefault();
  835. }
  836. formik.setFieldValue("faxCountryCode", value);
  837. }}
  838. placeholder={intl.formatMessage({ id: 'dialingCode' })}
  839. onBlur={formik.handleBlur}
  840. inputProps={{
  841. maxLength: 3,
  842. onKeyDown: (e) => {
  843. if (e.key === 'Enter') {
  844. e.preventDefault();
  845. }
  846. },
  847. }}
  848. sx={{ width: '25%' }}
  849. />
  850. <OutlinedInput
  851. id="fax-login"
  852. type="fax"
  853. value={formik.values.fax.trim()}
  854. name="fax"
  855. onBlur={formik.handleBlur}
  856. // onChange={formik.handleChange}
  857. onChange={(event) => {
  858. const value = event.target.value;
  859. if (value.match(/[^0-9]/)) {
  860. return event.preventDefault();
  861. }
  862. formik.setFieldValue("fax", value);
  863. }}
  864. placeholder={intl.formatMessage({ id: 'userFaxNumber' })}
  865. inputProps={{
  866. maxLength: 8,
  867. onKeyDown: (e) => {
  868. if (e.key === 'Enter') {
  869. e.preventDefault();
  870. }
  871. },
  872. }}
  873. sx={{ width: '75%' }}
  874. />
  875. </Stack>
  876. </Stack>
  877. </Grid>
  878. </Grid>
  879. </Grid>
  880. </Grid>
  881. </Grid>
  882. </Grid>
  883. <Grid item xs={12} md={12}>
  884. <Grid container>
  885. <Grid item xs={12} md={12}>
  886. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  887. <FormattedMessage id="termsAndCondition" />
  888. <span style={{ color: '#B00020' }}>*</span>
  889. </Typography>
  890. </Grid>
  891. <Grid item xs={12} md={12}>
  892. <Grid container>
  893. <Grid item xs={12} md={12}>
  894. <Typography variant="h5" sx={{ textAlign: "left", borderRadius: "inherit", borderStyle: "solid", borderWidth: "1px", borderColor: "#0C489E" }}>
  895. <div style={{ padding: 12 }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "termsAndCon" }) }} />
  896. </Typography>
  897. </Grid>
  898. </Grid>
  899. <Grid item xs={12} s={12} md={12} lg={12}>
  900. <Grid container>
  901. <Grid item xs={6} s={6} md={11} lg={11}>
  902. <Grid container>
  903. <Grid item sx={{ display: 'flex', alignItems: 'center' }}>
  904. <Checkbox
  905. checked={termsAndConAccept}
  906. onChange={handleCheckBoxChange}
  907. name="termsAndConAccept"
  908. color="primary"
  909. size="small"
  910. />
  911. <Typography variant="h5">
  912. <FormattedMessage id="iConfirm" />
  913. </Typography>
  914. </Grid>
  915. </Grid>
  916. </Grid>
  917. <Grid item xs={6} s={6} md={3} lg={3}>
  918. <Grid container style={{ display: "none" }}>
  919. <Grid item sx={{ display: 'flex', alignItems: 'center' }}>
  920. <Checkbox
  921. checked={termsAndConNotAccept}
  922. onChange={handleCheckBoxChange}
  923. name="termsAndConNotAccept"
  924. color="primary"
  925. size="small"
  926. />
  927. <Typography variant="h5">
  928. <FormattedMessage id="rejectTerms" />
  929. </Typography>
  930. </Grid>
  931. </Grid>
  932. </Grid>
  933. </Grid>
  934. </Grid>
  935. </Grid>
  936. </Grid>
  937. </Grid>
  938. <Grid item xs={12} lg={12}>
  939. <Grid container>
  940. <Stack direction="column">
  941. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  942. <FormattedMessage id="verify" />
  943. <span style={{ color: '#B00020' }}>*</span>
  944. </Typography>
  945. <Stack spacing={1} direction="row">
  946. <Grid item xs={5} lg={5} style={{ "border": "1px solid black" }}>
  947. <img src={captchaImg} alt="" />
  948. </Grid>
  949. <Grid item xs={1} lg={1} style={{ "border": "0px solid black" }}>
  950. <IconButton aria-label="refrashCaptcha" size="large" onClick={() => { onCaptchaChange() }}>
  951. <LoopIcon fontSize="inherit" />
  952. </IconButton>
  953. </Grid>
  954. <Grid item xs={6} lg={6}>
  955. <OutlinedInput
  956. fullWidth
  957. id="captchaField"
  958. type="text"
  959. value={formik.values.captchaField.trim()}
  960. onBlur={formik.handleBlur}
  961. error={Boolean(formik.touched.captchaField && formik.errors.captchaField)}
  962. name="captchaField"
  963. onChange={(event) => {
  964. const value = event.target.value;
  965. props.setCheckCode(event.target.value);
  966. setCheckCode(event.target.value);
  967. formik.setFieldValue("captchaField", value);
  968. }}
  969. sx={{ width: '75%' }}
  970. />
  971. </Grid>
  972. </Stack>
  973. {formik.touched.captchaField && formik.errors.captchaField && (
  974. <FormHelperText error id="helper-text-captcha-signup">
  975. {formik.errors.captchaField}
  976. </FormHelperText>
  977. )}
  978. <Stack spacing={1} direction="row">
  979. <Button onClick={playCaptchaAudio} aria-label={intl.formatMessage({id:"captchaPlayAudioAria"})}>
  980. <FormattedMessage id="captchaPlayAudio" />
  981. </Button>
  982. </Stack>
  983. </Stack>
  984. </Grid>
  985. </Grid>
  986. </Grid>
  987. </Grid>
  988. </FormGroup>
  989. {/* Preview Form */}
  990. <FormGroup id={"previewForm"} sx={{ display: props.step === 1 ? "" : "none" }}>
  991. <Grid container spacing={3}>
  992. <Grid item xs={12} md={12}>
  993. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  994. <div style={{ borderBottom: "3px solid #1A4399", width: "100%", margin_right: "15px" }}>
  995. <Typography display="inline" variant="h3" sx={{ color: '#1A4399' }}>
  996. <FormattedMessage id="becomeNewPersonalUser" />
  997. </Typography>
  998. </div>
  999. </Stack>
  1000. </Grid>
  1001. <Grid item xs={12} md={12}>
  1002. <Grid container spacing={2}>
  1003. <Grid item xs={12} mt={1} mb={1}>
  1004. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1005. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1006. <FormattedMessage id="yourPersonalInformation" />
  1007. </Typography>
  1008. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  1009. Already have an account?
  1010. </Typography> */}
  1011. </Stack>
  1012. </Grid>
  1013. <Grid item xs={12} md={12} >
  1014. <Stack direction="row">
  1015. <Typography variant="h5" color={theme.palette.grey[600]} sx={{ mr: 1 }}>
  1016. <FormattedMessage id="userIdDoc" />
  1017. </Typography>
  1018. <Typography variant="h5" name="preview-idDocType-1">
  1019. {formik?.values?.idNo?.slice(0, 4)}
  1020. {/* {formik.values.idNo + "(" + formik.values.checkDigit + ")"} */}
  1021. </Typography>
  1022. <Typography variant="h5" name="preview-idDocType-2">
  1023. {showComId ? formik?.values?.idNo?.slice(4) : "****"}{showComId ? '(' + formik.values.checkDigit + ')' : null}
  1024. {/* {formik.values.idNo + "(" + formik.values.checkDigit + ")"} */}
  1025. </Typography>
  1026. <IconButton
  1027. aria-label="toggle id visibility"
  1028. onClick={handleClickShowComId}
  1029. onMouseDown={handleMouseDownComId}
  1030. edge="end"
  1031. size="medium"
  1032. >
  1033. {showComId ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  1034. </IconButton>
  1035. </Stack>
  1036. </Grid>
  1037. <Grid item xs={12} md={6}>
  1038. <Stack spacing={1} direction="row">
  1039. <Typography variant="h5" color={theme.palette.grey[600]}>
  1040. <FormattedMessage id="userEnglishName" />:
  1041. </Typography>
  1042. <Typography variant="h5" id="preview-enName-signup">
  1043. {formik.values.enName}
  1044. </Typography>
  1045. {iAmSmartData.enName ? <img src={iAmSmartICon} alt="iAM Smart" width="25" /> : <></>}
  1046. </Stack>
  1047. </Grid>
  1048. <Grid item xs={12} md={6}>
  1049. <Stack spacing={1} direction="row">
  1050. <Typography variant="h5" color={theme.palette.grey[600]}>
  1051. <FormattedMessage id="userChineseName" />:
  1052. </Typography>
  1053. <Typography variant="h5" id="preview-chName-signup">
  1054. {formik.values.chName}
  1055. </Typography>
  1056. </Stack>
  1057. </Grid>
  1058. <Grid item xs={12}>
  1059. <Stack spacing={1} direction="column">
  1060. <Typography variant="h5" color={theme.palette.grey[600]}>
  1061. <FormattedMessage id="formAddress" />:
  1062. </Typography>
  1063. <Stack spacing={1} direction="column">
  1064. <Typography variant="h5" id="preview-address1-signup">
  1065. {formik.values.address1}
  1066. </Typography>
  1067. {formik.values.address2 != null ?
  1068. <Typography variant="h5" id="preview-address2-signup">
  1069. {formik.values.address2}
  1070. </Typography>
  1071. : null}
  1072. {formik.values.address3 != null ?
  1073. <Typography variant="h5" id="preview-address3-signup">
  1074. {formik.values.address3}
  1075. </Typography>
  1076. : null}
  1077. {selectedAddress5.type === "hongKong" ?
  1078. <Stack direction="column">
  1079. {/* <Typography variant="h5" color={theme.palette.grey[600]} id="preview-address4-signup">
  1080. <FormattedMessage id="region" />:
  1081. </Typography> */}
  1082. <Typography variant="h5">
  1083. {!selectedAddress4 ? "" : intl.formatMessage({ id: selectedAddress4.type })}
  1084. </Typography>
  1085. </Stack>
  1086. : null}
  1087. <Stack direction="column">
  1088. {/* <Typography variant="h5" color={theme.palette.grey[600]} id="preview-address5-signup">
  1089. <FormattedMessage id="regionOrCountry" />:
  1090. </Typography> */}
  1091. <Typography variant="h5">
  1092. {intl.formatMessage({ id: selectedAddress5.type })}
  1093. </Typography>
  1094. </Stack>
  1095. </Stack>
  1096. </Stack>
  1097. </Grid>
  1098. <Grid item xs={12} mt={1} mb={1}>
  1099. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1100. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1101. <FormattedMessage id="yourContact" />
  1102. </Typography>
  1103. </Stack>
  1104. </Grid>
  1105. <Grid item xs={12} md={12}>
  1106. <Stack spacing={1} direction="row">
  1107. <Typography variant="h5" color={theme.palette.grey[600]}>
  1108. <FormattedMessage id="userContactEmail" />:
  1109. </Typography>
  1110. <Typography variant="h5" id="preview-email-signup">
  1111. {formik.values.email}
  1112. </Typography>
  1113. </Stack>
  1114. </Grid>
  1115. <Grid item xs={12} md={6}>
  1116. <Stack spacing={1} direction="row">
  1117. <Typography variant="h5" color={theme.palette.grey[600]}>
  1118. <FormattedMessage id="userContactNumber" />:
  1119. </Typography>
  1120. <Typography variant="h5" id="preview-phone-signup">
  1121. +{formik.values.phoneCountryCode} {formik.values.phone}
  1122. </Typography>
  1123. </Stack>
  1124. </Grid>
  1125. {formik.values.faxCountryCode != "" && formik.values.fax != "" ?
  1126. <Grid item xs={12} md={6}>
  1127. <Stack spacing={1} direction="row">
  1128. <Typography variant="h5" color={theme.palette.grey[600]}>
  1129. <FormattedMessage id="userFaxNumber" />:
  1130. </Typography>
  1131. <Typography variant="h5" id="preview-fax-signup">
  1132. +{formik.values.faxCountryCode} {formik.values.fax}
  1133. </Typography>
  1134. </Stack>
  1135. </Grid>
  1136. : null}
  1137. </Grid>
  1138. </Grid>
  1139. </Grid>
  1140. </FormGroup>
  1141. {/* Submit page */}
  1142. <FormGroup id={"submitForm"} sx={{ display: props.step === 2 ? "" : "none" }}>
  1143. <Grid container spacing={3}>
  1144. {isLoading ?
  1145. <LoadingComponent /> :
  1146. <Grid item xs={12}>
  1147. {checkUpload ?
  1148. // SUCCESS page
  1149. <Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
  1150. <CheckCircleOutlineIcon color="success" sx={{ width: "200px", height: "200px" }} />
  1151. <Typography display="inline" variant="h4">
  1152. <FormattedMessage id="registerSubmitted" />
  1153. </Typography>
  1154. <Typography display="inline" variant="h4">
  1155. <FormattedMessage id="emailSent" />
  1156. </Typography>
  1157. <Button variant="outlined" component={Link} to="/login" ><Typography variant="h5">
  1158. <FormattedMessage id="backToLogin" />
  1159. </Typography></Button>
  1160. </Stack>
  1161. :
  1162. // ERROR page
  1163. <Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
  1164. {/* <Button disabled={true} hidden={true} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> */}
  1165. <CancelOutlinedIcon color="error" sx={{ width: "200px", height: "200px" }} />
  1166. <Typography display="inline" variant="h4">
  1167. <FormattedMessage id="registerFail" />
  1168. </Typography>
  1169. <Button color="error" variant="outlined" component={Link} to="/login" ><Typography variant="h5">
  1170. <FormattedMessage id="backToLogin" />
  1171. </Typography></Button>
  1172. </Stack>
  1173. }
  1174. </Grid>
  1175. }
  1176. </Grid>
  1177. </FormGroup>
  1178. </form>
  1179. </FormikProvider>
  1180. );
  1181. }
  1182. export default CustomFormWizard;