|
|
@ -29,6 +29,7 @@ function Profile({ |
|
|
|
provinceList, |
|
|
|
provinceList, |
|
|
|
cityList, |
|
|
|
cityList, |
|
|
|
setHeaderOptions, |
|
|
|
setHeaderOptions, |
|
|
|
|
|
|
|
headerOptions, |
|
|
|
loading, |
|
|
|
loading, |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
let navigate = useNavigate(); |
|
|
|
let navigate = useNavigate(); |
|
|
@ -69,18 +70,7 @@ function Profile({ |
|
|
|
}, [user]); |
|
|
|
}, [user]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (!isMobile) { |
|
|
|
setHeaderOptions(headerOptions); |
|
|
|
setHeaderOptions({ |
|
|
|
|
|
|
|
logo: true, |
|
|
|
|
|
|
|
hamburgerMenu: true, |
|
|
|
|
|
|
|
qr: true, |
|
|
|
|
|
|
|
title: false, |
|
|
|
|
|
|
|
back: false, |
|
|
|
|
|
|
|
shown: true, |
|
|
|
|
|
|
|
menu: false, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getProvince(); |
|
|
|
getProvince(); |
|
|
|
getCity({ provinceId: profile.provinceId }); |
|
|
|
getCity({ provinceId: profile.provinceId }); |
|
|
|
}, []); |
|
|
|
}, []); |
|
|
@ -216,33 +206,23 @@ function Profile({ |
|
|
|
// if (setDone) return <Navigate path="/" />;
|
|
|
|
// if (setDone) return <Navigate path="/" />;
|
|
|
|
|
|
|
|
|
|
|
|
return isMobile ? ( |
|
|
|
return isMobile ? ( |
|
|
|
<div className="profile main d-flex justify-content-center"> |
|
|
|
<div className="flex flex-col gap-6 lg:hidden px-4 pb-20"> |
|
|
|
<main> |
|
|
|
<header className="flex flex-col gap-2 w-full"> |
|
|
|
<header className="d-flex align-items-center justify-content-between"> |
|
|
|
<h1 className="text-base text-gray1">{window.t("حساب کاربری")}</h1> |
|
|
|
<div> |
|
|
|
<p className="text-sm text-gray1"> |
|
|
|
<h1>{window.t("حساب کاربری")}</h1> |
|
|
|
{window.t("لطفا مشخصات خود را به صورت کامل نمایید.")} |
|
|
|
<p>{window.t("لطفا مشخصات خود را به صورت کامل نمایید.")}</p> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mobile justify-content-center"> |
|
|
|
|
|
|
|
<Upload |
|
|
|
|
|
|
|
name="file" |
|
|
|
|
|
|
|
value={formData?.file} |
|
|
|
|
|
|
|
onChange={onChange} |
|
|
|
|
|
|
|
label={window.t("فایل")} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</header> |
|
|
|
</header> |
|
|
|
<div className="profile__box d-flex" onSubmit={(e) => onSubmit()}> |
|
|
|
<form |
|
|
|
<div className="profile__box--section"> |
|
|
|
className="flex flex-col items-center w-full gap-4" |
|
|
|
<div className="mb-2 desktop justify-content-center"> |
|
|
|
onSubmit={(e) => e.preventDefault()} |
|
|
|
|
|
|
|
> |
|
|
|
<Upload |
|
|
|
<Upload |
|
|
|
name="file" |
|
|
|
name="file" |
|
|
|
value={formData?.file} |
|
|
|
value={formData?.file} |
|
|
|
onChange={onChange} |
|
|
|
onChange={onChange} |
|
|
|
label={window.t("فایل")} |
|
|
|
label={window.t("فایل")} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="firstName" |
|
|
|
name="firstName" |
|
|
|
label={window.t("نام")} |
|
|
|
label={window.t("نام")} |
|
|
@ -254,8 +234,6 @@ function Profile({ |
|
|
|
} |
|
|
|
} |
|
|
|
regex={(val) => val} |
|
|
|
regex={(val) => val} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="lastName" |
|
|
|
name="lastName" |
|
|
|
label={window.t("نام نام خانوادگی")} |
|
|
|
label={window.t("نام نام خانوادگی")} |
|
|
@ -267,8 +245,6 @@ function Profile({ |
|
|
|
onInput={onInput.persianOnly} |
|
|
|
onInput={onInput.persianOnly} |
|
|
|
regex={(val) => val} |
|
|
|
regex={(val) => val} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="username" |
|
|
|
name="username" |
|
|
|
label={window.t("نام کاربری")} |
|
|
|
label={window.t("نام کاربری")} |
|
|
@ -279,8 +255,6 @@ function Profile({ |
|
|
|
align="left" |
|
|
|
align="left" |
|
|
|
regex={(val) => onInput.englishAndNumberWithoutSpace(val)} |
|
|
|
regex={(val) => onInput.englishAndNumberWithoutSpace(val)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Gender |
|
|
|
<Gender |
|
|
|
options={[window.t("دختر"), window.t("پسر")]} |
|
|
|
options={[window.t("دختر"), window.t("پسر")]} |
|
|
|
name="gender" |
|
|
|
name="gender" |
|
|
@ -288,10 +262,8 @@ function Profile({ |
|
|
|
onChange={(name, value) => |
|
|
|
onChange={(name, value) => |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
label="" |
|
|
|
label="جنسیت" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="nationalId" |
|
|
|
name="nationalId" |
|
|
|
label={window.t("کد ملی/اتباع")} |
|
|
|
label={window.t("کد ملی/اتباع")} |
|
|
@ -303,8 +275,6 @@ function Profile({ |
|
|
|
} |
|
|
|
} |
|
|
|
regex={(val) => onInput.numberOnly(val)} |
|
|
|
regex={(val) => onInput.numberOnly(val)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Birthdate |
|
|
|
<Birthdate |
|
|
|
name="birthDate" |
|
|
|
name="birthDate" |
|
|
|
onChange={(name, value) => |
|
|
|
onChange={(name, value) => |
|
|
@ -312,8 +282,6 @@ function Profile({ |
|
|
|
} |
|
|
|
} |
|
|
|
value={formData?.birthDate} |
|
|
|
value={formData?.birthDate} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="password" |
|
|
|
name="password" |
|
|
|
label={window.t("رمز عبور")} |
|
|
|
label={window.t("رمز عبور")} |
|
|
@ -324,10 +292,6 @@ function Profile({ |
|
|
|
align="left" |
|
|
|
align="left" |
|
|
|
regex={(val) => onInput.englishAndNumberWithoutSpace(val)} |
|
|
|
regex={(val) => onInput.englishAndNumberWithoutSpace(val)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="profile__box--section"> |
|
|
|
|
|
|
|
<div className="mb-2" style={{ minWidth: "100%" }}> |
|
|
|
|
|
|
|
<Gender |
|
|
|
<Gender |
|
|
|
options={[window.t("معلم"), window.t("دانش آموز")]} |
|
|
|
options={[window.t("معلم"), window.t("دانش آموز")]} |
|
|
|
name="status" |
|
|
|
name="status" |
|
|
@ -335,9 +299,7 @@ function Profile({ |
|
|
|
selectedOption={formData?.status} |
|
|
|
selectedOption={formData?.status} |
|
|
|
onChange={onChange} |
|
|
|
onChange={onChange} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
{formData?.status === 1 ? ( |
|
|
|
{formData?.status === 1 ? ( |
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Select |
|
|
|
<Select |
|
|
|
options={grades} |
|
|
|
options={grades} |
|
|
|
name="gradeIds" |
|
|
|
name="gradeIds" |
|
|
@ -347,10 +309,8 @@ function Profile({ |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
{formData?.status === 2 ? ( |
|
|
|
{formData?.status === 2 ? ( |
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<MultipleSelector |
|
|
|
<MultipleSelector |
|
|
|
options={grades} |
|
|
|
options={grades} |
|
|
|
name="gradeIds" |
|
|
|
name="gradeIds" |
|
|
@ -362,12 +322,10 @@ function Profile({ |
|
|
|
align="right" |
|
|
|
align="right" |
|
|
|
defaultValue={profile} |
|
|
|
defaultValue={profile} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
|
|
|
|
|
|
|
|
{formData?.status === window.t("دانش آموز") && |
|
|
|
{formData?.status === window.t("دانش آموز") && |
|
|
|
formData?.gradeIds > 9 ? ( |
|
|
|
formData?.gradeIds > 9 ? ( |
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Select |
|
|
|
<Select |
|
|
|
options={[ |
|
|
|
options={[ |
|
|
|
window.t("ریاضی"), |
|
|
|
window.t("ریاضی"), |
|
|
@ -384,9 +342,7 @@ function Profile({ |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
<div className="mb-2" style={{ minWidth: "100%" }}> |
|
|
|
|
|
|
|
<Select |
|
|
|
<Select |
|
|
|
options={provinceList} |
|
|
|
options={provinceList} |
|
|
|
name="provinceId" |
|
|
|
name="provinceId" |
|
|
@ -396,8 +352,6 @@ function Profile({ |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Select |
|
|
|
<Select |
|
|
|
options={cityList} |
|
|
|
options={cityList} |
|
|
|
name="cityId" |
|
|
|
name="cityId" |
|
|
@ -407,9 +361,7 @@ function Profile({ |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
{formData?.status == 1 ? ( |
|
|
|
{formData?.status == 1 ? ( |
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="schools" |
|
|
|
name="schools" |
|
|
|
label={window.t("نام مدرسه")} |
|
|
|
label={window.t("نام مدرسه")} |
|
|
@ -419,10 +371,8 @@ function Profile({ |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
{formData?.status == 2 ? ( |
|
|
|
{formData?.status == 2 ? ( |
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="schools" |
|
|
|
name="schools" |
|
|
|
label={window.t("محل تدریس")} |
|
|
|
label={window.t("محل تدریس")} |
|
|
@ -430,7 +380,6 @@ function Profile({ |
|
|
|
regex={(val) => onInput.persianOnly(val)} |
|
|
|
regex={(val) => onInput.persianOnly(val)} |
|
|
|
onChange={onChange} |
|
|
|
onChange={onChange} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
{formData?.status == 2 ? ( |
|
|
|
{formData?.status == 2 ? ( |
|
|
|
<Document |
|
|
|
<Document |
|
|
@ -441,7 +390,6 @@ function Profile({ |
|
|
|
name="docFileIds" |
|
|
|
name="docFileIds" |
|
|
|
/> |
|
|
|
/> |
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="postalCode" |
|
|
|
name="postalCode" |
|
|
|
placeholder={window.t("کد پستی")} |
|
|
|
placeholder={window.t("کد پستی")} |
|
|
@ -452,8 +400,6 @@ function Profile({ |
|
|
|
value={formData?.postalCode} |
|
|
|
value={formData?.postalCode} |
|
|
|
regex={(val) => onInput.numberOnly(val)} |
|
|
|
regex={(val) => onInput.numberOnly(val)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
|
|
|
<TextArea |
|
|
|
<TextArea |
|
|
|
placeholder={window.t("آدرس محل سکونت")} |
|
|
|
placeholder={window.t("آدرس محل سکونت")} |
|
|
|
name="address" |
|
|
|
name="address" |
|
|
@ -462,13 +408,13 @@ function Profile({ |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<button |
|
|
|
<div className="profile__box--form__footer d-flex justify-content-center"> |
|
|
|
className="w-full bg-blueC0 py-3 text-base text-white rounded-sm" |
|
|
|
<button onClick={() => onSubmit()}>{window.t("ذخیره")}</button> |
|
|
|
onClick={() => onSubmit()} |
|
|
|
</div> |
|
|
|
> |
|
|
|
</div> |
|
|
|
{window.t("ذخیره")} |
|
|
|
</div> |
|
|
|
</button> |
|
|
|
</main> |
|
|
|
</form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<div |
|
|
|
<div |
|
|
@ -504,7 +450,6 @@ function Profile({ |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
setFormData({ ...formData, [name]: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
regex={(val) => val} |
|
|
|
regex={(val) => val} |
|
|
|
padding="py-4" |
|
|
|
|
|
|
|
value={formData?.lastName} |
|
|
|
value={formData?.lastName} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -569,7 +514,12 @@ function Profile({ |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div className="w-full"></div> |
|
|
|
<div className="w-full"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<button className="w-full bg-blueC0 py-3 text-tiny text-white rounded-sm" onClick={() => onSubmit()}>{window.t("ذخیره")}</button> |
|
|
|
<button |
|
|
|
|
|
|
|
className="w-full bg-blueC0 py-3 text-tiny text-white rounded-sm" |
|
|
|
|
|
|
|
onClick={() => onSubmit()} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{window.t("ذخیره")} |
|
|
|
|
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|