|
|
|
@ -6,6 +6,9 @@ import Select from "./Select/index"; |
|
|
|
|
import Input from "./Input/index"; |
|
|
|
|
import TextArea from "./TextArea/index"; |
|
|
|
|
import Upload from "./Upload/index"; |
|
|
|
|
import Gender from "./GenderSwitch/index"; |
|
|
|
|
import Birthdate from "./Birthdate/index"; |
|
|
|
|
import MultipleSelector from "./MultipleSelector/index"; |
|
|
|
|
|
|
|
|
|
import logo from "../../../assets/icons/logo.png"; |
|
|
|
|
import pic from "../../../assets/images/pic.png"; |
|
|
|
@ -13,12 +16,17 @@ import pic from "../../../assets/images/pic.png"; |
|
|
|
|
import "./index.scss"; |
|
|
|
|
|
|
|
|
|
const maxDesktopSize = 1250; |
|
|
|
|
const maxMobileSize = 550; |
|
|
|
|
|
|
|
|
|
const fontSize = { |
|
|
|
|
desktop: { |
|
|
|
|
h1: window.innerWidth > maxDesktopSize ? 25 : window.innerWidth / 55, |
|
|
|
|
p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 90, |
|
|
|
|
}, |
|
|
|
|
mobile: { |
|
|
|
|
h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18, |
|
|
|
|
p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 28, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
class Profile extends Component { |
|
|
|
|
state = { |
|
|
|
@ -30,6 +38,13 @@ class Profile extends Component { |
|
|
|
|
address: "", |
|
|
|
|
gender: "", |
|
|
|
|
userRoleId: "", |
|
|
|
|
nationalId: "", |
|
|
|
|
provinceId: "", |
|
|
|
|
cityId: "", |
|
|
|
|
zoneId: "", |
|
|
|
|
schoolId: "", |
|
|
|
|
postalCode: "", |
|
|
|
|
gradeId: [], |
|
|
|
|
validation: { |
|
|
|
|
firstName: { name: "نام", status: "" }, |
|
|
|
|
lastName: { name: "نام خانوادگی", status: "" }, |
|
|
|
@ -38,9 +53,15 @@ class Profile extends Component { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onChange = (name, value) => { |
|
|
|
|
this.setState({ |
|
|
|
|
[name]: value, |
|
|
|
|
}); |
|
|
|
|
if (name === "gardeId" && this.state.userRoleId === "معلم") { |
|
|
|
|
this.setState((prevState) => ({ |
|
|
|
|
gradeId: [...prevState.gradeId, value], |
|
|
|
|
})); |
|
|
|
|
} else { |
|
|
|
|
this.setState({ |
|
|
|
|
[name]: value, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
@ -68,7 +89,7 @@ class Profile extends Component { |
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
{window.innerWidth > 1000 ? ( |
|
|
|
|
<div className="auth-profile d-flex justify-content-center align-items-center"> |
|
|
|
|
<div className="auth-profile d-flex justify-content-center"> |
|
|
|
|
<div className="auth-profile__box d-flex flex-column p-4"> |
|
|
|
|
<h1 style={{ fontSize: fontSize.desktop.h1 }}>حساب کاربری</h1> |
|
|
|
|
<p style={{ fontSize: fontSize.desktop.p }}> |
|
|
|
@ -93,7 +114,7 @@ class Profile extends Component { |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Input |
|
|
|
|
name="lastName" |
|
|
|
|
label="نام و نام خانوادگی" |
|
|
|
|
label="نام خانوادگی" |
|
|
|
|
parent={this} |
|
|
|
|
defaultValue={profile.lastName} |
|
|
|
|
/> |
|
|
|
@ -107,27 +128,95 @@ class Profile extends Component { |
|
|
|
|
align="left" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Gender |
|
|
|
|
options={["دختر", "پسر"]} |
|
|
|
|
parent={this} |
|
|
|
|
name="gender" |
|
|
|
|
selectedOption={this.state.gender} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Input |
|
|
|
|
name="nationalId" |
|
|
|
|
label="کد ملی" |
|
|
|
|
parent={this} |
|
|
|
|
align="left" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Birthdate /> |
|
|
|
|
</div> |
|
|
|
|
{/* <div className="mb-2"> |
|
|
|
|
<Input name="password" label="رمز عبور" parent={this} /> |
|
|
|
|
</div> */} |
|
|
|
|
</div> |
|
|
|
|
<div style={{ width: "48%" }}> |
|
|
|
|
<div className="mb-2" style={{ minWidth: "100%" }}> |
|
|
|
|
<Select |
|
|
|
|
<Gender |
|
|
|
|
parent={this} |
|
|
|
|
options={["معلم", "دانش آموز"]} |
|
|
|
|
name="userRoleId" |
|
|
|
|
label={"عنوان"} |
|
|
|
|
selectedOption={this.state.userRoleId} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
{this.state.userRoleId === "دانش آموز" ? ( |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={["دختر", "پسر"]} |
|
|
|
|
name="gender" |
|
|
|
|
label={"جنسیت"} |
|
|
|
|
/> |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={[ |
|
|
|
|
"1", |
|
|
|
|
"2", |
|
|
|
|
"3", |
|
|
|
|
"4", |
|
|
|
|
"5", |
|
|
|
|
"6", |
|
|
|
|
"7", |
|
|
|
|
"8", |
|
|
|
|
"9", |
|
|
|
|
"10", |
|
|
|
|
"11", |
|
|
|
|
"12", |
|
|
|
|
]} |
|
|
|
|
name="gradeId" |
|
|
|
|
label={"پایه تحصیلی"} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
{this.state.userRoleId === "معلم" ? ( |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<MultipleSelector |
|
|
|
|
parent={this} |
|
|
|
|
options={[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]} |
|
|
|
|
name="gradeId" |
|
|
|
|
label={"پایه تحصیلی"} |
|
|
|
|
selectedOptions={this.state.gradeId} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
|
|
|
|
|
{this.state.userRoleId === "دانش آموز" && |
|
|
|
|
this.state.gradeId > 9 ? ( |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={[ |
|
|
|
|
"ریاضی", |
|
|
|
|
"تجربی", |
|
|
|
|
"انسانی", |
|
|
|
|
"فنی حرفهای", |
|
|
|
|
"کاردانش", |
|
|
|
|
"معارف", |
|
|
|
|
]} |
|
|
|
|
name="field" |
|
|
|
|
label={"رشته تحصیلی"} |
|
|
|
|
selectedOptions={this.state.gradeId} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
|
|
|
|
|
<div className="mb-2" style={{ minWidth: "100%" }}> |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
@ -144,6 +233,47 @@ class Profile extends Component { |
|
|
|
|
label={"شهرستان"} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={["chaharbagh", "mahalat"]} |
|
|
|
|
name="zoneId" |
|
|
|
|
label={"شهر/روستا"} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
{this.state.userRoleId === "دانش آموز" ? ( |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Input |
|
|
|
|
parent={this} |
|
|
|
|
name="schoolId" |
|
|
|
|
label={"نام مدرسه"} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
{this.state.userRoleId === "معلم" ? ( |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Input |
|
|
|
|
parent={this} |
|
|
|
|
name="schoolId" |
|
|
|
|
label={"محل تدریس"} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<Input |
|
|
|
|
parent={this} |
|
|
|
|
name="postalCode" |
|
|
|
|
label={"کد پستی"} |
|
|
|
|
align="left" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<div className="mb-2"> |
|
|
|
|
<TextArea |
|
|
|
|
parent={this} |
|
|
|
|
label={"آدرس محل سکونت"} |
|
|
|
|
name="address" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<div className="auth-profile__box--form__footer d-flex justify-content-center"> |
|
|
|
|
<button>ذخیره</button> |
|
|
|
|
</div> |
|
|
|
@ -155,24 +285,139 @@ class Profile extends Component { |
|
|
|
|
{window.innerWidth < 1000 ? ( |
|
|
|
|
<div className="mobile-auth-profile d-flex flex-column"> |
|
|
|
|
<img src={logo} alt="دانوین" /> |
|
|
|
|
<h1>حساب کاربری</h1> |
|
|
|
|
<p>لطفا مشحصات خود را به صورت کامل وارد نمایید</p> |
|
|
|
|
<Upload name="file" /> |
|
|
|
|
<Input name="name" label="نام و نام خانوادگی" /> |
|
|
|
|
<Input name="username" label="نام کاربری" /> |
|
|
|
|
<Input name="password" label="رمز عبور" /> |
|
|
|
|
<h1 style={{ fontSize: fontSize.mobile.h1 }}>حساب کاربری</h1> |
|
|
|
|
<p style={{ fontSize: fontSize.mobile.p }}> |
|
|
|
|
لطفا مشحصات خود را به صورت کامل وارد نمایید |
|
|
|
|
</p> |
|
|
|
|
<Upload name="file" parent={this} /> |
|
|
|
|
<Input |
|
|
|
|
name="firstName" |
|
|
|
|
label="نام" |
|
|
|
|
parent={this} |
|
|
|
|
defaultValue={profile.firstName} |
|
|
|
|
/> |
|
|
|
|
<Input |
|
|
|
|
name="lastName" |
|
|
|
|
label="نام خانوادگی" |
|
|
|
|
parent={this} |
|
|
|
|
defaultValue={profile.lastName} |
|
|
|
|
/> |
|
|
|
|
<Input |
|
|
|
|
name="username" |
|
|
|
|
label="نام کاربری" |
|
|
|
|
parent={this} |
|
|
|
|
align="left" |
|
|
|
|
/> |
|
|
|
|
<Gender |
|
|
|
|
options={["دختر", "پسر"]} |
|
|
|
|
parent={this} |
|
|
|
|
name="gender" |
|
|
|
|
selectedOption={this.state.gender} |
|
|
|
|
/> |
|
|
|
|
<Input |
|
|
|
|
name="nationalId" |
|
|
|
|
label="کد ملی" |
|
|
|
|
parent={this} |
|
|
|
|
align="left" |
|
|
|
|
/> |
|
|
|
|
<Birthdate /> |
|
|
|
|
<Gender |
|
|
|
|
parent={this} |
|
|
|
|
options={["معلم", "دانش آموز"]} |
|
|
|
|
name="userRoleId" |
|
|
|
|
selectedOption={this.state.userRoleId} |
|
|
|
|
/> |
|
|
|
|
{this.state.userRoleId === "دانش آموز" ? ( |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={[ |
|
|
|
|
"1", |
|
|
|
|
"2", |
|
|
|
|
"3", |
|
|
|
|
"4", |
|
|
|
|
"5", |
|
|
|
|
"6", |
|
|
|
|
"7", |
|
|
|
|
"8", |
|
|
|
|
"9", |
|
|
|
|
"10", |
|
|
|
|
"11", |
|
|
|
|
"12", |
|
|
|
|
]} |
|
|
|
|
name="gradeId" |
|
|
|
|
label={"پایه تحصیلی"} |
|
|
|
|
/> |
|
|
|
|
) : null} |
|
|
|
|
{this.state.userRoleId === "معلم" ? ( |
|
|
|
|
<MultipleSelector |
|
|
|
|
parent={this} |
|
|
|
|
options={[ |
|
|
|
|
"1", |
|
|
|
|
"2", |
|
|
|
|
"3", |
|
|
|
|
"4", |
|
|
|
|
"5", |
|
|
|
|
"6", |
|
|
|
|
"7", |
|
|
|
|
"8", |
|
|
|
|
"9", |
|
|
|
|
"10", |
|
|
|
|
"11", |
|
|
|
|
"12", |
|
|
|
|
]} |
|
|
|
|
name="gradeId" |
|
|
|
|
label={"پایه تحصیلی"} |
|
|
|
|
selectedOptions={this.state.gradeId} |
|
|
|
|
/> |
|
|
|
|
) : null} |
|
|
|
|
{this.state.userRoleId === "دانش آموز" && |
|
|
|
|
this.state.gradeId.length > 0 ? ( |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={[ |
|
|
|
|
"ریاضی", |
|
|
|
|
"تجربی", |
|
|
|
|
"انسانی", |
|
|
|
|
"فنی حرفهای", |
|
|
|
|
"کاردانش", |
|
|
|
|
"معارف", |
|
|
|
|
]} |
|
|
|
|
name="field" |
|
|
|
|
label={"رشته تحصیلی"} |
|
|
|
|
selectedOptions={this.state.gradeId} |
|
|
|
|
/> |
|
|
|
|
) : null} |
|
|
|
|
|
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={["karaj", "tehran"]} |
|
|
|
|
name="province" |
|
|
|
|
name="provinceId" |
|
|
|
|
label={"استان"} |
|
|
|
|
/> |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={["karaj", "tehran"]} |
|
|
|
|
name="city" |
|
|
|
|
name="cityId" |
|
|
|
|
label={"شهرستان"} |
|
|
|
|
/> |
|
|
|
|
<Select |
|
|
|
|
parent={this} |
|
|
|
|
options={["chaharbagh", "mahalat"]} |
|
|
|
|
name="zoneId" |
|
|
|
|
label={"شهر/روستا"} |
|
|
|
|
/> |
|
|
|
|
{this.state.userRoleId === "دانش آموز" ? ( |
|
|
|
|
<Input parent={this} name="schoolId" label={"نام مدرسه"} /> |
|
|
|
|
) : null} |
|
|
|
|
{this.state.userRoleId === "معلم" ? ( |
|
|
|
|
<Input parent={this} name="schoolId" label={"محل تدریس"} /> |
|
|
|
|
) : null} |
|
|
|
|
<Input |
|
|
|
|
parent={this} |
|
|
|
|
name="postalCode" |
|
|
|
|
label={"کد پستی"} |
|
|
|
|
align="left" |
|
|
|
|
/> |
|
|
|
|
<TextArea parent={this} label={"آدرس محل سکونت"} name="address" /> |
|
|
|
|
<div className="mobile-auth-profile__footer d-flex justify-content-center"> |
|
|
|
|
<button onClick={() => this.onSubmit()}>ذخیره</button> |
|
|
|
|