You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1873 lines
115 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
  582. variant="outlined"
  583. type="reset"
  584. onClick={handleReset.bind(null, formik.resetForm)}
  585. sx={{
  586. height: '40px',
  587. borderColor: '#616161',
  588. color: '#424242',
  589. '&:hover': { borderColor: '#424242', backgroundColor: 'rgba(97,97,97,0.08)' },
  590. }}
  591. >
  592. <Typography variant="pnspsFormHeader">
  593. <FormattedMessage id="reset"/>
  594. </Typography>
  595. </Button>
  596. <div style={{ borderBottom: "3px solid #1A4399", width: "100%", margin_right: "15px" }}>
  597. <Typography display="inline" variant="h3" sx={{ color: '#1A4399' }}>
  598. <FormattedMessage id="becomeNewBusinessUser"/>
  599. </Typography>
  600. </div>
  601. <Typography mt={0.25} variant="h6" sx={{ color: '#B00020' }}>
  602. <FormattedMessage id="requireString"/>
  603. </Typography>
  604. <Typography mt={0.25} variant="h4" sx={{ color: 'primary.primary' }}>
  605. <FormattedMessage id="yourLoginInformation"/>
  606. </Typography>
  607. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  608. Already have an account?
  609. </Typography> */}
  610. </Stack>
  611. </Grid>
  612. <Grid item xs={12} md={12}>
  613. <Grid container spacing={1}>
  614. <Grid item xs={12} md={12} >
  615. <Stack spacing={1}>
  616. <InputLabel htmlFor="username-signup">
  617. <Typography variant="pnspsFormHeader">
  618. <FormattedMessage id="userLoginName"/>
  619. <span style={{ color: '#B00020' }}>*</span>
  620. {/* <Button
  621. variant="contained"
  622. onClick={handleCheckUsername}
  623. sx={{ ml: 2, height: "40px" }}>
  624. <Typography variant="h6">檢查是否重覆</Typography>
  625. </Button> */}
  626. </Typography>
  627. </InputLabel>
  628. <OutlinedInput
  629. id="username-signup"
  630. type="text"
  631. value={formik.values.username.trim()}
  632. name="username"
  633. onChange={(e) => {
  634. setCheckUsername(false)
  635. props.setUsername(e.target.value)
  636. formik.handleChange(e)
  637. }}
  638. placeholder={intl.formatMessage({id: 'userLoginName'})}
  639. fullWidth
  640. autoFocus
  641. error={Boolean((formik.touched.username && formik.errors.username) || checkUsername)}
  642. onBlur={formik.handleBlur}
  643. inputProps={{
  644. "aria-label": intl.formatMessage({ id: "userLoginName" }),
  645. "aria-describedby": 'helper-text-username-login',
  646. onKeyDown: (e) => {
  647. if (e.key === 'Enter') {
  648. e.preventDefault();
  649. }
  650. },
  651. }}
  652. />
  653. {formik.touched.username && formik.errors.username && (
  654. <FormHelperText error id="helper-text-username-signup">
  655. {formik.errors.username}
  656. </FormHelperText>
  657. )}
  658. {checkUsername && (
  659. <FormHelperText error id="helper-text-username-signup">
  660. <FormattedMessage id="usernameTaken"/>
  661. </FormHelperText>
  662. )}
  663. </Stack>
  664. </Grid>
  665. <Grid item xs={12} md={12}>
  666. <Grid container>
  667. <Grid item xs={12} md={6} >
  668. <Stack spacing={1} sx={{ mr: { md: 1 }, mb: 1 }}>
  669. <Stack direction="row" justifyContent="space-between">
  670. <InputLabel htmlFor="password-signup">
  671. <Typography variant="pnspsFormHeader">
  672. <FormattedMessage id="userPassword"/>
  673. <span style={{ color: '#B00020' }}>*</span>
  674. </Typography>
  675. </InputLabel>
  676. </Stack>
  677. <OutlinedInput
  678. fullWidth
  679. error={Boolean(formik.touched.password && formik.errors.password)}
  680. id="password-signup"
  681. type={showPassword ? 'text' : 'password'}
  682. value={formik.values.password.trim()}
  683. name="password"
  684. onChange={(e) => {
  685. formik.handleChange(e);
  686. changePassword(e.target.value);
  687. }}
  688. endAdornment={
  689. <InputAdornment position="end">
  690. <IconButton
  691. aria-label={intl.formatMessage({
  692. id: showPassword ? "ariaHidePassword" : "ariaShowPassword"
  693. })}
  694. onClick={handleClickShowPassword}
  695. onMouseDown={handleMouseDownPassword}
  696. edge="end"
  697. size="large"
  698. >
  699. {showPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  700. </IconButton>
  701. </InputAdornment>
  702. }
  703. placeholder={intl.formatMessage({id: 'userPassword'})}
  704. onBlur={formik.handleBlur}
  705. inputProps={{
  706. "aria-label": intl.formatMessage({ id: "userPassword" }),
  707. "aria-describedby": 'helper-text-password-signup',
  708. onKeyDown: (e) => {
  709. if (e.key === 'Enter') {
  710. e.preventDefault();
  711. }
  712. },
  713. }}
  714. />
  715. {formik.touched.password && formik.errors.password && (
  716. <FormHelperText error id="helper-text-password-signup">
  717. {formik.errors.password}
  718. </FormHelperText>
  719. )}
  720. </Stack>
  721. <FormControl fullWidth sx={{ mt: 2 }}>
  722. <Grid container spacing={2} alignItems="center">
  723. <Grid item>
  724. <Box sx={{ bgcolor: level?.color, width: 85, height: 8, borderRadius: '7px' }} />
  725. </Grid>
  726. <Grid item>
  727. <Typography variant="subtitle1">
  728. <FormattedMessage id={level ? level?.label : "pwWeak" }/>
  729. </Typography>
  730. </Grid>
  731. </Grid>
  732. </FormControl>
  733. </Grid>
  734. <Grid item xs={12} md={6} >
  735. <Stack spacing={1}>
  736. <InputLabel htmlFor="confirmPassword-signup">
  737. <Typography variant="pnspsFormHeader">
  738. <FormattedMessage id="confirmPassword"/>
  739. <span style={{ color: '#B00020' }}>*</span>
  740. </Typography>
  741. </InputLabel>
  742. <OutlinedInput
  743. id="confirmPassword-signup"
  744. type={showConfirmPassword ? 'text' : 'password'}
  745. value={formik.values.confirmPassword.trim()}
  746. name="confirmPassword"
  747. onBlur={formik.handleBlur}
  748. onCut={handleCCPChange}
  749. onCopy={handleCCPChange}
  750. onPaste={handleCCPChange}
  751. onChange={(e) => {
  752. formik.handleChange(e);
  753. // changePassword(e.target.value);
  754. }}
  755. inputProps={{
  756. "aria-label": intl.formatMessage({ id: "confirmPassword" }),
  757. "aria-describedby": 'helper-text-confirmPassword-signup',
  758. onKeyDown: (e) => {
  759. if (e.key === 'Enter') {
  760. e.preventDefault();
  761. }
  762. },
  763. }}
  764. endAdornment={
  765. <InputAdornment position="end">
  766. <IconButton
  767. aria-label={intl.formatMessage({
  768. id: showConfirmPassword ? "ariaHidePassword" : "ariaShowPassword"
  769. })}
  770. onClick={handleClickShowConfirmPassword}
  771. onMouseDown={handleMouseDownPassword}
  772. edge="end"
  773. size="large"
  774. >
  775. {showConfirmPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
  776. </IconButton>
  777. </InputAdornment>
  778. }
  779. placeholder={intl.formatMessage({id: 'confirmPassword'})}
  780. fullWidth
  781. error={Boolean(formik.touched.confirmPassword && formik.errors.confirmPassword)}
  782. />
  783. {formik.touched.confirmPassword && formik.errors.confirmPassword && (
  784. <FormHelperText error id="helper-text-confirmPassword-signup">
  785. {formik.errors.confirmPassword}
  786. </FormHelperText>
  787. )}
  788. </Stack>
  789. <Grid container spacing={2} alignItems="center">
  790. <Grid item sx={{mt:1}}>
  791. <Typography variant="subtitle1">
  792. •<FormattedMessage id="pwRemark1"/><br />
  793. •<FormattedMessage id="pwRemark2"/><br />
  794. •<FormattedMessage id="pwRemark3"/><br />
  795. •<FormattedMessage id="pwRemark4"/><br />
  796. •<FormattedMessage id="pwRemark5"/>
  797. </Typography>
  798. </Grid>
  799. </Grid>
  800. </Grid>
  801. </Grid>
  802. </Grid>
  803. <Grid item xs={12} mt={1} mb={1}>
  804. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  805. <Typography display="inline" variant="h4" /*sx={{ color: '#1A4399' }}*/>
  806. <FormattedMessage id="yourBusinessInformation"/>
  807. </Typography>
  808. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  809. Already have an account?
  810. </Typography> */}
  811. </Stack>
  812. </Grid>
  813. <Grid item xs={12} md={12}>
  814. <Typography variant="subtitle1">
  815. •<FormattedMessage id="pleaseEnterOrgOrCompName"/>
  816. </Typography>
  817. </Grid>
  818. <Grid item xs={12} md={6}>
  819. <Stack spacing={1}>
  820. <InputLabel htmlFor="enCompanyName-signup">
  821. <Typography variant="pnspsFormHeader">
  822. <FormattedMessage id="businessEngName"/>
  823. </Typography>
  824. </InputLabel>
  825. <OutlinedInput
  826. id="enCompanyName-signup"
  827. type="enCompanyName"
  828. value={formik.values.enCompanyName}
  829. name="enCompanyName"
  830. onChange={formik.handleChange}
  831. placeholder={intl.formatMessage({id: 'sameAsBusinessRegistrationCert'})}
  832. fullWidth
  833. error={Boolean(formik.touched.enCompanyName && formik.errors.enCompanyName && selectedAddress5 !== "內地")}
  834. onBlur={formik.handleBlur}
  835. inputProps={{
  836. "aria-label": intl.formatMessage({ id: "businessEngName" }),
  837. "aria-describedby": 'helper-text-enCompanyName-signup',
  838. onKeyDown: (e) => {
  839. if (e.key === 'Enter') {
  840. e.preventDefault();
  841. }
  842. },
  843. }}
  844. />
  845. {formik.touched.enCompanyName && formik.errors.enCompanyName && selectedAddress5 !== "內地" && (
  846. <FormHelperText error id="helper-text-enCompanyName-signup">
  847. {formik.errors.enCompanyName}
  848. </FormHelperText>
  849. )}
  850. </Stack>
  851. </Grid>
  852. <Grid item xs={12} md={6}>
  853. <Stack spacing={1}>
  854. <InputLabel htmlFor="chCompanyName-signup">
  855. <Typography variant="pnspsFormHeader">
  856. <FormattedMessage id="businessChName"/>
  857. </Typography>
  858. </InputLabel>
  859. <OutlinedInput
  860. fullWidth
  861. error={Boolean(formik.touched.chCompanyName && formik.errors.chCompanyName)}
  862. id="chCompanyName-signup"
  863. type="text"
  864. value={formik.values.chCompanyName.trim()}
  865. name="chCompanyName"
  866. onChange={formik.handleChange}
  867. placeholder={intl.formatMessage({id: 'sameAsBusinessRegistrationCert'})}
  868. onBlur={formik.handleBlur}
  869. inputProps={{
  870. "aria-label": intl.formatMessage({ id: "businessChName" }),
  871. "aria-describedby": 'helper-text-chCompanyName-signup',
  872. onKeyDown: (e) => {
  873. if (e.key === 'Enter') {
  874. e.preventDefault();
  875. }
  876. },
  877. }}
  878. />
  879. {formik.touched.chCompanyName && formik.errors.chCompanyName && (
  880. <FormHelperText error id="helper-text-chCompanyName-signup">
  881. {formik.errors.chCompanyName}
  882. </FormHelperText>
  883. )}
  884. </Stack>
  885. </Grid>
  886. <Grid item xs={12} md={6}>
  887. <Stack spacing={1}>
  888. <InputLabel htmlFor="brNo-signup" sx={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}>
  889. <Typography variant="pnspsFormHeader">
  890. <FormattedMessage id="businessRegCertNumber"/> (e.g. 12341234)
  891. <span style={{ color: '#B00020' }}>*</span>
  892. </Typography>
  893. </InputLabel>
  894. <OutlinedInput
  895. fullWidth
  896. error={Boolean(formik.touched.brNo && formik.errors.brNo)}
  897. id="brNo-signup"
  898. type="text"
  899. value={formik.values.brNo.trim()}
  900. name="brNo"
  901. onChange={formik.handleChange}
  902. onBlur={formik.handleBlur}
  903. placeholder={intl.formatMessage({id: 'sameAsBusinessRegistrationCert'})}
  904. inputProps={{
  905. "aria-label": intl.formatMessage({ id: "businessRegCertNumber" }),
  906. "aria-describedby": 'helper-text-brNo-signup',
  907. onKeyDown: (e) => {
  908. if (e.key === 'Enter') {
  909. e.preventDefault();
  910. }
  911. },
  912. }}
  913. />
  914. {formik.touched.brNo && formik.errors.brNo && (
  915. <FormHelperText error id="helper-text-brNo-signup">
  916. {formik.errors.brNo}
  917. </FormHelperText>
  918. )}
  919. </Stack>
  920. </Grid>
  921. <Grid item xs={12} md={6}>
  922. <Stack spacing={1}>
  923. <InputLabel htmlFor="brExpiryDate-signup">
  924. <Typography variant="pnspsFormHeader">
  925. <FormattedMessage id="businessRegCertValidityDate"/>
  926. <span style={{ color: '#B00020' }}>*</span>
  927. </Typography>
  928. </InputLabel>
  929. <OutlinedInput
  930. fullWidth
  931. error={Boolean(formik.touched.brExpiryDate && formik.errors.brExpiryDate)}
  932. id="brExpiryDate-signup"
  933. type="date"
  934. value={formik.values.brExpiryDate}
  935. name="brExpiryDate"
  936. onChange={formik.handleChange}
  937. onBlur={formik.handleBlur}
  938. placeholder={intl.formatMessage({id: 'sameAsBusinessRegistrationCert'})}
  939. inputProps={{
  940. "aria-label": intl.formatMessage({ id: "businessRegCertExpiryDate" }),
  941. "aria-describedby": 'helper-text-brExpiryDate-signup',
  942. max: "2099-12-31",
  943. min: new Date().toISOString().split("T")[0],
  944. onKeyDown: (e) => {
  945. if (e.key === 'Enter') {
  946. e.preventDefault();
  947. }
  948. },
  949. }}
  950. />
  951. {formik.touched.brExpiryDate && formik.errors.brExpiryDate && (
  952. <FormHelperText error id="helper-text-brExpiryDate-signup">
  953. {formik.errors.brExpiryDate}
  954. </FormHelperText>
  955. )}
  956. </Stack>
  957. </Grid>
  958. <Grid item xs={12}>
  959. <Stack spacing={1}>
  960. <InputLabel htmlFor="address1-signup">
  961. <Typography variant="pnspsFormHeader">
  962. <FormattedMessage id="formAddress"/>
  963. <span style={{ color: '#B00020' }}>*</span>
  964. </Typography>
  965. </InputLabel>
  966. <OutlinedInput
  967. fullWidth
  968. error={Boolean(formik.touched.address1 && formik.errors.address1)}
  969. id="address1-signup"
  970. value={formik.values.address1}
  971. name="address1"
  972. onChange={formik.handleChange}
  973. placeholder={intl.formatMessage({id: 'addressLine1'})}
  974. onBlur={formik.handleBlur}
  975. inputProps={{
  976. "aria-label": intl.formatMessage({ id: "addressLine1" }),
  977. onKeyDown: (e) => {
  978. if (e.key === 'Enter') {
  979. e.preventDefault();
  980. }
  981. },
  982. }}
  983. />
  984. <OutlinedInput
  985. fullWidth
  986. error={Boolean(formik.touched.address2 && formik.errors.address2)}
  987. id="address2-signup"
  988. value={formik.values.address2}
  989. name="address2"
  990. onBlur={formik.handleBlur}
  991. onChange={formik.handleChange}
  992. placeholder={intl.formatMessage({id: 'addressLine2'})}
  993. inputProps={{
  994. "aria-label": intl.formatMessage({ id: "addressLine2" }),
  995. onKeyDown: (e) => {
  996. if (e.key === 'Enter') {
  997. e.preventDefault();
  998. }
  999. },
  1000. }}
  1001. />
  1002. <OutlinedInput
  1003. fullWidth
  1004. error={Boolean(formik.touched.address3 && formik.errors.address3)}
  1005. id="address3-signup"
  1006. value={formik.values.address3}
  1007. name="address3"
  1008. onBlur={formik.handleBlur}
  1009. onChange={formik.handleChange}
  1010. placeholder={intl.formatMessage({id: 'addressLine3'})}
  1011. inputProps={{
  1012. "aria-label": intl.formatMessage({ id: "addressLine3" }),
  1013. onKeyDown: (e) => {
  1014. if (e.key === 'Enter') {
  1015. e.preventDefault();
  1016. }
  1017. },
  1018. }}
  1019. />
  1020. <Autocomplete
  1021. disablePortal
  1022. id="address4-combo"
  1023. value={selectedAddress4}
  1024. options={address4ComboList}
  1025. disabled={checkCountry}
  1026. // error={Boolean(districtErrStr!="")}
  1027. // onBlur={formik.handleBlur}
  1028. getOptionLabel={(option) => option.type? intl.formatMessage({ id: option.type }) : ""}
  1029. onChange={(event, newValue) => {
  1030. setSelectedAddress4(newValue);
  1031. }}
  1032. sx={{
  1033. '& .MuiInputBase-root': { alignItems: 'center' },
  1034. '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' },
  1035. '& .MuiOutlinedInput-root': { height: 40 }
  1036. }}
  1037. renderInput={(params) => <TextField error={checkDistrict} {...params} placeholder={intl.formatMessage({id: 'region'})}
  1038. />}
  1039. clearText={intl.formatMessage({ id: "muiClear" })}
  1040. closeText={intl.formatMessage({ id: "muiClose" })}
  1041. openText={intl.formatMessage({ id: "muiOpen" })}
  1042. noOptionsText={intl.formatMessage({ id: "muiNoOptions" })}
  1043. />
  1044. <Autocomplete
  1045. disablePortal
  1046. id="address5-combo"
  1047. value={selectedAddress5}
  1048. options={address5ComboList}
  1049. disabled= {true}
  1050. getOptionLabel={(option) => option.type? intl.formatMessage({ id: option.type }) : ""}
  1051. onChange={(event, newValue) => {
  1052. if (newValue !== null) {
  1053. setSelectedAddress5(newValue);
  1054. if (newValue.type === 'hongKong') {
  1055. setCheckCountry(false)
  1056. if(formik.values.phone==""){
  1057. formik.values.phoneCountryCode = "852";
  1058. }
  1059. if(formik.values.fax==""){
  1060. formik.values.faxCountryCode = "852";
  1061. }
  1062. } else {
  1063. if (newValue.type === 'mainland'){
  1064. if(formik.values.phone==""){
  1065. formik.values.phoneCountryCode = "86";
  1066. }
  1067. if(formik.values.fax==""){
  1068. formik.values.faxCountryCode = "86";
  1069. }
  1070. }else if(newValue.type === 'macau'){
  1071. if(formik.values.phone==""){
  1072. formik.values.phoneCountryCode = "853";
  1073. }
  1074. if(formik.values.fax==""){
  1075. formik.values.faxCountryCode = "853";
  1076. }
  1077. }
  1078. setSelectedAddress4("");
  1079. setCheckCountry(true)
  1080. }
  1081. } else {
  1082. setSelectedAddress4("");
  1083. setCheckCountry(true)
  1084. }
  1085. }}
  1086. sx={{
  1087. '& .MuiInputBase-root': { alignItems: 'center' },
  1088. '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' },
  1089. '& .MuiOutlinedInput-root': { height: 40 }
  1090. }}
  1091. renderInput={(params) => <TextField {...params} placeholder={intl.formatMessage({id: 'regionOrCountry'})} />}
  1092. clearText={intl.formatMessage({ id: "muiClear" })}
  1093. closeText={intl.formatMessage({ id: "muiClose" })}
  1094. openText={intl.formatMessage({ id: "muiOpen" })}
  1095. noOptionsText={intl.formatMessage({ id: "muiNoOptions" })}
  1096. />
  1097. {formik.touched.address1 && formik.errors.address1 && (
  1098. <FormHelperText error id="helper-text-address1-signup">
  1099. {formik.errors.address1}
  1100. </FormHelperText>
  1101. )}
  1102. {formik.touched.address2 && formik.errors.address2 && (
  1103. <FormHelperText error id="helper-text-address2-signup">
  1104. {formik.errors.address2}
  1105. </FormHelperText>
  1106. )}
  1107. {formik.touched.address3 && formik.errors.address3 && (
  1108. <FormHelperText error id="helper-text-address3-signup">
  1109. {formik.errors.address3}
  1110. </FormHelperText>
  1111. )}
  1112. {checkDistrict && (
  1113. <FormHelperText error >
  1114. {districtErrStr}
  1115. </FormHelperText>
  1116. )}
  1117. </Stack>
  1118. </Grid>
  1119. <Grid item xs={12} mt={1} mb={1}>
  1120. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1121. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1122. <FormattedMessage id="yourContact"/>
  1123. </Typography>
  1124. </Stack>
  1125. </Grid>
  1126. <Grid item xs={12} md={12}>
  1127. <Stack spacing={1}>
  1128. <InputLabel htmlFor="enName-signup">
  1129. <Typography variant="pnspsFormHeader">
  1130. <FormattedMessage id="userContactName"/>
  1131. <span style={{ color: '#B00020' }}>*</span>
  1132. </Typography>
  1133. </InputLabel>
  1134. <OutlinedInput
  1135. id="enName-signup"
  1136. type="enName"
  1137. value={formik.values.enName}
  1138. name="enName"
  1139. onChange={formik.handleChange}
  1140. placeholder=""
  1141. fullWidth
  1142. error={Boolean(formik.touched.enName && formik.errors.enName)}
  1143. onBlur={formik.handleBlur}
  1144. inputProps={{
  1145. "aria-label": intl.formatMessage({ id: "userContactName" }),
  1146. "aria-describedby": 'helper-text-enName-signup',
  1147. onKeyDown: (e) => {
  1148. if (e.key === 'Enter') {
  1149. e.preventDefault();
  1150. }
  1151. },
  1152. }}
  1153. />
  1154. {formik.touched.enName && formik.errors.enName && (
  1155. <FormHelperText error id="helper-text-enName-signup">
  1156. {formik.errors.enName}
  1157. </FormHelperText>
  1158. )}
  1159. </Stack>
  1160. </Grid>
  1161. <Grid item xs={12} md={12}>
  1162. <Grid container>
  1163. <Grid item xs={12} md={6}>
  1164. <Stack spacing={1} sx={{ mr: { md: 1 }, mb: 1 }}>
  1165. <InputLabel htmlFor="email-signup">
  1166. <Typography variant="pnspsFormHeader">
  1167. <FormattedMessage id="userContactEmail"/>
  1168. <span style={{ color: '#B00020' }}>*</span>
  1169. </Typography>
  1170. </InputLabel>
  1171. <OutlinedInput
  1172. fullWidth
  1173. error={Boolean((formik.touched.email && formik.errors.email) || checkEmail)}
  1174. id="email-signup"
  1175. type="email"
  1176. value={formik.values.email.trim()}
  1177. name="email"
  1178. onChange={formik.handleChange}
  1179. placeholder={intl.formatMessage({id: 'userContactEmail'})}
  1180. onBlur={formik.handleBlur}
  1181. inputProps={{
  1182. "aria-label": intl.formatMessage({ id: "userContactEmail" }),
  1183. "aria-describedby": 'helper-text-email-signup',
  1184. onKeyDown: (e) => {
  1185. if (e.key === 'Enter') {
  1186. e.preventDefault();
  1187. }
  1188. },
  1189. }}
  1190. />
  1191. {formik.touched.email && formik.errors.email && (
  1192. <FormHelperText error id="helper-text-email-signup">
  1193. {formik.errors.email}
  1194. </FormHelperText>
  1195. )}
  1196. {checkEmail && (
  1197. <FormHelperText error id="helper-text-email-signup">
  1198. <FormattedMessage id="emailUsed"/>
  1199. </FormHelperText>
  1200. )}
  1201. </Stack>
  1202. </Grid>
  1203. <Grid item xs={12} md={6}>
  1204. <Stack spacing={1} >
  1205. <InputLabel htmlFor="emailConfirm-signup">
  1206. <Typography variant="pnspsFormHeader">
  1207. <FormattedMessage id="confirmEmail"/>
  1208. <span style={{ color: '#B00020' }}>*</span>
  1209. </Typography>
  1210. </InputLabel>
  1211. <OutlinedInput
  1212. fullWidth
  1213. error={Boolean(formik.touched.emailConfirm && formik.errors.emailConfirm)}
  1214. id="emailConfirm-signup"
  1215. type="email"
  1216. value={formik.values.emailConfirm.trim()}
  1217. name="emailConfirm"
  1218. // onBlur={formik.handleBlur}
  1219. onChange={formik.handleChange}
  1220. placeholder={intl.formatMessage({id: 'confirmEmail'})}
  1221. onBlur={formik.handleBlur}
  1222. onCut={handleCCPChange}
  1223. onCopy={handleCCPChange}
  1224. onPaste={handleCCPChange}
  1225. inputProps={{
  1226. "aria-label": intl.formatMessage({ id: "confirmEmail" }),
  1227. "aria-describedby": 'helper-text-emailConfirm-signup',
  1228. onKeyDown: (e) => {
  1229. if (e.key === 'Enter') {
  1230. e.preventDefault();
  1231. }
  1232. },
  1233. }}
  1234. />
  1235. {formik.touched.emailConfirm && formik.errors.emailConfirm && (
  1236. <FormHelperText error id="helper-text-emailConfirm-signup">
  1237. {formik.errors.emailConfirm}
  1238. </FormHelperText>
  1239. )}
  1240. </Stack>
  1241. </Grid>
  1242. </Grid>
  1243. </Grid>
  1244. <Grid item xs={12} md={12}>
  1245. <Grid container>
  1246. <Grid item xs={12} md={6}>
  1247. <Grid container>
  1248. <Grid item xs={12} md={12}>
  1249. <Stack direction="column" spacing={1} sx={{ mr: { md: 1 }, mb: 1 }}>
  1250. <InputLabel htmlFor="phone-signup">
  1251. <Typography variant="pnspsFormHeader">
  1252. <FormattedMessage id="userContactNumber"/>
  1253. <span style={{ color: '#B00020' }}>*</span>
  1254. </Typography>
  1255. </InputLabel>
  1256. <Stack direction="row">
  1257. <OutlinedInput
  1258. id="phoneCountryCode-signup"
  1259. type="phoneCountryCode"
  1260. value={formik.values.phoneCountryCode.trim()}
  1261. name="phoneCountryCode"
  1262. // onBlur={formik.handleBlur}
  1263. // onChange={formik.handleChange}
  1264. onChange={(event) => {
  1265. const value = event.target.value;
  1266. if (value.match(/[^0-9]/)) {
  1267. return event.preventDefault();
  1268. }
  1269. formik.setFieldValue("phoneCountryCode", value);
  1270. }}
  1271. endAdornment={<InputAdornment position="end">-</InputAdornment>}
  1272. placeholder={intl.formatMessage({id: 'dialingCode'})}
  1273. error={Boolean(formik.touched.phone && formik.errors.phone)}
  1274. onBlur={formik.handleBlur}
  1275. inputProps={{
  1276. "aria-label": intl.formatMessage({ id: "phoneCountryCode" }),
  1277. maxLength: 3,
  1278. onKeyDown: (e) => {
  1279. if (e.key === 'Enter') {
  1280. e.preventDefault();
  1281. }
  1282. },
  1283. }}
  1284. sx={{ width: '33%', mr:1 }}
  1285. />
  1286. <OutlinedInput
  1287. id="phone-signup"
  1288. type="phone"
  1289. value={formik.values.phone.trim()}
  1290. name="phone"
  1291. onBlur={formik.handleBlur}
  1292. // onChange={formik.handleChange}
  1293. onChange={(event) => {
  1294. const value = event.target.value;
  1295. if (value.match(/[^0-9]/)) {
  1296. return event.preventDefault();
  1297. }
  1298. formik.setFieldValue("phone", value);
  1299. }}
  1300. placeholder={intl.formatMessage({id: 'userContactNumber'})}
  1301. error={Boolean(formik.touched.phone && formik.errors.phone)}
  1302. inputProps={{
  1303. "aria-label": intl.formatMessage({ id: "userContactNumber" }),
  1304. "aria-describedby": 'helper-text-phone-signup',
  1305. maxLength: 11,
  1306. onKeyDown: (e) => {
  1307. if (e.key === 'Enter') {
  1308. e.preventDefault();
  1309. }
  1310. },
  1311. }}
  1312. sx={{ width: '66%' }}
  1313. />
  1314. </Stack>
  1315. {formik.touched.phone && formik.errors.phone && (
  1316. <FormHelperText error id="helper-text-phone-signup">
  1317. {formik.errors.phone}
  1318. </FormHelperText>
  1319. )}
  1320. </Stack>
  1321. </Grid>
  1322. </Grid>
  1323. </Grid>
  1324. <Grid item xs={12} md={6}>
  1325. <Grid container>
  1326. <Grid item xs={12} md={12}>
  1327. <Stack spacing={1} direction="column">
  1328. <InputLabel htmlFor="fax-signup">
  1329. <Typography variant="pnspsFormHeader">
  1330. <FormattedMessage id="userFaxNumber"/>
  1331. </Typography>
  1332. </InputLabel>
  1333. <Stack direction="row">
  1334. <OutlinedInput
  1335. error={Boolean(formik.touched.fax && formik.errors.fax)}
  1336. id="faxCountryCode-signup"
  1337. type="faxCountryCode"
  1338. value={formik.values.faxCountryCode.trim()}
  1339. name="faxCountryCode"
  1340. // onBlur={formik.handleBlur}
  1341. // onChange={formik.handleChange}
  1342. onChange={(event) => {
  1343. const value = event.target.value;
  1344. if (value.match(/[^0-9]/)) {
  1345. return event.preventDefault();
  1346. }
  1347. formik.setFieldValue("faxCountryCode", value);
  1348. }}
  1349. placeholder={intl.formatMessage({id: 'dialingCode'})}
  1350. endAdornment={<InputAdornment position="end">-</InputAdornment>}
  1351. inputProps={{
  1352. "aria-label": intl.formatMessage({ id: "faxCountryCode" }),
  1353. maxLength: 3,
  1354. onKeyDown: (e) => {
  1355. if (e.key === 'Enter') {
  1356. e.preventDefault();
  1357. }
  1358. },
  1359. }}
  1360. sx={{ width: '33%', mr:1 }}
  1361. />
  1362. <OutlinedInput
  1363. id="fax-signup"
  1364. type="fax"
  1365. value={formik.values.fax.trim()}
  1366. name="fax"
  1367. // onBlur={formik.handleBlur}
  1368. // onChange={formik.handleChange}
  1369. onChange={(event) => {
  1370. const value = event.target.value;
  1371. if (value.match(/[^0-9]/)) {
  1372. return event.preventDefault();
  1373. }
  1374. formik.setFieldValue("fax", value);
  1375. }}
  1376. placeholder={intl.formatMessage({id: 'userFaxNumber'})}
  1377. inputProps={{
  1378. "aria-label": intl.formatMessage({ id: "userFaxNumber" }),
  1379. maxLength: 8,
  1380. onKeyDown: (e) => {
  1381. if (e.key === 'Enter') {
  1382. e.preventDefault();
  1383. }
  1384. },
  1385. }}
  1386. sx={{ width: '66%' }}
  1387. />
  1388. </Stack>
  1389. </Stack>
  1390. </Grid>
  1391. </Grid>
  1392. </Grid>
  1393. </Grid>
  1394. </Grid>
  1395. <Grid item xs={12} md={12} mt={1} mb={1}>
  1396. <Grid container>
  1397. <Grid item xs={12} md={12}>
  1398. <Stack spacing={1} direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1399. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1400. <FormattedMessage id="businessRegCertAndDoc"/>
  1401. <span style={{ color: '#B00020' }}>*</span>
  1402. </Typography>
  1403. <Typography display="inline" variant="h6" sx={{ color: 'primary.primary' }}>
  1404. <FormattedMessage id="pleaseUploadDoc"/>
  1405. </Typography>
  1406. {/* <Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography> */}
  1407. <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
  1408. <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
  1409. <Button variant="contained" component="label" sx={{ height: '40px' }}>
  1410. <FormattedMessage id="uploadFile"/>
  1411. <input
  1412. accept="image/png, .jpg, .bmp, .pdf"
  1413. //className={classes.input}
  1414. id="contained-button-file"
  1415. multiple
  1416. type="file"
  1417. onChange={handleFileUpload}
  1418. style={{ display: 'none' }}
  1419. />
  1420. </Button>
  1421. </ThemeProvider>
  1422. {/* <Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}></Typography> */}
  1423. </Stack>
  1424. {fileList != null ?
  1425. <UploadFileTable key="uploadTable" recordList={fileListData} setUpdateRows={setUpdateRows} /> : null}
  1426. {/* <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
  1427. <Button variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button>
  1428. <Button disabled={!formik.isValid} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button>
  1429. </Stack> */}
  1430. </Stack>
  1431. </Grid>
  1432. </Grid>
  1433. </Grid>
  1434. </Grid>
  1435. <Grid item xs={12} md={12}>
  1436. <Grid container>
  1437. <Grid item xs={12} md={12}>
  1438. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1439. <FormattedMessage id="termsAndCondition"/>
  1440. <span style={{ color: '#B00020' }}>*</span>
  1441. </Typography>
  1442. </Grid>
  1443. <Grid item xs={12} md={12}>
  1444. <Grid container>
  1445. <Grid item xs={12} md={12}>
  1446. <Typography variant="h6" height="100%" sx={{ textAlign: "left", /*overflow: "scroll",*/ borderRadius: "inherit", borderStyle: "solid", borderWidth: "1px", borderColor: "#0C489E" }}>
  1447. <div style={{padding: 12}} dangerouslySetInnerHTML={{__html: intl.formatMessage({id: "termsAndCon"})}} />
  1448. </Typography>
  1449. </Grid>
  1450. </Grid>
  1451. <Grid item xs={12} s={12} md={12} lg={12}>
  1452. <Grid container>
  1453. <Grid item xs={6} s={6} md={11} lg={11}>
  1454. <Grid container>
  1455. <Grid item sx={{ display: 'flex', alignItems: 'center' }}>
  1456. <Checkbox
  1457. checked={termsAndConAccept}
  1458. onChange={handleCheckBoxChange}
  1459. name="termsAndConAccept"
  1460. color="primary"
  1461. size="small"
  1462. inputProps={{
  1463. "aria-label": intl.formatMessage({ id: "iConfirm" })
  1464. }}
  1465. />
  1466. <Typography variant="pnspsFormHeader">
  1467. <FormattedMessage id="iConfirm"/>
  1468. </Typography>
  1469. </Grid>
  1470. </Grid>
  1471. </Grid>
  1472. <Grid item xs={6} s={6} md={3} lg={3}>
  1473. <Grid container style={{ display: "none" }}>
  1474. <Grid item sx={{ display: 'flex', alignItems: 'center' }}>
  1475. <Checkbox
  1476. checked={termsAndConNotAccept}
  1477. onChange={handleCheckBoxChange}
  1478. name="termsAndConNotAccept"
  1479. color="primary"
  1480. size="small"
  1481. inputProps={{
  1482. "aria-label": intl.formatMessage({ id: "rejectTerms" })
  1483. }}
  1484. />
  1485. <Typography variant="pnspsFormHeader">
  1486. <FormattedMessage id="rejectTerms"/>
  1487. </Typography>
  1488. </Grid>
  1489. </Grid>
  1490. </Grid>
  1491. </Grid>
  1492. </Grid>
  1493. </Grid>
  1494. </Grid>
  1495. </Grid>
  1496. <Grid item xs={12} lg={12}>
  1497. <Grid container>
  1498. <Stack direction="column">
  1499. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1500. <FormattedMessage id="verify"/>
  1501. <span style={{ color: '#B00020' }}>*</span>
  1502. </Typography>
  1503. <Stack spacing={1} direction="row">
  1504. <Grid item xs={5} lg={5} style={{ "border": "1px solid black" }}>
  1505. <img src={captchaImg} alt="" />
  1506. </Grid>
  1507. <Grid item xs={1} lg={1} style={{ "border": "0px solid black" }}>
  1508. <IconButton aria-label={intl.formatMessage({ id: 'ariaRefreshCaptcha' })} size="large" onClick={() => { onCaptchaChange() }}>
  1509. <LoopIcon fontSize="inherit" />
  1510. </IconButton>
  1511. </Grid>
  1512. <Grid item xs={6} lg={6}>
  1513. <OutlinedInput
  1514. fullWidth
  1515. id="captchaField"
  1516. type="text"
  1517. value={formik.values.captchaField.trim()}
  1518. onBlur={formik.handleBlur}
  1519. error={Boolean(formik.touched.captchaField && formik.errors.captchaField)}
  1520. name="captchaField"
  1521. onChange={(event) => {
  1522. const value = event.target.value;
  1523. props.setCheckCode(event.target.value);
  1524. setCheckCode(event.target.value);
  1525. formik.setFieldValue("captchaField", value);
  1526. }}
  1527. sx={{ width: '75%' }}
  1528. inputProps={{
  1529. "aria-label": intl.formatMessage({ id: "verify" }),
  1530. "aria-describedby": 'helper-text-captcha-signup'
  1531. }}
  1532. />
  1533. </Grid>
  1534. </Stack>
  1535. {formik.touched.captchaField && formik.errors.captchaField && (
  1536. <FormHelperText error id="helper-text-captcha-signup">
  1537. {formik.errors.captchaField}
  1538. </FormHelperText>
  1539. )}
  1540. <Stack spacing={1} direction="row" sx={{ mt: 0.25 }}>
  1541. <Button
  1542. variant="contained"
  1543. onClick={playCaptchaAudio}
  1544. aria-label={intl.formatMessage({ id: "captchaPlayAudio" })}
  1545. sx={{
  1546. backgroundColor: '#0C489E',
  1547. color: '#FFFFFF',
  1548. '&:hover': { backgroundColor: '#093A7A' },
  1549. }}
  1550. >
  1551. <FormattedMessage id="captchaPlayAudio" />
  1552. </Button>
  1553. </Stack>
  1554. </Stack>
  1555. </Grid>
  1556. </Grid>
  1557. </Grid>
  1558. </Grid>
  1559. </FormGroup>
  1560. {/* Preview Form */}
  1561. <FormGroup id={"previewForm"} sx={{ display: props.step === 1 ? "" : "none" }}>
  1562. <Grid container spacing={2}>
  1563. <Grid item xs={12}>
  1564. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1565. <div style={{ borderBottom: "3px solid #1A4399", width: "100%", margin_right: "15px" }}>
  1566. <Typography display="inline" variant="h3" sx={{ color: '#1A4399' }}>
  1567. <FormattedMessage id="becomeNewBusinessUser"/>
  1568. </Typography>
  1569. </div>
  1570. {/* <Typography mt={0.25} variant="h6" sx={{ fontSize: 12,color: '#B00020'}}>註有*的項目必須輸入資料</Typography> */}
  1571. <Typography mt={0.25} variant="h4" sx={{ color: 'primary.primary' }}>
  1572. <FormattedMessage id="yourLoginInformation"/>
  1573. </Typography>
  1574. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  1575. Already have an account?
  1576. </Typography> */}
  1577. </Stack>
  1578. </Grid>
  1579. <Grid item xs={12}>
  1580. <Grid container spacing={1}>
  1581. <Grid item xs={12} >
  1582. <Stack spacing={1} direction="row">
  1583. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1584. {intl.formatMessage({id: 'userLoginName'})}:
  1585. </Typography>
  1586. <Typography variant="pnspsFormHeader" id="preview-username-login">
  1587. {formik.values.username}
  1588. </Typography>
  1589. </Stack>
  1590. </Grid>
  1591. <Grid item xs={12} mt={1} mb={1}>
  1592. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1593. <Typography display="inline" variant="h4" /*sx={{ color: '#1A4399' }}*/>
  1594. <FormattedMessage id="yourBusinessInformation"/>
  1595. </Typography>
  1596. {/* <Typography component={Link} to="/login" variant="body1" sx={{ textDecoration: 'none' }} color="primary">
  1597. Already have an account?
  1598. </Typography> */}
  1599. </Stack>
  1600. </Grid>
  1601. <Grid item xs={12} md={6}>
  1602. <Stack spacing={1} direction="row">
  1603. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1604. <FormattedMessage id="businessEngName"/>:
  1605. </Typography>
  1606. <Typography variant="pnspsFormHeader" id="preview-enCompanyName-signup">
  1607. {formik.values.enCompanyName}
  1608. </Typography>
  1609. </Stack>
  1610. </Grid>
  1611. <Grid item xs={12} md={6}>
  1612. <Stack spacing={1} direction="row">
  1613. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1614. <FormattedMessage id="businessChName"/>:
  1615. </Typography>
  1616. <Typography variant="pnspsFormHeader" id="preview-chCompanyName-signup">
  1617. {formik.values.chCompanyName}
  1618. </Typography>
  1619. </Stack>
  1620. </Grid>
  1621. <Grid item xs={12} md={12} >
  1622. <Stack spacing={1}>
  1623. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1624. <FormattedMessage id="businessRegCert"/>
  1625. </Typography>
  1626. </Stack>
  1627. </Grid>
  1628. <Grid item xs={12} md={6}>
  1629. <Stack spacing={1} direction="row">
  1630. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1631. <FormattedMessage id="businessRegCertNumber"/>:
  1632. </Typography>
  1633. <Typography variant="pnspsFormHeader" id="brNo-login">
  1634. {formik.values.brNo}
  1635. </Typography>
  1636. </Stack>
  1637. </Grid>
  1638. <Grid item xs={12} md={6}>
  1639. <Stack spacing={1} direction="row">
  1640. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1641. <FormattedMessage id="businessRegCertValidityDate"/>:
  1642. </Typography>
  1643. <Typography variant="pnspsFormHeader" id="brExpiryDate-login">
  1644. {formik.values.brExpiryDate}
  1645. </Typography>
  1646. </Stack>
  1647. </Grid>
  1648. <Grid item xs={12}>
  1649. <Stack spacing={1} direction="column">
  1650. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1651. <FormattedMessage id="formAddress"/>:
  1652. </Typography>
  1653. <Stack spacing={1} direction="column">
  1654. <Typography variant="pnspsFormHeader" id="preview-address1-signup">
  1655. {formik.values.address1}
  1656. </Typography>
  1657. {formik.values.address2 != null ?
  1658. <Typography variant="pnspsFormHeader" id="preview-address2-signup">
  1659. {formik.values.address2}
  1660. </Typography>
  1661. : null}
  1662. {formik.values.address3 != null ?
  1663. <Typography variant="pnspsFormHeader" id="preview-address3-signup">
  1664. {formik.values.address3}
  1665. </Typography>
  1666. : null}
  1667. {selectedAddress5.type === "hongKong" ?
  1668. <Stack direction="column">
  1669. {/* <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]} id="preview-address4-signup">
  1670. <FormattedMessage id="region"/>:
  1671. </Typography> */}
  1672. <Typography variant="pnspsFormHeader">
  1673. {!selectedAddress4? "" : intl.formatMessage({id: selectedAddress4.type})}
  1674. </Typography>
  1675. </Stack>
  1676. : null}
  1677. <Stack direction="column">
  1678. {/* <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]} id="preview-address5-signup">
  1679. <FormattedMessage id="regionOrCountry"/>:
  1680. </Typography> */}
  1681. <Typography variant="pnspsFormHeader">
  1682. {intl.formatMessage({id: selectedAddress5.type})}
  1683. </Typography>
  1684. </Stack>
  1685. </Stack>
  1686. </Stack>
  1687. </Grid>
  1688. <Grid item xs={12} mt={1} mb={1}>
  1689. <Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1690. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1691. <FormattedMessage id="yourContact"/>
  1692. </Typography>
  1693. </Stack>
  1694. </Grid>
  1695. <Grid item xs={12} md={12}>
  1696. <Stack spacing={1} direction="row">
  1697. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1698. <FormattedMessage id="userEnglishName"/>
  1699. </Typography>
  1700. <Typography variant="pnspsFormHeader" id="preview-enName-signup">
  1701. {formik.values.enName}
  1702. </Typography>
  1703. </Stack>
  1704. </Grid>
  1705. <Grid item xs={12} md={12}>
  1706. <Stack spacing={1} direction="row">
  1707. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1708. <FormattedMessage id="userContactEmail"/>:
  1709. </Typography>
  1710. <Typography variant="pnspsFormHeader" id="preview-email-signup">
  1711. {formik.values.email}
  1712. </Typography>
  1713. </Stack>
  1714. </Grid>
  1715. <Grid item xs={12} md={6}>
  1716. <Stack spacing={1} direction="row">
  1717. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1718. <FormattedMessage id="userContactNumber"/>:
  1719. </Typography>
  1720. <Typography variant="pnspsFormHeader" id="preview-phone-signup">
  1721. +{formik.values.phoneCountryCode} {formik.values.phone}
  1722. </Typography>
  1723. </Stack>
  1724. </Grid>
  1725. <Grid item xs={12} md={6}>
  1726. <Stack spacing={1} direction="row">
  1727. <Typography variant="pnspsFormHeader" color={theme.palette.grey[600]}>
  1728. <FormattedMessage id="userFaxNumber"/>:
  1729. </Typography>
  1730. <Typography variant="pnspsFormHeader" id="preview-fax-signup">
  1731. +{formik.values.faxCountryCode} {formik.values.fax}
  1732. </Typography>
  1733. </Stack>
  1734. </Grid>
  1735. <Grid item xs={12} md={12} mt={1} mb={1}>
  1736. <Grid container>
  1737. <Grid item xs={12} md={12}>
  1738. <Stack spacing={1} direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
  1739. <Typography display="inline" variant="h4" sx={{ color: 'primary.primary' }}>
  1740. <FormattedMessage id="userIdDoc"/>
  1741. </Typography>
  1742. {fileList != null ?
  1743. <PreviewUploadFileTable key="previewTable" recordList={fileListData} /> : null}
  1744. </Stack>
  1745. </Grid>
  1746. </Grid>
  1747. </Grid>
  1748. </Grid>
  1749. </Grid>
  1750. </Grid>
  1751. </FormGroup>
  1752. {/* Submit page */}
  1753. <FormGroup id={"submitForm"} sx={{ display: props.step === 2 ? "" : "none" }}>
  1754. <Grid container spacing={3}>
  1755. {isLoading ?
  1756. <LoadingComponent /> :
  1757. <Grid item xs={12}>
  1758. {checkUpload ?
  1759. // SUCCESS page
  1760. <Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
  1761. <CheckCircleOutlineIcon color="success" sx={{ width: "200px", height: "200px" }} />
  1762. <Typography display="inline" variant="h4">
  1763. <FormattedMessage id="registerSubmitted"/>
  1764. </Typography>
  1765. <Typography display="inline" variant="h4">
  1766. <FormattedMessage id="emailSent"/>
  1767. </Typography>
  1768. <Button variant="outlined" component={Link} to="/login" >
  1769. <Typography variant="pnspsFormHeader">
  1770. <FormattedMessage id="backToLogin"/>
  1771. </Typography></Button>
  1772. </Stack>
  1773. :
  1774. // ERROR page
  1775. <Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
  1776. {/* <Button disabled={true} hidden={true} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> */}
  1777. <CancelOutlinedIcon color="error" sx={{ width: "200px", height: "200px" }} />
  1778. <Typography display="inline" variant="h4">
  1779. <FormattedMessage id="registerFail" />
  1780. </Typography>
  1781. <Button color="error" variant="outlined" component={Link} to="/login" ><Typography variant="pnspsFormHeader">
  1782. <FormattedMessage id="backToLogin"/>
  1783. </Typography></Button>
  1784. </Stack>
  1785. }
  1786. </Grid>
  1787. }
  1788. </Grid>
  1789. </FormGroup>
  1790. </form>
  1791. </FormikProvider>
  1792. );
  1793. }
  1794. export default BusCustomFormWizard;