diff --git a/package-lock.json b/package-lock.json index a209699..88bf2af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "draft-js": "^0.11.7", "jalaali-js": "^1.2.3", "jalali-moment": "^3.3.10", + "leaflet": "^1.7.1", "lord-icon-element": "^3.3.3", "lottie-web": "^5.8.1", "mapir-react-component": "^2.0.1", @@ -28,6 +29,7 @@ "react-dropzone": "^11.4.2", "react-icons": "^4.3.1", "react-indiana-drag-scroll": "^2.1.0", + "react-leaflet": "^3.2.5", "react-multi-date-picker": "^3.3.0", "react-redux": "^7.2.6", "react-router-dom": "^6.2.1", @@ -2833,6 +2835,16 @@ "node": ">= 8" } }, + "node_modules/@react-leaflet/core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz", + "integrity": "sha512-7PGLWa9MZ5x/cWy8EH2VzI4T8q5WpuHbixzCDXqixP/WyqwIrg5NDUPgYuFnB4IEIZF+6nA265mYzswFo/h1Pw==", + "peerDependencies": { + "leaflet": "^1.7.1", + "react": "^17.0.1", + "react-dom": "^17.0.1" + } + }, "node_modules/@react-pdf-viewer/core": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@react-pdf-viewer/core/-/core-3.1.2.tgz", @@ -11403,6 +11415,11 @@ "language-subtag-registry": "~0.3.2" } }, + "node_modules/leaflet": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.7.1.tgz", + "integrity": "sha512-/xwPEBidtg69Q3HlqPdU3DnrXQOvQU/CCHA1tcDQVzOwm91YMYaILjNp7L4Eaw5Z4sOYdbBz6koWyibppd8Zqw==" + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -14436,6 +14453,19 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, + "node_modules/react-leaflet": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/react-leaflet/-/react-leaflet-3.2.5.tgz", + "integrity": "sha512-Z3KZ+4SijsRbbrt2I1a3ZDY6+V6Pm91eYTdxTN18G6IOkFRsJo1BuSPLFnyFrlF3WDjQFPEcTPkEgD1VEeAoBg==", + "dependencies": { + "@react-leaflet/core": "^1.1.1" + }, + "peerDependencies": { + "leaflet": "^1.7.1", + "react": "^17.0.1", + "react-dom": "^17.0.1" + } + }, "node_modules/react-mapbox-gl": { "version": "4.8.6", "resolved": "https://registry.npmjs.org/react-mapbox-gl/-/react-mapbox-gl-4.8.6.tgz", @@ -19533,6 +19563,12 @@ } } }, + "@react-leaflet/core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz", + "integrity": "sha512-7PGLWa9MZ5x/cWy8EH2VzI4T8q5WpuHbixzCDXqixP/WyqwIrg5NDUPgYuFnB4IEIZF+6nA265mYzswFo/h1Pw==", + "requires": {} + }, "@react-pdf-viewer/core": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@react-pdf-viewer/core/-/core-3.1.2.tgz", @@ -25844,6 +25880,11 @@ "language-subtag-registry": "~0.3.2" } }, + "leaflet": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.7.1.tgz", + "integrity": "sha512-/xwPEBidtg69Q3HlqPdU3DnrXQOvQU/CCHA1tcDQVzOwm91YMYaILjNp7L4Eaw5Z4sOYdbBz6koWyibppd8Zqw==" + }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -27910,6 +27951,14 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, + "react-leaflet": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/react-leaflet/-/react-leaflet-3.2.5.tgz", + "integrity": "sha512-Z3KZ+4SijsRbbrt2I1a3ZDY6+V6Pm91eYTdxTN18G6IOkFRsJo1BuSPLFnyFrlF3WDjQFPEcTPkEgD1VEeAoBg==", + "requires": { + "@react-leaflet/core": "^1.1.1" + } + }, "react-mapbox-gl": { "version": "4.8.6", "resolved": "https://registry.npmjs.org/react-mapbox-gl/-/react-mapbox-gl-4.8.6.tgz", diff --git a/package.json b/package.json index 5526417..c1b6087 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "draft-js": "^0.11.7", "jalaali-js": "^1.2.3", "jalali-moment": "^3.3.10", + "leaflet": "^1.7.1", "lord-icon-element": "^3.3.3", "lottie-web": "^5.8.1", "mapir-react-component": "^2.0.1", @@ -23,6 +24,7 @@ "react-dropzone": "^11.4.2", "react-icons": "^4.3.1", "react-indiana-drag-scroll": "^2.1.0", + "react-leaflet": "^3.2.5", "react-multi-date-picker": "^3.3.0", "react-redux": "^7.2.6", "react-router-dom": "^6.2.1", diff --git a/src/App.js b/src/App.js index 51c7a5f..157ef7a 100644 --- a/src/App.js +++ b/src/App.js @@ -631,8 +631,11 @@ function App() { } } } - let loginStorage = localStorage.getItem('login') - const [LOGIN,setLOGIN]=useState(true); + let loginStorage = localStorage.getItem('userData'); + let userData = JSON.parse(loginStorage); + console.log(loginStorage == null); + console.log(userData) + const [LOGIN,setLOGIN]=useState(loginStorage == undefined ? false : true); const activeLogin=()=>{ setLOGIN(true) localStorage.setItem('login', true) @@ -645,9 +648,9 @@ function App() { localStorage.setItem('login', false) }; - useEffect(() => { - setLOGIN(true); - }, [loginStorage]) + // useEffect(() => { + // setLOGIN(true); + // }, [loginStorage]) //--UserFullInfo--------------------- const [ActiveUserFullInfo, setActiveUserFullInfo] = useState(false); @@ -667,14 +670,17 @@ function App() {
{LOGIN &&
} - {LOGIN &&
diff --git a/src/components/Map/index.js b/src/components/Map/index.js index 3dd254a..52c849c 100644 --- a/src/components/Map/index.js +++ b/src/components/Map/index.js @@ -1,6 +1,6 @@ import Mapir from "mapir-react-component"; - -// import blueMark from '../../../assets/icons/marker-blue.png'; +import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet' +import blueMark from './pin.png'; // import './index.scss'; @@ -19,21 +19,16 @@ const Map = Mapir.setToken({ export default function location() { return ( - - - + + + + {/* + A pretty CSS3 popup.
Easily customizable. +
*/} +
+
); } \ No newline at end of file diff --git a/src/components/Map/pin.png b/src/components/Map/pin.png new file mode 100644 index 0000000..41d0505 Binary files /dev/null and b/src/components/Map/pin.png differ diff --git a/src/components/Product/index.js b/src/components/Product/index.js index 0508a43..541befd 100644 --- a/src/components/Product/index.js +++ b/src/components/Product/index.js @@ -75,7 +75,7 @@ const ProductDesign = ({ ] - if (catId == 1) { + if (catId == 3) { return (
@@ -188,7 +188,7 @@ const ProductDesign = ({
) } - if(catId == 3){ + if(catId == 2){ return(
{ setCodeId({ offCodeValue: value, userId: userId, id: factorId }); } return ( -
+
setValue(_onInput.englishAndNumberWithoutSpace(e.target.value))} /> - - + +
); } diff --git a/src/components/ShoppingCart/Product/index.js b/src/components/ShoppingCart/Product/index.js index bae9473..bc987ea 100644 --- a/src/components/ShoppingCart/Product/index.js +++ b/src/components/ShoppingCart/Product/index.js @@ -6,8 +6,9 @@ import { userProduct } from "../../../redux/actions"; // import bookImage from "../../../assets/images/zist-11.svg"; import exitIcon from "../../../assets/img/exit.svg"; import deleteIcon from "../../../assets/img/delete.svg"; +import separate from "../../../utils/separate"; -function Product({ product, grades, pushToCart, isMobile }) { +function Product({ product, grades, pushToCart, isMobile, productTypes }) { // return isMobile ? ( //
//
@@ -146,10 +147,10 @@ function Product({ product, grades, pushToCart, isMobile }) { //
//
return ( -
+
-
{product?.product?.book?.category}
-

{product?.product?.book?.name}

+
{productTypes.find(itm => itm.id == product?.productType).title}
+

{product?.product?.name}

@@ -157,7 +158,7 @@ function Product({ product, grades, pushToCart, isMobile }) { { product.count > 1 &&

{product?.count} عدد

} -

{product?.product?.price} تومان

+

{separate(product?.product?.price)} تومان

({ grades: state.publicApi.grades, isMobile: state.publicApi.isMobile, + productTypes: state.publicApi.productTypes }); const mapDispatchToProps = { diff --git a/src/components/ShoppingCart/index.js b/src/components/ShoppingCart/index.js index af7c00c..ea2fd7e 100644 --- a/src/components/ShoppingCart/index.js +++ b/src/components/ShoppingCart/index.js @@ -10,6 +10,7 @@ import Button from "../../components/Button"; import alertIcon from "../../assets/img/alert.svg"; import { connect } from "react-redux"; +import separate from "../../utils/separate"; function ShoppingCart({ isDark, @@ -25,206 +26,81 @@ function ShoppingCart({ payFactor, headerOptions, setHeaderOptions, + schoolList, desktopContentTransform, + pushToCart, + pushSchoolToCart }) { const [phase, setPhase] = useState("products"); useEffect(() => { getList(); - getFactorInfo({ userId }); + getFactorInfo({userId}); setHeaderOptions(headerOptions); }, []); - // const Table = () => { - // return ( - //
- //
- // - // کالاهای انتخابی{" "} - // - // - // تعداد سفارش - // - // - // مبلغ - // - //
- //
    - // {list.map((product, index) => ( - // - // ))} - //
- //
- // ); - // }; - - // const PriceStatus = ({ name, value, type }) => { - // return isMobile ? ( - //
- // {name} - // - // {value + " " + "تومان"} - // - //
- // ) : ( - //
- // - // {name} - // - // - // {value} - // - // تومان - // - // - //
- // ); - // }; - - // isMobile ? ( - //
- // {list.map((product, index) => ( - // - // ))} - // - //
- // - // - // - //
- //
- // - // جمع کل سبد خرید - // - //

- // {factorInfo?.payPrice + " " + "تومان"} - //

- //
- - //
- // ) : ( - //
- //
- // {/* {phase === "products" && } - // {phase === "delivery-form" && } */} - // - //
- //
- // - // - // - //
- //
- // - // جمع کل سبد خرید - // - //

- // {factorInfo?.payPrice} - // تومان - //

- //
- - // {phase === "delivery-form" && ( - //
- // - // انتخاب شیوه پرداخت - // - //
- // )} - - //
- // return(isMobile ?
3 && 'overflow-x-hidden overflow-scroll'}`} style={{height: '35%'}}> - + { + schoolList.map((school, index) => ( +
+
+
{school?.product?.book?.category}
+

{school?.product?.name}

+
+
+ +
+ { + school.count > 1 &&

{school?.count} عدد

+ } +

{separate(school?.product?.price)} تومان

+ +
+
+ pushToCart( + { + productId: school?.productId, + userId: school?.userId, + count: school?.count == 1 ? -school?.count : -1, + }, + {}, + { id: school?.factorId } + ) + } + > + + + + {school.count == 1 ? + + + + + + + : + + + + + } + + + +
+
+
+ )) + } {list.map((product, index) => ( ))} @@ -248,7 +124,7 @@ function ShoppingCart({
+

+ توجه: + نحوه پرداخت برای رزرو پیش ثبت‌نام از طریق دکمه بالا خواهد بود +و می بایست ازین طریق جداگانه پرداخت گردد +

+ +
+ + +
+ pushSchoolToCart( + { + productId: school?.productId, + userId: school?.userId, + count: school?.count == 1 ? -school?.count : -1, + }, + {}, + { id: school?.factorId } + ) + } + > + + + + {school.count == 1 ? + + + + + + + : + + + + + } + + + +
+
+ + )) + } + { + schoolList.length > 0 &&
+ } {list.map((product, index) => ( ))} @@ -284,9 +223,9 @@ function ShoppingCart({ } diff --git a/src/components/header/Header.js b/src/components/header/Header.js index 6215ddd..d7b7dd9 100644 --- a/src/components/header/Header.js +++ b/src/components/header/Header.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import './Header.scss'; import searchIcon from "../../assets/img/Group 1148.svg"; @@ -13,26 +13,33 @@ import arrowIcon from './MobileSideMenu/arrow-down.svg' import exitIcon from '../../assets/img/group-9.svg' import backIcon from './arrow-left-1.svg'; import profileIcon from './MobileSideMenu/profile-active.svg' +import { user } from '../../redux/actions'; +import { grades } from '../../redux/reducers/public'; const Header = ({ isMobile, cart, - logOut + logOut, + setUserStatus, + user }) => { let today = moment().locale("fa").format("YYYY/M/D"); console.log("today:"); console.log(today); let weekday = new Date().getDay(); let weekdayList = ["یکشنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", 'پنج‌شنبه', 'جمعه', "شنبه"]; - console.log("weekday:"); - console.log(weekday); + // console.log("weekday:"); + // console.log(weekday); const [menuPopup, setMenuPopup] = useState(false); const [subMenu, setSubMenu] = useState(false); const location = useLocation(); const navigate = useNavigate(); + useEffect(() => { + setUserStatus() + }, []) return ( <> -
+
{ subMenu &&
setSubMenu(false)} className='w-full text-right border-b border-gray-200 py-2'> - افزودن حساب کاربری جدید + ویرایش حساب کاربری
} @@ -97,10 +104,10 @@ const Header = ({
- کوروش زراندوز + {user.displayName ? user.displayName : user?.firstName + ' ' + user?.lastName}
- پایه ششم + {grades[user.gradeIds]}
@@ -121,7 +128,7 @@ const Header = ({ {today} - روز ملی صنعت نفت + {/* روز ملی صنعت نفت */}
@@ -146,10 +153,10 @@ const Header = ({ <>
- ({ isMobile: state.publicApi.isMobile, - cart: state.userProduct.list + cart: state.userProduct.list, + user: state.user.status, }); const mapDispatchToProps = { + setUserStatus: user.setUserStatus }; export default connect(mapStateToProps, mapDispatchToProps)(Header); diff --git a/src/components/header/MobileSideMenu/index.js b/src/components/header/MobileSideMenu/index.js index 8c34b4c..51e52e0 100644 --- a/src/components/header/MobileSideMenu/index.js +++ b/src/components/header/MobileSideMenu/index.js @@ -20,6 +20,8 @@ import bookIconActive from './book-1-active.svg'; import smsIconActive from './sms-active.svg'; import mapIconActive from './map-active.svg'; import radarIconActive from './radar-1-active.svg'; +import { connect } from "react-redux"; +import { user } from "../../../redux/actions"; const MobileSideMenu = ({ profilePic, @@ -89,7 +91,7 @@ const MobileSideMenu = ({ }, ] return ( -
+
@@ -129,4 +131,13 @@ const MobileSideMenu = ({
) } -export default MobileSideMenu; \ No newline at end of file + +const mapStateToProps = (state) => ({ + +}); + +const mapDispatchToProps = { + logOut: user.logout, +}; + +export default connect(mapStateToProps, mapDispatchToProps)(MobileSideMenu); \ No newline at end of file diff --git a/src/components/input/index.js b/src/components/input/index.js index e2f2a74..6382c42 100644 --- a/src/components/input/index.js +++ b/src/components/input/index.js @@ -1,4 +1,5 @@ -import React from "react"; +import React, { useEffect } from "react"; +import _onInput from "../../utils/onInput"; const Input = ({ @@ -16,6 +17,13 @@ const Input = ({ max, onFocus }) => { + useEffect(() => { + + if(value !== null && value !== '' && value !== undefined){ + blurHandler(id ? id : 0) + } + + }, [value]) const focusHandler = (id) => { let inputs = document.querySelectorAll(".Login-box-form-item"); @@ -36,12 +44,14 @@ const Input = ({ let inputs = document.querySelectorAll(".Login-box-form-item-input"); let label = document.querySelectorAll(".Login-box-form-item-label"); let line = document.querySelectorAll(".Login-box-form-item-line"); - if (inputs[id].value === "") { + if (inputs[id]) { inputsBox[id].style.borderColor = "#EBEBEB"; - label[id].style.transform = "translate(0px,0px)"; + label[id].style.transform = "translate(-10px,-27px)"; label[id].style.color = "#959595"; - line[id].style.backgroundColor = "#EBEBEB"; + inputs[id].style.backgroundColor = "#fff"; + line[id].style.backgroundColor = "#fff"; } + }; return (
@@ -51,11 +61,13 @@ const Input = ({
{if(onFocus){onFocus();} focusHandler(id ? id : 0)}} + onBlur={() => blurHandler(id ? id : 0)} onChange={onChange} diff --git a/src/components/input/signUpInput.js b/src/components/input/signUpInput.js index cbe8f13..024aa80 100644 --- a/src/components/input/signUpInput.js +++ b/src/components/input/signUpInput.js @@ -111,7 +111,7 @@ const blurHandler = (id) => { className={_.join( [ - `flex-1 border border-gray-300 dark:bg-opacity-10 bg-transparent rounded-md outline-none py-3 px-4 text-tiny ${backgroundColor} ${align}`, + `flex-1 dark:bg-opacity-10 bg-transparent rounded-md outline-none py-3 px-4 text-tiny ${backgroundColor} ${align}`, inputStatusHandler( value, focusToggle, diff --git a/src/components/nav/Nav.js b/src/components/nav/Nav.js index 4730ad9..99d550a 100644 --- a/src/components/nav/Nav.js +++ b/src/components/nav/Nav.js @@ -8,18 +8,20 @@ import logo from "../../assets/img/logo.png"; import img1 from "../../assets/img/Group 1440.svg"; import { Link, useLocation } from "react-router-dom"; import MinimalNav from "./minimalNav"; +import { user } from "../../redux/actions"; // defineLordIconElement(loadAnimation); // let oldNavItemId = 1; -let location = window.location.pathname; const Nav = ({ logOut, isMobile, isLogin, + logout }) => { - + let locationL = useLocation(); + let location = locationL.pathname; const [type, setType] = useState('default'); const location2 = useLocation(); useEffect(() => { @@ -189,6 +191,7 @@ useEffect(() => { className="nav-menu-container-item w-full h-1/6 flex flex-col items-center justify-center hover:bg-color2_5 cursor-pointer" onClick={() => chaneNav(1)} > +
{ /> +
منوی اصلی
@@ -253,7 +257,8 @@ useEffect(() => { className="nav-menu-container-item w-full h-1/6 flex flex-col items-center justify-center hover:bg-color2_5 cursor-pointer" onClick={() => chaneNav(2)} > - + { opacity="0" /> +
انتخاب خدمات
@@ -330,17 +336,19 @@ useEffect(() => { className="nav-menu-container-item w-full h-1/6 flex flex-col items-center justify-center hover:bg-color2_5 cursor-pointer" onClick={() => chaneNav(3)} > - +
+ +
خدمات من
@@ -355,7 +363,8 @@ useEffect(() => { className="nav-menu-container-item w-full h-1/6 flex flex-col items-center justify-center hover:bg-color2_5 cursor-pointer" onClick={() => chaneNav(4)} > - + { /> +
+
چت با اساتید
@@ -409,7 +420,7 @@ useEffect(() => { className="nav-menu-container-item w-full h-1/6 flex flex-col items-center justify-center hover:bg-color2_5 cursor-pointer" onClick={() => chaneNav(5)} > - + @@ -425,7 +436,7 @@ useEffect(() => {
پشتیبانی
@@ -436,7 +447,7 @@ useEffect(() => { logout()} > {
خروج
@@ -521,6 +532,7 @@ const mapStateToProps = (state) => ({ }); const mapDispatchToProps = { + logout: user.logout, }; export default connect(mapStateToProps, mapDispatchToProps)(Nav); diff --git a/src/constants/defaultValues.js b/src/constants/defaultValues.js index 63e72a9..501cf93 100644 --- a/src/constants/defaultValues.js +++ b/src/constants/defaultValues.js @@ -1,7 +1,7 @@ export const ApiConfig = { // apiKey: 'AIzaSyBBksq-Asxq2M4Ot-75X19IyrEYJqNBPcg', // authDomain: 'dnvn.ir', - // baseUrl: 'https://dnvn.ir/api/v1', + baseUrl: 'https://new.andishmand.ir/api/v1', //baseUrl: 'http://localhost:3030/api/v1', loginURL: 'user/login', otploginURL: 'user/otp/login', diff --git a/src/redux/actions/book.js b/src/redux/actions/book.js index 8f7354d..6a11165 100644 --- a/src/redux/actions/book.js +++ b/src/redux/actions/book.js @@ -3,11 +3,11 @@ const book = { list: (data = {}) => async (dispatch) => - await proxy.get("book/list", data, { dispatch }), + await proxy.get("product/list", data, { dispatch }), info: (data = {}) => async (dispatch) => - await proxy.get("book/info", data, { dispatch }), + await proxy.get("product/info", data, { dispatch }), setLessonActive: (data) => async (dispatch) => await dispatch({ type: "book/lesson/active", data: data }), gradeFilter: (data) => async (dispatch) => diff --git a/src/redux/actions/product.js b/src/redux/actions/product.js index 0dabd1e..a7cc104 100644 --- a/src/redux/actions/product.js +++ b/src/redux/actions/product.js @@ -25,6 +25,8 @@ const product = { async (dispatch) => { await dispatch({ type: "product/selectVOD", data }); }, + listExams: (data = {}) => async (dispatch) => + await proxy.get('exam/list', data, {dispatch}) }; export default product; diff --git a/src/redux/actions/user.js b/src/redux/actions/user.js index 31fe949..02d3e1e 100644 --- a/src/redux/actions/user.js +++ b/src/redux/actions/user.js @@ -58,6 +58,13 @@ const user = { await proxy.delete("user/delete", data); await proxy.get("user/list", data2, { dispatch }); }, + bnLogin: (data) => async (dispatch) => + await proxy.login("user/login", data, { dispatch }), + setUserStatus: () => async (dispatch) => { + let userDataString = localStorage.getItem('userData'); + let userData = JSON.parse(userDataString); + dispatch({type: 'SET_USER_STATUS', data: userData}) + } }; export default user; diff --git a/src/redux/actions/userProduct.js b/src/redux/actions/userProduct.js index 9994438..b8d084a 100644 --- a/src/redux/actions/userProduct.js +++ b/src/redux/actions/userProduct.js @@ -1,9 +1,10 @@ import proxy from "../proxy"; const userProduct = { list: - (data = {}) => + (data = {}, data2 = {}) => async (dispatch) => { await proxy.get("userProduct/list", data, { dispatch }); + await proxy.get('userProduct/listSchool', data2, {dispatch}); }, info: (data = {}) => @@ -28,6 +29,12 @@ const userProduct = { await proxy.delete("userProduct/delete", data); await proxy.get("userProduct/list", data2, { dispatch }); }, + addSchool: + (data = {}, data2 = {}) => + async (dispatch) => { + await proxy.post('userProduct/addSchool', data, {dispatch}); + await proxy.get('userProduct/listSchool', data2, {dispatch}); + } }; export default userProduct; diff --git a/src/redux/proxy.js b/src/redux/proxy.js index 23bc497..4fefa20 100644 --- a/src/redux/proxy.js +++ b/src/redux/proxy.js @@ -9,7 +9,7 @@ const Axios = axios.create({ withCredentials: true, validateStatus: null, baseURL: baseUrl, - //headers: access ? { Authorization: `Bearer ${access}` } : {}, + headers: access ? { Authorization: `Bearer ${access}` } : {}, }); class Proxy { get = async (url, params, opt, data) => diff --git a/src/redux/reducers/book.js b/src/redux/reducers/book.js index b74c1a0..eecc593 100644 --- a/src/redux/reducers/book.js +++ b/src/redux/reducers/book.js @@ -136,7 +136,7 @@ const grades = [ export default function book(state = initialState, action) { let { type, data } = action; switch (type) { - case "book/list": + case "product/list": let itemsSubject = (Array.isArray(data) ? data : []).map( (item, index) => item.name ); @@ -159,7 +159,7 @@ export default function book(state = initialState, action) { filterResult: data, error: null, }; - case "book/info": + case "product/info": return { ...state, loading: false, info: data, error: null }; case "book/lesson/active": return { diff --git a/src/redux/reducers/product.js b/src/redux/reducers/product.js index 4fb4099..c9a0361 100644 --- a/src/redux/reducers/product.js +++ b/src/redux/reducers/product.js @@ -6,6 +6,7 @@ const initialState = { listVOD: [], selectedVOD: null, similarList : [], + exams: [], }; export default function product(state = initialState, action) { let { type, data } = action; @@ -25,6 +26,12 @@ export default function product(state = initialState, action) { case "product/error": toast.error(data.message); return { ...state, loading: false, error: data.message }; + case 'exam/list': + return { + ...state, + loading:false, + exams: data + } default: return state; } diff --git a/src/redux/reducers/public.js b/src/redux/reducers/public.js index 7f2815e..30791da 100644 --- a/src/redux/reducers/public.js +++ b/src/redux/reducers/public.js @@ -96,10 +96,44 @@ const initialState = { back: false, title: false, }, + productTypes: [ + { + id: 1, + title: 'کتاب فیزیکی', + }, + { + id: 2, + title: 'آزمون حضوری', + }, + { + id: 3, + title: 'آزمون آنلاین', + }, + { + id: 4, + title: 'کلاس حضوری', + }, + { + id: 5, + title: 'کلاس آنلاین', + }, + { + id: 6, + title: 'دوره مجازی', + }, + { + id: 7, + title: 'پیش ثبت نام', + }, + { + id: 8, + title: 'سایر', + }, + ], desktopContentTransform: false, }; -const grades = [ +export const grades = [ "پیش دبستان", "اول", "دوم", diff --git a/src/redux/reducers/user.js b/src/redux/reducers/user.js index 1a59c28..d13a781 100644 --- a/src/redux/reducers/user.js +++ b/src/redux/reducers/user.js @@ -1,18 +1,19 @@ import proxy from "../proxy"; import { toast } from "react-toastify"; + const initialState = { status: { - name:'کوروش', + name: 'کوروش', lastName: 'زراندوز', roles: [], rolesString: [ { - id:1, + id: 1, roleName: 'پایه ششم', }, { - id:2, + id: 2, roleName: 'مدیر', }, ] @@ -24,10 +25,13 @@ const initialState = { mothers: [], profileStatus: false, setDone: false, - setLogin : false, + setLogin: false, }; + export default function user(state = initialState, action) { let { type, data } = action; + + switch (type) { // case "user/login": // case "user/register": @@ -36,6 +40,9 @@ export default function user(state = initialState, action) { return { ...state, loading: false, status: data.profile, error: null }; case "user/login": case "user/otp/login": + if (data.profile.username == null) { + window.location.replace('/register') + } return { ...state, loading: false, @@ -45,18 +52,21 @@ export default function user(state = initialState, action) { }; case "user/getProfile": localStorage.setItem("userData", JSON.stringify(data)); - return { ...state, loading: false, status: data, error: null, setDone : false, }; + return { ...state, loading: false, status: data, error: null, setDone: false, }; case "user/logout": + window.location.reload() return { ...state, loading: false, status: proxy.status(), error: null }; case "user/getUserRole": return { ...state, loading: false, userRoles: data, error: null }; case "user/setProfile": toast.success("تغییرات اعمال شد."); - return { ...state, loading: false, error: null, setDone : true }; + return { ...state, loading: false, error: null, setDone: true }; case "loading": return { ...state, loading: true }; case "error": return { ...state, loading: false, error: data.message }; + case 'SET_USER_STATUS': + return {...state, status: data}; default: return state; } diff --git a/src/redux/reducers/userProduct.js b/src/redux/reducers/userProduct.js index ad3e4db..b1ffd23 100644 --- a/src/redux/reducers/userProduct.js +++ b/src/redux/reducers/userProduct.js @@ -4,6 +4,7 @@ const initialState = { loading: false, error: null, list: [], + schoolList: [], info: null, sum: null, checkEmpty: false, @@ -28,6 +29,11 @@ export default function userFactor(state = initialState, action) { error: null, hasPhysical: hasPhysical, }; + case 'userProduct/listSchool': + return { + ...state, + schoolList: data + } case "userProduct/info": return { ...state, loading: false, info: data, error: null }; case "userProduct/update": @@ -44,6 +50,7 @@ export default function userFactor(state = initialState, action) { case "userProduct/error": toast.error(data.message); return { ...state, loading: false, error: data.message }; + default: return state; } diff --git a/src/utils/onInput.js b/src/utils/onInput.js index 0a45958..6fea5af 100644 --- a/src/utils/onInput.js +++ b/src/utils/onInput.js @@ -275,6 +275,21 @@ class onInput { .replace(/[^\d]/, ""); return formattedValue; }; + noNumber = (value) => { + let newText = value; + newText = newText.replace(/`/g, ""); + newText = newText.replace(/0/g, ""); + newText = newText.replace(/1/g, ""); + newText = newText.replace(/2/g, ""); + newText = newText.replace(/3/g, ""); + newText = newText.replace(/4/g, ""); + newText = newText.replace(/5/g, ""); + newText = newText.replace(/6/g, ""); + newText = newText.replace(/7/g, ""); + newText = newText.replace(/8/g, ""); + newText = newText.replace(/9/g, ""); + return newText + }; } const _onInput = new onInput(); diff --git a/src/view/LoginSignUp/index.js b/src/view/LoginSignUp/index.js index 7d2c107..af93c83 100644 --- a/src/view/LoginSignUp/index.js +++ b/src/view/LoginSignUp/index.js @@ -16,6 +16,8 @@ import LoginSignUpMobile from './mobile' import { connect } from "react-redux"; import { user, publicApi } from "../../redux/actions"; +import axios from "axios"; +import { ApiConfig } from "../../constants/defaultValues"; const LoginSignUp = ({ activeLogin, sendOtp, @@ -25,6 +27,7 @@ const LoginSignUp = ({ activeLogin, headerOptions, setHeaderOptions, isMobile, + bnLogin }) => { const [steps, setSteps] = useState(0); const [index, setIndex] = useState(1); @@ -178,8 +181,8 @@ const LoginSignUp = ({ activeLogin, signUpFields?.otp2 + signUpFields?.otp3 + signUpFields?.otp4, - userToken: "2", - applicationToken: "22", + userToken: '1', + applicationToken: '1', }); setError(undefined); @@ -200,8 +203,8 @@ const LoginSignUp = ({ activeLogin, sendOtp({ cellphone: signUpFields?.cellphone, otp: signUpFields?.otp, - userToken: "2", - applicationToken: "22", + userToken: '1', + applicationToken: '1', }); } }, [signUpFields]); @@ -287,6 +290,43 @@ const LoginSignUp = ({ activeLogin, > ثبت نام + {/* { + // setSteps(1); + bnLogin({ + username: 'student', + password: 'barnameneg@r', + }) + }} + > + ورود + + { + // setSteps(1); + // setRegister(true); + bnLogin({ + username: 'admin', + password: 'barnameneg@r', + }) + // try { + // let res = await axios.post(ApiConfig.baseUrl + '/user/login', { + // username: 'admin', + // password: 'barnameneg@r', + // }); + // console.log(res) + // } catch (error) { + // console.error(error) + // } + }} + > + ورود ادمین + */} + } { @@ -327,7 +367,7 @@ const LoginSignUp = ({ activeLogin,
-
+
window.location.reload(), 200) + // setTimeout(() => window.location.reload(), 200) }} > تایید @@ -403,7 +443,7 @@ const LoginSignUp = ({ activeLogin, شماره خود را اشتباه وارد کردید؟{" "} @@ -479,6 +519,7 @@ const mapStateToProps = (state) => ({ const mapDispatchToProps = { sendOtp: user.otp_login, sendPhoneNumber: user.otp, + bnLogin: user.bnLogin, setHeaderOptions: publicApi.setHeaderOptions, }; diff --git a/src/view/LoginSignUp/mobile/index.js b/src/view/LoginSignUp/mobile/index.js index 5ffc78f..c2cf53b 100644 --- a/src/view/LoginSignUp/mobile/index.js +++ b/src/view/LoginSignUp/mobile/index.js @@ -435,7 +435,7 @@ const LoginSignUpMobile = ({ شماره خود را اشتباه وارد کردید؟{" "} diff --git a/src/view/addExam/index.js b/src/view/addExam/index.js index 0e399a9..26ecbd1 100644 --- a/src/view/addExam/index.js +++ b/src/view/addExam/index.js @@ -64,8 +64,8 @@ const AddExam = () => { ] return( -
-
+
+

ساخت آزمون جدید

diff --git a/src/view/addExam/views/AddDescription.js b/src/view/addExam/views/AddDescription.js index e8c8245..0a5ae5b 100644 --- a/src/view/addExam/views/AddDescription.js +++ b/src/view/addExam/views/AddDescription.js @@ -112,7 +112,7 @@ const AddExamDescription = ({ grades, addExamState, dispatch, stepClick, backSte
-
+
-
+
- -
- { - phase == 1 ? -
- -
- - { - let value = e.target.value - - value = value.replace(/[^A-Za-z]/ig, '') - - this.setState({ - value, - }) -}}/> - - -
-
- -
- : + isMobile ? +
+

تماس با ما

+
+ + +
+ { + phase == 1 ? +
+ +
+ + { + let value = e.target.value + + value = value.replace(/[^A-Za-z]/ig, '') + + this.setState({ + value, + }) + }} /> + + +
+
+ +
+ : -
-
- -
-
- -
-

آدرس ما

-

تهران خیابان انقلاب بین ابوریحان و فلسطین بن بست سروش پلاک 2

+
+
+
-
-

شماره تماس

-

02163462405 - 02163462406

-
- -
-

ایمیل سازمانی

-

Info@Azmoonsample.ir

-
- - - -
-

شماره پیامک

-

300000000008762144

-

توجه داشته باشید تمامی پیامک ها از سامانه آزمون از طریق همین سرشماره برای شما ارسال خواهد شد

+
+ +
+

آدرس ما

+

تهران خیابان فاطمی نبش خیابان دائمی پلاک 178

+
+
+

شماره تماس

+

02188976077

+
+ +
+

ایمیل سازمانی

+ < a href="mailto:info@andishmand.ir">

info@andishmand.ir

+
+ + + +
+

شماره پیامک

+

300000000008762144

+

توجه داشته باشید تمامی پیامک ها از سامانه آزمون از طریق همین سرشماره برای شما ارسال خواهد شد

+
+ + +
- - - -
- - -
- } -
- : -
-

تماس با ما

-
-
- -
- - { - let value = e.target.value - - value = value.replace(/[^A-Za-z]/ig, '') - - this.setState({ - value, - }) -}} /> - - - -
-
- -
-
-
- + } +
+ + : + +
+

تماس با ما

+
+
+ +
+ + { + let value = e.target.value + + value = value.replace(/[^A-Za-z]/ig, '') + + this.setState({ + value, + }) + }} /> + + + +
+
+ +
+
+
+

آدرس ما

-

تهران خیابان انقلاب بین ابوریحان و فلسطین بن بست سروش پلاک 2

+

تهران خیابان فاطمی نبش خیابان دائمی پلاک 178

شماره تماس

-

02163462405 - 02163462406

+ ‍

02188976077

- - -
-
- -
+ + +
+
+ +

شماره پیامک

300000000008762144

توجه داشته باشید تمامی پیامک ها از سامانه آزمون از طریق همین سرشماره برای شما ارسال خواهد شد

ایمیل سازمانی

-

Info@Azmoonsample.ir

+ < a href="mailto:info@andishmand.ir">

info@andishmand.ir

- - -
-
-
- + + +
+
+
+ +
-
); }; const mapStateToProps = (state) => ({ isDark: state.publicApi.isDark, isMobile: state.publicApi.isMobile, - }); - - const mapDispatchToProps = { - }; - - export default connect(mapStateToProps, mapDispatchToProps)(ContactUs); \ No newline at end of file +}); + +const mapDispatchToProps = { +}; + +export default connect(mapStateToProps, mapDispatchToProps)(ContactUs); \ No newline at end of file diff --git a/src/view/dashboard2/Games.js b/src/view/dashboard2/Games.js index e33cd56..669a1b6 100644 --- a/src/view/dashboard2/Games.js +++ b/src/view/dashboard2/Games.js @@ -10,64 +10,70 @@ import { connect } from "react-redux"; import ScrollContainer from 'react-indiana-drag-scroll' -const Games = ({ gameId, chooseGame, selectedGames, isMobile }) => { +const Games = ({ gameId, chooseGame, selectedGames, isMobile, setTypes }) => { const [data, setData] = useState([ { id: 1, - img: img1, - title: 'کلاس های آموزشی', + img: img4, + title: 'کتاب های آموزشی', + includedProductTypes: [1] }, { id: 2, - img: img2, - title: 'پیش ثبت نام مدارس', + img: img3, + title: 'بسته های آزمون', + includedProductTypes: [2, 3] }, { id: 3, - img: img3, - title: 'بسته های آزمون', + img: img1, + title: 'کلاس های آموزشی', + includedProductTypes: [4, 5] }, { id: 4, - img: img4, - title: 'کتاب های آموزشی', + img: img5, + title: 'دوره های مجازی', + includedProductTypes: [6] }, { id: 5, - img: img5, - title: 'دوره های مجازی', + img: img2, + title: 'پیش ثبت نام مدارس', + includedProductTypes: [7] }, { id: 6, img: img6, title: 'سایر خدمات', + includedProductTypes: [8] }, ]); return ( <> { - !isMobile ?
+ !isMobile ?
{data.map((item, index) => (
chooseGame(item.id)} + onClick={() => {chooseGame(item.id); setTypes(item.includedProductTypes); console.log(item)}} > {selectedGames.includes(item.id) &&
} game-img
{item.title} @@ -89,7 +95,7 @@ const Games = ({ gameId, chooseGame, selectedGames, isMobile }) => { } : { aspectRatio: "0.95/1" } } - onClick={() => chooseGame(item.id)} + onClick={() => {chooseGame(item.id); setTypes(item.includedProductTypes); console.log(item)}} > {selectedGames.includes(item.id) &&
diff --git a/src/view/register/index.js b/src/view/register/index.js index c741d26..23de6e0 100644 --- a/src/view/register/index.js +++ b/src/view/register/index.js @@ -16,67 +16,150 @@ import { connect } from "react-redux"; import MobileRegister from './mobile' import persian from "react-date-object/calendars/persian" import persian_fa from "react-date-object/locales/persian_fa" -import DatePicker from "react-multi-date-picker"; +import DatePicker, { DateObject } from "react-multi-date-picker"; +import "react-multi-date-picker/styles/colors/red.css" import Checkbox from "../../components/Checkbox"; import { ostan } from "../../constants/states"; import { cities } from "../../constants/cities"; +import _onInput from "../../utils/onInput"; +import { publicApi, user } from "../../redux/actions"; +import { VscDebugBreakpointUnsupported } from "react-icons/vsc"; -const Register = ({ activeLogin, isMobile }) => { +const Register = ({ activeLogin, isMobile, setProfile, getProvince, getCity, province, city, user }) => { const [steps, setSteps] = useState(0); const [index, setIndex] = useState(1); const [register, setRegister] = useState(false); const timeoutRef = useRef(null); const [activeStep, setActiveStep] = useState([true, false, false, false]); const [error, setError] = useState(''); + useEffect(() => { + 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 + + }) + } + }, [user]) + useEffect(() => { + window.scrollTo(0,0); + }, [steps]) + const madraks = [ + { + id: 0, + title: 'مدرک تحصیلی' + }, + { + id: 1, + title: 'ابتدایی' + }, + { + id: 2, + title: 'راهنمایی' + }, + { + id: 3, + title: 'دیپلم' + }, + { + id: 4, + title: 'فوق دیپلم' + }, + { + id: 5, + title: 'کارشناسی' + }, + { + id: 6, + title: 'کارشناسی ارشد' + }, + { + id: 7, + title: 'دکتری عمومی' + }, + { + id: 8, + title: 'دکترای حرفه‌ای' + }, + { + id: 9, + title: 'دکترای تخصصی' + }, + { + id: 10, + title: 'فوق تخصص' + }, + ] const [userInfo, setUserInfo] = useState({ - name: null, - familyName: null, + firstName: null, + lastName: null, nationalId: null, birthDate: null, - sex: null, - grade: null, - schoolName: null, - city: null, - state: null, - fatherName: null, - fatherNationalId: null, - fatherFamilyName: null, - fatherJob: null, - fatherMajor: null, - fatherPhoneNumber: null, - fatherJobAddress: null, - fatherJobPhoneNumber: null, - motherName: null, - motherNationalId: null, - motherFamilyName: null, - motherJob: null, - motherMajor: null, - motherPhoneNumber: null, - motherJobAddress: null, - motherJobPhoneNumber: null, - - familyNumber: 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, - homePhoneNumber: null, + phone: null, + rulesAccepted: false, + }); const finalViewInfo = [ { title: 'نام', - value: userInfo.name + value: userInfo.firstName }, { title: 'نام خانوادگی', - value: userInfo.familyName + value: userInfo.lastName }, { title: 'جنسیت', - value: userInfo.sex + value: userInfo.gender }, { title: 'کد ملی', @@ -84,87 +167,87 @@ const Register = ({ activeLogin, isMobile }) => { }, { title: 'تاریخ تولد', - value: userInfo.birthDate + value: userInfo.birthDate?.toLocaleDateString('fa-IR') }, { title: 'نام مدرسه ', - value: userInfo.schoolName + value: userInfo.previousSchoolName }, { title: 'شهر', - value: userInfo.city + value: userInfo.cityId }, { title: 'منطقه', - value: userInfo.state + value: userInfo.zone }, { title: 'نام', - value: userInfo.fatherName + value: userInfo.fatherInfo.firstName }, { title: 'نام خانوادگی', - value: userInfo.fatherFamilyName + value: userInfo.fatherInfo.lastName }, { title: 'کدملی', - value: userInfo.fatherNationalId + value: userInfo.fatherInfo.nationalId }, { title: 'مدرک تحصیلی', - value: userInfo.fatherMajor + value:madraks.find(itm => itm.id == userInfo.fatherInfo.education)?.title }, { title: 'تلفن همراه', - value: userInfo.fatherPhoneNumber + value: userInfo.fatherInfo.cellphone }, { title: 'شغل', - value: userInfo.fatherJob + value: userInfo.fatherInfo.job }, { title: 'محل کار', - value: userInfo.fatherJobAddress + value: userInfo.fatherInfo.workPlace }, { title: 'تلفن محل کار', - value: userInfo.fatherJobPhoneNumber + value: userInfo.fatherInfo.workPhone }, { title: 'نام', - value: userInfo.motherName + value: userInfo.motherInfo.firstName }, { title: 'نام خانوادگی', - value: userInfo.motherFamilyName + value: userInfo.motherInfo.lastName }, { title: 'کدملی', - value: userInfo.motherNationalId + value: userInfo.motherInfo.nationalId }, { title: 'مدرک تحصیلی', - value: userInfo.motherMajor + value: madraks.find(itm => itm.id == userInfo.motherInfo.education)?.title }, { title: 'تلفن همراه', - value: userInfo.motherPhoneNumber + value: userInfo.motherInfo.cellphone }, { title: 'شغل', - value: userInfo.motherJob + value: userInfo.motherInfo.job }, { title: 'محل کار', - value: userInfo.motherJobAddress + value: userInfo.motherInfo.workPlace }, { title: 'تلفن محل کار', - value: userInfo.motherJobPhoneNumber + value: userInfo.motherInfo.workPhone }, { title: 'تعداد افراد خانواده', - value: userInfo.familyNumber + value: userInfo.familyMemberCount }, { title: 'نشانی محل سکونت', @@ -172,7 +255,7 @@ const Register = ({ activeLogin, isMobile }) => { }, { title: 'تلفن ثابت', - value: userInfo.homePhoneNumber + value: userInfo.phone }, ]; @@ -279,11 +362,11 @@ const Register = ({ activeLogin, isMobile }) => { }, { id: 1, - title: 'مذکر', + title: 'آقا', }, { id: 2, - title: 'مونث', + title: 'خانم', } ] const CostumeDatePickerInput = ({ openCalendar, value, handleValueChange, title }) => { @@ -293,43 +376,14 @@ const Register = ({ activeLogin, isMobile }) => { value={value} onChange={handleValueChange} title={title} - className="w-52" + className="w-52 mx-1" + // type='date' id={3} /> ) } - const madraks = [ - { - id: 0, - title: 'مدرک تحصیلی' - }, - { - id: 1, - title: 'ابتدایی' - }, - { - id: 2, - title: 'دیپلم' - }, - { - id: 3, - title: 'فوق دیپلم' - }, - { - id: 4, - title: 'کارشناسی' - }, - { - id: 5, - title: 'کارشناسی ارشد' - }, - { - id: 6, - title: 'دکتری' - }, - ] - + const [selectedState, setSelectedState] = useState(null); const [selectedCity, setSelectedCity] = useState(null); return ( @@ -340,7 +394,7 @@ const Register = ({ activeLogin, isMobile }) => { {/* form */} {console.log(userInfo)} -
+
{/* */}
@@ -381,6 +435,7 @@ const Register = ({ activeLogin, isMobile }) => {
+ {/* Content */} @@ -393,31 +448,50 @@ const Register = ({ activeLogin, isMobile }) => {

مشخصات هویتی دانش آموز

اطلاعات هویتی دانش آموز را با دقت تکمیل و عکس مدارک را بارگزاری نمایید

-
-
+
+
- setUserInfo({ ...userInfo, name: e.target.value })} /> - setUserInfo({ ...userInfo, familyName: e.target.value })} /> - setUserInfo({ ...userInfo, nationalId: e.target.value })} /> + setUserInfo({ ...userInfo, firstName: _onInput.noNumber(e.target.value)})} /> + setUserInfo({ ...userInfo, lastName: _onInput.noNumber(e.target.value) })} /> + setUserInfo({ ...userInfo, nationalId: _onInput.numberOnly(e.target.value) })} /> {/* */} setUserInfo({ ...userInfo, birthDate: e.day})} + onChange={(e) =>{ + // console.log(e) + var s = new Date(e.unix * 1000) + // console.log(date) + setUserInfo({ ...userInfo, birthDate: s }) + }} calendar={persian} - + className="red" locale={persian_fa} - renderButton={(direction, handleClick) => ( - - )} + maxDate="1396/01/01" + currentDate={ + new DateObject({ + year: 2017, + month: 1, + day: 1 + }) + } + renderButton={(direction, handleClick) => + { + return

handleClick()} + > + {direction === "right" ? ">" : "<"} +

+ } + } render={} /> - setUserInfo({...userInfo, gender: e.target.value})} + className="bg-white border border-solid border-gray-200 w-52 px-3 mx-1 rounded text-gray-400 outline-red52 py-1 h-12 mt-6"> {genders.map((item) => ( - + ))} @@ -427,13 +501,14 @@ const Register = ({ activeLogin, isMobile }) => {
-
-
+
+ +
-
- -
+ + +
@@ -444,44 +519,54 @@ const Register = ({ activeLogin, isMobile }) => {

پایه تحصیلی

لطفا پایه تحصیلی دانش آموز را وارد کنید

- setUserInfo({...userInfo, gradeIds: e.target.value})} + className="bg-white border border-solid border-gray-300 w-48 p-3 rounded-lg text-gray-400 outline-red52 mx-6"> {grades.map((item) => ( - + ))}
-

مشخصات هویتی دانش آموز

-

اطلاعات هویتی دانش آموز را با دقت تکمیل و عکس مدارک را بارگزاری نمایید

+

اطلاعات محل تحصیل

+

لطفا اطلاعات مربوط به محل تحصیل دانش آموز را وارد کنید

- setUserInfo({ ...userInfo, schoolName: e.target.value })} /> - + setUserInfo({ ...userInfo, previousSchoolName: e.target.value })} /> + + - { - selectedState !== null && - - } - { - selectedCity !== null && - } + + + + + setUserInfo({ ...userInfo, zone: e.target.value })} /> +
@@ -494,7 +579,7 @@ const Register = ({ activeLogin, isMobile }) => { } else { alert('لطفا تمامی فیلد ها را پر کنید') } - + }} />
@@ -514,14 +599,28 @@ const Register = ({ activeLogin, isMobile }) => {
- setUserInfo({ ...userInfo, fatherName: e.target.value })}/> - setUserInfo({ ...userInfo, fatherNationalId: e.target.value })}/> - - - setUserInfo({ ...userInfo, fatherFamilyName: e.target.value })}/> - setUserInfo({ + ...userInfo, fatherInfo: { + ...userInfo.fatherInfo, + firstName: _onInput.noNumber(e.target.value) + } + })} /> + setUserInfo({ ...userInfo, fatherInfo:{...userInfo.fatherInfo, lastName: _onInput.noNumber(e.target.value) }})} /> + setUserInfo({ ...userInfo, fatherInfo: { + ...userInfo.fatherInfo, + nationalId : _onInput.numberOnly(e.target.value) + } })} /> + @@ -532,12 +631,19 @@ const Register = ({ activeLogin, isMobile }) => {
- setUserInfo({ ...userInfo, fatherPhoneNumber: e.target.value })}/> - setUserInfo({ ...userInfo, fatherJob: e.target.value })}/> + setUserInfo({ ...userInfo, fatherInfo:{ + ...userInfo.fatherInfo, + cellphone: _onInput.phonenumber(e.target.value) + }})} /> + setUserInfo({ ...userInfo, fatherInfo: { ...userInfo.fatherInfo, job:e.target.value }})} /> - setUserInfo({ ...userInfo, fatherJobAddress: e.target.value })}/> - setUserInfo({ ...userInfo, fatherJobPhoneNumber: e.target.value })} /> + setUserInfo({ ...userInfo, fatherInfo:{...userInfo.fatherInfo, workPlace: e.target.value }})} /> + setUserInfo({ ...userInfo, fatherInfo:{...userInfo.fatherInfo, workPhone: _onInput.numberOnly(e.target.value) }})} /> @@ -555,14 +661,23 @@ const Register = ({ activeLogin, isMobile }) => {
- setUserInfo({ ...userInfo, motherName: e.target.value })}/> - setUserInfo({ ...userInfo, motherNationalId: e.target.value })} /> + setUserInfo({ ...userInfo, motherInfo:{...userInfo.motherInfo, firstName: _onInput.noNumber(e.target.value) }})} /> + + setUserInfo({ ...userInfo, motherInfo:{...userInfo.motherInfo, lastName: _onInput.noNumber(e.target.value) }})} /> + setUserInfo({ ...userInfo, motherInfo:{...userInfo.motherInfo, nationalId: _onInput.numberOnly(e.target.value) }})} /> - setUserInfo({ ...userInfo, motherFamilyName: e.target.value })} /> - setUserInfo({...userInfo, motherInfo: { + ...userInfo.motherInfo, + education: e.target.value + }})}> {madraks.map((item) => ( - + ))} @@ -573,12 +688,30 @@ const Register = ({ activeLogin, isMobile }) => {
- setUserInfo({ ...userInfo, motherPhoneNumber: e.target.value })}/> - setUserInfo({ ...userInfo, motherJob: e.target.value })}/> + setUserInfo({ ...userInfo, motherInfo: { + ...userInfo.motherInfo, + cellphone: _onInput.phonenumber(e.target.value) + }})} /> + setUserInfo({ ...userInfo, motherInfo:{ + ...userInfo.motherInfo, + job: e.target.value + } })} /> - setUserInfo({ ...userInfo, motherJobAddress: e.target.value })} /> - setUserInfo({ ...userInfo, motherJobPhoneNumber: e.target.value })}/> + setUserInfo({ ...userInfo, motherInfo: { + ...userInfo.motherInfo, + workPlace: e.target.value + } })} /> + setUserInfo({ ...userInfo, motherInfo: { + ...userInfo.motherInfo, + workPhone: _onInput.numberOnly(e.target.value) + } })} /> @@ -593,18 +726,18 @@ const Register = ({ activeLogin, isMobile }) => {

در این قسمت مشخص کنید دانشس آموز به همراه چه کسانی زندگی میکند

- - - setUserInfo({ ...userInfo, familyNumber: e.target.value })} /> - setUserInfo({ ...userInfo, homePhoneNumber: e.target.value })}/> - - setUserInfo({ ...userInfo, address: e.target.value })}/> - - - - + setUserInfo({ ...userInfo, familyMemberCount: e.target.value })} /> + setUserInfo({ ...userInfo, phone: _onInput.numberOnly(e.target.value) })} /> + + setUserInfo({ ...userInfo, address: e.target.value })} /> + + + + + +
@@ -627,8 +760,8 @@ const Register = ({ activeLogin, isMobile }) => { } else { alert('لطفا تمامی فیلد ها را پر کنید') } - - + + }} />
@@ -648,7 +781,7 @@ const Register = ({ activeLogin, isMobile }) => {

لطفا قوانین و مقررات را مطالعه فرمایید

-

+

بند اول: موارد مربوط به آموزش مخاطبین پیر مردی هر روز تو محله می دید پسر کی با کفش های پاره و پای برهنه با توپ پلاستیکی فوتبال بازی می کند، روزی رفت ی کتانی نو خرید و اومد و به پسرک گفت بیا این کفشا رو بپوش…پسرک کفشا رو پوشید و خوشحال رو به پیر مرد کرد و گفت: شما خدایید؟! پیر مرد لبش را گزید و گفت نه! پسرک گفت پس دوست خدایی، چون من دیشب فقط به خدا گفتم كه کفش ندارم هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دست‌ اندازی می‌کند پس می‌زند... در نهایت این مرگ است که باید پیروز شود، زیرا از هنگام تولد بخشی از سرنوشت ما شده و فقط مدت کوتاهی پیش از بلعیدن طعمه اش، با آن بازی می کند. با این همه، ما تا آنجا که ممکن است، با علاقه فراوان و دلواپسی زیاد به زندگی ادامه می دهیم، همان‌ طور که تا آنجا که ممکن است طولانی‌ تر در یک حباب صابون می‌ دمیم تا بزرگتر شود، گر چه با قطعیتی تمام می‌ دانیم که خواهد ترکید. @@ -666,14 +799,19 @@ const Register = ({ activeLogin, isMobile }) => {

{/* */} - + + e.target.checked ? setUserInfo({...userInfo, rulesAccepted: true}) + :setUserInfo({...userInfo, rulesAccepted: false}) + + + }/>
@@ -706,46 +844,47 @@ const Register = ({ activeLogin, isMobile }) => {

لطفا اطلاعاتی که وارد کرده اید را چک کنید

- -
-

مشخصات دانش آموز

- { - finalViewInfo.slice(0, 8).map(item => ( -
-

{item.title}

:

{item.value}

-
- )) - } -
-
-

مشخصات پدر دانش آموز

- { - finalViewInfo.slice(8, 16).map(item => ( -
-

{item.title}

:

{item.value}

-
- )) - } -
-
-

مشخصات مادر دانش آموز

- { - finalViewInfo.slice(16, 24).map(item => ( -
-

{item.title}

:

{item.value}

-
- )) - } -
-
-

مشخصات خانواده دانش آموز

- { - finalViewInfo.slice(24, 27).map(item => ( -
-

{item.title}

:

{item.value}

-
- )) - } +
+
+

مشخصات دانش آموز

+ { + finalViewInfo.slice(0, 8).map(item => ( +
+

{item.title}

:

{item.value}

+
+ )) + } +
+
+

مشخصات پدر دانش آموز

+ { + finalViewInfo.slice(8, 16).map(item => ( +
+

{item.title}

:

{item.value}

+
+ )) + } +
+
+

مشخصات مادر دانش آموز

+ { + finalViewInfo.slice(16, 24).map(item => ( +
+

{item.title}

:

{item.value}

+
+ )) + } +
+
+

مشخصات خانواده دانش آموز

+ { + finalViewInfo.slice(24, 27).map(item => ( +
+

{item.title}

:

{item.value}

+
+ )) + } +
@@ -758,8 +897,9 @@ const Register = ({ activeLogin, isMobile }) => {
-
@@ -780,7 +920,15 @@ const Register = ({ activeLogin, isMobile }) => { }; const mapStateToProps = (state) => ({ isMobile: state.publicApi.isMobile, + province: state.publicApi.province, + city: state.publicApi.city, + user: state.user.status, }) +const mapDispatchToProps = { + setProfile: user.setProfile, + getProvince: publicApi.getProvince, + getCity: publicApi.getCity, +} -export default connect(mapStateToProps)(Register); \ No newline at end of file +export default connect(mapStateToProps, mapDispatchToProps)(Register); \ No newline at end of file diff --git a/src/view/register/mobile/index.js b/src/view/register/mobile/index.js index a94d6e8..70f9bb6 100644 --- a/src/view/register/mobile/index.js +++ b/src/view/register/mobile/index.js @@ -11,65 +11,176 @@ import Stepper from "../../../components/Stepper"; import { connect } from "react-redux"; import { toast } from "react-toastify"; import Checkbox from "../../../components/Checkbox"; - - -const MobileRegister = ({ activeLogin, isMobile }) => { +import { user, publicApi } from "../../../redux/actions"; +import _onInput from "../../../utils/onInput"; +import persian from "react-date-object/calendars/persian" +import persian_fa from "react-date-object/locales/persian_fa" +import DatePicker, { DateObject } from "react-multi-date-picker"; +import "react-multi-date-picker/styles/colors/red.css" +import "react-multi-date-picker/styles/layouts/mobile.css" + + +const MobileRegister = ({ + activeLogin, + isMobile, + getProvince, + getCity, + province, + city, + user, + setProfile +}) => { const [steps, setSteps] = useState(0); const [index, setIndex] = useState(1); const [register, setRegister] = useState(false); const timeoutRef = useRef(null); const [activeStep, setActiveStep] = useState([true, false, false, false]); const [error, setError] = useState(''); - + const [selectedState, setSelectedState] = useState(null); + const [selectedCity, setSelectedCity] = useState(null); + useEffect(() => { - window.scrollTo(0,0) + window.scrollTo(0, 0) }, [steps]) + useEffect(() => { + 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 + + }) + } + }, [user]) + + + const madraks = [ + { + id: 0, + title: 'مدرک تحصیلی' + }, + { + id: 1, + title: 'ابتدایی' + }, + { + id: 2, + title: 'راهنمایی' + }, + { + id: 3, + title: 'دیپلم' + }, + { + id: 4, + title: 'فوق دیپلم' + }, + { + id: 5, + title: 'کارشناسی' + }, + { + id: 6, + title: 'کارشناسی ارشد' + }, + { + id: 7, + title: 'دکتری عمومی' + }, + { + id: 8, + title: 'دکترای حرفه‌ای' + }, + { + id: 9, + title: 'دکترای تخصصی' + }, + { + id: 10, + title: 'فوق تخصص' + }, + ] + const genders = [ + { + id: 0, + title: 'جنسیت' + }, + { + id: 1, + title: 'آقا', + }, + { + id: 2, + title: 'خانم', + } + ] const [userInfo, setUserInfo] = useState({ - name: null, - familyName: null, + firstName: null, + lastName: null, nationalId: null, birthDate: null, - sex: null, - grade: null, - schoolName: null, - city: null, - state: null, - fatherName: null, - fatherNationalId: null, - fatherFamilyName: null, - fatherJob: null, - fatherMajor: null, - fatherPhoneNumber: null, - fatherJobAddress: null, - fatherJobPhoneNumber: null, - motherName: null, - motherNationalId: null, - motherFamilyName: null, - motherJob: null, - motherMajor: null, - motherPhoneNumber: null, - motherJobAddress: null, - motherJobPhoneNumber: null, - - familyNumber: 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, - homePhoneNumber: null, + phone: null, + rulesAccepted: false, + }); const finalViewInfo = [ { title: 'نام', - value: userInfo.name + value: userInfo.firstName }, { title: 'نام خانوادگی', - value: userInfo.familyName + value: userInfo.lastName }, { title: 'جنسیت', - value: userInfo.sex + value: userInfo.gender }, { title: 'کد ملی', @@ -77,87 +188,87 @@ const MobileRegister = ({ activeLogin, isMobile }) => { }, { title: 'تاریخ تولد', - value: userInfo.birthDate + value: userInfo.birthDate?.toLocaleDateString('fa-IR') }, { title: 'نام مدرسه ', - value: userInfo.schoolName + value: userInfo.previousSchoolName }, { title: 'شهر', - value: userInfo.city + value: userInfo.cityId }, { title: 'منطقه', - value: userInfo.state + value: userInfo.zone }, { title: 'نام', - value: userInfo.fatherName + value: userInfo.fatherInfo.firstName }, { title: 'نام خانوادگی', - value: userInfo.fatherFamilyName + value: userInfo.fatherInfo.lastName }, { title: 'کدملی', - value: userInfo.fatherNationalId + value: userInfo.fatherInfo.nationalId }, { title: 'مدرک تحصیلی', - value: userInfo.fatherMajor + value: madraks.find(itm => itm.id == userInfo.fatherInfo.education)?.title }, { title: 'تلفن همراه', - value: userInfo.fatherPhoneNumber + value: userInfo.fatherInfo.cellphone }, { title: 'شغل', - value: userInfo.fatherJob + value: userInfo.fatherInfo.job }, { title: 'محل کار', - value: userInfo.fatherJobAddress + value: userInfo.fatherInfo.workPlace }, { title: 'تلفن محل کار', - value: userInfo.fatherJobPhoneNumber + value: userInfo.fatherInfo.workPhone }, { title: 'نام', - value: userInfo.motherName + value: userInfo.motherInfo.firstName }, { title: 'نام خانوادگی', - value: userInfo.motherFamilyName + value: userInfo.motherInfo.lastName }, { title: 'کدملی', - value: userInfo.motherNationalId + value: userInfo.motherInfo.nationalId }, { title: 'مدرک تحصیلی', - value: userInfo.motherMajor + value: madraks.find(itm => itm.id == userInfo.motherInfo.education)?.title }, { title: 'تلفن همراه', - value: userInfo.motherPhoneNumber + value: userInfo.motherInfo.cellphone }, { title: 'شغل', - value: userInfo.motherJob + value: userInfo.motherInfo.job }, { title: 'محل کار', - value: userInfo.motherJobAddress + value: userInfo.motherInfo.workPlace }, { title: 'تلفن محل کار', - value: userInfo.motherJobPhoneNumber + value: userInfo.motherInfo.workPhone }, { title: 'تعداد افراد خانواده', - value: userInfo.familyNumber + value: userInfo.familyMemberCount }, { title: 'نشانی محل سکونت', @@ -165,7 +276,7 @@ const MobileRegister = ({ activeLogin, isMobile }) => { }, { title: 'تلفن ثابت', - value: userInfo.homePhoneNumber + value: userInfo.phone }, ]; @@ -212,10 +323,7 @@ const MobileRegister = ({ activeLogin, isMobile }) => { }, ] const grades = [ - { - id: 0, - title: '' - }, + { id: 1, title: 'پایه اول' @@ -268,15 +376,30 @@ const MobileRegister = ({ activeLogin, isMobile }) => { ] + const CostumeDatePickerInput = ({ openCalendar, value, handleValueChange, title }) => { + return ( + + + ) + } + return ( - -
+ +
{/* form */} {console.log(userInfo)} - + {/* Content */} @@ -287,38 +410,74 @@ const MobileRegister = ({ activeLogin, isMobile }) => {

مشخصات هویتی دانش آموز

-

مرحله ۱ از ۴

+

مرحله ۱ از ۴

- - - - - - - - - - -

- -

- - - + setUserInfo({ ...userInfo, firstName: _onInput.noNumber(e.target.value) })} /> + setUserInfo({ ...userInfo, lastName: _onInput.noNumber(e.target.value) })} /> + setUserInfo({ ...userInfo, nationalId: _onInput.numberOnly(e.target.value) })} /> + + { + // console.log(e) + var s = new Date(e.unix * 1000) + // console.log(date) + setUserInfo({ ...userInfo, birthDate: s }) + }} + calendar={persian} + className="red rmdp-mobile" + locale={persian_fa} + + maxDate="1396/01/01" + currentDate={ + new DateObject({ + year: 2017, + month: 1, + day: 1 + }) + } + renderButton={(direction, handleClick) => { + return

handleClick()} + > + {direction === "right" ? ">" : "<"} +

+ } + } + + render={} + + /> + + +

+ +

+ + +

-
+

پایه تحصیلی

لطفا پایه تحصیلی دانش آموز را وارد کنید

- setUserInfo({ ...userInfo, gradeIds: e.target.value })} + className="bg-white border border-solid border-gray-300 w-full p-3 rounded-md text-gray-400 outline-red52"> {grades.map((item) => ( - + ))}
@@ -328,15 +487,39 @@ const MobileRegister = ({ activeLogin, isMobile }) => {

اطلاعات هویتی دانش آموز را با دقت تکمیل و عکس مدارک را بارگزاری نمایید

- - setUserInfo({ ...userInfo, previousSchoolName: e.target.value })} /> + + + + + - - - + + + setUserInfo({ ...userInfo, zone: e.target.value })} />
@@ -344,31 +527,16 @@ const MobileRegister = ({ activeLogin, isMobile }) => {
-
+
@@ -378,9 +546,9 @@ const MobileRegister = ({ activeLogin, isMobile }) => { steps == 1 &&
-

مشخصات هویتی خانواده دانش آموز

-

مرحله ۲ از ۴

-
+

مشخصات هویتی خانواده دانش آموز

+

مرحله ۲ از ۴

+

مشخصات هویتی پدر

@@ -389,26 +557,51 @@ const MobileRegister = ({ activeLogin, isMobile }) => {
- - - - - - - - - - - + setUserInfo({ + ...userInfo, fatherInfo: { + ...userInfo.fatherInfo, + firstName: _onInput.noNumber(e.target.value) + } + })} /> + setUserInfo({ ...userInfo, fatherInfo: { ...userInfo.fatherInfo, lastName: _onInput.noNumber(e.target.value) } })} /> + setUserInfo({ + ...userInfo, fatherInfo: { + ...userInfo.fatherInfo, + nationalId: _onInput.numberOnly(e.target.value) + } + })} /> + - - + setUserInfo({ + ...userInfo, fatherInfo: { + ...userInfo.fatherInfo, + cellphone: _onInput.phonenumber(e.target.value) + } + })} /> + setUserInfo({ ...userInfo, fatherInfo: { ...userInfo.fatherInfo, job: e.target.value } })} /> - - + setUserInfo({ ...userInfo, fatherInfo: { ...userInfo.fatherInfo, workPlace: e.target.value } })} /> + setUserInfo({ ...userInfo, fatherInfo: { ...userInfo.fatherInfo, workPhone: _onInput.numberOnly(e.target.value) } })} /> @@ -425,25 +618,60 @@ const MobileRegister = ({ activeLogin, isMobile }) => {
- - - + setUserInfo({ ...userInfo, motherInfo: { ...userInfo.motherInfo, firstName: _onInput.noNumber(e.target.value) } })} /> - - + setUserInfo({ ...userInfo, motherInfo: { ...userInfo.motherInfo, lastName: _onInput.noNumber(e.target.value) } })} /> + setUserInfo({ ...userInfo, motherInfo: { ...userInfo.motherInfo, nationalId: _onInput.numberOnly(e.target.value) } })} /> + - - - - - - - - - + setUserInfo({ + ...userInfo, motherInfo: { + ...userInfo.motherInfo, + cellphone: _onInput.phonenumber(e.target.value) + } + })} /> + setUserInfo({ + ...userInfo, motherInfo: { + ...userInfo.motherInfo, + job: e.target.value + } + })} /> + + + setUserInfo({ + ...userInfo, motherInfo: { + ...userInfo.motherInfo, + workPlace: e.target.value + } + })} /> + setUserInfo({ + ...userInfo, motherInfo: { + ...userInfo.motherInfo, + workPhone: _onInput.numberOnly(e.target.value) + } + })} /> @@ -458,21 +686,16 @@ const MobileRegister = ({ activeLogin, isMobile }) => {

در این قسمت مشخص کنید دانشس آموز به همراه چه کسانی زندگی میکند

- - - - - - + + setUserInfo({ ...userInfo, familyMemberCount: e.target.value })} /> + setUserInfo({ ...userInfo, phone: _onInput.numberOnly(e.target.value) })} /> + + setUserInfo({ ...userInfo, address: e.target.value })} /> + + + - - -
@@ -487,46 +710,13 @@ const MobileRegister = ({ activeLogin, isMobile }) => {
@@ -540,13 +730,13 @@ const MobileRegister = ({ activeLogin, isMobile }) => { steps == 2 && <>
-
+

تایید قوانین و مقررات

-

مرحله ۳ از ۴

+

مرحله ۳ از ۴

- -

+ +

بند اول: موارد مربوط به آموزش مخاطبین پیر مردی هر روز تو محله می دید پسر کی با کفش های پاره و پای برهنه با توپ پلاستیکی فوتبال بازی می کند، روزی رفت ی کتانی نو خرید و اومد و به پسرک گفت بیا این کفشا رو بپوش…پسرک کفشا رو پوشید و خوشحال رو به پیر مرد کرد و گفت: شما خدایید؟! پیر مرد لبش را گزید و گفت نه! پسرک گفت پس دوست خدایی، چون من دیشب فقط به خدا گفتم كه کفش ندارم هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دست‌ اندازی می‌کند پس می‌زند... در نهایت این مرگ است که باید پیروز شود، زیرا از هنگام تولد بخشی از سرنوشت ما شده و فقط مدت کوتاهی پیش از بلعیدن طعمه اش، با آن بازی می کند. با این همه، ما تا آنجا که ممکن است، با علاقه فراوان و دلواپسی زیاد به زندگی ادامه می دهیم، همان‌ طور که تا آنجا که ممکن است طولانی‌ تر در یک حباب صابون می‌ دمیم تا بزرگتر شود، گر چه با قطعیتی تمام می‌ دانیم که خواهد ترکید. @@ -563,16 +753,21 @@ const MobileRegister = ({ activeLogin, isMobile }) => {

- + + e.target.checked ? setUserInfo({...userInfo, rulesAccepted: true}) + :setUserInfo({...userInfo, rulesAccepted: false}) + + + }/> + اینجانبان + {userInfo.fatherInfo.firstName} {userInfo.fatherInfo.lastName} + و + {userInfo.motherInfo.firstName} {userInfo.motherInfo.lastName} + سرپرست های دانش آموز + {userInfo.firstName} {userInfo.lastName} + با قوانین و مقررات موافقت نموده و تمامی موارد به عهده اینجانب میباشد +
@@ -598,68 +793,68 @@ const MobileRegister = ({ activeLogin, isMobile }) => { steps == 3 && <>
-
+

تایید اطلاعات

-

مرحله ۴ از ۴

+

مرحله ۴ از ۴

- +
-

مشخصات دانش آموز

- { - finalViewInfo.slice(0,8).map(item => ( -
-

{item.title}

:

{item.value}

-
- )) - } -
-
-

مشخصات پدر دانش آموز

- { - finalViewInfo.slice(8,16).map(item => ( -
-

{item.title}

:

{item.value}

-
- )) - } -
-
-

مشخصات مادر دانش آموز

- { - finalViewInfo.slice(16,24).map(item => ( -
-

{item.title}

:

{item.value}

-
- )) - } -
-
-

مشخصات خانواده دانش آموز

- { - finalViewInfo.slice(24,27).map(item => ( -
-

{item.title}

:

{item.value}

-
- )) - } -
-
+

مشخصات دانش آموز

+ { + finalViewInfo.slice(0, 8).map(item => ( +
+

{item.title}

:

{item.value}

+
+ )) + } +
+
+

مشخصات پدر دانش آموز

+ { + finalViewInfo.slice(8, 16).map(item => ( +
+

{item.title}

:

{item.value}

+
+ )) + } +
+
+

مشخصات مادر دانش آموز

+ { + finalViewInfo.slice(16, 24).map(item => ( +
+

{item.title}

:

{item.value}

+
+ )) + } +
+
+

مشخصات خانواده دانش آموز

+ { + finalViewInfo.slice(24, 27).map(item => ( +
+

{item.title}

:

{item.value}

+
+ )) + } +
+
-
-
-
+
+
+
-
-
+
+
- +
+ @@ -676,7 +871,16 @@ const MobileRegister = ({ activeLogin, isMobile }) => { }; const mapStateToProps = (state) => ({ isMobile: state.publicApi.isMobile, + province: state.publicApi.province, + city: state.publicApi.city, + user: state.user.status, }) +const mapDispatchToProps = { + setProfile: user.setProfile, + getProvince: publicApi.getProvince, + getCity: publicApi.getCity, +} + -export default connect(mapStateToProps)(MobileRegister); \ No newline at end of file +export default connect(mapStateToProps, mapDispatchToProps)(MobileRegister); \ No newline at end of file diff --git a/src/view/services/index.js b/src/view/services/index.js index 3130c8e..1a2ec2e 100644 --- a/src/view/services/index.js +++ b/src/view/services/index.js @@ -34,9 +34,20 @@ const Services = ({ headerOptions, videos, pushToCart, + pushSchoolToCart }) => { - const [filterCheck, setFilterCheck] = useState(null); + const [filterCheck, setFilterCheck] = useState([ + { + id:1, + title: 'حضوری', + }, + { + id:2, + title: 'آنلاین', + }, + ]); + const [selectedFilters, setSelectedFilters] = useState([]) const [filter, setFilter] = useState({ search: "", grade: "", @@ -55,6 +66,7 @@ const Services = ({ classMinute: "", }); const [sharzhVal, setSharzhVal] = useState(''); + const [selectedProductTypes, setSelectedProductTypes] = useState([1]); // const onChange = (name, value) => { // setFilter({ ...filter, [name]: value }); // }; @@ -105,7 +117,9 @@ const Services = ({ const [gameId, setGameId] = useState(1); const chooseGame = (id) => { setGameId(id); + console.log(selectedProductTypes) }; + console.log(gameId) if (!isMobile) { return (
setSelectedProductTypes(val)} />
{/* filters */} @@ -223,19 +238,26 @@ const Services = ({
+ { + filterCheck.map((filter) => (
- setFilterCheck('Online') - } + onClick={(prevState) =>{ + if(selectedFilters.includes(filter.id)){ + setSelectedFilters(selectedFilters.filter(itm => itm !== filter.id)) + }else{ + setSelectedFilters([...selectedFilters, filter.id]) + } + }} > -

آنلاین

- {filterCheck == 'Online' && ( +

{filter.title}

+ {selectedFilters.includes(filter.id) && (
-
+
*/}
- {services.map((item, index) => ( ))} @@ -309,9 +333,9 @@ const Services = ({
- {books?.map((product, index) => ( + { books?.filter(itm => selectedProductTypes.includes(itm.productType)).map((product, index) => (
{ - pushToCart({ - productId: product?.id, - - count: 1, - }); + + if(selectedProductTypes.includes(7)){ + pushSchoolToCart({ + productId: product?.id, + + count: 1, + }) + } + else{ + pushToCart({ + productId: product?.id, + + count: 1, + }); + } + // console.log(gameId) setTimeout(() => setPopUp(false), 0) - console.log(popup) - console.log(product.id) + // console.log(popup) + // console.log(product.id) } } /> @@ -391,13 +426,13 @@ const Services = ({ ))} { gameId == 6 && -
+
-
+

افزایش مبلغ دلخواه

لطفا مبلغ دلخواه خود را در کادر روبرو وارد کنید

-
+
setSharzhVal(e.target.value)} />

ریال

-
+

بابت

- +
} @@ -430,11 +465,12 @@ const Services = ({ return (
- + setSelectedProductTypes(val)} + />
{ @@ -495,78 +531,51 @@ const Services = ({ -
- setFilterCheck('Online') - } - > -

آنلاین

- {filterCheck == 'Online' && ( -
-
- - - -
-
- - - )} -
-
- setFilterCheck('offLine') - } - > -

حضوری

- {filterCheck == 'offLine' && ( -
-
- - - + { + filterCheck.map((filter) => ( +
{ + if(selectedFilters.includes(filter.id)){ + setSelectedFilters(selectedFilters.filter(itm => itm !== filter.id)) + }else{ + setSelectedFilters([...selectedFilters, filter.id]) + } + }} + > +

{filter.title}

+ {selectedFilters.includes(filter.id) && ( +
+
+ + + +
-
- )} -
+ )} +
+ )) + }
}
@@ -574,78 +583,95 @@ const Services = ({
- {books?.map((product, index) => ( - { - setPopUpContent({ - id: gameId, - title: product?.name, - video: "", - teacher: product.vodTeacher, - description: - "در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار می‌گیرد در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت", - price: product.product[0].price, - classHour: 21, - classMinute: 56, - image: 'https://narafella.ir/wp-content/uploads/2021/08/books-min.jpg', - examCont: [ - { - title: 'بخش اول آزمون ' + product.name, - date: '۱۴۰۰/۱۲/۱۳', - time: '۱۴:۴۶', - numberOfQ: '۱۸', - price: 10000 - }, - { - title: 'بخش دوم آزمون ' + product.name, - date: '۱۴۰۰/۱۲/۱۴', - time: '۱۴:۴۶', - numberOfQ: '۱۸', - price: 10000 - }, - { - title: 'بخش سوم آزمون ' + product.name, - date: '۱۴۰۰/۱۲/۱۵', - time: '۱۴:۴۶', - numberOfQ: '۳۲', - price: 250000 - }, - ] - }); - setPopUp(true); - // console.log(gameId) - }} - > - {console.log(product)} - - pushToCart({ - productId: product?.id, - // userId: product?.userId, - count: 1, - }) + { books?.filter(itm => selectedProductTypes.includes(itm.productType)).map((product, index) => ( +
- - ))} + > + {/* {console.log(product)} */} + { + setPopUpContent({ + id: gameId, + title: product?.name, + video: "", + teacher: product?.vodTeacher, + description: + "در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار می‌گیرد در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت", + price: gameId == 2 ? 0 : product?.price, + classHour: 21, + classMinute: 56, + image: 'https://narafella.ir/wp-content/uploads/2021/08/books-min.jpg', + examCont: [ + { + title: 'بخش اول آزمون ' + product.name, + date: '۱۴۰۰/۱۲/۱۳', + time: '۱۴:۴۶', + numberOfQ: '۱۸', + price: 10000 + }, + { + title: 'بخش دوم آزمون ' + product.name, + date: '۱۴۰۰/۱۲/۱۴', + time: '۱۴:۴۶', + numberOfQ: '۱۸', + price: 10000 + }, + { + title: 'بخش سوم آزمون ' + product.name, + date: '۱۴۰۰/۱۲/۱۵', + time: '۱۴:۴۶', + numberOfQ: '۳۲', + price: 250000 + }, + ] + }); + if (gameId !== 5) { + setPopUp(true) + } + console.log(gameId) + }} + btnOnClick={() => { + + if(selectedProductTypes.includes(7)){ + pushSchoolToCart({ + productId: product?.id, + + count: 1, + }) + } + else{ + pushToCart({ + productId: product?.id, + + count: 1, + }); + } + // console.log(gameId) + setTimeout(() => setPopUp(false), 0) + // console.log(popup) + // console.log(product.id) + } + } + /> +
+ ))} { gameId == 6 &&
@@ -699,6 +725,7 @@ const mapDispatchToProps = { gradeFilter: book.gradeFilter, setHeaderOptions: publicApi.setHeaderOptions, pushToCart: userProduct.add, + pushSchoolToCart: userProduct.addSchool, }; export default connect(mapStateToProps, mapDispatchToProps)(Services); diff --git a/src/view/services/service/index.js b/src/view/services/service/index.js index 47ac54d..b0f8d19 100644 --- a/src/view/services/service/index.js +++ b/src/view/services/service/index.js @@ -24,10 +24,10 @@ const servicePopUp = ({
- { content.id !== 3 &&
+ { content.id !== 2 &&

- {content.id === 1 ? 'کلاس آنلاین ' : content.id === 4 ? 'کتاب ' : null} + {content.id === 4 ? 'کلاس آنلاین ' : content.id === 1 ? 'کتاب ' : null} {content.title}

@@ -54,7 +54,7 @@ const servicePopUp = ({

} { - content.id === 3 && + content.id === 2 &&

آزمون {content.title}

@@ -89,7 +89,7 @@ const servicePopUp = ({
} - {content.id === 1 &&
diff --git a/yarn.lock b/yarn.lock index f1dd4ec..5681e81 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1412,6 +1412,11 @@ "schema-utils" "^3.0.0" "source-map" "^0.7.3" +"@react-leaflet/core@^1.1.1": + "integrity" "sha512-7PGLWa9MZ5x/cWy8EH2VzI4T8q5WpuHbixzCDXqixP/WyqwIrg5NDUPgYuFnB4IEIZF+6nA265mYzswFo/h1Pw==" + "resolved" "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz" + "version" "1.1.1" + "@react-pdf-viewer/core@^3.1.2": "integrity" "sha512-tctjW98NjIN/BaZO42r0ZPx63H41EubU/n+E9nS1zS/3K/xrILQU5s+UP0WqEYoBFNs/mMI7pTJWsxV4WUhdDg==" "resolved" "https://registry.npmjs.org/@react-pdf-viewer/core/-/core-3.1.2.tgz" @@ -6106,6 +6111,11 @@ dependencies: "language-subtag-registry" "~0.3.2" +"leaflet@^1.7.1": + "integrity" "sha512-/xwPEBidtg69Q3HlqPdU3DnrXQOvQU/CCHA1tcDQVzOwm91YMYaILjNp7L4Eaw5Z4sOYdbBz6koWyibppd8Zqw==" + "resolved" "https://registry.npmjs.org/leaflet/-/leaflet-1.7.1.tgz" + "version" "1.7.1" + "leven@^3.1.0": "integrity" "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==" "resolved" "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz" @@ -7732,7 +7742,7 @@ "strip-ansi" "^6.0.1" "text-table" "^0.2.0" -"react-dom@*", "react-dom@^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0", "react-dom@^15.0.0 || ^16.0.0 || ^17.0.0", "react-dom@^16.11.0", "react-dom@^16.8.0 || ^17.0.0", "react-dom@^16.8.5 || ^17.0.0", "react-dom@^17.0.2", "react-dom@>=0.14.0", "react-dom@>=16", "react-dom@>=16.8", "react-dom@>=16.8.0", "react-dom@0.13.x || 0.14.x || ^15.0.0-0 || 15.x.x || ^16.0.0-0 || ^16.x.x || ^17.x.x": +"react-dom@*", "react-dom@^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0", "react-dom@^15.0.0 || ^16.0.0 || ^17.0.0", "react-dom@^16.11.0", "react-dom@^16.8.0 || ^17.0.0", "react-dom@^16.8.5 || ^17.0.0", "react-dom@^17.0.1", "react-dom@^17.0.2", "react-dom@>=0.14.0", "react-dom@>=16", "react-dom@>=16.8", "react-dom@>=16.8.0", "react-dom@0.13.x || 0.14.x || ^15.0.0-0 || 15.x.x || ^16.0.0-0 || ^16.x.x || ^17.x.x": "integrity" "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==" "resolved" "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz" "version" "17.0.2" @@ -7800,6 +7810,13 @@ "resolved" "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz" "version" "17.0.2" +"react-leaflet@^3.2.5": + "integrity" "sha512-Z3KZ+4SijsRbbrt2I1a3ZDY6+V6Pm91eYTdxTN18G6IOkFRsJo1BuSPLFnyFrlF3WDjQFPEcTPkEgD1VEeAoBg==" + "resolved" "https://registry.npmjs.org/react-leaflet/-/react-leaflet-3.2.5.tgz" + "version" "3.2.5" + dependencies: + "@react-leaflet/core" "^1.1.1" + "react-mapbox-gl-draw@^2.0.4": "integrity" "sha512-oaBdIlyu+g7PhLUvwnCsl/wvu+5tGB9I3RLjcrYLt6U1sUMzQJqplKtVxXRv9TZqRdNaAU5qNOP+dRs55QKjsA==" "resolved" "https://registry.npmjs.org/react-mapbox-gl-draw/-/react-mapbox-gl-draw-2.0.4.tgz" @@ -7937,7 +7954,7 @@ dependencies: "clsx" "^1.1.1" -"react@*", "react@^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0", "react@^15.0.0 || ^16.0.0 || ^17.0.0", "react@^16.11.0", "react@^16.8.0 || ^17.0.0", "react@^16.8.3 || ^17", "react@^16.8.5 || ^17.0.0", "react@^17.0.2", "react@>= 16", "react@>= 16.8", "react@>=0.14.0", "react@>=16", "react@>=16.8", "react@>=16.8.0", "react@0.13.x || 0.14.x || ^15.0.0-0 || 15.x.x || ^16.0.0-0 || ^16.x.x || ^17.x.x", "react@17.0.2": +"react@*", "react@^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0", "react@^15.0.0 || ^16.0.0 || ^17.0.0", "react@^16.11.0", "react@^16.8.0 || ^17.0.0", "react@^16.8.3 || ^17", "react@^16.8.5 || ^17.0.0", "react@^17.0.1", "react@^17.0.2", "react@>= 16", "react@>= 16.8", "react@>=0.14.0", "react@>=16", "react@>=16.8", "react@>=16.8.0", "react@0.13.x || 0.14.x || ^15.0.0-0 || 15.x.x || ^16.0.0-0 || ^16.x.x || ^17.x.x", "react@17.0.2": "integrity" "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==" "resolved" "https://registry.npmjs.org/react/-/react-17.0.2.tgz" "version" "17.0.2"