|
|
@ -27,6 +27,7 @@ import { ApiConfig } from "../../constants/defaultValues"; |
|
|
|
import { toast } from "react-toastify"; |
|
|
|
import { toast } from "react-toastify"; |
|
|
|
import moment from "jalali-moment"; |
|
|
|
import moment from "jalali-moment"; |
|
|
|
import loadingGiff from "../../assets/img/Rolling-2s-223px.gif"; |
|
|
|
import loadingGiff from "../../assets/img/Rolling-2s-223px.gif"; |
|
|
|
|
|
|
|
import { upload } from "@testing-library/user-event/dist/upload"; |
|
|
|
|
|
|
|
|
|
|
|
const Register = ({ |
|
|
|
const Register = ({ |
|
|
|
activeLogin, |
|
|
|
activeLogin, |
|
|
@ -40,7 +41,10 @@ const Register = ({ |
|
|
|
getUserInfo, |
|
|
|
getUserInfo, |
|
|
|
loading, |
|
|
|
loading, |
|
|
|
getRulse, |
|
|
|
getRulse, |
|
|
|
termInfo |
|
|
|
termInfo, |
|
|
|
|
|
|
|
uploadLoading, |
|
|
|
|
|
|
|
uploadImg, |
|
|
|
|
|
|
|
lastUploadId, |
|
|
|
}) => { |
|
|
|
}) => { |
|
|
|
const [steps, setSteps] = useState(0); |
|
|
|
const [steps, setSteps] = useState(0); |
|
|
|
console.log("user:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); |
|
|
|
console.log("user:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); |
|
|
@ -55,8 +59,9 @@ const Register = ({ |
|
|
|
getRulse({ id: localStorage.getItem("termId") }); |
|
|
|
getRulse({ id: localStorage.getItem("termId") }); |
|
|
|
}, []); |
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log( |
|
|
|
console.log("termInfo:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); |
|
|
|
"termInfo:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" |
|
|
|
|
|
|
|
); |
|
|
|
console.log(termInfo); |
|
|
|
console.log(termInfo); |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (user?.firstName !== null) { |
|
|
|
if (user?.firstName !== null) { |
|
|
@ -385,26 +390,34 @@ const Register = ({ |
|
|
|
const [selectedState, setSelectedState] = useState(null); |
|
|
|
const [selectedState, setSelectedState] = useState(null); |
|
|
|
const [selectedCity, setSelectedCity] = useState(null); |
|
|
|
const [selectedCity, setSelectedCity] = useState(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [uploadImgNumber, setUploadImgNumber] = useState(0); |
|
|
|
|
|
|
|
const uploadImghandler1 = (e) => { |
|
|
|
|
|
|
|
uploadImg({ |
|
|
|
|
|
|
|
file: e, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
setUploadImgNumber(1); |
|
|
|
|
|
|
|
setFiles({ ...files, personalPic: e }); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uploadImghandler2 = (e) => { |
|
|
|
|
|
|
|
setFiles({ ...files, shenasNameh: e }); |
|
|
|
|
|
|
|
console.log("fffffff:") |
|
|
|
|
|
|
|
console.log(e); |
|
|
|
|
|
|
|
uploadImg({ |
|
|
|
|
|
|
|
file: e, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
setUploadImgNumber(2); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
if (uploadImgNumber === 1) { |
|
|
|
|
|
|
|
setUserInfo({ ...userInfo, personalPicFileId: lastUploadId }); |
|
|
|
|
|
|
|
} else if (uploadImgNumber === 2) { |
|
|
|
|
|
|
|
setUserInfo({ ...userInfo, shenasnamehFileId: lastUploadId }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, [uploadImgNumber]); |
|
|
|
|
|
|
|
|
|
|
|
const firstStepSubmit = () => { |
|
|
|
const firstStepSubmit = () => { |
|
|
|
// if (
|
|
|
|
|
|
|
|
// userInfo.firstName &&
|
|
|
|
|
|
|
|
// userInfo.lastName &&
|
|
|
|
|
|
|
|
// userInfo.birthDate &&
|
|
|
|
|
|
|
|
// userInfo.gradeIds &&
|
|
|
|
|
|
|
|
// userInfo.nationalId &&
|
|
|
|
|
|
|
|
// userInfo.gender &&
|
|
|
|
|
|
|
|
// // userInfo.previousSchoolName &&
|
|
|
|
|
|
|
|
// // userInfo.previousSchoolType &&
|
|
|
|
|
|
|
|
// // userInfo.zone &&
|
|
|
|
|
|
|
|
// files.personalPic &&
|
|
|
|
|
|
|
|
// files.shenasNameh
|
|
|
|
|
|
|
|
// ) {
|
|
|
|
|
|
|
|
// setSteps(1);
|
|
|
|
|
|
|
|
// setActiveStep([true, true, false, false]);
|
|
|
|
|
|
|
|
// setError("");
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// toast.warning("لطفا تمامی فیلد ها را پر کنید");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (!userInfo.firstName && !userInfo.lastName) { |
|
|
|
if (!userInfo.firstName && !userInfo.lastName) { |
|
|
|
toast.warning("لطفا نام و نام خانوادگی خود را وارد کنید"); |
|
|
|
toast.warning("لطفا نام و نام خانوادگی خود را وارد کنید"); |
|
|
|
} else if (!userInfo.birthDate) { |
|
|
|
} else if (!userInfo.birthDate) { |
|
|
@ -415,7 +428,7 @@ const Register = ({ |
|
|
|
toast.warning("لطفا کد ملی خود را وارد کنید"); |
|
|
|
toast.warning("لطفا کد ملی خود را وارد کنید"); |
|
|
|
} else if (!userInfo.gender) { |
|
|
|
} else if (!userInfo.gender) { |
|
|
|
toast.warning("لطفا جنسیت خود را مشخص کنید"); |
|
|
|
toast.warning("لطفا جنسیت خود را مشخص کنید"); |
|
|
|
} else if ((!files.personalPic && !files.shenasNameh)) { |
|
|
|
} else if (!files.personalPic && !files.shenasNameh) { |
|
|
|
toast.warning("لطفا عکس شناسنامه و عکس پرسنلی خود را وارد کنید"); |
|
|
|
toast.warning("لطفا عکس شناسنامه و عکس پرسنلی خود را وارد کنید"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setSteps(1); |
|
|
|
setSteps(1); |
|
|
@ -612,10 +625,12 @@ const Register = ({ |
|
|
|
title="بارگزاری صفحه اول شناسنامه" |
|
|
|
title="بارگزاری صفحه اول شناسنامه" |
|
|
|
id={1} |
|
|
|
id={1} |
|
|
|
file={files.shenasNameh} |
|
|
|
file={files.shenasNameh} |
|
|
|
onChange={(e) => setFiles({ ...files, shenasNameh: e })} |
|
|
|
onChange={(e) => uploadImghandler2(e)} |
|
|
|
|
|
|
|
// onChange={(e) => setFiles({ ...files, shenasNameh: e })}
|
|
|
|
deleteHandler={(e) => |
|
|
|
deleteHandler={(e) => |
|
|
|
setFiles({ ...files, shenasNameh: e }) |
|
|
|
setFiles({ ...files, shenasNameh: e }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
loading={uploadLoading} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -623,10 +638,12 @@ const Register = ({ |
|
|
|
title="بارگزاری عکس پرسنلی" |
|
|
|
title="بارگزاری عکس پرسنلی" |
|
|
|
id={2} |
|
|
|
id={2} |
|
|
|
file={files.personalPic} |
|
|
|
file={files.personalPic} |
|
|
|
onChange={(e) => setFiles({ ...files, personalPic: e })} |
|
|
|
// onChange={(e) => setFiles({ ...files, personalPic: e })}
|
|
|
|
|
|
|
|
onChange={(e) => uploadImghandler1(e)} |
|
|
|
deleteHandler={(e) => |
|
|
|
deleteHandler={(e) => |
|
|
|
setFiles({ ...files, personalPic: e }) |
|
|
|
setFiles({ ...files, personalPic: e }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
loading={uploadLoading} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -1139,82 +1156,23 @@ const Register = ({ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div className="w-40"> |
|
|
|
<div className="w-40"> |
|
|
|
{/* <Button |
|
|
|
<div |
|
|
|
borderType="rounded" |
|
|
|
className="w-full h-12 mt-4 rounded-lg bg-red52 flex items-center justify-center text-white cursor-pointer" |
|
|
|
title="مرحله بعد" |
|
|
|
|
|
|
|
onClick={() => { |
|
|
|
onClick={() => { |
|
|
|
// const inputs = document.querySelectorAll('.Login-box-form-item-input')
|
|
|
|
|
|
|
|
// if (
|
|
|
|
|
|
|
|
// userInfo?.motherInfo.cellphone &&
|
|
|
|
|
|
|
|
// userInfo?.motherInfo.education &&
|
|
|
|
|
|
|
|
// userInfo?.motherInfo.firstName &&
|
|
|
|
|
|
|
|
// userInfo?.motherInfo.job &&
|
|
|
|
|
|
|
|
// userInfo?.motherInfo.lastName &&
|
|
|
|
|
|
|
|
// userInfo?.motherInfo.nationalId &&
|
|
|
|
|
|
|
|
// userInfo?.motherInfo.workPhone &&
|
|
|
|
|
|
|
|
// userInfo?.motherInfo.workPlace &&
|
|
|
|
|
|
|
|
// userInfo?.fatherInfo.cellphone &&
|
|
|
|
|
|
|
|
// userInfo?.fatherInfo.education &&
|
|
|
|
|
|
|
|
// userInfo?.fatherInfo.firstName &&
|
|
|
|
|
|
|
|
// userInfo?.fatherInfo.job &&
|
|
|
|
|
|
|
|
// userInfo?.fatherInfo.lastName &&
|
|
|
|
|
|
|
|
// userInfo?.fatherInfo.nationalId &&
|
|
|
|
|
|
|
|
// userInfo?.fatherInfo.workPhone &&
|
|
|
|
|
|
|
|
// userInfo?.fatherInfo.workPlace &&
|
|
|
|
|
|
|
|
// userInfo?.familyMemberCount &&
|
|
|
|
|
|
|
|
// userInfo?.address &&
|
|
|
|
|
|
|
|
// userInfo?.phone
|
|
|
|
|
|
|
|
// ) {
|
|
|
|
|
|
|
|
// setSteps(2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// setActiveStep([true, true, true, false]);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// toast.warning("لطفا تمامی فیلد ها را پر کنید");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// alert("joooo");
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
!userInfo?.motherInfo.cellphone && |
|
|
|
!userInfo?.fatherInfo?.cellphone && |
|
|
|
!userInfo?.motherInfo.education && |
|
|
|
!userInfo?.fatherInfo?.education && |
|
|
|
!userInfo?.motherInfo.firstName && |
|
|
|
!userInfo?.fatherInfo?.firstName && |
|
|
|
!userInfo?.motherInfo.job && |
|
|
|
!userInfo?.fatherInfo?.job && |
|
|
|
!userInfo?.motherInfo.lastName && |
|
|
|
!userInfo?.fatherInfo?.lastName && |
|
|
|
!userInfo?.motherInfo.nationalId && |
|
|
|
!userInfo?.fatherInfo?.nationalId && |
|
|
|
!userInfo?.motherInfo.workPhone && |
|
|
|
!userInfo?.fatherInfo?.workPhone && |
|
|
|
!userInfo?.motherInfo.workPlace |
|
|
|
!userInfo?.fatherInfo?.workPlace |
|
|
|
) { |
|
|
|
|
|
|
|
toast.warning( |
|
|
|
|
|
|
|
"لطفااطلاعات مادر را به صورت کامل وارد کنید" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else if ( |
|
|
|
|
|
|
|
!userInfo?.fatherInfo.cellphone && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo.education && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo.firstName && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo.job && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo.lastName && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo.nationalId && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo.workPhone && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo.workPlace |
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
toast.warning( |
|
|
|
toast.warning( |
|
|
|
"لطفااطلاعات پدر را به صورت کامل وارد کنید" |
|
|
|
"لطفااطلاعات پدر را به صورت کامل وارد کنید" |
|
|
|
); |
|
|
|
); |
|
|
|
} else if (!userInfo?.familyMemberCount) { |
|
|
|
} else if ( |
|
|
|
toast.warning( |
|
|
|
|
|
|
|
"لطفا تعداد اعضای خانواده را وارد کنید" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else if (!userInfo?.address && !userInfo?.phone) { |
|
|
|
|
|
|
|
toast.warning("لطفاآدرس و تلفن خود را وارد کنید"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
setSteps(2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setActiveStep([true, true, true, false]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
/> */} |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
className="w-full h-12 mt-4 rounded-lg bg-red52 flex items-center justify-center text-white cursor-pointer" |
|
|
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
!userInfo?.motherInfo?.cellphone && |
|
|
|
!userInfo?.motherInfo?.cellphone && |
|
|
|
!userInfo?.motherInfo?.education && |
|
|
|
!userInfo?.motherInfo?.education && |
|
|
|
!userInfo?.motherInfo?.firstName && |
|
|
|
!userInfo?.motherInfo?.firstName && |
|
|
@ -1227,19 +1185,6 @@ const Register = ({ |
|
|
|
toast.warning( |
|
|
|
toast.warning( |
|
|
|
"لطفااطلاعات مادر را به صورت کامل وارد کنید" |
|
|
|
"لطفااطلاعات مادر را به صورت کامل وارد کنید" |
|
|
|
); |
|
|
|
); |
|
|
|
} else if ( |
|
|
|
|
|
|
|
!userInfo?.fatherInfo?.cellphone && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo?.education && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo?.firstName && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo?.job && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo?.lastName && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo?.nationalId && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo?.workPhone && |
|
|
|
|
|
|
|
!userInfo?.fatherInfo?.workPlace |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
toast.warning( |
|
|
|
|
|
|
|
"لطفااطلاعات پدر را به صورت کامل وارد کنید" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else if (!userInfo?.familyMemberCount) { |
|
|
|
} else if (!userInfo?.familyMemberCount) { |
|
|
|
toast.warning( |
|
|
|
toast.warning( |
|
|
|
"لطفا تعداد اعضای خانواده را وارد کنید" |
|
|
|
"لطفا تعداد اعضای خانواده را وارد کنید" |
|
|
@ -1486,15 +1431,17 @@ const mapStateToProps = (state) => ({ |
|
|
|
city: state.publicApi.city, |
|
|
|
city: state.publicApi.city, |
|
|
|
user: state.user.status, |
|
|
|
user: state.user.status, |
|
|
|
// loading: state.user.loading,
|
|
|
|
// loading: state.user.loading,
|
|
|
|
loading: state.file.loading, |
|
|
|
uploadLoading: state.file.loading, |
|
|
|
termInfo:state.term.info |
|
|
|
termInfo: state.term.info, |
|
|
|
|
|
|
|
lastUploadId : state.file.lastUpload |
|
|
|
}); |
|
|
|
}); |
|
|
|
const mapDispatchToProps = { |
|
|
|
const mapDispatchToProps = { |
|
|
|
setProfile: user.setProfile, |
|
|
|
setProfile: user.setProfile, |
|
|
|
getProvince: publicApi.getProvince, |
|
|
|
getProvince: publicApi.getProvince, |
|
|
|
getCity: publicApi.getCity, |
|
|
|
getCity: publicApi.getCity, |
|
|
|
getUserInfo: user.info, |
|
|
|
getUserInfo: user.info, |
|
|
|
getRulse: term.info |
|
|
|
getRulse: term.info, |
|
|
|
|
|
|
|
uploadImg : file.upload |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Register); |
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Register); |
|
|
|