Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

1814 linhas
110 KiB

  1. import { useEffect, useState, } from 'react';
  2. // material-ui
  3. import {
  4. Box,
  5. Button,
  6. FormControl,
  7. FormHelperText,
  8. Grid, IconButton,
  9. InputAdornment,
  10. InputLabel, OutlinedInput,
  11. Stack,
  12. Typography,
  13. FormGroup,
  14. TextField,
  15. Checkbox
  16. // MenuItem
  17. } from '@mui/material';
  18. import { useForm, } from 'react-hook-form'
  19. import Autocomplete from "@mui/material/Autocomplete";
  20. // third party
  21. import { useFormik, FormikProvider } 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. import { POST_PUBLIC_USER_REGISTER, POST_CAPTCHA, POST_USERNAME, POST_USER_EMAIL, POST_CAPTCHA_AUDIO} from "utils/ApiPathConst";
  30. // import * as HttpUtils from 'utils/HttpUtils';
  31. import * as ComboData from "utils/ComboData";
  32. import Loadable from 'components/Loadable';
  33. import { lazy } from 'react';
  34. const UploadFileTable = Loadable(lazy(() => import('./UploadFileTable')));
  35. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  36. const PreviewUploadFileTable = Loadable(lazy(() => import('./PreviewUploadFileTable')));
  37. // import UploadFileTable from './UploadFileTable';
  38. // import LoadingComponent from "../../extra-pages/LoadingComponent";
  39. // assets
  40. import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons';
  41. import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
  42. import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined';
  43. import { Link } from 'react-router-dom';
  44. import * as HttpUtils from "../../../utils/HttpUtils"
  45. import LoopIcon from '@mui/icons-material/Loop';
  46. import { useTheme } from '@mui/material/styles';
  47. import {PNSPS_LONG_BUTTON_THEME} from "../../../themes/buttonConst";
  48. import {ThemeProvider} from "@emotion/react";
  49. import {FormattedMessage, useIntl} from "react-intl";
  50. //import { Invaild } from 'utils/IconUtils';
  51. import { notifyActionError } from 'utils/CommonFunction';
  52. // ============================|| FIREBASE - REGISTER ||============================ //
  53. const BusCustomFormWizard = (props) => {
  54. const intl = useIntl();
  55. const { locale } = intl;
  56. const theme = useTheme()
  57. const [level, setLevel] = useState();
  58. const [showPassword, setShowPassword] = useState(false);
  59. const [showConfirmPassword, setshowConfirmPassword] = useState(false);
  60. const [fileList, setFileList] = useState([]);
  61. const [fileListData, setFileListData] = useState([]);
  62. const [checkUpload, setCheckUpload] = useState(false);
  63. const [isLoading, setLoding] = useState(true);
  64. const [updateRows, setUpdateRows] = useState([]);
  65. // const [userNameList, setUserNameList] = useState([]);
  66. const [captchaImg, setCaptchaImage] = useState("");
  67. const [base64Url, setBase64Url] = useState("")
  68. const [checkCode, setCheckCode] = useState("")
  69. const handleClickShowPassword = () => {
  70. setShowPassword(!showPassword);
  71. };
  72. const handleClickShowConfirmPassword = () => {
  73. setshowConfirmPassword(!showConfirmPassword);
  74. };
  75. const handleMouseDownPassword = (event) => {
  76. event.preventDefault();
  77. };
  78. const changePassword = (value) => {
  79. const temp = strengthIndicator(value);
  80. setLevel(strengthColorChi(temp));
  81. };
  82. const [selectedAddress4, setSelectedAddress4] = useState(null);
  83. const [selectedAddress5, setSelectedAddress5] = useState(ComboData.country[0]);
  84. const [termsAndConAccept, setTermsAndConAccept] = useState(false);
  85. const [termsAndConNotAccept, setTermsAndConNotAccept] = useState(false);
  86. const [isValid, setisValid] = useState(false);
  87. const [checkCountry, setCheckCountry] = useState(false);
  88. const username = document.getElementById("username-login")
  89. const [checkUsername, setCheckUsername] = useState(false);
  90. const [checkUsernameBlur, setCheckUsernameBlur] = useState(false)
  91. const email = document.getElementById("email-login")
  92. const [checkEmail, setCheckEmail] = useState(false)
  93. const [checkEmailBlur, setCheckEmailBlur] = useState(false)
  94. const district = document.getElementById("address4-combo")
  95. const [checkDistrict, setCheckDistrict] = useState(false)
  96. const [checkDistrictBlur, setCheckDistrictBlur] = useState(false)
  97. const [districtErrStr, setDistrictErrStr] = useState("")
  98. const address4ComboList = ComboData.district;
  99. const address5ComboList = ComboData.country;
  100. const refType = "identification";
  101. useEffect(() => {
  102. changePassword('');
  103. }, []);
  104. const playCaptchaAudio = async () => {
  105. try {
  106. const resp = await axios.post(
  107. `${POST_CAPTCHA_AUDIO}`,
  108. { base64Url, lang: intl.locale },
  109. { responseType: "arraybuffer" }
  110. );
  111. const blob = new Blob([resp.data], { type: "audio/wav" });
  112. const url = URL.createObjectURL(blob);
  113. const audio = new Audio(url);
  114. await audio.play();
  115. } catch (error) {
  116. let message = intl.formatMessage({ id: "captchaAudioError" });
  117. if (error.response) {
  118. if (error.response.status === 404) {
  119. message = intl.formatMessage({ id: "captchaExpired" });
  120. } else if (error.response.status === 500) {
  121. message = intl.formatMessage({ id: "captchaAudioServerError" });
  122. }
  123. } else if (error.request) {
  124. message = intl.formatMessage({ id: "connectionError" });
  125. }
  126. notifyActionError(message);
  127. }
  128. };
  129. const handleCheckUsername = async () => {
  130. if (values?.username) {
  131. const response = await axios.post(`${POST_USERNAME}`, {
  132. u1: values.username,
  133. })
  134. setCheckUsername((Number(response.data[0]) === 1))
  135. return Number(response.data[0]) === 1
  136. }
  137. }
  138. const handleCheckEmail = async () => {
  139. if (values?.email) {
  140. const response = await axios.post(`${POST_USER_EMAIL}`, {
  141. e1: values.email,
  142. })
  143. setCheckEmail((Number(response.data[0]) === 1))
  144. return Number(response.data[0]) === 1
  145. }
  146. }
  147. useEffect(() => {
  148. if (username) {
  149. username.addEventListener("blur", function () {
  150. setCheckUsernameBlur(true)
  151. })
  152. }
  153. }, [username])
  154. useEffect(() => {
  155. if (checkUsernameBlur) {
  156. handleCheckUsername()
  157. setCheckUsernameBlur(false)
  158. }
  159. }, [checkUsernameBlur])
  160. useEffect(() => {
  161. if (email) {
  162. email.addEventListener("blur", function () {
  163. setCheckEmailBlur(true)
  164. })
  165. }
  166. }, [email])
  167. useEffect(() => {
  168. if (checkEmailBlur) {
  169. handleCheckEmail()
  170. setCheckEmailBlur(false)
  171. }
  172. }, [checkEmailBlur])
  173. useEffect(() => {
  174. if (district) {
  175. district.addEventListener("blur", function () {
  176. setCheckDistrictBlur(true)
  177. })
  178. }
  179. }, [district])
  180. useEffect(() => {
  181. if (checkDistrictBlur) {
  182. handleCheckDistrict()
  183. setCheckDistrictBlur(false)
  184. }
  185. }, [checkDistrictBlur])
  186. const handleCheckDistrict = async () => {
  187. setDistrictErrStr("");
  188. if (selectedAddress5?.type === "hongKong") {
  189. if (selectedAddress4 == null || selectedAddress4 == "" || selectedAddress4 == {}){
  190. setCheckDistrict(true)
  191. setDistrictErrStr(getRequiredErrStr("district"))
  192. }else {
  193. setCheckDistrict(false)
  194. }
  195. }
  196. }
  197. function getRequiredErrStr(fieldname){
  198. return displayErrorMsg(intl.formatMessage({ id: 'require'},{fieldname:fieldname?intl.formatMessage({ id: fieldname}):""}));
  199. }
  200. function getMaxErrStr(num, fieldname){
  201. return displayErrorMsg(intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}));
  202. }
  203. const onCaptchaChange = () => {
  204. HttpUtils.post({
  205. url: POST_CAPTCHA,
  206. params: { width: 130, height: 40, captcha: captchaImg},
  207. onSuccess: (responseData) => {
  208. props.setBase64Url(responseData.base64Url)
  209. setBase64Url(responseData.base64Url)
  210. localStorage.setItem("base64Url", responseData.base64Url);
  211. setCaptchaImage(localStorage.getItem('base64Url'));
  212. }
  213. });
  214. }
  215. const checkDataField = (data) => {
  216. // console.log(data.brExpiryDate)
  217. if (
  218. handleCaptcha(data.captchaField) &&
  219. data.username !== "" &&
  220. data.password !== "" &&
  221. data.confirmPassword !== "" &&
  222. data.password === data.confirmPassword &&
  223. (data.chCompanyName !== "" || data.enCompanyName !== "") &&
  224. data.enName !== "" &&
  225. data.chName !== "" &&
  226. data.address1 !== "" &&
  227. data.email !== "" &&
  228. data.emailConfirm !== "" &&
  229. data.email === data.emailConfirm &&
  230. data.phone !== "" &&
  231. data.phoneCountryCode !== "" &&
  232. termsAndConAccept === true &&
  233. fileList.length !== 0 &&
  234. data.brNo !== "" &&
  235. data.brExpiryDate !== "" &&
  236. handlePassword(data.password) &&
  237. handleEmail(data.email) &&
  238. handlePhone(data.phone) &&
  239. handleUserName(data.username) &&
  240. handleBrNo(data.brNo) &&
  241. handleCheckDistrict()&&
  242. !checkUsername&&
  243. !checkEmail&&
  244. !checkDistrict
  245. ) {
  246. setisValid(true)
  247. return isValid
  248. } else {
  249. setisValid(false)
  250. return isValid
  251. }
  252. };
  253. const handleCheckBoxChange = (event) => {
  254. // console.log(event.target)
  255. if (event.target.name == 'termsAndConAccept') {
  256. setTermsAndConAccept(event.target.checked)
  257. setTermsAndConNotAccept(!event.target.checked)
  258. }
  259. if (event.target.name == 'termsAndConNotAccept') {
  260. setTermsAndConNotAccept(event.target.checked)
  261. setTermsAndConAccept(!event.target.checked)
  262. }
  263. };
  264. useEffect(() => {
  265. let updateRowList = new DataTransfer();
  266. var updateRowsIndex = updateRows.length;
  267. const saveFileList = [];
  268. if (updateRowsIndex != null) {
  269. for (let i = 0; i < updateRowsIndex; i++) {
  270. const file = updateRows[i]
  271. file.id = i;
  272. updateRowList.items.add(file);
  273. saveFileList.push(file);
  274. }
  275. let updatedFileList = updateRowList.files;
  276. setFileList(updatedFileList);
  277. setFileListData(saveFileList)
  278. }
  279. }, [updateRows]);
  280. const handleBrNo = (brNo) => {
  281. var brNo_pattern = /[0-9]{8}/
  282. if (brNo !== undefined) {
  283. if (brNo.match(brNo_pattern)) {
  284. return true
  285. } else {
  286. return false
  287. }
  288. }
  289. }
  290. const handleFileUpload = (event) => {
  291. let updateList = new DataTransfer();
  292. let currentFileList = fileListData;
  293. const uploadFileList = event.target.files;
  294. const saveFileList = [];
  295. var currentIndex = 0;
  296. if (currentFileList.length != null) {
  297. currentIndex = currentFileList.length;
  298. for (let i = 0; i < currentIndex; i++) {
  299. const file = currentFileList[i]
  300. // file.id = currentIndex;
  301. updateList.items.add(file);
  302. saveFileList.push(file);
  303. }
  304. }
  305. for (let i = 0; i < uploadFileList.length && currentIndex < 5; i++) {
  306. const file = event.target.files[i]
  307. let isDuplicate = false;
  308. // Check if the file name already exists in saveFileList
  309. for (let j = 0; j < saveFileList.length; j++) {
  310. if (saveFileList[j].name === file.name) {
  311. isDuplicate = true;
  312. break;
  313. }
  314. }
  315. if (!isDuplicate && i + currentIndex < 5) {
  316. file.id = currentIndex + i
  317. saveFileList.push(file)
  318. updateList.items.add(file);
  319. }
  320. // console.log("currentIndex")
  321. // console.log(currentIndex)
  322. }
  323. let updatedFileList = updateList.files;
  324. setFileListData(saveFileList)
  325. setFileList(updatedFileList);
  326. };
  327. useEffect(() => {
  328. props.setUpdateValid(isValid)
  329. }, [isValid])
  330. useEffect(() => {
  331. checkDataField(values)
  332. }, [selectedAddress4, selectedAddress5,
  333. termsAndConAccept, termsAndConNotAccept, fileList])
  334. useEffect(() => {
  335. props.step == 2 ? _onSubmit() : null;
  336. if(captchaImg=="")
  337. onCaptchaChange();
  338. checkDataField(values)
  339. }, [props.step])
  340. const { handleSubmit } = useForm({})
  341. const _onSubmit = () => {
  342. setLoding(true);
  343. values.address4 = selectedAddress4==null?"":selectedAddress4.type
  344. values.address5 = selectedAddress5.type
  345. // console.log(values)
  346. const busUserAddress = {
  347. "addressLine1": "",
  348. "addressLine2": "",
  349. "addressLine3": "",
  350. "district": "",
  351. "country": ""
  352. };
  353. busUserAddress.addressLine1 = values.address1
  354. busUserAddress.addressLine2 = values.address2
  355. busUserAddress.addressLine3 = values.address3
  356. busUserAddress.district = values.address4
  357. busUserAddress.country = values.address5
  358. const userFaxNo = {
  359. "countryCode": values.faxCountryCode,
  360. "faxNumber": values.fax,
  361. };
  362. const busUserContactTel = {
  363. "countryCode": values.phoneCountryCode,
  364. "phoneNumber": values.phone,
  365. };
  366. let tncFlag = false;
  367. if (termsAndConAccept) {
  368. tncFlag = true
  369. }
  370. if (termsAndConNotAccept) {
  371. tncFlag = false
  372. }
  373. const preferLocale = locale === 'en' ? 'en': locale === 'zh-HK' ? 'zh_HK': 'zh-CN'
  374. const user = {
  375. username: values.username,
  376. password: values.password,
  377. name: values.username,
  378. enCompanyName: values.enCompanyName,
  379. chCompanyName: values.chCompanyName,
  380. emailBus: values.email,
  381. brNo: values.brNo,
  382. brExpiryDate: values.brExpiryDate,
  383. contactPerson: values.enName,
  384. tncFlag: tncFlag,
  385. type: "ORG",
  386. captcha: base64Url,
  387. checkCode: checkCode,
  388. preferLocale:preferLocale
  389. };
  390. var formData = new FormData();
  391. for (let i = 0; i < fileListData.length; i++) {
  392. const file = fileListData[i]
  393. formData.append("multipartFileList", file);
  394. }
  395. formData.append("refType", refType);
  396. for (const [key, value] of Object.entries(user)) {
  397. formData.append(key, value);
  398. }
  399. formData.append("userFaxNo", JSON.stringify(userFaxNo));
  400. formData.append("busUserContactTel", JSON.stringify(busUserContactTel));
  401. formData.append("busUserAddress", JSON.stringify(busUserAddress));
  402. // formData.append("preferLocale", "en");
  403. if (isValid) {
  404. axios.post(POST_PUBLIC_USER_REGISTER, formData, {
  405. headers: {
  406. "Content-Type": "multipart/form-data"
  407. }
  408. })
  409. .then((
  410. // response
  411. ) => {
  412. // console.log(response)
  413. setCheckUpload(true)
  414. setLoding(false);
  415. })
  416. .catch(error => {
  417. console.error(error);
  418. setLoding(false);
  419. });
  420. } else {
  421. setLoding(false);
  422. }
  423. }
  424. function handlePhone(phone) {
  425. if (phone.length < 8) {
  426. return false;
  427. } else {
  428. return true;
  429. }
  430. }
  431. function handleUserName(username) {
  432. var symbol = /^(?=.*\W)/;
  433. var space = /\s/;
  434. if (username.length < 6) {
  435. return false;
  436. } else if (username.match(symbol)) {
  437. return false;
  438. } else if (username.match(space)) {
  439. return false;
  440. } else {
  441. return true;
  442. }
  443. }
  444. function handleCaptcha(captchaField) {
  445. if (captchaField.length == 5 ){
  446. return true
  447. } else {
  448. return false
  449. }
  450. }
  451. function handlePassword(password) {
  452. let new_pass = password;
  453. // regular expressions to validate password
  454. var lowerCase = /[a-z]/g;
  455. var upperCase = /[A-Z]/g;
  456. var numbers = /[0-9]/g;
  457. var symbol = /^(?=.*\W)/;
  458. var space = /\s/;
  459. if (!new_pass.match(lowerCase)) {
  460. return false;
  461. } else if (!new_pass.match(upperCase)) {
  462. return false;
  463. } else if (!new_pass.match(numbers)) {
  464. return false;
  465. } else if (!new_pass.match(symbol)) {
  466. return false;
  467. } else if (new_pass.length < 8) {
  468. return false;
  469. }
  470. else if (new_pass.match(space)) {
  471. return false;
  472. } else {
  473. // console.log("password true")
  474. return true;
  475. }
  476. }
  477. function handleEmail(email) {
  478. var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
  479. if (!email.match(validRegex)) {
  480. return false;
  481. } else {
  482. return true;
  483. }
  484. }
  485. function displayErrorMsg(errorMsg) {
  486. return <Typography variant="errorMessage1">{errorMsg}</Typography>
  487. }
  488. const formik = useFormik({
  489. initialValues: ({
  490. username: '',
  491. enName: '',
  492. enCompanyName: '',
  493. chCompanyName: '',
  494. email: '',
  495. address1: '',
  496. address2: '',
  497. address3: '',
  498. password: '',
  499. confirmPassword: '',
  500. phone: '',
  501. phoneCountryCode: '852',
  502. submit: null,
  503. fax: '',
  504. faxCountryCode: '852',
  505. brExpiryDate: '',
  506. brNo: '',
  507. emailConfirm: '',
  508. captchaField: ''
  509. }),
  510. validationSchema: yup.object().shape({
  511. username: yup.string().min(6, displayErrorMsg(intl.formatMessage({id: 'atLeast6CharAccount'}))).max(30,getMaxErrStr(30)).required(displayErrorMsg(intl.formatMessage({id: 'requireUsername'})))
  512. .matches(/^[aA-zZ0-9\s]+$/, { message: displayErrorMsg(intl.formatMessage({id: 'noSpecialCharAccount'})) })
  513. .matches(/^\S*$/, { message: displayErrorMsg(intl.formatMessage({id: 'noSpaceAccount'})) }),
  514. password: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'atLeast8CharPassword'}))).max(60,getMaxErrStr(60)).required(displayErrorMsg(intl.formatMessage({id: 'requirePassword'})))
  515. .matches(/^\S*$/, { message: displayErrorMsg(intl.formatMessage({id: 'noSpacePassword'})) })
  516. .matches(/^(?=.*[a-z])/, { message: displayErrorMsg(intl.formatMessage({id: 'atLeastOneSmallLetter'})) })
  517. .matches(/^(?=.*[A-Z])/, { message: displayErrorMsg(intl.formatMessage({id: 'atLeastOneCapLetter'})) })
  518. .matches(/^(?=.*[0-9])/, { message: displayErrorMsg(intl.formatMessage({id: 'atLeast1Number'})) })
  519. .matches(/^(?=.*\W)/, { message: displayErrorMsg(intl.formatMessage({id: 'atLeast1SpecialChar'})) }),
  520. confirmPassword: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'atLeast8CharPassword'}))).required(displayErrorMsg(intl.formatMessage({id: 'pleaseConfirmPassword'}))).oneOf([yup.ref('password'), null], displayErrorMsg(intl.formatMessage({id: 'samePassword'}))),
  521. enName: yup.string().max(40,getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({id: 'userRequireEnglishName'}))),
  522. enCompanyName: yup.string().matches(/^[^$^*]+$/, { message: displayErrorMsg('No special characters $/^/*') }).when('chCompanyName', {
  523. is: (chCompanyName) => !chCompanyName || chCompanyName.length === 0,
  524. then: yup.string().required(displayErrorMsg('Please enter either English or Chinese name')),
  525. }),
  526. chCompanyName: yup.string().matches(/^[^$^*]+$/, { message: displayErrorMsg(intl.formatMessage({id: 'notContainSpecialChar'})) }).when('enCompanyName', {
  527. is: (enCompanyName) => !enCompanyName || enCompanyName.length === 0,
  528. then: yup.string().required(displayErrorMsg(intl.formatMessage({id: 'validateEngOrChiName'}))),
  529. }),
  530. chName: yup.string().max(6, getMaxErrStr(6)).required(displayErrorMsg(intl.formatMessage({id: 'userRequireChineseName'}))),
  531. address1: yup.string().max(40, getMaxErrStr(40)).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine1'}))),
  532. address2: yup.string().max(40, getMaxErrStr(40)),
  533. address3: yup.string().max(40, getMaxErrStr(40)),
  534. email: yup.string().email(displayErrorMsg(intl.formatMessage({id: 'validEmailFormat'}))).max(128, getMaxErrStr(128)).required(displayErrorMsg(intl.formatMessage({id: 'requireEmail'}))),
  535. 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'}))),
  536. phoneCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast2Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))),
  537. faxCountryCode: yup.string().min(2, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast2Number'}))),
  538. phone: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast8Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))),
  539. fax: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'requireAtLeast8Number'}))),
  540. brExpiryDate: yup.date().min(new Date().toISOString().split("T")[0], displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertValidityDate'})))
  541. .max("2099-12-31", displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertValidityDate'}))).
  542. required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertValidityDate'}))),
  543. brNo: yup.string().max(8, getMaxErrStr(8)).required(displayErrorMsg(intl.formatMessage({id: 'pleaseFillInBusinessRegCertNumber'}))).test('checkBrNoFormat', displayErrorMsg(`${intl.formatMessage({id: 'pleaseFillInValidBusinessRegCertNumber'})} (e.g. 12341234)`), function (value) {
  544. // var brNo_pattern = /[0-9]{8}-[0-9]{3}-(0[1-9]|1[012])-[0-9]{2}-[0-9A-Z]{1}/
  545. var brNo_pattern = /[0-9]{8}/
  546. if (value !== undefined) {
  547. if (value.match(brNo_pattern)) {
  548. return true
  549. } else {
  550. return false
  551. }
  552. }
  553. }),
  554. captchaField: yup.string().max(5, getMaxErrStr(5)).required(displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))).min(5, displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')),
  555. }, ['enCompanyName', 'chCompanyName']),
  556. });
  557. const handleReset = (resetForm) => {
  558. resetForm();
  559. setSelectedAddress4("")
  560. setSelectedAddress5(ComboData.country[0])
  561. setCheckCountry(false)
  562. setFileList([])
  563. setFileListData([])
  564. onCaptchaChange()
  565. };
  566. const handleCCPChange = (e) => {
  567. e.preventDefault();
  568. };
  569. const { values } = formik
  570. useEffect(() => {
  571. checkDataField(values)
  572. }, [values])
  573. return (
  574. <FormikProvider value={formik}>
  575. <form onSubmit={handleSubmit(_onSubmit)}>
  576. {/* Input Form */}
  577. <FormGroup id={"inputForm"} sx={{ display: props.step === 0 ? "" : "none" }}>
  578. <Grid container spacing={3}>
  579. <Grid item xs={12} md={12}>
  580. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  581. <Button variant="outlined" type="reset" onClick={handleReset.bind(null, formik.resetForm)} sx={{ height: '40px' }}><Typography variant="pnspsFormHeader">
  582. <FormattedMessage id="reset"/>
  583. </Typography></Button>
  584. <div style={{ borderBottom: "3px solid #1A4399", width: "100%", margin_right: "15px" }}>
  585. <Typography display="inline" variant="h3" sx={{ color: '#1A4399' }}>
  586. <FormattedMessage id="becomeNewBusinessUser"/>
  587. </Typography>
  588. </div>
  589. <Typography mt={0.25} variant="h6" sx={{ color: '#B00020' }}>
  590. <FormattedMessage id="requireString"/>
  591. </Typography>
  592. <Typography mt={0.25} variant="h4" sx={{ color: 'primary.primary' }}>
  593. <FormattedMessage id="yourLoginInformation"/>
  594. </Typography>
  595. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  596. Already have an account?
  597. </Typography> */}
  598. </Stack>
  599. </Grid>
  600. <Grid item xs={12} md={12}>
  601. <Grid container spacing={1}>
  602. <Grid item xs={12} md={12} >
  603. <Stack spacing={1}>
  604. <InputLabel htmlFor="username-signup">
  605. <Typography variant="pnspsFormHeader">
  606. <FormattedMessage id="userLoginName"/>
  607. <span style={{ color: '#B00020' }}>*</span>
  608. {/* <Button
  609. variant="contained"
  610. onClick={handleCheckUsername}
  611. sx={{ ml: 2, height: "40px" }}>
  612. <Typography variant="h6">檢查是否重覆</Typography>
  613. </Button> */}
  614. </Typography>
  615. </InputLabel>
  616. <OutlinedInput
  617. id="username-login"
  618. type="text"
  619. value={formik.values.username.trim()}
  620. name="username"
  621. onChange={(e) => {
  622. setCheckUsername(false)
  623. props.setUsername(e.target.value)
  624. formik.handleChange(e)
  625. }}
  626. placeholder={intl.formatMessage({id: 'userLoginName'})}
  627. fullWidth
  628. autoFocus
  629. error={Boolean((formik.touched.username && formik.errors.username) || checkUsername)}
  630. onBlur={formik.handleBlur}
  631. inputProps={{
  632. onKeyDown: (e) => {
  633. if (e.key === 'Enter') {
  634. e.preventDefault();
  635. }
  636. },
  637. }}
  638. />
  639. {formik.touched.username && formik.errors.username && (
  640. <FormHelperText error id="helper-text-username-signup">
  641. {formik.errors.username}
  642. </FormHelperText>
  643. )}
  644. {checkUsername && (
  645. <FormHelperText error id="helper-text-username-signup">
  646. <FormattedMessage id="usernameTaken"/>
  647. </FormHelperText>
  648. )}
  649. </Stack>
  650. </Grid>
  651. <Grid item xs={12} md={12}>
  652. <Grid container>
  653. <Grid item xs={12} md={6} >
  654. <Stack spacing={1} sx={{ mr: { md: 1 }, mb: 1 }}>
  655. <Stack direction="row" justifyContent="space-between">
  656. <InputLabel htmlFor="password-signup">
  657. <Typography variant="pnspsFormHeader">
  658. <FormattedMessage id="userPassword"/>
  659. <span style={{ color: '#B00020' }}>*</span>
  660. </Typography>
  661. </InputLabel>
  662. </Stack>
  663. <OutlinedInput
  664. fullWidth
  665. error={Boolean(formik.touched.password && formik.errors.password)}
  666. id="password-signup"
  667. type={showPassword ? 'text' : 'password'}
  668. value={formik.values.password.trim()}
  669. name="password"
  670. onChange={(e) => {
  671. formik.handleChange(e);
  672. changePassword(e.target.value);
  673. }}
  674. endAdornment={
  675. <InputAdornment position="end">
  676. <IconButton
  677. aria-label={intl.formatMessage({
  678. id: showPassword ? "ariaHidePassword" : "ariaShowPassword"
  679. })}
  680. onClick={handleClickShowPassword}
  681. onMouseDown={handleMouseDownPassword}
  682. edge="end"
  683. size="large"
  684. >
  685. {showPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  686. </IconButton>
  687. </InputAdornment>
  688. }
  689. placeholder={intl.formatMessage({id: 'userPassword'})}
  690. onBlur={formik.handleBlur}
  691. inputProps={{
  692. onKeyDown: (e) => {
  693. if (e.key === 'Enter') {
  694. e.preventDefault();
  695. }
  696. },
  697. }}
  698. />
  699. {formik.touched.password && formik.errors.password && (
  700. <FormHelperText error id="helper-text-password-signup">
  701. {formik.errors.password}
  702. </FormHelperText>
  703. )}
  704. </Stack>
  705. <FormControl fullWidth sx={{ mt: 2 }}>
  706. <Grid container spacing={2} alignItems="center">
  707. <Grid item>
  708. <Box sx={{ bgcolor: level?.color, width: 85, height: 8, borderRadius: '7px' }} />
  709. </Grid>
  710. <Grid item>
  711. <Typography variant="subtitle1">
  712. <FormattedMessage id={level ? level?.label : "pwWeak" }/>
  713. </Typography>
  714. </Grid>
  715. </Grid>
  716. </FormControl>
  717. </Grid>
  718. <Grid item xs={12} md={6} >
  719. <Stack spacing={1}>
  720. <InputLabel htmlFor="confirmPassword-signup">
  721. <Typography variant="pnspsFormHeader">
  722. <FormattedMessage id="confirmPassword"/>
  723. <span style={{ color: '#B00020' }}>*</span>
  724. </Typography>
  725. </InputLabel>
  726. <OutlinedInput
  727. id="confirmPassword-login"
  728. type={showConfirmPassword ? 'text' : 'password'}
  729. value={formik.values.confirmPassword.trim()}
  730. name="confirmPassword"
  731. onBlur={formik.handleBlur}
  732. onCut={handleCCPChange}
  733. onCopy={handleCCPChange}
  734. onPaste={handleCCPChange}
  735. onChange={(e) => {
  736. formik.handleChange(e);
  737. // changePassword(e.target.value);
  738. }}
  739. inputProps={{
  740. onKeyDown: (e) => {
  741. if (e.key === 'Enter') {
  742. e.preventDefault();
  743. }
  744. },
  745. }}
  746. endAdornment={
  747. <InputAdornment position="end">
  748. <IconButton
  749. aria-label={intl.formatMessage({
  750. id: showConfirmPassword ? "ariaHidePassword" : "ariaShowPassword"
  751. })}
  752. onClick={handleClickShowConfirmPassword}
  753. onMouseDown={handleMouseDownPassword}
  754. edge="end"
  755. size="large"
  756. >
  757. {showConfirmPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  758. </IconButton>
  759. </InputAdornment>
  760. }
  761. placeholder={intl.formatMessage({id: 'confirmPassword'})}
  762. fullWidth
  763. error={Boolean(formik.touched.confirmPassword && formik.errors.confirmPassword)}
  764. />
  765. {formik.touched.confirmPassword && formik.errors.confirmPassword && (
  766. <FormHelperText error id="helper-text-confirmPassword-signup">
  767. {formik.errors.confirmPassword}
  768. </FormHelperText>
  769. )}
  770. </Stack>
  771. <Grid container spacing={2} alignItems="center">
  772. <Grid item sx={{mt:1}}>
  773. <Typography variant="subtitle1">
  774. •<FormattedMessage id="pwRemark1"/><br />
  775. •<FormattedMessage id="pwRemark2"/><br />
  776. •<FormattedMessage id="pwRemark3"/><br />
  777. •<FormattedMessage id="pwRemark4"/><br />
  778. •<FormattedMessage id="pwRemark5"/>
  779. </Typography>
  780. </Grid>
  781. </Grid>
  782. </Grid>
  783. </Grid>
  784. </Grid>
  785. <Grid item xs={12} mt={1} mb={1}>
  786. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  787. <Typography display="inline" variant="h4" /*sx={{ color: '#1A4399' }}*/>
  788. <FormattedMessage id="yourBusinessInformation"/>
  789. </Typography>
  790. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  791. Already have an account?
  792. </Typography> */}
  793. </Stack>
  794. </Grid>
  795. <Grid item xs={12} md={12}>
  796. <Typography variant="subtitle1">
  797. •<FormattedMessage id="pleaseEnterOrgOrCompName"/>
  798. </Typography>
  799. </Grid>
  800. <Grid item xs={12} md={6}>
  801. <Stack spacing={1}>
  802. <InputLabel htmlFor="enCompanyName-signup">
  803. <Typography variant="pnspsFormHeader">
  804. <FormattedMessage id="businessEngName"/>
  805. </Typography>
  806. </InputLabel>
  807. <OutlinedInput
  808. id="enCompanyName-login"
  809. type="enCompanyName"
  810. value={formik.values.enCompanyName}
  811. name="enCompanyName"
  812. onChange={formik.handleChange}
  813. placeholder={intl.formatMessage({id: 'sameAsBusinessRegistrationCert'})}
  814. fullWidth
  815. error={Boolean(formik.touched.enCompanyName && formik.errors.enCompanyName && selectedAddress5 !== "內地")}
  816. onBlur={formik.handleBlur}
  817. inputProps={{
  818. onKeyDown: (e) => {
  819. if (e.key === 'Enter') {
  820. e.preventDefault();
  821. }
  822. },
  823. }}
  824. />
  825. {formik.touched.enCompanyName && formik.errors.enCompanyName && selectedAddress5 !== "內地" && (
  826. <FormHelperText error id="helper-text-enCompanyName-signup">
  827. {formik.errors.enCompanyName}
  828. </FormHelperText>
  829. )}
  830. </Stack>
  831. </Grid>
  832. <Grid item xs={12} md={6}>
  833. <Stack spacing={1}>
  834. <InputLabel htmlFor="chCompanyName-signup">
  835. <Typography variant="pnspsFormHeader">
  836. <FormattedMessage id="businessChName"/>
  837. </Typography>
  838. </InputLabel>
  839. <OutlinedInput
  840. fullWidth
  841. error={Boolean(formik.touched.chCompanyName && formik.errors.chCompanyName)}
  842. id="chCompanyName-signup"
  843. type="text"
  844. value={formik.values.chCompanyName.trim()}
  845. name="chCompanyName"
  846. onChange={formik.handleChange}
  847. placeholder={intl.formatMessage({id: 'sameAsBusinessRegistrationCert'})}
  848. onBlur={formik.handleBlur}
  849. inputProps={{
  850. onKeyDown: (e) => {
  851. if (e.key === 'Enter') {
  852. e.preventDefault();
  853. }
  854. },
  855. }}
  856. />
  857. {formik.touched.chCompanyName && formik.errors.chCompanyName && (
  858. <FormHelperText error id="helper-text-chCompanyName-signup">
  859. {formik.errors.chCompanyName}
  860. </FormHelperText>
  861. )}
  862. </Stack>
  863. </Grid>
  864. <Grid item xs={12} md={6}>
  865. <Stack spacing={1}>
  866. <InputLabel htmlFor="brNo-signup" sx={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}>
  867. <Typography variant="pnspsFormHeader">
  868. <FormattedMessage id="businessRegCertNumber"/> (e.g. 12341234)
  869. <span style={{ color: '#B00020' }}>*</span>
  870. </Typography>
  871. </InputLabel>
  872. <OutlinedInput
  873. fullWidth
  874. error={Boolean(formik.touched.brNo && formik.errors.brNo)}
  875. id="brNo-signup"
  876. type="text"
  877. value={formik.values.brNo.trim()}
  878. name="brNo"
  879. onChange={formik.handleChange}
  880. onBlur={formik.handleBlur}
  881. placeholder={intl.formatMessage({id: 'sameAsBusinessRegistrationCert'})}
  882. inputProps={{
  883. onKeyDown: (e) => {
  884. if (e.key === 'Enter') {
  885. e.preventDefault();
  886. }
  887. },
  888. }}
  889. />
  890. {formik.touched.brNo && formik.errors.brNo && (
  891. <FormHelperText error id="helper-text-brNo-signup">
  892. {formik.errors.brNo}
  893. </FormHelperText>
  894. )}
  895. </Stack>
  896. </Grid>
  897. <Grid item xs={12} md={6}>
  898. <Stack spacing={1}>
  899. <InputLabel htmlFor="brExpiryDate-signup">
  900. <Typography variant="pnspsFormHeader">
  901. <FormattedMessage id="businessRegCertValidityDate"/>
  902. <span style={{ color: '#B00020' }}>*</span>
  903. </Typography>
  904. </InputLabel>
  905. <OutlinedInput
  906. fullWidth
  907. error={Boolean(formik.touched.brExpiryDate && formik.errors.brExpiryDate)}
  908. id="brExpiryDate-signup"
  909. type="date"
  910. value={formik.values.brExpiryDate}
  911. name="brExpiryDate"
  912. onChange={formik.handleChange}
  913. onBlur={formik.handleBlur}
  914. placeholder={intl.formatMessage({id: 'sameAsBusinessRegistrationCert'})}
  915. inputProps={{
  916. max: "2099-12-31",
  917. min: new Date().toISOString().split("T")[0],
  918. onKeyDown: (e) => {
  919. if (e.key === 'Enter') {
  920. e.preventDefault();
  921. }
  922. },
  923. }}
  924. />
  925. {formik.touched.brExpiryDate && formik.errors.brExpiryDate && (
  926. <FormHelperText error id="helper-text-brExpiryDate-signup">
  927. {formik.errors.brExpiryDate}
  928. </FormHelperText>
  929. )}
  930. </Stack>
  931. </Grid>
  932. <Grid item xs={12}>
  933. <Stack spacing={1}>
  934. <InputLabel htmlFor="address1-signup">
  935. <Typography variant="pnspsFormHeader">
  936. <FormattedMessage id="formAddress"/>
  937. <span style={{ color: '#B00020' }}>*</span>
  938. </Typography>
  939. </InputLabel>
  940. <OutlinedInput
  941. fullWidth
  942. error={Boolean(formik.touched.address1 && formik.errors.address1)}
  943. id="address1-signup"
  944. value={formik.values.address1}
  945. name="address1"
  946. onChange={formik.handleChange}
  947. placeholder={intl.formatMessage({id: 'addressLine1'})}
  948. onBlur={formik.handleBlur}
  949. inputProps={{
  950. onKeyDown: (e) => {
  951. if (e.key === 'Enter') {
  952. e.preventDefault();
  953. }
  954. },
  955. }}
  956. />
  957. <OutlinedInput
  958. fullWidth
  959. error={Boolean(formik.touched.address2 && formik.errors.address2)}
  960. id="address2-signup"
  961. value={formik.values.address2}
  962. name="address2"
  963. onBlur={formik.handleBlur}
  964. onChange={formik.handleChange}
  965. placeholder={intl.formatMessage({id: 'addressLine2'})}
  966. inputProps={{
  967. onKeyDown: (e) => {
  968. if (e.key === 'Enter') {
  969. e.preventDefault();
  970. }
  971. },
  972. }}
  973. />
  974. <OutlinedInput
  975. fullWidth
  976. error={Boolean(formik.touched.address3 && formik.errors.address3)}
  977. id="address3-signup"
  978. value={formik.values.address3}
  979. name="address3"
  980. onBlur={formik.handleBlur}
  981. onChange={formik.handleChange}
  982. placeholder={intl.formatMessage({id: 'addressLine3'})}
  983. inputProps={{
  984. onKeyDown: (e) => {
  985. if (e.key === 'Enter') {
  986. e.preventDefault();
  987. }
  988. },
  989. }}
  990. />
  991. <Autocomplete
  992. disablePortal
  993. id="address4-combo"
  994. value={selectedAddress4}
  995. options={address4ComboList}
  996. disabled={checkCountry}
  997. // error={Boolean(districtErrStr!="")}
  998. // onBlur={formik.handleBlur}
  999. getOptionLabel={(option) => option.type? intl.formatMessage({ id: option.type }) : ""}
  1000. onChange={(event, newValue) => {
  1001. setSelectedAddress4(newValue);
  1002. }}
  1003. sx={{
  1004. '& .MuiInputBase-root': { alignItems: 'center' },
  1005. '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' },
  1006. '& .MuiOutlinedInput-root': { height: 40 }
  1007. }}
  1008. renderInput={(params) => <TextField error={checkDistrict} {...params} placeholder={intl.formatMessage({id: 'region'})}
  1009. />}
  1010. clearText={intl.formatMessage({ id: "muiClear" })}
  1011. closeText={intl.formatMessage({ id: "muiClose" })}
  1012. openText={intl.formatMessage({ id: "muiOpen" })}
  1013. noOptionsText={intl.formatMessage({ id: "muiNoOptions" })}
  1014. />
  1015. <Autocomplete
  1016. disablePortal
  1017. id="address5-combo"
  1018. value={selectedAddress5}
  1019. options={address5ComboList}
  1020. disabled= {true}
  1021. getOptionLabel={(option) => option.type? intl.formatMessage({ id: option.type }) : ""}
  1022. onChange={(event, newValue) => {
  1023. if (newValue !== null) {
  1024. setSelectedAddress5(newValue);
  1025. if (newValue.type === 'hongKong') {
  1026. setCheckCountry(false)
  1027. if(formik.values.phone==""){
  1028. formik.values.phoneCountryCode = "852";
  1029. }
  1030. if(formik.values.fax==""){
  1031. formik.values.faxCountryCode = "852";
  1032. }
  1033. } else {
  1034. if (newValue.type === 'mainland'){
  1035. if(formik.values.phone==""){
  1036. formik.values.phoneCountryCode = "86";
  1037. }
  1038. if(formik.values.fax==""){
  1039. formik.values.faxCountryCode = "86";
  1040. }
  1041. }else if(newValue.type === 'macau'){
  1042. if(formik.values.phone==""){
  1043. formik.values.phoneCountryCode = "853";
  1044. }
  1045. if(formik.values.fax==""){
  1046. formik.values.faxCountryCode = "853";
  1047. }
  1048. }
  1049. setSelectedAddress4("");
  1050. setCheckCountry(true)
  1051. }
  1052. } else {
  1053. setSelectedAddress4("");
  1054. setCheckCountry(true)
  1055. }
  1056. }}
  1057. sx={{
  1058. '& .MuiInputBase-root': { alignItems: 'center' },
  1059. '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' },
  1060. '& .MuiOutlinedInput-root': { height: 40 }
  1061. }}
  1062. renderInput={(params) => <TextField {...params} placeholder={intl.formatMessage({id: 'regionOrCountry'})} />}
  1063. clearText={intl.formatMessage({ id: "muiClear" })}
  1064. closeText={intl.formatMessage({ id: "muiClose" })}
  1065. openText={intl.formatMessage({ id: "muiOpen" })}
  1066. noOptionsText={intl.formatMessage({ id: "muiNoOptions" })}
  1067. />
  1068. {formik.touched.address1 && formik.errors.address1 && (
  1069. <FormHelperText error id="helper-text-address1-signup">
  1070. {formik.errors.address1}
  1071. </FormHelperText>
  1072. )}
  1073. {formik.touched.address2 && formik.errors.address2 && (
  1074. <FormHelperText error id="helper-text-address2-signup">
  1075. {formik.errors.address2}
  1076. </FormHelperText>
  1077. )}
  1078. {formik.touched.address3 && formik.errors.address3 && (
  1079. <FormHelperText error id="helper-text-address3-signup">
  1080. {formik.errors.address3}
  1081. </FormHelperText>
  1082. )}
  1083. {checkDistrict && (
  1084. <FormHelperText error >
  1085. {districtErrStr}
  1086. </FormHelperText>
  1087. )}
  1088. </Stack>
  1089. </Grid>
  1090. <Grid item xs={12} mt={1} mb={1}>
  1091. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1092. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1093. <FormattedMessage id="yourContact"/>
  1094. </Typography>
  1095. </Stack>
  1096. </Grid>
  1097. <Grid item xs={12} md={12}>
  1098. <Stack spacing={1}>
  1099. <InputLabel htmlFor="enName-signup">
  1100. <Typography variant="pnspsFormHeader">
  1101. <FormattedMessage id="userContactName"/>
  1102. <span style={{ color: '#B00020' }}>*</span>
  1103. </Typography>
  1104. </InputLabel>
  1105. <OutlinedInput
  1106. id="enName-login"
  1107. type="enName"
  1108. value={formik.values.enName}
  1109. name="enName"
  1110. onChange={formik.handleChange}
  1111. placeholder=""
  1112. fullWidth
  1113. error={Boolean(formik.touched.enName && formik.errors.enName)}
  1114. onBlur={formik.handleBlur}
  1115. inputProps={{
  1116. onKeyDown: (e) => {
  1117. if (e.key === 'Enter') {
  1118. e.preventDefault();
  1119. }
  1120. },
  1121. }}
  1122. />
  1123. {formik.touched.enName && formik.errors.enName && (
  1124. <FormHelperText error id="helper-text-enName-signup">
  1125. {formik.errors.enName}
  1126. </FormHelperText>
  1127. )}
  1128. </Stack>
  1129. </Grid>
  1130. <Grid item xs={12} md={12}>
  1131. <Grid container>
  1132. <Grid item xs={12} md={6}>
  1133. <Stack spacing={1} sx={{ mr: { md: 1 }, mb: 1 }}>
  1134. <InputLabel htmlFor="email-signup">
  1135. <Typography variant="pnspsFormHeader">
  1136. <FormattedMessage id="userContactEmail"/>
  1137. <span style={{ color: '#B00020' }}>*</span>
  1138. </Typography>
  1139. </InputLabel>
  1140. <OutlinedInput
  1141. fullWidth
  1142. error={Boolean((formik.touched.email && formik.errors.email) || checkEmail)}
  1143. id="email-login"
  1144. type="email"
  1145. value={formik.values.email.trim()}
  1146. name="email"
  1147. onChange={formik.handleChange}
  1148. placeholder={intl.formatMessage({id: 'userContactEmail'})}
  1149. onBlur={formik.handleBlur}
  1150. inputProps={{
  1151. onKeyDown: (e) => {
  1152. if (e.key === 'Enter') {
  1153. e.preventDefault();
  1154. }
  1155. },
  1156. }}
  1157. />
  1158. {formik.touched.email && formik.errors.email && (
  1159. <FormHelperText error id="helper-text-email-signup">
  1160. {formik.errors.email}
  1161. </FormHelperText>
  1162. )}
  1163. {checkEmail && (
  1164. <FormHelperText error id="helper-text-email-signup">
  1165. <FormattedMessage id="emailUsed"/>
  1166. </FormHelperText>
  1167. )}
  1168. </Stack>
  1169. </Grid>
  1170. <Grid item xs={12} md={6}>
  1171. <Stack spacing={1} >
  1172. <InputLabel htmlFor="emailConfirm-signup">
  1173. <Typography variant="pnspsFormHeader">
  1174. <FormattedMessage id="confirmEmail"/>
  1175. <span style={{ color: '#B00020' }}>*</span>
  1176. </Typography>
  1177. </InputLabel>
  1178. <OutlinedInput
  1179. fullWidth
  1180. error={Boolean(formik.touched.emailConfirm && formik.errors.emailConfirm)}
  1181. id="emailConfirm-login"
  1182. type="email"
  1183. value={formik.values.emailConfirm.trim()}
  1184. name="emailConfirm"
  1185. // onBlur={formik.handleBlur}
  1186. onChange={formik.handleChange}
  1187. placeholder={intl.formatMessage({id: 'confirmEmail'})}
  1188. onBlur={formik.handleBlur}
  1189. onCut={handleCCPChange}
  1190. onCopy={handleCCPChange}
  1191. onPaste={handleCCPChange}
  1192. inputProps={{
  1193. onKeyDown: (e) => {
  1194. if (e.key === 'Enter') {
  1195. e.preventDefault();
  1196. }
  1197. },
  1198. }}
  1199. />
  1200. {formik.touched.emailConfirm && formik.errors.emailConfirm && (
  1201. <FormHelperText error id="helper-text-emailConfirm-signup">
  1202. {formik.errors.emailConfirm}
  1203. </FormHelperText>
  1204. )}
  1205. </Stack>
  1206. </Grid>
  1207. </Grid>
  1208. </Grid>
  1209. <Grid item xs={12} md={12}>
  1210. <Grid container>
  1211. <Grid item xs={12} md={6}>
  1212. <Grid container>
  1213. <Grid item xs={12} md={12}>
  1214. <Stack direction="column" spacing={1} sx={{ mr: { md: 1 }, mb: 1 }}>
  1215. <InputLabel htmlFor="phone-signup">
  1216. <Typography variant="pnspsFormHeader">
  1217. <FormattedMessage id="userContactNumber"/>
  1218. <span style={{ color: '#B00020' }}>*</span>
  1219. </Typography>
  1220. </InputLabel>
  1221. <Stack direction="row">
  1222. <OutlinedInput
  1223. id="phoneCountryCode-login"
  1224. type="phoneCountryCode"
  1225. value={formik.values.phoneCountryCode.trim()}
  1226. name="phoneCountryCode"
  1227. // onBlur={formik.handleBlur}
  1228. // onChange={formik.handleChange}
  1229. onChange={(event) => {
  1230. const value = event.target.value;
  1231. if (value.match(/[^0-9]/)) {
  1232. return event.preventDefault();
  1233. }
  1234. formik.setFieldValue("phoneCountryCode", value);
  1235. }}
  1236. endAdornment={<InputAdornment position="end">-</InputAdornment>}
  1237. placeholder={intl.formatMessage({id: 'dialingCode'})}
  1238. error={Boolean(formik.touched.phone && formik.errors.phone)}
  1239. onBlur={formik.handleBlur}
  1240. inputProps={{
  1241. maxLength: 3,
  1242. onKeyDown: (e) => {
  1243. if (e.key === 'Enter') {
  1244. e.preventDefault();
  1245. }
  1246. },
  1247. }}
  1248. sx={{ width: '33%', mr:1 }}
  1249. />
  1250. <OutlinedInput
  1251. id="phone-login"
  1252. type="phone"
  1253. value={formik.values.phone.trim()}
  1254. name="phone"
  1255. onBlur={formik.handleBlur}
  1256. // onChange={formik.handleChange}
  1257. onChange={(event) => {
  1258. const value = event.target.value;
  1259. if (value.match(/[^0-9]/)) {
  1260. return event.preventDefault();
  1261. }
  1262. formik.setFieldValue("phone", value);
  1263. }}
  1264. placeholder={intl.formatMessage({id: 'userContactNumber'})}
  1265. error={Boolean(formik.touched.phone && formik.errors.phone)}
  1266. inputProps={{
  1267. maxLength: 11,
  1268. onKeyDown: (e) => {
  1269. if (e.key === 'Enter') {
  1270. e.preventDefault();
  1271. }
  1272. },
  1273. }}
  1274. sx={{ width: '66%' }}
  1275. />
  1276. </Stack>
  1277. {formik.touched.phone && formik.errors.phone && (
  1278. <FormHelperText error id="helper-text-phone-signup">
  1279. {formik.errors.phone}
  1280. </FormHelperText>
  1281. )}
  1282. </Stack>
  1283. </Grid>
  1284. </Grid>
  1285. </Grid>
  1286. <Grid item xs={12} md={6}>
  1287. <Grid container>
  1288. <Grid item xs={12} md={12}>
  1289. <Stack spacing={1} direction="column">
  1290. <InputLabel htmlFor="fax-signup">
  1291. <Typography variant="pnspsFormHeader">
  1292. <FormattedMessage id="userFaxNumber"/>
  1293. </Typography>
  1294. </InputLabel>
  1295. <Stack direction="row">
  1296. <OutlinedInput
  1297. error={Boolean(formik.touched.fax && formik.errors.fax)}
  1298. id="faxCountryCode-login"
  1299. type="faxCountryCode"
  1300. value={formik.values.faxCountryCode.trim()}
  1301. name="faxCountryCode"
  1302. // onBlur={formik.handleBlur}
  1303. // onChange={formik.handleChange}
  1304. onChange={(event) => {
  1305. const value = event.target.value;
  1306. if (value.match(/[^0-9]/)) {
  1307. return event.preventDefault();
  1308. }
  1309. formik.setFieldValue("faxCountryCode", value);
  1310. }}
  1311. placeholder={intl.formatMessage({id: 'dialingCode'})}
  1312. endAdornment={<InputAdornment position="end">-</InputAdornment>}
  1313. inputProps={{
  1314. maxLength: 3,
  1315. onKeyDown: (e) => {
  1316. if (e.key === 'Enter') {
  1317. e.preventDefault();
  1318. }
  1319. },
  1320. }}
  1321. sx={{ width: '33%', mr:1 }}
  1322. />
  1323. <OutlinedInput
  1324. id="fax-login"
  1325. type="fax"
  1326. value={formik.values.fax.trim()}
  1327. name="fax"
  1328. // onBlur={formik.handleBlur}
  1329. // onChange={formik.handleChange}
  1330. onChange={(event) => {
  1331. const value = event.target.value;
  1332. if (value.match(/[^0-9]/)) {
  1333. return event.preventDefault();
  1334. }
  1335. formik.setFieldValue("fax", value);
  1336. }}
  1337. placeholder={intl.formatMessage({id: 'userFaxNumber'})}
  1338. inputProps={{
  1339. maxLength: 8,
  1340. onKeyDown: (e) => {
  1341. if (e.key === 'Enter') {
  1342. e.preventDefault();
  1343. }
  1344. },
  1345. }}
  1346. sx={{ width: '66%' }}
  1347. />
  1348. </Stack>
  1349. </Stack>
  1350. </Grid>
  1351. </Grid>
  1352. </Grid>
  1353. </Grid>
  1354. </Grid>
  1355. <Grid item xs={12} md={12} mt={1} mb={1}>
  1356. <Grid container>
  1357. <Grid item xs={12} md={12}>
  1358. <Stack spacing={1} direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1359. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1360. <FormattedMessage id="businessRegCertAndDoc"/>
  1361. <span style={{ color: '#B00020' }}>*</span>
  1362. </Typography>
  1363. <Typography display="inline" variant="h6" sx={{ color: 'primary.primary' }}>
  1364. <FormattedMessage id="pleaseUploadDoc"/>
  1365. </Typography>
  1366. {/* <Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography> */}
  1367. <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
  1368. <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
  1369. <Button variant="contained" component="label" sx={{ height: '40px' }}>
  1370. <FormattedMessage id="uploadFile"/>
  1371. <input
  1372. accept="image/png, .jpg, .bmp, .pdf"
  1373. //className={classes.input}
  1374. id="contained-button-file"
  1375. multiple
  1376. type="file"
  1377. onChange={handleFileUpload}
  1378. style={{ display: 'none' }}
  1379. />
  1380. </Button>
  1381. </ThemeProvider>
  1382. {/* <Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}></Typography> */}
  1383. </Stack>
  1384. {fileList != null ?
  1385. <UploadFileTable key="uploadTable" recordList={fileListData} setUpdateRows={setUpdateRows} /> : null}
  1386. {/* <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
  1387. <Button variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button>
  1388. <Button disabled={!formik.isValid} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button>
  1389. </Stack> */}
  1390. </Stack>
  1391. </Grid>
  1392. </Grid>
  1393. </Grid>
  1394. </Grid>
  1395. <Grid item xs={12} md={12}>
  1396. <Grid container>
  1397. <Grid item xs={12} md={12}>
  1398. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1399. <FormattedMessage id="termsAndCondition"/>
  1400. <span style={{ color: '#B00020' }}>*</span>
  1401. </Typography>
  1402. </Grid>
  1403. <Grid item xs={12} md={12}>
  1404. <Grid container>
  1405. <Grid item xs={12} md={12}>
  1406. <Typography variant="h6" height="100%" sx={{ textAlign: "left", /*overflow: "scroll",*/ borderRadius: "inherit", borderStyle: "solid", borderWidth: "1px", borderColor: "#0C489E" }}>
  1407. <div style={{padding: 12}} dangerouslySetInnerHTML={{__html: intl.formatMessage({id: "termsAndCon"})}} />
  1408. </Typography>
  1409. </Grid>
  1410. </Grid>
  1411. <Grid item xs={12} s={12} md={12} lg={12}>
  1412. <Grid container>
  1413. <Grid item xs={6} s={6} md={11} lg={11}>
  1414. <Grid container>
  1415. <Grid item sx={{ display: 'flex', alignItems: 'center' }}>
  1416. <Checkbox
  1417. checked={termsAndConAccept}
  1418. onChange={handleCheckBoxChange}
  1419. name="termsAndConAccept"
  1420. color="primary"
  1421. size="small"
  1422. />
  1423. <Typography variant="pnspsFormHeader">
  1424. <FormattedMessage id="iConfirm"/>
  1425. </Typography>
  1426. </Grid>
  1427. </Grid>
  1428. </Grid>
  1429. <Grid item xs={6} s={6} md={3} lg={3}>
  1430. <Grid container style={{ display: "none" }}>
  1431. <Grid item sx={{ display: 'flex', alignItems: 'center' }}>
  1432. <Checkbox
  1433. checked={termsAndConNotAccept}
  1434. onChange={handleCheckBoxChange}
  1435. name="termsAndConNotAccept"
  1436. color="primary"
  1437. size="small"
  1438. />
  1439. <Typography variant="pnspsFormHeader">
  1440. <FormattedMessage id="rejectTerms"/>
  1441. </Typography>
  1442. </Grid>
  1443. </Grid>
  1444. </Grid>
  1445. </Grid>
  1446. </Grid>
  1447. </Grid>
  1448. </Grid>
  1449. </Grid>
  1450. <Grid item xs={12} lg={12}>
  1451. <Grid container>
  1452. <Stack direction="column">
  1453. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1454. <FormattedMessage id="verify"/>
  1455. <span style={{ color: '#B00020' }}>*</span>
  1456. </Typography>
  1457. <Stack spacing={1} direction="row">
  1458. <Grid item xs={5} lg={5} style={{ "border": "1px solid black" }}>
  1459. <img src={captchaImg} alt="" />
  1460. </Grid>
  1461. <Grid item xs={1} lg={1} style={{ "border": "0px solid black" }}>
  1462. <IconButton aria-label="refrashCaptcha" size="large" onClick={() => { onCaptchaChange() }}>
  1463. <LoopIcon fontSize="inherit" />
  1464. </IconButton>
  1465. </Grid>
  1466. <Grid item xs={6} lg={6}>
  1467. <OutlinedInput
  1468. fullWidth
  1469. id="captchaField"
  1470. type="text"
  1471. value={formik.values.captchaField.trim()}
  1472. onBlur={formik.handleBlur}
  1473. error={Boolean(formik.touched.captchaField && formik.errors.captchaField)}
  1474. name="captchaField"
  1475. onChange={(event) => {
  1476. const value = event.target.value;
  1477. props.setCheckCode(event.target.value);
  1478. setCheckCode(event.target.value);
  1479. formik.setFieldValue("captchaField", value);
  1480. }}
  1481. sx={{ width: '75%' }}
  1482. />
  1483. </Grid>
  1484. </Stack>
  1485. {formik.touched.captchaField && formik.errors.captchaField && (
  1486. <FormHelperText error id="helper-text-captcha-signup">
  1487. {formik.errors.captchaField}
  1488. </FormHelperText>
  1489. )}
  1490. <Stack spacing={1} direction="row">
  1491. <Button onClick={playCaptchaAudio} aria-label={intl.formatMessage({id:"captchaPlayAudioAria"})}>
  1492. <FormattedMessage id="captchaPlayAudio" />
  1493. </Button>
  1494. </Stack>
  1495. </Stack>
  1496. </Grid>
  1497. </Grid>
  1498. </Grid>
  1499. </Grid>
  1500. </FormGroup>
  1501. {/* Preview Form */}
  1502. <FormGroup id={"previewForm"} sx={{ display: props.step === 1 ? "" : "none" }}>
  1503. <Grid container spacing={2}>
  1504. <Grid item xs={12}>
  1505. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1506. <div style={{ borderBottom: "3px solid #1A4399", width: "100%", margin_right: "15px" }}>
  1507. <Typography display="inline" variant="h3" sx={{ color: '#1A4399' }}>
  1508. <FormattedMessage id="becomeNewBusinessUser"/>
  1509. </Typography>
  1510. </div>
  1511. {/* <Typography mt={0.25} variant="h6" sx={{ fontSize: 12,color: '#B00020'}}>註有*的項目必須輸入資料</Typography> */}
  1512. <Typography mt={0.25} variant="h4" sx={{ color: 'primary.primary' }}>
  1513. <FormattedMessage id="yourLoginInformation"/>
  1514. </Typography>
  1515. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  1516. Already have an account?
  1517. </Typography> */}
  1518. </Stack>
  1519. </Grid>
  1520. <Grid item xs={12}>
  1521. <Grid container spacing={1}>
  1522. <Grid item xs={12} >
  1523. <Stack spacing={1} direction="row">
  1524. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1525. {intl.formatMessage({id: 'userLoginName'})}:
  1526. </Typography>
  1527. <Typography variant="pnspsFormHeader" id="preview-username-login">
  1528. {formik.values.username}
  1529. </Typography>
  1530. </Stack>
  1531. </Grid>
  1532. <Grid item xs={12} mt={1} mb={1}>
  1533. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1534. <Typography display="inline" variant="h4" /*sx={{ color: '#1A4399' }}*/>
  1535. <FormattedMessage id="yourBusinessInformation"/>
  1536. </Typography>
  1537. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  1538. Already have an account?
  1539. </Typography> */}
  1540. </Stack>
  1541. </Grid>
  1542. <Grid item xs={12} md={6}>
  1543. <Stack spacing={1} direction="row">
  1544. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1545. <FormattedMessage id="businessEngName"/>:
  1546. </Typography>
  1547. <Typography variant="pnspsFormHeader" id="preview-enCompanyName-signup">
  1548. {formik.values.enCompanyName}
  1549. </Typography>
  1550. </Stack>
  1551. </Grid>
  1552. <Grid item xs={12} md={6}>
  1553. <Stack spacing={1} direction="row">
  1554. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1555. <FormattedMessage id="businessChName"/>:
  1556. </Typography>
  1557. <Typography variant="pnspsFormHeader" id="preview-chCompanyName-signup">
  1558. {formik.values.chCompanyName}
  1559. </Typography>
  1560. </Stack>
  1561. </Grid>
  1562. <Grid item xs={12} md={12} >
  1563. <Stack spacing={1}>
  1564. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1565. <FormattedMessage id="businessRegCert"/>
  1566. </Typography>
  1567. </Stack>
  1568. </Grid>
  1569. <Grid item xs={12} md={6}>
  1570. <Stack spacing={1} direction="row">
  1571. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1572. <FormattedMessage id="businessRegCertNumber"/>:
  1573. </Typography>
  1574. <Typography variant="pnspsFormHeader" id="brNo-login">
  1575. {formik.values.brNo}
  1576. </Typography>
  1577. </Stack>
  1578. </Grid>
  1579. <Grid item xs={12} md={6}>
  1580. <Stack spacing={1} direction="row">
  1581. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1582. <FormattedMessage id="businessRegCertValidityDate"/>:
  1583. </Typography>
  1584. <Typography variant="pnspsFormHeader" id="brExpiryDate-login">
  1585. {formik.values.brExpiryDate}
  1586. </Typography>
  1587. </Stack>
  1588. </Grid>
  1589. <Grid item xs={12}>
  1590. <Stack spacing={1} direction="column">
  1591. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1592. <FormattedMessage id="formAddress"/>:
  1593. </Typography>
  1594. <Stack spacing={1} direction="column">
  1595. <Typography variant="pnspsFormHeader" id="preview-address1-signup">
  1596. {formik.values.address1}
  1597. </Typography>
  1598. {formik.values.address2 != null ?
  1599. <Typography variant="pnspsFormHeader" id="preview-address2-signup">
  1600. {formik.values.address2}
  1601. </Typography>
  1602. : null}
  1603. {formik.values.address3 != null ?
  1604. <Typography variant="pnspsFormHeader" id="preview-address3-signup">
  1605. {formik.values.address3}
  1606. </Typography>
  1607. : null}
  1608. {selectedAddress5.type === "hongKong" ?
  1609. <Stack direction="column">
  1610. {/* <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]} id="preview-address4-signup">
  1611. <FormattedMessage id="region"/>:
  1612. </Typography> */}
  1613. <Typography variant="pnspsFormHeader">
  1614. {!selectedAddress4? "" : intl.formatMessage({id: selectedAddress4.type})}
  1615. </Typography>
  1616. </Stack>
  1617. : null}
  1618. <Stack direction="column">
  1619. {/* <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]} id="preview-address5-signup">
  1620. <FormattedMessage id="regionOrCountry"/>:
  1621. </Typography> */}
  1622. <Typography variant="pnspsFormHeader">
  1623. {intl.formatMessage({id: selectedAddress5.type})}
  1624. </Typography>
  1625. </Stack>
  1626. </Stack>
  1627. </Stack>
  1628. </Grid>
  1629. <Grid item xs={12} mt={1} mb={1}>
  1630. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1631. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1632. <FormattedMessage id="yourContact"/>
  1633. </Typography>
  1634. </Stack>
  1635. </Grid>
  1636. <Grid item xs={12} md={12}>
  1637. <Stack spacing={1} direction="row">
  1638. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1639. <FormattedMessage id="userEnglishName"/>
  1640. </Typography>
  1641. <Typography variant="pnspsFormHeader" id="preview-enName-signup">
  1642. {formik.values.enName}
  1643. </Typography>
  1644. </Stack>
  1645. </Grid>
  1646. <Grid item xs={12} md={12}>
  1647. <Stack spacing={1} direction="row">
  1648. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1649. <FormattedMessage id="userContactEmail"/>:
  1650. </Typography>
  1651. <Typography variant="pnspsFormHeader" id="preview-email-signup">
  1652. {formik.values.email}
  1653. </Typography>
  1654. </Stack>
  1655. </Grid>
  1656. <Grid item xs={12} md={6}>
  1657. <Stack spacing={1} direction="row">
  1658. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1659. <FormattedMessage id="userContactNumber"/>:
  1660. </Typography>
  1661. <Typography variant="pnspsFormHeader" id="preview-phone-signup">
  1662. +{formik.values.phoneCountryCode} {formik.values.phone}
  1663. </Typography>
  1664. </Stack>
  1665. </Grid>
  1666. <Grid item xs={12} md={6}>
  1667. <Stack spacing={1} direction="row">
  1668. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1669. <FormattedMessage id="userFaxNumber"/>:
  1670. </Typography>
  1671. <Typography variant="pnspsFormHeader" id="preview-fax-signup">
  1672. +{formik.values.faxCountryCode} {formik.values.fax}
  1673. </Typography>
  1674. </Stack>
  1675. </Grid>
  1676. <Grid item xs={12} md={12} mt={1} mb={1}>
  1677. <Grid container>
  1678. <Grid item xs={12} md={12}>
  1679. <Stack spacing={1} direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1680. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1681. <FormattedMessage id="userIdDoc"/>
  1682. </Typography>
  1683. {fileList != null ?
  1684. <PreviewUploadFileTable key="previewTable" recordList={fileListData} /> : null}
  1685. </Stack>
  1686. </Grid>
  1687. </Grid>
  1688. </Grid>
  1689. </Grid>
  1690. </Grid>
  1691. </Grid>
  1692. </FormGroup>
  1693. {/* Submit page */}
  1694. <FormGroup id={"submitForm"} sx={{ display: props.step === 2 ? "" : "none" }}>
  1695. <Grid container spacing={3}>
  1696. {isLoading ?
  1697. <LoadingComponent /> :
  1698. <Grid item xs={12}>
  1699. {checkUpload ?
  1700. // SUCCESS page
  1701. <Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
  1702. <CheckCircleOutlineIcon color="success" sx={{ width: "200px", height: "200px" }} />
  1703. <Typography display="inline" variant="h4">
  1704. <FormattedMessage id="registerSubmitted"/>
  1705. </Typography>
  1706. <Typography display="inline" variant="h4">
  1707. <FormattedMessage id="emailSent"/>
  1708. </Typography>
  1709. <Button variant="outlined" component={Link} to="/login" >
  1710. <Typography variant="pnspsFormHeader">
  1711. <FormattedMessage id="backToLogin"/>
  1712. </Typography></Button>
  1713. </Stack>
  1714. :
  1715. // ERROR page
  1716. <Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
  1717. {/* <Button disabled={true} hidden={true} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> */}
  1718. <CancelOutlinedIcon color="error" sx={{ width: "200px", height: "200px" }} />
  1719. <Typography display="inline" variant="h4">
  1720. <FormattedMessage id="registerFail" />
  1721. </Typography>
  1722. <Button color="error" variant="outlined" component={Link} to="/login" ><Typography variant="pnspsFormHeader">
  1723. <FormattedMessage id="backToLogin"/>
  1724. </Typography></Button>
  1725. </Stack>
  1726. }
  1727. </Grid>
  1728. }
  1729. </Grid>
  1730. </FormGroup>
  1731. </form>
  1732. </FormikProvider>
  1733. );
  1734. }
  1735. export default BusCustomFormWizard;