@@ -141,6 +141,7 @@ const BusCustomFormWizard = (props) => { | |||||
data.address1 !==""&& | data.address1 !==""&& | ||||
data.email !==""&& | data.email !==""&& | ||||
data.emailConfirm !==""&& | data.emailConfirm !==""&& | ||||
data.email == data.emailConfirm&& | |||||
data.phone !==""&& | data.phone !==""&& | ||||
data.phoneCountryCode !==""&& | data.phoneCountryCode !==""&& | ||||
termsAndConAccept == true&& | termsAndConAccept == true&& | ||||
@@ -389,13 +390,12 @@ const BusCustomFormWizard = (props) => { | |||||
} | } | ||||
function handleEmail(email) { | function handleEmail(email) { | ||||
var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; | |||||
// var result = reg.test(email); | |||||
var result = email.match(validRegex); | |||||
if (result == false) { | |||||
var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; | |||||
if (!email.match(validRegex)) { | |||||
return false; | return false; | ||||
}else{ | |||||
return true; | |||||
} | } | ||||
return true; | |||||
} | } | ||||
const formik = useFormik({ | const formik = useFormik({ | ||||
@@ -136,6 +136,7 @@ const CustomFormWizard = (props) => { | |||||
data.address1 !==""&& | data.address1 !==""&& | ||||
data.email !==""&& | data.email !==""&& | ||||
data.emailConfirm !==""&& | data.emailConfirm !==""&& | ||||
data.email == data.emailConfirm&& | |||||
data.phone !==""&& | data.phone !==""&& | ||||
data.phoneCountryCode !==""&& | data.phoneCountryCode !==""&& | ||||
termsAndConAccept == true&& | termsAndConAccept == true&& | ||||
@@ -409,13 +410,11 @@ const CustomFormWizard = (props) => { | |||||
function handleEmail(email) { | function handleEmail(email) { | ||||
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 = email.match(validRegex); | |||||
if (result == false) { | |||||
if (!email.match(validRegex)) { | |||||
return false; | return false; | ||||
}else{ | |||||
return true; | |||||
} | } | ||||
console.log("email true") | |||||
return true; | |||||
} | } | ||||
const formik = useFormik({ | const formik = useFormik({ | ||||
@@ -58,31 +58,31 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
}), | }), | ||||
onSubmit: (values) => { | onSubmit: (values) => { | ||||
HttpUtils.post({ | HttpUtils.post({ | ||||
url: UrlUtils.POST_IND_USER + "/" + userData.id, | |||||
url: UrlUtils.POST_ORG_USER + "/" + userData.id, | |||||
params: { | params: { | ||||
contactTel: { | contactTel: { | ||||
countryCode: values.tel_countryCode, | countryCode: values.tel_countryCode, | ||||
phoneNumber: values.phoneNumber | phoneNumber: values.phoneNumber | ||||
}, | }, | ||||
faxNo: { | |||||
countryCode: values.fax_countryCode, | |||||
faxNumber: values.faxNumber | |||||
}, | |||||
addressBus: { | |||||
country: values.country, | |||||
district: values.district, | |||||
addressLine1: values.addressLine1, | |||||
addressLine2: values.addressLine2, | |||||
addressLine3: values.addressLine3, | |||||
}, | |||||
// faxNo: { | |||||
// countryCode: values.fax_countryCode, | |||||
// faxNumber: values.faxNumber | |||||
// }, | |||||
// addressBus: { | |||||
// country: values.country, | |||||
// district: values.district, | |||||
// addressLine1: values.addressLine1, | |||||
// addressLine2: values.addressLine2, | |||||
// addressLine3: values.addressLine3, | |||||
// }, | |||||
identification: values.identification, | identification: values.identification, | ||||
emailBus: values.emailBus, | emailBus: values.emailBus, | ||||
contactPerson: values.contactPerson, | contactPerson: values.contactPerson, | ||||
enCompanyName: values.enCompanyName, | |||||
chCompanyName: values.chCompanyName, | |||||
// enCompanyName: values.enCompanyName, | |||||
// chCompanyName: values.chCompanyName, | |||||
orgId: values.orgId, | orgId: values.orgId, | ||||
brNo: values.brNo, | |||||
brExpiryDate: values.brExpiryDate, | |||||
// brNo: values.brNo, | |||||
// brExpiryDate: values.brExpiryDate, | |||||
}, | }, | ||||
onSuccess: function () { | onSuccess: function () { | ||||
@@ -307,7 +307,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
); | ); | ||||
return displayOptions; | return displayOptions; | ||||
}, | }, | ||||
getOptionLabel: (item) => item ? typeof item === 'number' ? item + "" : (item["brNo"] ? item["brNo"] + "-" + item["enCompanyName"] : "") : "", | |||||
getOptionLabel: (item) => item ? typeof item === 'number' ? item + "" : (item["brNo"] ? item["brNo"] + "-" + item["enCompanyName"]: "") : "", | |||||
isOptionEqualToValue: (option, newValue, setValue, setInputValue) => { | isOptionEqualToValue: (option, newValue, setValue, setInputValue) => { | ||||
if (option.id == newValue) { | if (option.id == newValue) { | ||||
setValue(option); | setValue(option); | ||||
@@ -463,13 +463,16 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
Organization | Organization | ||||
</Typography> | </Typography> | ||||
</Grid> | </Grid> | ||||
<Grid item lg={2} > | |||||
<Button variant="contained" | |||||
onClick={createOrgClick} | |||||
> | |||||
Create Organization | |||||
</Button> | |||||
</Grid> | |||||
{currentUserData.orgId==null? | |||||
<Grid item lg={2} > | |||||
<Button variant="contained" | |||||
onClick={createOrgClick} | |||||
> | |||||
Create Organization | |||||
</Button> | |||||
</Grid> | |||||
:null | |||||
} | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -477,7 +480,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
{FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
label: "Org.Name (English):", | label: "Org.Name (English):", | ||||
valueName: "enCompanyName", | valueName: "enCompanyName", | ||||
disabled: (!editMode), | |||||
disabled: true, | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -486,7 +489,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
{FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
label: "Org.Name (Chinese):", | label: "Org.Name (Chinese):", | ||||
valueName: "chCompanyName", | valueName: "chCompanyName", | ||||
disabled: (!editMode), | |||||
disabled: true, | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -495,7 +498,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
{FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
label: "BR No.:", | label: "BR No.:", | ||||
valueName: "brNo", | valueName: "brNo", | ||||
disabled: (!editMode), | |||||
disabled: true, | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -505,7 +508,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
label: "Country:", | label: "Country:", | ||||
valueName: "country", | valueName: "country", | ||||
dataList: ComboData.country, | dataList: ComboData.country, | ||||
disabled: (!editMode), | |||||
disabled: true, | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -517,7 +520,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
code: "fax_countryCode", | code: "fax_countryCode", | ||||
num: "faxNumber" | num: "faxNumber" | ||||
}, | }, | ||||
disabled: (!editMode), | |||||
disabled: true, | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -526,7 +529,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
{FieldUtils.getDateField({ | {FieldUtils.getDateField({ | ||||
label: "BR Expiry Date.:", | label: "BR Expiry Date.:", | ||||
valueName: "brExpiryDate", | valueName: "brExpiryDate", | ||||
disabled: (!editMode), | |||||
disabled: true, | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -535,7 +538,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
{FieldUtils.getAddressField({ | {FieldUtils.getAddressField({ | ||||
label: "Address:", | label: "Address:", | ||||
valueName: ["addressLine1", "addressLine2", "addressLine3"], | valueName: ["addressLine1", "addressLine2", "addressLine3"], | ||||
disabled: (!editMode), | |||||
disabled: true, | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -545,7 +548,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
label: "District:", | label: "District:", | ||||
valueName: "district", | valueName: "district", | ||||
dataList: ComboData.district, | dataList: ComboData.district, | ||||
disabled: (!editMode), | |||||
disabled: true, | |||||
form: formik | form: formik | ||||
})} | })} | ||||
</Grid> | </Grid> | ||||
@@ -27,7 +27,7 @@ const UserMaintainPage_Organization = () => { | |||||
useEffect(()=>{ | useEffect(()=>{ | ||||
console.log(userData); | |||||
// console.log(userData); | |||||
loadData(); | loadData(); | ||||
},[]); | },[]); | ||||
@@ -40,9 +40,24 @@ const UserMaintainPage_Organization = () => { | |||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: `${UrlUtils.GET_ORG_USER_PATH}/${params.id}`, | url: `${UrlUtils.GET_ORG_USER_PATH}/${params.id}`, | ||||
onSuccess: function(response){ | onSuccess: function(response){ | ||||
response.data["addressBus"] = JSON.parse(response.data["addressBus"]); | |||||
response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | |||||
response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | |||||
console.log(response) | |||||
if(response.data.orgId !=null){ | |||||
response.data["addressBus"] = response.orgDetail.data["addressTemp"]; | |||||
response.data["contactTel"] = response.orgDetail.data["contactTel"]; | |||||
response.data["faxNo"] = response.orgDetail.data["faxNo"]; | |||||
response.data["brExpiryDate"] = response.orgDetail.data.brExpiryDate?DateUtils.dateStr(response.orgDetail.data.brExpiryDate):""; | |||||
response.data["brNo"] = response.orgDetail.data.brNo; | |||||
response.data["enCompanyName"] = response.orgDetail.data.enCompanyName; | |||||
response.data["chCompanyName"] = response.orgDetail.data.chCompanyName; | |||||
response.data["chCompanyName"] = response.orgDetail.data.chCompanyName; | |||||
}else{ | |||||
response.data["addressBus"] = JSON.parse(response.data["addressBus"]); | |||||
response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | |||||
response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | |||||
response.data["brExpiryDate"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; | |||||
} | |||||
let createDate = DateUtils.datetimeStr(response.data.created); | let createDate = DateUtils.datetimeStr(response.data.created); | ||||
let modifiedBy = DateUtils.datetimeStr(response.data.modified)+", "+response.data.modifiedBy; | let modifiedBy = DateUtils.datetimeStr(response.data.modified)+", "+response.data.modifiedBy; | ||||
@@ -64,10 +79,9 @@ const UserMaintainPage_Organization = () => { | |||||
response.data["faxNumber"] = response.data.faxNo?.faxNumber; | response.data["faxNumber"] = response.data.faxNo?.faxNumber; | ||||
response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | ||||
response.data["brExpiryDate"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; | |||||
//response.data["orgId"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; | //response.data["orgId"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; | ||||
setUserData(response.data); | setUserData(response.data); | ||||
setOrgData(response.orgList); | setOrgData(response.orgList); | ||||
} | } | ||||
@@ -20,6 +20,7 @@ export const GET_IND_USER_VERIFY = apiPath+'/user/verify'; | |||||
export const POST_IND_USER = apiPath+'/user/ind'; | export const POST_IND_USER = apiPath+'/user/ind'; | ||||
export const GET_ORG_USER_PATH = apiPath+'/user/org'; | export const GET_ORG_USER_PATH = apiPath+'/user/org'; | ||||
export const POST_ORG_USER = apiPath+'/user/org'; | |||||
export const GET_ORG_PATH = apiPath+'/org'; | export const GET_ORG_PATH = apiPath+'/org'; | ||||
export const GET_ORG_FROM_USER_PATH = apiPath+'/org/from-user'; | export const GET_ORG_FROM_USER_PATH = apiPath+'/org/from-user'; | ||||