some debug & mobile login

main
alireza khaji 3 years ago
parent 71f90f5724
commit 119552b7dd
  1. 12
      src/components/Product/index.js
  2. 1
      src/redux/reducers/user.js
  3. 4
      src/redux/reducers/userFactor.js
  4. 43
      src/view/LoginSignUp/SignUpBox.js
  5. 852
      src/view/LoginSignUp/mobile/index.js
  6. 314
      src/view/register/index.js
  7. 70
      src/view/services/PaymentBox.js
  8. 73
      src/view/services/index.js

@ -41,12 +41,13 @@ const ProductDesign = ({
isMobile, isMobile,
onClick, onClick,
product, product,
userInfo,
}) => { }) => {
const [isHovering, setIsHovering] = useState(false); const [isHovering, setIsHovering] = useState(false);
// alert(catId); // alert(catId);
let rulesAccepted = JSON.parse( console.log("userInfo:*******************************************************");
localStorage.getItem("userData") console.log(userInfo);
).rulesAccepted; let rulesAccepted = userInfo.rulesAccepted;
const emkanat = [ const emkanat = [
{ {
title: "دستشویی", title: "دستشویی",
@ -177,7 +178,10 @@ const ProductDesign = ({
} `} } `}
/> />
</div> </div>
<div className="flex flex-col text-right" style={!isMobile?{width:"calc(100% - 15rem)"}:null}> <div
className="flex flex-col text-right"
style={!isMobile ? { width: "calc(100% - 15rem)" } : null}
>
<h1 className="font-bold text-red52 border-b border-red82OP p-2 "> <h1 className="font-bold text-red52 border-b border-red82OP p-2 ">
{product?.name} {product?.name}
</h1> </h1>

@ -62,6 +62,7 @@ export default function user(state = initialState, action) {
return { ...state, loading: false, userRoles: data, error: null }; return { ...state, loading: false, userRoles: data, error: null };
case "user/setProfile": case "user/setProfile":
toast.success("تغییرات اعمال شد."); toast.success("تغییرات اعمال شد.");
window.location.replace("/services");
return { ...state, loading: false, error: null, setDone: true }; return { ...state, loading: false, error: null, setDone: true };
case "loading": case "loading":
return { ...state, loading: true }; return { ...state, loading: true };

@ -52,7 +52,9 @@ export default function userFactor(state = initialState, action) {
case "userFactor/loading": case "userFactor/loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "userFactor/error": case "userFactor/error":
if (data.statusCode!==404){ toast.error(data.message);} if(data.statusCode !== 404) {
toast.error(data.message);
}
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:
return state; return state;

@ -57,7 +57,7 @@ const SignUpBox = ({ setSignUp, sendOtp,otpLogin }) => {
let code = Number( let code = Number(
box[0].value + box[1].value + box[2].value + box[3].value box[0].value + box[1].value + box[2].value + box[3].value
); );
alert(code); // alert(code);
} }
//api send //api send
} }
@ -104,8 +104,8 @@ const SignUpBox = ({ setSignUp, sendOtp,otpLogin }) => {
<div className="w-[85%]"> <div className="w-[85%]">
<Input label="نام دانشآموز" index={0} /> <Input label="نام دانشآموز" index={0} />
<Input label="نام خانوادگی دانشآموز" index={1} /> <Input label="نام خانوادگی دانشآموز" index={1} />
<Input label="کد ملی دانشآموز" index={2} /> <Input label="کد ملی دانشآموز" index={2} maxLength={10} />
<Input label="شماره موبایل" index={3} /> <Input label="شماره موبایل" index={3} maxLength={11} />
</div> </div>
)} )}
{/* -------SendCodeText----------- */} {/* -------SendCodeText----------- */}
@ -180,32 +180,32 @@ export default connect(mapStateToProps, mapDispatchToProps)(SignUpBox);
//---------------------------------- //----------------------------------
const Input = ({ label,index }) => { const Input = ({ label, index, maxLength }) => {
const onFocushandler=(i)=>{ const onFocushandler = (i) => {
let box = document.querySelectorAll(".Input"); let box = document.querySelectorAll(".Input");
let label = document.querySelectorAll(".Input-label"); let label = document.querySelectorAll(".Input-label");
let line = document.querySelectorAll(".line"); let line = document.querySelectorAll(".line");
box[i].style.borderColor = "#DF1452"; box[i].style.borderColor = "#DF1452";
label[i].style.color = "#DF1452"; label[i].style.color = "#DF1452";
label[i].style.fontSize = "12px"; label[i].style.fontSize = "12px";
if(window.innerWidth>1270){ if (window.innerWidth > 1270) {
label[i].style.transform = "translate(-15px,-25px)"; label[i].style.transform = "translate(-15px,-25px)";
}else{ } else {
label[i].style.transform = "translate(-15px,-20px)"; label[i].style.transform = "translate(-15px,-20px)";
} }
line[i].style.display="block"; line[i].style.display = "block";
} };
const onBlurHandler = (e,i) => { const onBlurHandler = (e, i) => {
if(e.target.value.length===0){ if (e.target.value.length === 0) {
let box = document.querySelectorAll(".Input"); let box = document.querySelectorAll(".Input");
let label = document.querySelectorAll(".Input-label"); let label = document.querySelectorAll(".Input-label");
let line = document.querySelectorAll(".line"); let line = document.querySelectorAll(".line");
box[i].style.borderColor = "#ECECEC"; box[i].style.borderColor = "#ECECEC";
label[i].style.color = "#8A8A8A"; label[i].style.color = "#8A8A8A";
label[i].style.fontSize = "16px"; label[i].style.fontSize = "16px";
label[i].style.transform = "translate(0px,0px)"; label[i].style.transform = "translate(0px,0px)";
line[i].style.display = "none"; line[i].style.display = "none";
} }
}; };
return ( return (
@ -219,6 +219,7 @@ const Input = ({ label,index }) => {
className="w-full h-full absolute top-0 right-0 outline-0 outline-transparent rounded-lg bg-transparent px-5 text-lg text-[#DF1452]" className="w-full h-full absolute top-0 right-0 outline-0 outline-transparent rounded-lg bg-transparent px-5 text-lg text-[#DF1452]"
onFocus={() => onFocushandler(index)} onFocus={() => onFocushandler(index)}
onBlur={(e) => onBlurHandler(e, index)} onBlur={(e) => onBlurHandler(e, index)}
maxLength={maxLength || null}
/> />
<div className="Input-label text-[#8A8A8A] absolute right-[10px] pointer-events-none transition-all duration-300 ease-out"> <div className="Input-label text-[#8A8A8A] absolute right-[10px] pointer-events-none transition-all duration-300 ease-out">
{label} {label}

@ -11,6 +11,7 @@ import thirdPic from '../../../assets/img/undraw_certificate_re_yadi.svg';
import { connect } from "react-redux"; import { connect } from "react-redux";
import { user, publicApi } from "../../../redux/actions"; import { user, publicApi } from "../../../redux/actions";
import SignUpBox from "../SignUpBox";
const LoginSignUpMobile = ({ const LoginSignUpMobile = ({
activeLogin, activeLogin,
@ -22,443 +23,437 @@ const LoginSignUpMobile = ({
setHeaderOptions, setHeaderOptions,
isMobile, isMobile,
}) => { }) => {
const [steps, setSteps] = useState(0); //ark add------------------------------------------
const [index, setIndex] = useState(1); const [signUp, setSignUp] = useState(false);
const [register, setRegister] = useState(false); //----------------------------------------
const timeoutRef = useRef(null); const [steps, setSteps] = useState(0);
const [index, setIndex] = useState(1);
const focusHandler = (id) => { const [register, setRegister] = useState(false);
let inputs = document.querySelectorAll(".Login-box-form-item"); const timeoutRef = useRef(null);
let label = document.querySelectorAll(".Login-box-form-item-label");
let line = document.querySelectorAll(".Login-box-form-item-line"); const focusHandler = (id) => {
inputs[id].style.borderColor = "#df1452"; let inputs = document.querySelectorAll(".Login-box-form-item");
inputs[id].style.backgroundColor = "#fff"; let label = document.querySelectorAll(".Login-box-form-item-label");
label[id].style.transform = "translate(-10px,-27px)"; let line = document.querySelectorAll(".Login-box-form-item-line");
label[id].style.color = "#df1452"; inputs[id].style.borderColor = "#df1452";
line[id].style.backgroundColor = "#fff"; inputs[id].style.backgroundColor = "#fff";
}; label[id].style.transform = "translate(-10px,-27px)";
label[id].style.color = "#df1452";
const blurHandler = (id) => { line[id].style.backgroundColor = "#fff";
let inputsBox = document.querySelectorAll(".Login-box-form-item"); };
let inputs = document.querySelectorAll(".Login-box-form-item-input");
let label = document.querySelectorAll(".Login-box-form-item-label"); const blurHandler = (id) => {
let line = document.querySelectorAll(".Login-box-form-item-line"); let inputsBox = document.querySelectorAll(".Login-box-form-item");
if (inputs[id].value === "") { let inputs = document.querySelectorAll(".Login-box-form-item-input");
inputsBox[id].style.borderColor = "#EBEBEB"; let label = document.querySelectorAll(".Login-box-form-item-label");
label[id].style.transform = "translate(0px,0px)"; let line = document.querySelectorAll(".Login-box-form-item-line");
label[id].style.color = "#959595"; if (inputs[id].value === "") {
line[id].style.backgroundColor = "#EBEBEB"; inputsBox[id].style.borderColor = "#EBEBEB";
} label[id].style.transform = "translate(0px,0px)";
}; label[id].style.color = "#959595";
line[id].style.backgroundColor = "#EBEBEB";
function resetTimeout() {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
} }
};
useEffect(() => { function resetTimeout() {
resetTimeout(); if (timeoutRef.current) {
timeoutRef.current = setTimeout( clearTimeout(timeoutRef.current);
() => { }
setIndex((prevIndex) => prevIndex + 1 }
// prevIndex === slideContents.length - 1 ? 0 : prevIndex + 1
) useEffect(() => {
if (index === slideContents.length) resetTimeout();
setTimeout(setIndex(1), 1000) timeoutRef.current = setTimeout(
}, () => {
setIndex(
delay (prevIndex) => prevIndex + 1
// prevIndex === slideContents.length - 1 ? 0 : prevIndex + 1
); );
if (index === slideContents.length) setTimeout(setIndex(1), 1000);
},
return () => { delay
resetTimeout(); );
};
}, [index]);
const [level, setLevel] = useState("phonenumber");
const [signUpFields, setSignUpFiels] = useState({});
const [error, setError] = useState("");
const [resend, setResend] = useState(false);
const navigate = useNavigate();
const otp1 = useRef();
const otp2 = useRef();
const otp3 = useRef();
const otp4 = useRef();
const onChange = (name, value) => { return () => {
setSignUpFiels({ ...signUpFields, [name]: value }); resetTimeout();
switch (name) {
case "otp1":
if (value) {
otp2.current.focus();
}
break;
case "otp2":
if (value) {
otp3.current.focus();
} else {
otp1.current.focus();
}
break;
case "otp3":
if (value) {
otp4.current.focus();
} else {
otp2.current.focus();
}
break;
case "otp4":
if (value) {
checkOtp();
} else {
otp3.current.focus();
}
break;
default:
break;
}
}; };
}, [index]);
const checkPhoneNumber = (e) => {
if ( const [level, setLevel] = useState("phonenumber");
signUpFields?.cellphone?.slice(0, 2) === "09" && const [signUpFields, setSignUpFiels] = useState({});
signUpFields?.cellphone.length === 11 const [error, setError] = useState("");
) { const [resend, setResend] = useState(false);
const navigate = useNavigate();
setSteps(2)
const otp1 = useRef();
sendPhoneNumber({ cellphone: signUpFields?.cellphone }); const otp2 = useRef();
setError(undefined); const otp3 = useRef();
console.log(signUpFields.cellphone) const otp4 = useRef();
} else {
setError("شماره موبایل خود را چک کنید."); const onChange = (name, value) => {
setSignUpFiels({ ...signUpFields, [name]: value });
switch (name) {
case "otp1":
if (value) {
otp2.current.focus();
} }
}; break;
case "otp2":
const checkOtp = () => { if (value) {
if (steps !== 1 && otp3.current.focus();
signUpFields?.otp1 &&
signUpFields?.otp2 &&
signUpFields?.otp3 &&
signUpFields?.otp4
) {
sendOtp({
cellphone: signUpFields?.cellphone,
otp:
signUpFields?.otp1 +
signUpFields?.otp2 +
signUpFields?.otp3 +
signUpFields?.otp4,
userToken: "2",
applicationToken: "22",
});
setError(undefined);
} else { } else {
setError("کد وارد شده را چک کنید."); otp1.current.focus();
}
};
const numberInput = useRef();
// useEffect(() => {
// // numberInput.current.focus();
// setHeaderOptions(headerOptions);
// }, []);
useEffect(() => {
if (signUpFields?.otp?.length === 4) {
sendOtp({
cellphone: signUpFields?.cellphone,
otp: signUpFields?.otp,
userToken: "2",
applicationToken: "22",
});
} }
}, [signUpFields]); break;
case "otp3":
useEffect(() => { if (value) {
if (level === "phonenumber") { otp4.current.focus();
// numberInput.current.focus();
} else { } else {
// otpInput.current.focus(); otp2.current.focus();
} }
}, [level]); break;
case "otp4":
useEffect(() => { if (value) {
if (loginFlag) { checkOtp();
navigate("/"); } else {
otp3.current.focus();
} }
}, [loginFlag]); break;
const light = theme === "light"; default:
break;
const slideContents = [ }
{ };
id: 0,
image: firstPic, const checkPhoneNumber = (e) => {
title: 'یک معلم دیوانه در کمین شما نشسته است مراقب باشید', if (
description: 'معلمی که دانش آموزانش رو شب ها شکار می کند و این متن شاید باعث تعجب شما شده باشد که آیا طراح دیوانه شده است یا خیر ؟ ', signUpFields?.cellphone?.slice(0, 2) === "09" &&
}, signUpFields?.cellphone.length === 11
{ ) {
id: 1, setSteps(2);
image: secondPic,
title: 'یک آزمون سخت و افتضاح در راه هست!', sendPhoneNumber({ cellphone: signUpFields?.cellphone });
description: 'لورم ایپسوم نمیخواستم استفاده کنم برای همین این متنای عجیب رو مینویسم ببینم چجوری میشه تهش بالاخره اونا هم قراره یه متن عجیب بنویسن ', setError(undefined);
}, console.log(signUpFields.cellphone);
{ } else {
id: 2, setError("شماره موبایل خود را چک کنید.");
image: thirdPic, }
title: 'یک اسلاید عجیب غریب دیگر در راه هست', };
description: 'معلمی که دانش آموزانش رو شب ها شکار می کند و این متن شاید باعث تعجب شما شده باشد که آیا طراح دیوانه شده است یا خیر ؟ ',
}, const checkOtp = () => {
if (
steps !== 1 &&
signUpFields?.otp1 &&
signUpFields?.otp2 &&
signUpFields?.otp3 &&
signUpFields?.otp4
) {
sendOtp({
cellphone: signUpFields?.cellphone,
otp:
signUpFields?.otp1 +
signUpFields?.otp2 +
signUpFields?.otp3 +
signUpFields?.otp4,
userToken: "2",
applicationToken: "22",
});
setError(undefined);
} else {
setError("کد وارد شده را چک کنید.");
}
};
const numberInput = useRef();
// useEffect(() => {
// // numberInput.current.focus();
// setHeaderOptions(headerOptions);
// }, []);
useEffect(() => {
if (signUpFields?.otp?.length === 4) {
sendOtp({
cellphone: signUpFields?.cellphone,
otp: signUpFields?.otp,
userToken: "2",
applicationToken: "22",
});
}
}, [signUpFields]);
]; useEffect(() => {
const delay = 2500; if (level === "phonenumber") {
return ( // numberInput.current.focus();
} else {
// otpInput.current.focus();
}
}, [level]);
<div className="w-full flex flex-col items-center justify-center" style={{ height: '100vh', direction: 'rtl' }}> useEffect(() => {
<div className="w-full flex flex-col h-full justify-between pt-10 pb-24 rounded-xl"> if (loginFlag) {
{/* form */} navigate("/");
<div className="h-12 w-full px-5 flex justify-end"> }
{steps != 0 && }, [loginFlag]);
<div className="w-12 h-12 bg-gray-200 rounded-xl flex items-center justify-center text-gray-500 m-0 text-2xl font-light cursor-pointer" onClick={() => setSteps(steps - 1)}> const light = theme === "light";
{`>`}
const slideContents = [
{
id: 0,
image: firstPic,
title: "یک معلم دیوانه در کمین شما نشسته است مراقب باشید",
description:
"معلمی که دانش آموزانش رو شب ها شکار می کند و این متن شاید باعث تعجب شما شده باشد که آیا طراح دیوانه شده است یا خیر ؟ ",
},
{
id: 1,
image: secondPic,
title: "یک آزمون سخت و افتضاح در راه هست!",
description:
"لورم ایپسوم نمیخواستم استفاده کنم برای همین این متنای عجیب رو مینویسم ببینم چجوری میشه تهش بالاخره اونا هم قراره یه متن عجیب بنویسن ",
},
{
id: 2,
image: thirdPic,
title: "یک اسلاید عجیب غریب دیگر در راه هست",
description:
"معلمی که دانش آموزانش رو شب ها شکار می کند و این متن شاید باعث تعجب شما شده باشد که آیا طراح دیوانه شده است یا خیر ؟ ",
},
];
const delay = 2500;
return (
<div
className="w-full flex flex-col items-center justify-center"
style={{ height: "100vh", direction: "rtl" }}
>
<div className="w-full flex flex-col h-full justify-between pt-10 pb-24 rounded-xl">
{/* form */}
<div className="h-12 w-full px-5 flex justify-end">
{steps != 0 && (
<div
className="w-12 h-12 bg-gray-200 rounded-xl flex items-center justify-center text-gray-500 m-0 text-2xl font-light cursor-pointer"
onClick={() => setSteps(steps - 1)}
>
{`>`}
</div>
)}
</div>
<div
className={`flex w-full ${
steps == 2 ? "h-full justify-center" : "justify-between"
} flex-col items-center p-6`}
>
<img src={logo} className="w-1/2 m-6" />
<div className="flex flex-col w-full items-start justify-start leading-normal">
{steps == 2 ? (
<h1 className="text-red26 text-lg font-bold">تاییدیه ثبت نام</h1>
) : (
<>
<div className=" w-full flex flex-col items-center justify-center h-4/5">
<div
className="slideshow items-center justify-center"
style={{ direction: "ltr" }}
>
<div
className="slideshowSlider w-full"
style={{
transform: `translate3d(${-index * 100}%, 0, 0)`,
}}
>
{[
slideContents[slideContents.length - 1],
...slideContents,
slideContents[0],
].map((item, index) => (
<div className="slide" key={`sildeNo${index}`}>
<div className="w-full h-full flex flex-col justify-center items-center">
<img src={item.image} className="h-2/5" />
<h1 className="w-4/5 text-sm my-2 text-red26 font-bold whitespace-normal">
{item.title}
</h1>
<p className=" px-12 text-right text-xs whitespace-normal">
{item.description}
</p>
</div>
</div> </div>
} ))}
</div>
</div>
</div> </div>
<div className={`flex w-full ${steps == 2 ? 'h-full justify-center' : 'justify-between'} flex-col items-center p-6`}> </>
)}
<img src={logo} className="w-1/2 m-6" />
<div className="flex flex-col w-full items-start justify-start leading-normal"> <p className="text-gray-500 text-sm mt-2 flex justify-center">
{ {steps == 2 &&
steps == 2 ? <h1 className="text-red26 text-lg font-bold">تاییدیه ثبت نام</h1> : (resend ? (
<> <div>
<div className=" w-full flex flex-col items-center justify-center h-4/5" > <span className="ml-2">کد تایید ارسال نشد؟</span>
<div className="slideshow items-center justify-center" style={{ direction: 'ltr' }}> <button
<div className="text-red52"
className="slideshowSlider w-full" onClick={() => {
style={{ transform: `translate3d(${-index * 100}%, 0, 0)` }} checkPhoneNumber(signUpFields?.cellphone);
> setResend(false);
{[slideContents[slideContents.length - 1], }}
...slideContents, slideContents[0] >
].map((item, index) => ( درخواست مجدد کد تایید
<div </button>
className="slide" </div>
key={`sildeNo${index}`} ) : (
<p className="w-4/5 ">
> یک کد چهار رقمی تا &nbsp;{" "}
<div className="w-full h-full flex flex-col justify-center items-center"> <Timer
<img src={item.image} className="h-2/5" /> seconds={120}
<h1 className="w-4/5 text-sm my-2 text-red26 font-bold whitespace-normal">{item.title}</h1> refresh={() => {
<p className=" px-12 text-right text-xs whitespace-normal">{item.description}</p> setResend(true);
</div> }}
</div> />
))} &nbsp; دیگر برای شماره &nbsp;{" "}
</div> <span className="text-red52 text-sm">
{signUpFields?.cellphone}
{/* <div className="slideshowDots"> </span>{" "}
{slideContents.map((_, idx) => ( &nbsp; ارسال خواهد شد.
<div </p>
key={idx} ))}
className={`slideshowDot${index === idx + 1 ? " active" : ""}`} </p>
onClick={() => {
setIndex(idx + 1); {steps == 0 && (
}} <div className="flex w-full items-center mt-4">
></div> <Link
))} to=""
</div> */} className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center ml-1"
</div> onClick={() => {
</div> setSteps(1);
</> }}
>
} ورود
</Link>
<p className="text-gray-500 text-sm mt-2 flex justify-center"> <Link
to=""
{ className="Login-box-form-btn w-full h-12 rounded-lg border border-solid border-red52 text-red52 flex items-center justify-center mr-1"
steps == 2 && (resend ? onClick={() => {
<div> setSignUp(true);
<span className="ml-2">کد تایید ارسال نشد؟</span> }}
<button className="text-red52" >
onClick={() => { ثبت نام
checkPhoneNumber(signUpFields?.cellphone); </Link>
setResend(false) </div>
}} )}
>درخواست مجدد کد تایید</button> {steps == 1 && (
</div> <>
: <p className="w-4/5 "> <Input
یک کد چهار رقمی تا &nbsp;{" "} title={"شماره موبایل"}
<Timer seconds={120} refresh={() => { setResend(true) }} /> name="cellphone"
&nbsp; دیگر برای شماره regex={onInput.numberOnly}
&nbsp;{" "} onChange={(name, value) => onChange(name, value)}
<span className="text-red52 text-sm"> value={signUpFields?.cellphone}
{signUpFields?.cellphone} maxLength={11}
</span>{" "} direction="ltr"
&nbsp; ارسال خواهد شد. />
</p>) <span className="text-red-500 text-xs">{error}</span>
}
<Link
</p> to=""
className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center mt-4"
{ onClick={(e) => {
steps == 0 && // setSteps(2);
<div className="flex w-full items-center mt-4"> checkPhoneNumber(e);
<Link }}
to="" >
className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center ml-1" ارسال کد تاییدیه
onClick={() => { </Link>
setSteps(1); </>
)}
}} {steps == 2 && (
> <>
ورود <div className="w-full flex flex-col mt-5">
</Link> <div className="w-full flex flex-row-reverse justify-center">
<Link <input
to="" inputMode="numeric"
className="Login-box-form-btn w-full h-12 rounded-lg border border-solid border-red52 text-red52 flex items-center justify-center mr-1" style={{ direction: "ltr" }}
onClick={() => { name="otp1"
setSteps(1); className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1 focus:text-red52 focus:bg-white focus:outline-red52"
setRegister(true); onChange={(e) =>
onChange(
}} e.target.name,
> (e.target.value = onInput.numberOnly(e.target.value))
ثبت نام )
</Link> }
</div> maxlength="1"
} ref={otp1}
{ />
steps == 1 && <input
<> inputMode="numeric"
style={{ direction: "ltr" }}
<Input name="otp2"
title={"شماره موبایل"} className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1 focus:text-red52 focus:bg-white focus:outline-red52"
name="cellphone" onChange={(e) =>
regex={onInput.numberOnly} onChange(
onChange={(name, value) => onChange(name, value)} e.target.name,
value={signUpFields?.cellphone} (e.target.value = onInput.numberOnly(e.target.value))
)
maxLength="11" }
direction="ltr" maxlength="1"
/> ref={otp2}
<span className="text-red-500 text-xs">{error}</span> />
<input
<Link inputMode="numeric"
to="" style={{ direction: "ltr" }}
className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center mt-4" name="otp3"
onClick={(e) => { className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1 focus:text-red52 focus:bg-white focus:outline-red52"
// setSteps(2); onChange={(e) =>
checkPhoneNumber(e) onChange(
}} e.target.name,
> (e.target.value = onInput.numberOnly(e.target.value))
ارسال کد تاییدیه )
</Link> }
maxlength="1"
ref={otp3}
/>
<input
</> inputMode="numeric"
} style={{ direction: "ltr" }}
{ name="otp4"
steps == 2 && className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1 focus:text-red52 focus:bg-white focus:outline-red52"
<> onChange={(e) =>
onChange(
e.target.name,
<div className="w-full flex flex-col mt-5"> (e.target.value =
<div className="w-full flex flex-row-reverse justify-center"> onInput.englishAndNumberWithoutSpace(
<input e.target.value
inputMode="numeric" ))
style={{ direction: "ltr" }} )
name="otp1" }
className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1 focus:text-red52 focus:bg-white focus:outline-red52" maxlength="1"
onChange={(e) => ref={otp4}
onChange( />
e.target.name, </div>
(e.target.value = onInput.numberOnly(e.target.value))
) <Link
} to={register == true ? "/register" : `/`}
maxlength="1" className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center mt-4"
ref={otp1} onClick={(e) => {
/> checkOtp(e);
<input // activeLogin()
inputMode="numeric" }}
style={{ direction: "ltr" }} >
name="otp2" تایید
className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1 focus:text-red52 focus:bg-white focus:outline-red52" </Link>
onChange={(e) => <div className="mt-3 flex flex-row text-center w-full justify-center">
onChange( <div className="text-xs text-gray1">
e.target.name, شماره خود را اشتباه وارد کردید؟{" "}
(e.target.value = onInput.numberOnly(e.target.value)) <button
) className="bg-transparent border-none text-red52 font-medium"
} onClick={() => setSteps(1)}
maxlength="1" >
ref={otp2} اصلاح شماره تلفن
/> </button>
<input </div>
inputMode="numeric" </div>
style={{ direction: "ltr" }} </div>
name="otp3" </>
className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1 focus:text-red52 focus:bg-white focus:outline-red52" )}
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.numberOnly(e.target.value))
)
}
maxlength="1"
ref={otp3}
/>
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp4"
className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1 focus:text-red52 focus:bg-white focus:outline-red52"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.englishAndNumberWithoutSpace(e.target.value))
)
}
maxlength="1"
ref={otp4}
/>
</div>
<Link
to={register == true ? '/register' : `/`}
className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center mt-4"
onClick={(e) => {
checkOtp(e)
// activeLogin()
}}
>
تایید
</Link>
<div className="mt-3 flex flex-row text-center w-full justify-center">
<div className="text-xs text-gray1">
شماره خود را اشتباه وارد کردید؟{" "}
<button
className="bg-transparent border-none text-red52 font-medium"
onClick={() => setSteps(1)}
>
اصلاح شماره تلفن
</button>
</div>
</div>
</div>
</>
}
{/* <div className="w-full flex flex-col items-center justify-center"> {/* <div className="w-full flex flex-col items-center justify-center">
<p className="w-3/5 text-xs my-20 text-center text-red26"> <p className="w-3/5 text-xs my-20 text-center text-red26">
ثبت نام شما در سامانه به منزله قبول ثبت نام شما در سامانه به منزله قبول
<Link to="" className="font-bold"> شرایط و قوانین استفاده </Link> <Link to="" className="font-bold"> شرایط و قوانین استفاده </Link>
@ -466,19 +461,12 @@ const LoginSignUpMobile = ({
</p> </p>
<p className="text-gray-300 text-xs">1401 - 1400</p> <p className="text-gray-300 text-xs">1401 - 1400</p>
</div> */} </div> */}
</div>
</div>
</div>
</div>
</div> </div>
</div>
); {signUp && <SignUpBox setSignUp={setSignUp} />}
</div>
);
}; };
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({

@ -35,33 +35,23 @@ const Register = ({
province, province,
city, city,
user, user,
getUserInfo,
}) => { }) => {
const [steps, setSteps] = useState(0); const [steps, setSteps] = useState(0);
console.log("user:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
console.log(user);
const timeoutRef = useRef(null); const timeoutRef = useRef(null);
const [activeStep, setActiveStep] = useState([true, false, false, false]); const [activeStep, setActiveStep] = useState([true, false, false, false]);
const [error, setError] = useState(""); const [error, setError] = useState("");
useEffect(() => { useEffect(() => {
getUserInfo();
getProvince(); getProvince();
getCity(); getCity();
}, []); }, []);
useEffect(() => { useEffect(() => {
if (user?.firstName !== null) { if (user?.firstName !== null) {
setUserInfo({ setUserInfo(user);
...userInfo,
firstName: user.firstName,
lastName: user.lastName,
nationalId: user.nationalId,
// birthDate: user.birthDate.toLocaleDateString('fa-IR'),
gender: user.gender,
previousSchoolName: user.previousSchoolName,
previousSchoolType: user.previousSchoolType,
zone: user.zone,
familyMemberCount: user.familyMemberCount,
phone: user.phone,
address: user.address,
});
} }
}, [user]); }, [user]);
useEffect(() => { useEffect(() => {
@ -120,154 +110,157 @@ const Register = ({
personalPic: null, personalPic: null,
}); });
const [userInfo, setUserInfo] = useState({ //ark added
firstName: null, const [userInfo, setUserInfo]=useState(user);
lastName: null, //ark added
nationalId: null, // const [userInfo, setUserInfo] = useState({
birthDate: null, // firstName: null,
gender: null, // lastName: null,
gradeIds: null, // nationalId: null,
previousSchoolName: null, // birthDate: null,
previousSchoolType: null, // gender: null,
cityId: null, // gradeIds: null,
provinceId: null, // previousSchoolName: null,
zone: null, // previousSchoolType: null,
fatherInfo: { // cityId: null,
firstName: null, // provinceId: null,
nationalId: null, // zone: null,
lastName: null, // fatherInfo: {
job: null, // firstName: null,
education: null, // nationalId: null,
cellphone: null, // lastName: null,
workPlace: null, // job: null,
workPhone: null, // education: null,
}, // cellphone: null,
motherInfo: { // workPlace: null,
firstName: null, // workPhone: null,
nationalId: null, // },
lastName: null, // motherInfo: {
job: null, // firstName: null,
education: null, // nationalId: null,
cellphone: null, // lastName: null,
workPlace: null, // job: null,
workPhone: null, // education: null,
}, // cellphone: null,
// workPlace: null,
// workPhone: null,
// },
familyMemberCount: null, // familyMemberCount: null,
address: null, // address: null,
phone: null, // phone: null,
rulesAccepted: false, // rulesAccepted: false,
}); // });
const finalViewInfo = [ const finalViewInfo = [
{ {
title: "نام", title: "نام",
value: userInfo.firstName, value: userInfo?.firstName,
}, },
{ {
title: "نام خانوادگی", title: "نام خانوادگی",
value: userInfo.lastName, value: userInfo?.lastName,
}, },
{ {
title: "جنسیت", title: "جنسیت",
value: userInfo.gender, value: userInfo?.gender,
}, },
{ {
title: "کد ملی", title: "کد ملی",
value: userInfo.nationalId, value: userInfo?.nationalId,
}, },
{ {
title: "تاریخ تولد", title: "تاریخ تولد",
value: userInfo.birthDate?.toLocaleDateString("fa-IR"), value: userInfo?.birthDate?.toLocaleDateString("fa-IR"),
}, },
{ {
title: "نام مدرسه ", title: "نام مدرسه ",
value: userInfo.previousSchoolName, value: userInfo?.previousSchoolName,
}, },
{ {
title: "شهر", title: "شهر",
value: userInfo.cityId, value: userInfo?.cityId,
}, },
{ {
title: "منطقه", title: "منطقه",
value: userInfo.zone, value: userInfo?.zone,
}, },
{ {
title: "نام", title: "نام",
value: userInfo.fatherInfo.firstName, value: userInfo?.fatherInfo?.firstName,
}, },
{ {
title: "نام خانوادگی", title: "نام خانوادگی",
value: userInfo.fatherInfo.lastName, value: userInfo?.fatherInfo?.lastName,
}, },
{ {
title: "کدملی", title: "کدملی",
value: userInfo.fatherInfo.nationalId, value: userInfo.fatherInfo?.nationalId,
}, },
{ {
title: "مدرک تحصیلی", title: "مدرک تحصیلی",
value: madraks.find((itm) => itm.id == userInfo.fatherInfo.education) value: madraks.find((itm) => itm.id == userInfo?.fatherInfo?.education)
?.title, ?.title,
}, },
{ {
title: "تلفن همراه", title: "تلفن همراه",
value: userInfo.fatherInfo.cellphone, value: userInfo?.fatherInfo?.cellphone,
}, },
{ {
title: "شغل", title: "شغل",
value: userInfo.fatherInfo.job, value: userInfo?.fatherInfo?.job,
}, },
{ {
title: "محل کار", title: "محل کار",
value: userInfo.fatherInfo.workPlace, value: userInfo?.fatherInfo?.workPlace,
}, },
{ {
title: "تلفن محل کار", title: "تلفن محل کار",
value: userInfo.fatherInfo.workPhone, value: userInfo?.fatherInfo?.workPhone,
}, },
{ {
title: "نام", title: "نام",
value: userInfo.motherInfo.firstName, value: userInfo?.motherInfo?.firstName,
}, },
{ {
title: "نام خانوادگی", title: "نام خانوادگی",
value: userInfo.motherInfo.lastName, value: userInfo?.motherInfo?.lastName,
}, },
{ {
title: "کدملی", title: "کدملی",
value: userInfo.motherInfo.nationalId, value: userInfo?.motherInfo?.nationalId,
}, },
{ {
title: "مدرک تحصیلی", title: "مدرک تحصیلی",
value: madraks.find((itm) => itm.id == userInfo.motherInfo.education) value: madraks.find((itm) => itm.id == userInfo?.motherInfo?.education)
?.title, ?.title,
}, },
{ {
title: "تلفن همراه", title: "تلفن همراه",
value: userInfo.motherInfo.cellphone, value: userInfo?.motherInfo?.cellphone,
}, },
{ {
title: "شغل", title: "شغل",
value: userInfo.motherInfo.job, value: userInfo?.motherInfo?.job,
}, },
{ {
title: "محل کار", title: "محل کار",
value: userInfo.motherInfo.workPlace, value: userInfo?.motherInfo?.workPlace,
}, },
{ {
title: "تلفن محل کار", title: "تلفن محل کار",
value: userInfo.motherInfo.workPhone, value: userInfo?.motherInfo?.workPhone,
}, },
{ {
title: "تعداد افراد خانواده", title: "تعداد افراد خانواده",
value: userInfo.familyMemberCount, value: userInfo?.familyMemberCount,
}, },
{ {
title: "نشانی محل سکونت", title: "نشانی محل سکونت",
value: userInfo.address, value: userInfo?.address,
}, },
{ {
title: "تلفن ثابت", title: "تلفن ثابت",
value: userInfo.phone, value: userInfo?.phone,
}, },
]; ];
@ -401,27 +394,27 @@ const Register = ({
const [selectedState, setSelectedState] = useState(null); const [selectedState, setSelectedState] = useState(null);
const [selectedCity, setSelectedCity] = useState(null); const [selectedCity, setSelectedCity] = useState(null);
const firstStepSubmit=()=>{ const firstStepSubmit = () => {
if ( if (
userInfo.firstName && userInfo.firstName &&
userInfo.lastName && userInfo.lastName &&
userInfo.birthDate && userInfo.birthDate &&
userInfo.gradeIds && userInfo.gradeIds &&
userInfo.nationalId && userInfo.nationalId &&
userInfo.gender && userInfo.gender &&
// userInfo.previousSchoolName && // userInfo.previousSchoolName &&
// userInfo.previousSchoolType && // userInfo.previousSchoolType &&
// userInfo.zone && // userInfo.zone &&
files.personalPic && files.personalPic &&
files.shenasNameh files.shenasNameh
) { ) {
setSteps(1); setSteps(1);
setActiveStep([true, true, false, false]); setActiveStep([true, true, false, false]);
setError(""); setError("");
} else { } else {
toast.warning("لطفا تمامی فیلد ها را پر کنید"); toast.warning("لطفا تمامی فیلد ها را پر کنید");
} }
} };
return isMobile ? ( return isMobile ? (
<MobileRegister /> <MobileRegister />
@ -475,7 +468,7 @@ const Register = ({
gapSize="8" gapSize="8"
direction="rtl" direction="rtl"
id={0} id={0}
value={userInfo.firstName} value={userInfo?.firstName}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
@ -690,9 +683,9 @@ const Register = ({
borderType="rounded" borderType="rounded"
title="مرحله بعد" title="مرحله بعد"
onClick={firstStepSubmit} onClick={firstStepSubmit}
// onClick={() => { // onClick={() => {
// }} // }}
/> />
</div> </div>
</div> </div>
@ -716,12 +709,12 @@ const Register = ({
gapSize="8" gapSize="8"
direction="rtl" direction="rtl"
id={0} id={0}
value={userInfo.fatherInfo.firstName} value={userInfo?.fatherInfo?.firstName}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
fatherInfo: { fatherInfo: {
...userInfo.fatherInfo, ...userInfo?.fatherInfo,
firstName: _onInput.noNumber(e.target.value), firstName: _onInput.noNumber(e.target.value),
}, },
}) })
@ -733,12 +726,12 @@ const Register = ({
borderType="rounded" borderType="rounded"
id={1} id={1}
direction="rtl" direction="rtl"
value={userInfo.fatherInfo.lastName} value={userInfo?.fatherInfo?.lastName}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
fatherInfo: { fatherInfo: {
...userInfo.fatherInfo, ...userInfo?.fatherInfo,
lastName: _onInput.noNumber(e.target.value), lastName: _onInput.noNumber(e.target.value),
}, },
}) })
@ -752,7 +745,7 @@ const Register = ({
id={2} id={2}
type="text" type="text"
max={10} max={10}
value={userInfo.fatherInfo.nationalId} value={userInfo?.fatherInfo?.nationalId}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
@ -769,7 +762,7 @@ const Register = ({
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
fatherInfo: { fatherInfo: {
...userInfo.fatherInfo, ...userInfo?.fatherInfo,
education: e.target.value, education: e.target.value,
}, },
}) })
@ -789,12 +782,12 @@ const Register = ({
borderType="rounded" borderType="rounded"
max={11} max={11}
id={3} id={3}
value={userInfo.fatherInfo.cellphone} value={userInfo?.fatherInfo?.cellphone}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
fatherInfo: { fatherInfo: {
...userInfo.fatherInfo, ...userInfo?.fatherInfo,
cellphone: _onInput.phonenumber(e.target.value), cellphone: _onInput.phonenumber(e.target.value),
}, },
}) })
@ -807,12 +800,12 @@ const Register = ({
direction="rtl" direction="rtl"
gapSize="8" gapSize="8"
id={4} id={4}
value={userInfo.fatherInfo.job} value={userInfo?.fatherInfo?.job}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
fatherInfo: { fatherInfo: {
...userInfo.fatherInfo, ...userInfo?.fatherInfo,
job: e.target.value, job: e.target.value,
}, },
}) })
@ -825,12 +818,12 @@ const Register = ({
borderType="rounded" borderType="rounded"
id={5} id={5}
direction="rtl" direction="rtl"
value={userInfo.fatherInfo.workPlace} value={userInfo?.fatherInfo?.workPlace}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
fatherInfo: { fatherInfo: {
...userInfo.fatherInfo, ...userInfo?.fatherInfo,
workPlace: e.target.value, workPlace: e.target.value,
}, },
}) })
@ -844,12 +837,12 @@ const Register = ({
id={6} id={6}
type="text" type="text"
max={11} max={11}
value={userInfo.fatherInfo.workPhone} value={userInfo?.fatherInfo?.workPhone}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
fatherInfo: { fatherInfo: {
...userInfo.fatherInfo, ...userInfo?.fatherInfo,
workPhone: _onInput.numberOnly(e.target.value), workPhone: _onInput.numberOnly(e.target.value),
}, },
}) })
@ -873,12 +866,12 @@ const Register = ({
gapSize="8" gapSize="8"
direction="rtl" direction="rtl"
id={7} id={7}
value={userInfo.motherInfo.firstName} value={userInfo?.motherInfo?.firstName}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
motherInfo: { motherInfo: {
...userInfo.motherInfo, ...userInfo?.motherInfo,
firstName: _onInput.noNumber(e.target.value), firstName: _onInput.noNumber(e.target.value),
}, },
}) })
@ -891,12 +884,12 @@ const Register = ({
borderType="rounded" borderType="rounded"
id={8} id={8}
direction="rtl" direction="rtl"
value={userInfo.motherInfo.lastName} value={userInfo?.motherInfo?.lastName}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
motherInfo: { motherInfo: {
...userInfo.motherInfo, ...userInfo?.motherInfo,
lastName: _onInput.noNumber(e.target.value), lastName: _onInput.noNumber(e.target.value),
}, },
}) })
@ -910,12 +903,12 @@ const Register = ({
id={9} id={9}
type="text" type="text"
max={10} max={10}
value={userInfo.motherInfo.nationalId} value={userInfo?.motherInfo?.nationalId}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
motherInfo: { motherInfo: {
...userInfo.motherInfo, ...userInfo?.motherInfo,
nationalId: _onInput.numberOnly(e.target.value), nationalId: _onInput.numberOnly(e.target.value),
}, },
}) })
@ -928,7 +921,7 @@ const Register = ({
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
motherInfo: { motherInfo: {
...userInfo.motherInfo, ...userInfo?.motherInfo,
education: e.target.value, education: e.target.value,
}, },
}) })
@ -949,12 +942,12 @@ const Register = ({
type="text" type="text"
id={10} id={10}
max={11} max={11}
value={userInfo.motherInfo.cellphone} value={userInfo?.motherInfo?.cellphone}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
motherInfo: { motherInfo: {
...userInfo.motherInfo, ...userInfo?.motherInfo,
cellphone: _onInput.phonenumber(e.target.value), cellphone: _onInput.phonenumber(e.target.value),
}, },
}) })
@ -967,12 +960,12 @@ const Register = ({
direction="rtl" direction="rtl"
gapSize="8" gapSize="8"
id={11} id={11}
value={userInfo.motherInfo.job} value={userInfo?.motherInfo?.job}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
motherInfo: { motherInfo: {
...userInfo.motherInfo, ...userInfo?.motherInfo,
job: e.target.value, job: e.target.value,
}, },
}) })
@ -985,12 +978,12 @@ const Register = ({
borderType="rounded" borderType="rounded"
id={12} id={12}
direction="rtl" direction="rtl"
value={userInfo.motherInfo.workPlace} value={userInfo?.motherInfo?.workPlace}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
motherInfo: { motherInfo: {
...userInfo.motherInfo, ...userInfo?.motherInfo,
workPlace: e.target.value, workPlace: e.target.value,
}, },
}) })
@ -1004,12 +997,12 @@ const Register = ({
id={13} id={13}
type="text" type="text"
max={11} max={11}
value={userInfo.motherInfo.workPhone} value={userInfo?.motherInfo?.workPhone}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
motherInfo: { motherInfo: {
...userInfo.motherInfo, ...userInfo?.motherInfo,
workPhone: _onInput.numberOnly(e.target.value), workPhone: _onInput.numberOnly(e.target.value),
}, },
}) })
@ -1035,7 +1028,7 @@ const Register = ({
gapSize="40" gapSize="40"
direction="rtl" direction="rtl"
id={14} id={14}
value={userInfo.familyMemberCount} value={userInfo?.familyMemberCount}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
@ -1051,7 +1044,7 @@ const Register = ({
direction="rtl" direction="rtl"
id={15} id={15}
max={11} max={11}
value={userInfo.phone} value={userInfo?.phone}
onChange={(e) => onChange={(e) =>
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
@ -1066,7 +1059,7 @@ const Register = ({
gapSize="40" gapSize="40"
id={16} id={16}
direction="rtl" direction="rtl"
value={userInfo.address} value={userInfo?.address}
onChange={(e) => onChange={(e) =>
setUserInfo({ ...userInfo, address: e.target.value }) setUserInfo({ ...userInfo, address: e.target.value })
} }
@ -1093,25 +1086,25 @@ const Register = ({
// const inputs = document.querySelectorAll('.Login-box-form-item-input') // const inputs = document.querySelectorAll('.Login-box-form-item-input')
if ( if (
userInfo.motherInfo.cellphone && userInfo?.motherInfo.cellphone &&
userInfo.motherInfo.education && userInfo?.motherInfo.education &&
userInfo.motherInfo.firstName && userInfo?.motherInfo.firstName &&
userInfo.motherInfo.job && userInfo?.motherInfo.job &&
userInfo.motherInfo.lastName && userInfo?.motherInfo.lastName &&
userInfo.motherInfo.nationalId && userInfo?.motherInfo.nationalId &&
userInfo.motherInfo.workPhone && userInfo?.motherInfo.workPhone &&
userInfo.motherInfo.workPlace && userInfo?.motherInfo.workPlace &&
userInfo.fatherInfo.cellphone && userInfo?.fatherInfo.cellphone &&
userInfo.fatherInfo.education && userInfo?.fatherInfo.education &&
userInfo.fatherInfo.firstName && userInfo?.fatherInfo.firstName &&
userInfo.fatherInfo.job && userInfo?.fatherInfo.job &&
userInfo.fatherInfo.lastName && userInfo?.fatherInfo.lastName &&
userInfo.fatherInfo.nationalId && userInfo?.fatherInfo.nationalId &&
userInfo.fatherInfo.workPhone && userInfo?.fatherInfo.workPhone &&
userInfo.fatherInfo.workPlace && userInfo?.fatherInfo.workPlace &&
userInfo.familyMemberCount && userInfo?.familyMemberCount &&
userInfo.address && userInfo?.address &&
userInfo.phone userInfo?.phone
) { ) {
setSteps(2); setSteps(2);
@ -1209,14 +1202,14 @@ const Register = ({
اینجانبان اینجانبان
<span className="text-red52 font-bold"> <span className="text-red52 font-bold">
{" "} {" "}
{userInfo.fatherInfo.firstName}{" "} {userInfo?.fatherInfo?.firstName}{" "}
{userInfo.fatherInfo.lastName}{" "} {userInfo?.fatherInfo?.lastName}{" "}
</span> </span>
و و
<span className="text-red52 font-bold"> <span className="text-red52 font-bold">
{" "} {" "}
{userInfo.motherInfo.firstName}{" "} {userInfo?.motherInfo?.firstName}{" "}
{userInfo.motherInfo.lastName}{" "} {userInfo?.motherInfo?.lastName}{" "}
</span> </span>
سرپرست های دانش آموز سرپرست های دانش آموز
<span className="text-red52 font-bold"> <span className="text-red52 font-bold">
@ -1331,7 +1324,7 @@ const Register = ({
<Button <Button
borderType="rounded" borderType="rounded"
title="تایید" title="تایید"
to="/" // to="/"
onClick={async () => { onClick={async () => {
// activeLogin() // activeLogin()
try { try {
@ -1397,6 +1390,7 @@ const mapDispatchToProps = {
setProfile: user.setProfile, setProfile: user.setProfile,
getProvince: publicApi.getProvince, getProvince: publicApi.getProvince,
getCity: publicApi.getCity, getCity: publicApi.getCity,
getUserInfo: user.getProfile,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(Register); export default connect(mapStateToProps, mapDispatchToProps)(Register);

@ -35,6 +35,7 @@ const PaymentBox = ({
cardNumber: null, cardNumber: null,
paidAt: null, paidAt: null,
TracingNumber: null, TracingNumber: null,
dueDateArray:null
}, },
]); ]);
useEffect(() => { useEffect(() => {
@ -55,6 +56,7 @@ const PaymentBox = ({
cardNumber: null, cardNumber: null,
paidAt: null, paidAt: null,
TracingNumber: null, TracingNumber: null,
dueDateArray:null
}); });
} }
} else { } else {
@ -87,6 +89,7 @@ const PaymentBox = ({
cardNumber: null, cardNumber: null,
paidAt: null, paidAt: null,
TracingNumber: null, TracingNumber: null,
dueDateArray:null
}); });
setPaymentList(newList); setPaymentList(newList);
setFake(fake + 1); setFake(fake + 1);
@ -121,7 +124,6 @@ const PaymentBox = ({
useEffect(()=>{ useEffect(()=>{
if(transactionSituation) if(transactionSituation)
{ {
alert("hooooooooo");
let newList = paymentList; let newList = paymentList;
newList[newList.length-1].status=0; newList[newList.length-1].status=0;
setPaymentList(newList); setPaymentList(newList);
@ -184,11 +186,19 @@ const PaymentBox = ({
) )
.format("YYYY-M-D HH:mm"); .format("YYYY-M-D HH:mm");
console.log(dueDate); console.log(dueDate);
let dueDateArray = [
Number(dateInfo[0].value),
Number(dateInfo[1].value),
Number(dateInfo[2].value),
Number(dateInfo[3].value),
Number(dateInfo[4].value),
];
//----------------------------------------- //-----------------------------------------
let newList = paymentList; let newList = paymentList;
newList[index].cardNumber = cardNumber; newList[index].cardNumber = cardNumber;
newList[index].paidAt = dueDate; newList[index].paidAt = dueDate;
newList[index].TracingNumber = TracingNumber; newList[index].TracingNumber = TracingNumber;
newList[index].dueDateArray=dueDateArray;
setPaymentList(newList); setPaymentList(newList);
setFake(fake + 1); setFake(fake + 1);
addUserTransaction({ addUserTransaction({
@ -264,6 +274,10 @@ const PaymentBox = ({
id="paymentBox-cardNumber-input" id="paymentBox-cardNumber-input"
className="w-[80%] h-10 px-1 outline-0 text-center" className="w-[80%] h-10 px-1 outline-0 text-center"
maxLength={16} maxLength={16}
style={
item.status !== null ? { pointerEvents: "none" } : null
}
value={item.cardNumber}
/> />
</div> </div>
)} )}
@ -279,6 +293,16 @@ const PaymentBox = ({
type="text" type="text"
className="paymentBox-payment-date-input w-[29%] h-full rounded border text-center text-sm" className="paymentBox-payment-date-input w-[29%] h-full rounded border text-center text-sm"
maxLength={2} maxLength={2}
style={
item.status !== null
? { pointerEvents: "none" }
: null
}
value={
item.dueDateArray !== null
? item.dueDateArray[0]
: null
}
/> />
<div className="h-full w-[5%] flex items-center justify-center"> <div className="h-full w-[5%] flex items-center justify-center">
/ /
@ -287,6 +311,16 @@ const PaymentBox = ({
type="text" type="text"
className="paymentBox-payment-date-input w-[29%] h-full rounded border text-center text-sm" className="paymentBox-payment-date-input w-[29%] h-full rounded border text-center text-sm"
maxLength={2} maxLength={2}
style={
item.status !== null
? { pointerEvents: "none" }
: null
}
value={
item.dueDateArray !== null
? item.dueDateArray[1]
: null
}
/> />
<div className="h-full w-[5%] flex items-center justify-center"> <div className="h-full w-[5%] flex items-center justify-center">
/ /
@ -295,6 +329,16 @@ const PaymentBox = ({
type="text" type="text"
className="paymentBox-payment-date-input w-[29%] h-full rounded border text-center text-sm" className="paymentBox-payment-date-input w-[29%] h-full rounded border text-center text-sm"
maxLength={4} maxLength={4}
style={
item.status !== null
? { pointerEvents: "none" }
: null
}
value={
item.dueDateArray !== null
? item.dueDateArray[2]
: null
}
/> />
</div> </div>
</div> </div>
@ -308,6 +352,16 @@ const PaymentBox = ({
type="text" type="text"
className="paymentBox-payment-date-input w-[45%] h-full rounded border text-center text-sm" className="paymentBox-payment-date-input w-[45%] h-full rounded border text-center text-sm"
maxLength={2} maxLength={2}
style={
item.status !== null
? { pointerEvents: "none" }
: null
}
value={
item.dueDateArray !== null
? item.dueDateArray[3]
: null
}
/> />
<div className="h-full w-[5%] flex items-center justify-center"> <div className="h-full w-[5%] flex items-center justify-center">
: :
@ -316,6 +370,16 @@ const PaymentBox = ({
type="text" type="text"
className="paymentBox-payment-date-input w-[45%] h-full rounded border text-center text-sm" className="paymentBox-payment-date-input w-[45%] h-full rounded border text-center text-sm"
maxLength={2} maxLength={2}
style={
item.status !== null
? { pointerEvents: "none" }
: null
}
value={
item.dueDateArray !== null
? item.dueDateArray[4]
: null
}
/> />
</div> </div>
</div> </div>
@ -333,6 +397,10 @@ const PaymentBox = ({
id="paymentBox-TracingNumber-input" id="paymentBox-TracingNumber-input"
className="w-[80%] h-10 px-1 outline-0 text-center" className="w-[80%] h-10 px-1 outline-0 text-center"
maxLength={30} maxLength={30}
style={
item.status !== null ? { pointerEvents: "none" } : null
}
value={item.TracingNumber}
/> />
</div> </div>
)} )}

@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { book, publicApi, userProduct } from "../../redux/actions"; import { book, publicApi, userProduct, user } from "../../redux/actions";
import PaymentBox from "./PaymentBox"; import PaymentBox from "./PaymentBox";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Link, useLocation } from "react-router-dom"; import { Link, useLocation } from "react-router-dom";
@ -36,7 +36,13 @@ const Services = ({
videos, videos,
pushToCart, pushToCart,
pushSchoolToCart, pushSchoolToCart,
getUserInfo,
userInfo
}) => { }) => {
useEffect(()=>{
getUserInfo();
},[])
//-------------------------------------------------------------
const [filterCheck, setFilterCheck] = useState([ const [filterCheck, setFilterCheck] = useState([
{ {
id: 1, id: 1,
@ -153,7 +159,7 @@ const Services = ({
console.log(gameId); console.log(gameId);
//productClickHandler------------------ //productClickHandler------------------
const productClickhandler=(product)=>{ const productClickhandler = (product) => {
setPopUpContent({ setPopUpContent({
id: gameId, id: gameId,
title: product?.name, title: product?.name,
@ -171,7 +177,7 @@ const Services = ({
setPopUp(true); setPopUp(true);
} }
console.log(gameId); console.log(gameId);
} };
//AddToCartHandler-------------------- //AddToCartHandler--------------------
const AddToCartHandler = (product) => { const AddToCartHandler = (product) => {
@ -317,6 +323,7 @@ const Services = ({
productHolderHoverBorder="shadow-md" productHolderHoverBorder="shadow-md"
teacher={product.vodTeacher} teacher={product.vodTeacher}
catId={gameId} catId={gameId}
userInfo={userInfo}
onClick={() => { onClick={() => {
productClickhandler(product); productClickhandler(product);
}} }}
@ -399,62 +406,7 @@ const Services = ({
{gameId !== 6 && ( {gameId !== 6 && (
<div className="flex items-center mx-4 my-4"> <div className="flex items-center mx-4 my-4">
<svg <img src={filterIcon} alt="filterIcon" className="w-9" />
xmlns="http://www.w3.org/2000/svg"
width="40"
height="40"
viewBox="0 0 14.378 14.378"
>
<g
id="vuesax_linear_filter-tick"
data-name="vuesax/linear/filter-tick"
transform="translate(-620 -700)"
>
<g id="filter-tick" transform="translate(620 700)">
<path
id="Vector"
d="M5.691,2.846a2.8,2.8,0,0,1-.407,1.468A2.836,2.836,0,0,1,2.846,5.691,2.768,2.768,0,0,1,1.312,5.23a2.685,2.685,0,0,1-.9-.917A2.807,2.807,0,0,1,0,2.846,2.848,2.848,0,0,1,2.846,0a2.648,2.648,0,0,1,.623.072A2.84,2.84,0,0,1,5.691,2.846Z"
transform="translate(7.267 5.991)"
fill="none"
stroke="#696969"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="0.6"
/>
<path
id="Vector-2"
data-name="Vector"
d="M0,.7l.7.7L2.217,0"
transform="translate(9.004 8.136)"
fill="none"
stroke="#696969"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="0.6"
/>
<path
id="Vector-3"
data-name="Vector"
d="M0,0H14.378V14.378H0Z"
transform="translate(14.378 14.378) rotate(180)"
fill="none"
opacity="0"
/>
<g id="Group" transform="translate(1.983 1.198)">
<path
id="Vector-4"
data-name="Vector"
d="M10.412,1.21V2.54a2.292,2.292,0,0,1-.605,1.4l-1.054.929a2.648,2.648,0,0,0-.623-.072A2.848,2.848,0,0,0,5.284,7.638,2.807,2.807,0,0,0,5.7,9.106a2.685,2.685,0,0,0,.9.917v.2a1.336,1.336,0,0,1-.545,1.03l-.845.545a1.233,1.233,0,0,1-1.875-1.03V7.567A2.342,2.342,0,0,0,2.846,6.3l-2.3-2.42A2.041,2.041,0,0,1,0,2.666V1.27A1.229,1.229,0,0,1,1.21,0H9.2A1.215,1.215,0,0,1,10.412,1.21Z"
fill="none"
stroke="#696969"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="0.6"
/>
</g>
</g>
</g>
</svg>
{filterCheck.map((filter) => ( {filterCheck.map((filter) => (
<div <div
key={`FILTER_${filter.id}`} key={`FILTER_${filter.id}`}
@ -523,6 +475,7 @@ const Services = ({
productHolderHoverBorder="shadow-md" productHolderHoverBorder="shadow-md"
teacher={product.vodTeacher} teacher={product.vodTeacher}
catId={gameId} catId={gameId}
userInfo={userInfo}
onClick={() => { onClick={() => {
setPopUpContent({ setPopUpContent({
id: gameId, id: gameId,
@ -637,6 +590,7 @@ const mapStateToProps = (state) => ({
grades: state.publicApi.grades, grades: state.publicApi.grades,
gradeFilterBooks: state.book.gradeFilterBooks, gradeFilterBooks: state.book.gradeFilterBooks,
selectedGrade: state.book.selectedGrade, selectedGrade: state.book.selectedGrade,
userInfo: state.user.status,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
@ -645,6 +599,7 @@ const mapDispatchToProps = {
setHeaderOptions: publicApi.setHeaderOptions, setHeaderOptions: publicApi.setHeaderOptions,
pushToCart: userProduct.add, pushToCart: userProduct.add,
pushSchoolToCart: userProduct.addSchool, pushSchoolToCart: userProduct.addSchool,
getUserInfo: user.getProfile
}; };
export default connect(mapStateToProps, mapDispatchToProps)(Services); export default connect(mapStateToProps, mapDispatchToProps)(Services);

Loading…
Cancel
Save