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

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