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. 23
      src/view/LoginSignUp/SignUpBox.js
  5. 200
      src/view/LoginSignUp/mobile/index.js
  6. 270
      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,
onClick,
product,
userInfo,
}) => {
const [isHovering, setIsHovering] = useState(false);
// alert(catId);
let rulesAccepted = JSON.parse(
localStorage.getItem("userData")
).rulesAccepted;
console.log("userInfo:*******************************************************");
console.log(userInfo);
let rulesAccepted = userInfo.rulesAccepted;
const emkanat = [
{
title: "دستشویی",
@ -177,7 +178,10 @@ const ProductDesign = ({
} `}
/>
</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 ">
{product?.name}
</h1>

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

@ -52,7 +52,9 @@ export default function userFactor(state = initialState, action) {
case "userFactor/loading":
return { ...state, loading: true };
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 };
default:
return state;

@ -57,7 +57,7 @@ const SignUpBox = ({ setSignUp, sendOtp,otpLogin }) => {
let code = Number(
box[0].value + box[1].value + box[2].value + box[3].value
);
alert(code);
// alert(code);
}
//api send
}
@ -104,8 +104,8 @@ const SignUpBox = ({ setSignUp, sendOtp,otpLogin }) => {
<div className="w-[85%]">
<Input label="نام دانشآموز" index={0} />
<Input label="نام خانوادگی دانشآموز" index={1} />
<Input label="کد ملی دانشآموز" index={2} />
<Input label="شماره موبایل" index={3} />
<Input label="کد ملی دانشآموز" index={2} maxLength={10} />
<Input label="شماره موبایل" index={3} maxLength={11} />
</div>
)}
{/* -------SendCodeText----------- */}
@ -180,24 +180,24 @@ export default connect(mapStateToProps, mapDispatchToProps)(SignUpBox);
//----------------------------------
const Input = ({ label,index }) => {
const onFocushandler=(i)=>{
const Input = ({ label, index, maxLength }) => {
const onFocushandler = (i) => {
let box = document.querySelectorAll(".Input");
let label = document.querySelectorAll(".Input-label");
let line = document.querySelectorAll(".line");
box[i].style.borderColor = "#DF1452";
label[i].style.color = "#DF1452";
label[i].style.fontSize = "12px";
if(window.innerWidth>1270){
if (window.innerWidth > 1270) {
label[i].style.transform = "translate(-15px,-25px)";
}else{
} else {
label[i].style.transform = "translate(-15px,-20px)";
}
line[i].style.display="block";
}
line[i].style.display = "block";
};
const onBlurHandler = (e,i) => {
if(e.target.value.length===0){
const onBlurHandler = (e, i) => {
if (e.target.value.length === 0) {
let box = document.querySelectorAll(".Input");
let label = document.querySelectorAll(".Input-label");
let line = document.querySelectorAll(".line");
@ -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]"
onFocus={() => onFocushandler(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">
{label}

@ -11,6 +11,7 @@ import thirdPic from '../../../assets/img/undraw_certificate_re_yadi.svg';
import { connect } from "react-redux";
import { user, publicApi } from "../../../redux/actions";
import SignUpBox from "../SignUpBox";
const LoginSignUpMobile = ({
activeLogin,
@ -22,6 +23,9 @@ const LoginSignUpMobile = ({
setHeaderOptions,
isMobile,
}) => {
//ark add------------------------------------------
const [signUp, setSignUp] = useState(false);
//----------------------------------------
const [steps, setSteps] = useState(0);
const [index, setIndex] = useState(1);
const [register, setRegister] = useState(false);
@ -61,11 +65,11 @@ const LoginSignUpMobile = ({
resetTimeout();
timeoutRef.current = setTimeout(
() => {
setIndex((prevIndex) => prevIndex + 1
setIndex(
(prevIndex) => prevIndex + 1
// prevIndex === slideContents.length - 1 ? 0 : prevIndex + 1
)
if (index === slideContents.length)
setTimeout(setIndex(1), 1000)
);
if (index === slideContents.length) setTimeout(setIndex(1), 1000);
},
delay
@ -76,10 +80,6 @@ const LoginSignUpMobile = ({
};
}, [index]);
const [level, setLevel] = useState("phonenumber");
const [signUpFields, setSignUpFiels] = useState({});
const [error, setError] = useState("");
@ -130,19 +130,19 @@ const LoginSignUpMobile = ({
signUpFields?.cellphone?.slice(0, 2) === "09" &&
signUpFields?.cellphone.length === 11
) {
setSteps(2)
setSteps(2);
sendPhoneNumber({ cellphone: signUpFields?.cellphone });
setError(undefined);
console.log(signUpFields.cellphone)
console.log(signUpFields.cellphone);
} else {
setError("شماره موبایل خود را چک کنید.");
}
};
const checkOtp = () => {
if (steps !== 1 &&
if (
steps !== 1 &&
signUpFields?.otp1 &&
signUpFields?.otp2 &&
signUpFields?.otp3 &&
@ -159,8 +159,6 @@ const LoginSignUpMobile = ({
applicationToken: "22",
});
setError(undefined);
} else {
setError("کد وارد شده را چک کنید.");
}
@ -203,119 +201,128 @@ const LoginSignUpMobile = ({
{
id: 0,
image: firstPic,
title: 'یک معلم دیوانه در کمین شما نشسته است مراقب باشید',
description: 'معلمی که دانش آموزانش رو شب ها شکار می کند و این متن شاید باعث تعجب شما شده باشد که آیا طراح دیوانه شده است یا خیر ؟ ',
title: "یک معلم دیوانه در کمین شما نشسته است مراقب باشید",
description:
"معلمی که دانش آموزانش رو شب ها شکار می کند و این متن شاید باعث تعجب شما شده باشد که آیا طراح دیوانه شده است یا خیر ؟ ",
},
{
id: 1,
image: secondPic,
title: 'یک آزمون سخت و افتضاح در راه هست!',
description: 'لورم ایپسوم نمیخواستم استفاده کنم برای همین این متنای عجیب رو مینویسم ببینم چجوری میشه تهش بالاخره اونا هم قراره یه متن عجیب بنویسن ',
title: "یک آزمون سخت و افتضاح در راه هست!",
description:
"لورم ایپسوم نمیخواستم استفاده کنم برای همین این متنای عجیب رو مینویسم ببینم چجوری میشه تهش بالاخره اونا هم قراره یه متن عجیب بنویسن ",
},
{
id: 2,
image: thirdPic,
title: 'یک اسلاید عجیب غریب دیگر در راه هست',
description: 'معلمی که دانش آموزانش رو شب ها شکار می کند و این متن شاید باعث تعجب شما شده باشد که آیا طراح دیوانه شده است یا خیر ؟ ',
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 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)}>
{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`}>
<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> :
{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=" w-full flex flex-col items-center justify-center h-4/5">
<div
className="slideshowSlider w-full"
style={{ transform: `translate3d(${-index * 100}%, 0, 0)` }}
className="slideshow items-center justify-center"
style={{ direction: "ltr" }}
>
{[slideContents[slideContents.length - 1],
...slideContents, slideContents[0]
].map((item, index) => (
<div
className="slide"
key={`sildeNo${index}`}
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>
<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 className="slideshowDots">
{slideContents.map((_, idx) => (
<div
key={idx}
className={`slideshowDot${index === idx + 1 ? " active" : ""}`}
onClick={() => {
setIndex(idx + 1);
}}
></div>
))}
</div> */}
</div>
</div>
</>
}
)}
<p className="text-gray-500 text-sm mt-2 flex justify-center">
{
steps == 2 && (resend ?
{steps == 2 &&
(resend ? (
<div>
<span className="ml-2">کد تایید ارسال نشد؟</span>
<button className="text-red52"
<button
className="text-red52"
onClick={() => {
checkPhoneNumber(signUpFields?.cellphone);
setResend(false)
setResend(false);
}}
>درخواست مجدد کد تایید</button>
>
درخواست مجدد کد تایید
</button>
</div>
: <p className="w-4/5 ">
) : (
<p className="w-4/5 ">
یک کد چهار رقمی تا &nbsp;{" "}
<Timer seconds={120} refresh={() => { setResend(true) }} />
&nbsp; دیگر برای شماره
&nbsp;{" "}
<Timer
seconds={120}
refresh={() => {
setResend(true);
}}
/>
&nbsp; دیگر برای شماره &nbsp;{" "}
<span className="text-red52 text-sm">
{signUpFields?.cellphone}
</span>{" "}
&nbsp; ارسال خواهد شد.
</p>)
}
</p>
))}
</p>
{
steps == 0 &&
{steps == 0 && (
<div className="flex w-full items-center mt-4">
<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={() => {
setSteps(1);
}}
>
ورود
@ -324,27 +331,22 @@ const LoginSignUpMobile = ({
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"
onClick={() => {
setSteps(1);
setRegister(true);
setSignUp(true);
}}
>
ثبت نام
</Link>
</div>
}
{
steps == 1 &&
)}
{steps == 1 && (
<>
<Input
title={"شماره موبایل"}
name="cellphone"
regex={onInput.numberOnly}
onChange={(name, value) => onChange(name, value)}
value={signUpFields?.cellphone}
maxLength="11"
maxLength={11}
direction="ltr"
/>
<span className="text-red-500 text-xs">{error}</span>
@ -354,22 +356,15 @@ const LoginSignUpMobile = ({
className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center mt-4"
onClick={(e) => {
// setSteps(2);
checkPhoneNumber(e)
checkPhoneNumber(e);
}}
>
ارسال کد تاییدیه
</Link>
</>
}
{
steps == 2 &&
)}
{steps == 2 && (
<>
<div className="w-full flex flex-col mt-5">
<div className="w-full flex flex-row-reverse justify-center">
<input
@ -422,7 +417,10 @@ const LoginSignUpMobile = ({
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.englishAndNumberWithoutSpace(e.target.value))
(e.target.value =
onInput.englishAndNumberWithoutSpace(
e.target.value
))
)
}
maxlength="1"
@ -431,13 +429,11 @@ const LoginSignUpMobile = ({
</div>
<Link
to={register == true ? '/register' : `/`}
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)
checkOtp(e);
// activeLogin()
}}
>
تایید
@ -455,8 +451,7 @@ const LoginSignUpMobile = ({
</div>
</div>
</>
}
)}
{/* <div className="w-full flex flex-col items-center justify-center">
<p className="w-3/5 text-xs my-20 text-center text-red26">
@ -466,18 +461,11 @@ const LoginSignUpMobile = ({
</p>
<p className="text-gray-300 text-xs">1401 - 1400</p>
</div> */}
</div>
</div>
</div>
{signUp && <SignUpBox setSignUp={setSignUp} />}
</div>
);
};

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

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

@ -1,5 +1,5 @@
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 { connect } from "react-redux";
import { Link, useLocation } from "react-router-dom";
@ -36,7 +36,13 @@ const Services = ({
videos,
pushToCart,
pushSchoolToCart,
getUserInfo,
userInfo
}) => {
useEffect(()=>{
getUserInfo();
},[])
//-------------------------------------------------------------
const [filterCheck, setFilterCheck] = useState([
{
id: 1,
@ -153,7 +159,7 @@ const Services = ({
console.log(gameId);
//productClickHandler------------------
const productClickhandler=(product)=>{
const productClickhandler = (product) => {
setPopUpContent({
id: gameId,
title: product?.name,
@ -171,7 +177,7 @@ const Services = ({
setPopUp(true);
}
console.log(gameId);
}
};
//AddToCartHandler--------------------
const AddToCartHandler = (product) => {
@ -317,6 +323,7 @@ const Services = ({
productHolderHoverBorder="shadow-md"
teacher={product.vodTeacher}
catId={gameId}
userInfo={userInfo}
onClick={() => {
productClickhandler(product);
}}
@ -399,62 +406,7 @@ const Services = ({
{gameId !== 6 && (
<div className="flex items-center mx-4 my-4">
<svg
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>
<img src={filterIcon} alt="filterIcon" className="w-9" />
{filterCheck.map((filter) => (
<div
key={`FILTER_${filter.id}`}
@ -523,6 +475,7 @@ const Services = ({
productHolderHoverBorder="shadow-md"
teacher={product.vodTeacher}
catId={gameId}
userInfo={userInfo}
onClick={() => {
setPopUpContent({
id: gameId,
@ -637,6 +590,7 @@ const mapStateToProps = (state) => ({
grades: state.publicApi.grades,
gradeFilterBooks: state.book.gradeFilterBooks,
selectedGrade: state.book.selectedGrade,
userInfo: state.user.status,
});
const mapDispatchToProps = {
@ -645,6 +599,7 @@ const mapDispatchToProps = {
setHeaderOptions: publicApi.setHeaderOptions,
pushToCart: userProduct.add,
pushSchoolToCart: userProduct.addSchool,
getUserInfo: user.getProfile
};
export default connect(mapStateToProps, mapDispatchToProps)(Services);

Loading…
Cancel
Save