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.
 
 

1866 lines
115 KiB

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