|
@@ -27,10 +27,10 @@ import * as yup from 'yup'; |
|
|
// project import |
|
|
// project import |
|
|
// import AnimateButton from 'components/@extended/AnimateButton'; |
|
|
// import AnimateButton from 'components/@extended/AnimateButton'; |
|
|
import { strengthColorChi, strengthIndicator } from 'utils/password-strength'; |
|
|
import { strengthColorChi, strengthIndicator } from 'utils/password-strength'; |
|
|
import {apiPath} from "auth/utils"; |
|
|
|
|
|
|
|
|
// import {apiPath} from "auth/utils"; |
|
|
import axios from "axios"; |
|
|
import axios from "axios"; |
|
|
import {POST_PUBLIC_USER_REGISTER} from "utils/ApiPathConst"; |
|
|
import {POST_PUBLIC_USER_REGISTER} from "utils/ApiPathConst"; |
|
|
import * as HttpUtils from 'utils/HttpUtils'; |
|
|
|
|
|
|
|
|
// import * as HttpUtils from 'utils/HttpUtils'; |
|
|
import * as ComboData from "../../../utils/ComboData"; |
|
|
import * as ComboData from "../../../utils/ComboData"; |
|
|
|
|
|
|
|
|
import Loadable from 'components/Loadable'; |
|
|
import Loadable from 'components/Loadable'; |
|
@@ -96,6 +96,7 @@ const CustomFormWizard = (props) => { |
|
|
+ "於所有文本、平面圖像、圖畫、圖片、照片以及數據或其他資料的匯編,均受版權保障。\n香" |
|
|
+ "於所有文本、平面圖像、圖畫、圖片、照片以及數據或其他資料的匯編,均受版權保障。\n香" |
|
|
+ "港特別行政區政府是本網頁內所有版權作品的擁有人,除非預先得到政府物流服務署的書面" |
|
|
+ "港特別行政區政府是本網頁內所有版權作品的擁有人,除非預先得到政府物流服務署的書面" |
|
|
+ "授權,否則嚴禁複製、改編、分發、發布或向公眾提供該等版權作品。" |
|
|
+ "授權,否則嚴禁複製、改編、分發、發布或向公眾提供該等版權作品。" |
|
|
|
|
|
const refType = "identification"; |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
changePassword(''); |
|
|
changePassword(''); |
|
@@ -143,17 +144,21 @@ const CustomFormWizard = (props) => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
console.log(updateRows); |
|
|
|
|
|
let updateRowList = new DataTransfer(); |
|
|
let updateRowList = new DataTransfer(); |
|
|
var updateRowsIndex = updateRows.length; |
|
|
var updateRowsIndex = updateRows.length; |
|
|
|
|
|
const saveFileList = []; |
|
|
|
|
|
|
|
|
if (updateRowsIndex!=null){ |
|
|
if (updateRowsIndex!=null){ |
|
|
for (let i = 0; i < updateRowsIndex; i++){ |
|
|
for (let i = 0; i < updateRowsIndex; i++){ |
|
|
const file = updateRows[i] |
|
|
const file = updateRows[i] |
|
|
|
|
|
file.id = i; |
|
|
updateRowList.items.add(file); |
|
|
updateRowList.items.add(file); |
|
|
|
|
|
saveFileList.push(file); |
|
|
} |
|
|
} |
|
|
let updatedFileList = updateRowList.files; |
|
|
let updatedFileList = updateRowList.files; |
|
|
setFileList(updatedFileList); |
|
|
setFileList(updatedFileList); |
|
|
|
|
|
setFileListData(saveFileList) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, [updateRows]); |
|
|
}, [updateRows]); |
|
@@ -164,25 +169,21 @@ const CustomFormWizard = (props) => { |
|
|
const uploadFileList = event.target.files; |
|
|
const uploadFileList = event.target.files; |
|
|
const saveFileList = []; |
|
|
const saveFileList = []; |
|
|
var currentIndex = 0; |
|
|
var currentIndex = 0; |
|
|
// console.log("uploadFileList") |
|
|
|
|
|
// console.log(uploadFileList) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currentFileList.length!=null){ |
|
|
if (currentFileList.length!=null){ |
|
|
currentIndex = currentFileList.length; |
|
|
currentIndex = currentFileList.length; |
|
|
for (let i = 0; i < currentIndex; i++){ |
|
|
for (let i = 0; i < currentIndex; i++){ |
|
|
const file = currentFileList[i] |
|
|
const file = currentFileList[i] |
|
|
|
|
|
// file.id = currentIndex; |
|
|
updateList.items.add(file); |
|
|
updateList.items.add(file); |
|
|
saveFileList.push(file); |
|
|
saveFileList.push(file); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// console.log("saveFileList") |
|
|
|
|
|
// console.log(saveFileList) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < uploadFileList.length && currentIndex<5; i++){ |
|
|
for (let i = 0; i < uploadFileList.length && currentIndex<5; i++){ |
|
|
const file = event.target.files[i] |
|
|
const file = event.target.files[i] |
|
|
let isDuplicate = false; |
|
|
let isDuplicate = false; |
|
|
// console.log("file 1") |
|
|
|
|
|
// console.log(file) |
|
|
|
|
|
|
|
|
|
|
|
// Check if the file name already exists in saveFileList |
|
|
// Check if the file name already exists in saveFileList |
|
|
for (let j = 0; j < saveFileList.length; j++) { |
|
|
for (let j = 0; j < saveFileList.length; j++) { |
|
|
if (saveFileList[j].name === file.name) { |
|
|
if (saveFileList[j].name === file.name) { |
|
@@ -191,8 +192,6 @@ const CustomFormWizard = (props) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (!isDuplicate) { |
|
|
if (!isDuplicate) { |
|
|
// console.log("file2") |
|
|
|
|
|
// console.log(file) |
|
|
|
|
|
file.id = currentIndex+i |
|
|
file.id = currentIndex+i |
|
|
saveFileList.push(file) |
|
|
saveFileList.push(file) |
|
|
updateList.items.add(file); |
|
|
updateList.items.add(file); |
|
@@ -203,8 +202,6 @@ const CustomFormWizard = (props) => { |
|
|
|
|
|
|
|
|
setFileListData(saveFileList) |
|
|
setFileListData(saveFileList) |
|
|
setFileList(updatedFileList); |
|
|
setFileList(updatedFileList); |
|
|
// console.log("saveFileList2") |
|
|
|
|
|
// console.log(saveFileList) |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
@@ -256,38 +253,53 @@ const CustomFormWizard = (props) => { |
|
|
if (termsAndConNotAccept){ |
|
|
if (termsAndConNotAccept){ |
|
|
tncFlag = false |
|
|
tncFlag = false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const user = { |
|
|
|
|
|
username: values.username, |
|
|
|
|
|
password: values.password, |
|
|
|
|
|
name: values.username, |
|
|
|
|
|
enName: values.enName, |
|
|
|
|
|
chName: values.chName, |
|
|
|
|
|
emailAddress: values.email, |
|
|
|
|
|
idDocType:values.idDocType, |
|
|
|
|
|
identification:values.idNo, |
|
|
|
|
|
checkDigit:values.checkDigit, |
|
|
|
|
|
tncFlag:tncFlag, |
|
|
|
|
|
type:"IND", |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var formData = new FormData(); |
|
|
|
|
|
for (let i = 0; i < fileListData.length; i++){ |
|
|
|
|
|
const file = fileListData[i] |
|
|
|
|
|
formData.append("multipartFileList", file); |
|
|
|
|
|
} |
|
|
|
|
|
formData.append("refType", refType); |
|
|
|
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(user)) { |
|
|
|
|
|
formData.append(key, value); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
formData.append("userFaxNo", JSON.stringify(userFaxNo)); |
|
|
|
|
|
formData.append("userMobileNumber", JSON.stringify(userMobileNumber)); |
|
|
|
|
|
formData.append("userAddress", JSON.stringify(userAddress)); |
|
|
|
|
|
|
|
|
|
|
|
// if(refCode){ |
|
|
|
|
|
// formData.append("refCode", refCode); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
console.log("formData:") |
|
|
|
|
|
console.log(formData) |
|
|
|
|
|
|
|
|
if (isValid){ |
|
|
if (isValid){ |
|
|
axios.post(`${apiPath}${POST_PUBLIC_USER_REGISTER}`, { |
|
|
|
|
|
username: values.username, |
|
|
|
|
|
password: values.password, |
|
|
|
|
|
name: values.username, |
|
|
|
|
|
enName: values.enName, |
|
|
|
|
|
chName: values.chName, |
|
|
|
|
|
emailAddress: values.email, |
|
|
|
|
|
idDocType:values.idDocType, |
|
|
|
|
|
identification:values.idNo, |
|
|
|
|
|
checkDigit:values.checkDigit, |
|
|
|
|
|
userFaxNo:userFaxNo, |
|
|
|
|
|
userMobileNumber:userMobileNumber, |
|
|
|
|
|
userAddress:userAddress, |
|
|
|
|
|
tncFlag:tncFlag, |
|
|
|
|
|
type:"IND" |
|
|
|
|
|
|
|
|
axios.post(POST_PUBLIC_USER_REGISTER, formData,{ |
|
|
|
|
|
headers: { |
|
|
|
|
|
"Content-Type":"multipart/form-data" |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
.then((response) => { |
|
|
.then((response) => { |
|
|
|
|
|
console.log(response) |
|
|
setCheckUpload(true) |
|
|
setCheckUpload(true) |
|
|
HttpUtils.fileUpload( |
|
|
|
|
|
{ |
|
|
|
|
|
refType:"identification", |
|
|
|
|
|
refId: response.data.id, |
|
|
|
|
|
file: fileList, |
|
|
|
|
|
onSuccess: (response)=>{ |
|
|
|
|
|
console.log(response); |
|
|
|
|
|
// setOpen(true); |
|
|
|
|
|
setLoding(false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
setLoding(false); |
|
|
}) |
|
|
}) |
|
|
.catch(error => { |
|
|
.catch(error => { |
|
|
console.error(error); |
|
|
console.error(error); |
|
@@ -341,7 +353,6 @@ const CustomFormWizard = (props) => { |
|
|
var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; |
|
|
var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; |
|
|
// var result = reg.test(email); |
|
|
// var result = reg.test(email); |
|
|
var result = email.match(validRegex); |
|
|
var result = email.match(validRegex); |
|
|
console.log("test1: "+result) |
|
|
|
|
|
if (result == false) { |
|
|
if (result == false) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
@@ -599,11 +610,8 @@ const CustomFormWizard = (props) => { |
|
|
// getOptionLabel={(idDocTypeComboList) => idDocTypeComboList.label} |
|
|
// getOptionLabel={(idDocTypeComboList) => idDocTypeComboList.label} |
|
|
onBlur={formik.handleBlur} |
|
|
onBlur={formik.handleBlur} |
|
|
onChange={(event, newValue) => { |
|
|
onChange={(event, newValue) => { |
|
|
// console.log(newValue) |
|
|
|
|
|
if (newValue!=null){ |
|
|
if (newValue!=null){ |
|
|
console.log(newValue) |
|
|
|
|
|
setSelectedIdDocType(newValue); |
|
|
setSelectedIdDocType(newValue); |
|
|
// setSelectedIdDocLabel(newValue.label); |
|
|
|
|
|
if (newValue.type!="HKID"){ |
|
|
if (newValue.type!="HKID"){ |
|
|
formik.setFieldValue("checkDigit","") |
|
|
formik.setFieldValue("checkDigit","") |
|
|
} |
|
|
} |
|
@@ -1067,7 +1075,7 @@ const CustomFormWizard = (props) => { |
|
|
<Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography> |
|
|
<Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography> |
|
|
</Stack> |
|
|
</Stack> |
|
|
{fileList !=null? |
|
|
{fileList !=null? |
|
|
<UploadFileTable recordList={fileListData} setUpdateRows={setUpdateRows} />:null} |
|
|
|
|
|
|
|
|
<UploadFileTable recordList={fileListData} setUpdateRows={setUpdateRows} disableDelete={false}/>:null} |
|
|
{/* <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}> |
|
|
{/* <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}> |
|
|
<Button variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> |
|
|
<Button variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> |
|
|
<Button disabled={!formik.isValid} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> |
|
|
<Button disabled={!formik.isValid} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> |
|
@@ -1288,7 +1296,7 @@ const CustomFormWizard = (props) => { |
|
|
<Stack spacing={1} direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}> |
|
|
<Stack spacing={1} direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}> |
|
|
<Typography display="inline" variant="h4" sx={{ color: 'primary.primary'}}>身份證明文件</Typography> |
|
|
<Typography display="inline" variant="h4" sx={{ color: 'primary.primary'}}>身份證明文件</Typography> |
|
|
{fileList !=null? |
|
|
{fileList !=null? |
|
|
<UploadFileTable recordList={fileListData} updateRows={updateRows} />:null} |
|
|
|
|
|
|
|
|
<UploadFileTable recordList={fileListData} updateRows={updateRows} disableDelete={true}/>:null} |
|
|
</Stack> |
|
|
</Stack> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</Grid> |
|
|