diff --git a/src/App.js b/src/App.js index e4bb529..b994281 100644 --- a/src/App.js +++ b/src/App.js @@ -30,6 +30,7 @@ import EXAM from './view/Exam' import CallBack from './view/CallBack'; import AdminPanel from './view/admin'; import AddProduct from './view/addProduct'; +import AddExam from './view/addExam'; let data = [ @@ -684,6 +685,7 @@ function App() { /> } /> } /> + } /> }/> } /> } /> @@ -695,7 +697,8 @@ function App() { hideUserFullInfo={hideUserFullInfo} />} /> */} - } /> + } /> + } /> }/> } /> diff --git a/src/components/Stepper/index.js b/src/components/Stepper/index.js index 1d10b07..d640bb4 100644 --- a/src/components/Stepper/index.js +++ b/src/components/Stepper/index.js @@ -6,20 +6,21 @@ function Stepper({ deactiveColor, count, currentStep, - steps + steps, + onStepClick }) { return (
{steps.map((item, index) => (
@@ -38,14 +39,14 @@ function Stepper({ : null }
-

{item.title}

+

{item.title}

{count !== (Number(index) + 1) && ( - + - - + + diff --git a/src/components/nav/home-2.svg b/src/components/nav/home-2.svg index 066bdff..c18219e 100644 --- a/src/components/nav/home-2.svg +++ b/src/components/nav/home-2.svg @@ -1,4 +1,4 @@ - - + + diff --git a/src/redux/reducers/exam.js b/src/redux/reducers/exam.js new file mode 100644 index 0000000..c1823e2 --- /dev/null +++ b/src/redux/reducers/exam.js @@ -0,0 +1,57 @@ +const initialState = { + grade: 8, + groupId: 0, + name: '', + startDate: new Date(), + endDate: new Date(), + startTime: '19:0', + endTime: '', + description: '', + type: 1, + courses: [], + questionnaires: [] +} + +export default function addExamReduser(state = initialState, { type, payload }) { + + switch (type) { + case 'ADD_EXAM_GRADE_AND_GROUP': + return { + ...state, + grade: payload.grade, + groupId: payload.groupId + } + + case 'ADD_EXAM_DESCRIPTION': + return { + ...state, + name: payload.name, + startDate: new Date(), + endDate: new Date(), + startTime: '19:0', + endTime: '', + description: payload.description, + type: payload.type + } + case 'ADD_EXAM_QUESTIONS': + return { + ...state, + name: payload.name, + startDate: new Date(), + endDate: new Date(), + startTime: '19:0', + endTime: '', + description: payload.description, + } + case 'ADD_EXAM_QUESTIONAIRES': + return { + ...state, + payload + } + + default: + return state; + + } + +} \ No newline at end of file diff --git a/src/redux/reducers/index.js b/src/redux/reducers/index.js index 584b6eb..2253507 100644 --- a/src/redux/reducers/index.js +++ b/src/redux/reducers/index.js @@ -9,4 +9,5 @@ export { default as file } from "./file"; export { default as userFactor } from "./userFactor"; export { default as userProduct } from "./userProduct"; export {default as scrollAction} from "./scroll"; -export {default as qr} from "./qr"; \ No newline at end of file +export {default as qr} from "./qr"; +export {default as addExamReduser} from "./exam"; \ No newline at end of file diff --git a/src/redux/reducers/public.js b/src/redux/reducers/public.js index 7e14a88..cb6a71e 100644 --- a/src/redux/reducers/public.js +++ b/src/redux/reducers/public.js @@ -36,21 +36,56 @@ const initialState = { activeCategory: null, categories: null, bookSection: null, - grades: { - 0: "پیش دبستان", - 1: "اول", - 2: "دوم", - 3: "سوم", - 4: "چهارم", - 5: "پنجم", - 6: "ششم", - 7: "هفتم", - 8: "هشتم", - 9: "نهم", - 10: "دهم", - 11: "یازدهم", - 12: "دوازدهم", - }, + grades: [ + { + 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: 'دهم' + }, + { + id: 11, + title: 'یازدهم' + }, + { + id: 12, + title: 'دوازدهم' + }, + ], headerOptions: { shown: false, logo: false, diff --git a/src/view/addExam/index.js b/src/view/addExam/index.js new file mode 100644 index 0000000..68d459b --- /dev/null +++ b/src/view/addExam/index.js @@ -0,0 +1,80 @@ +import React,{useState} from 'react'; +import Stepper from '../../components/Stepper'; +import AddGradeGroup from './views/AddGradeGroup'; +import AddExamDescription from './views/AddDescription'; +import AddQuestions from './views/addQuestions'; + +const AddExam = () => { + const [activeStep, setActiveStep] = useState([true, false, false, false, false]); + const [step, setStep] = useState(0); + const steps = [ + { + title: 'انتخاب گروه و پایه تحصیلی', + active: activeStep[0] + }, + { + title: 'تنظیمات آزمون', + active: activeStep[1] + }, + { + title: ' ورود سوالات ', + active: activeStep[2] + }, + { + title: 'پیش نمایش', + active: activeStep[3] + }, + { + title: 'ثبت نهایی', + active: activeStep[4] + }, + ] + console.log(activeStep) + const backStep = () => { + + const backStepArray = () => { + const fakeArray = []; + [0,1,2,3,4].map((item, index) => index < step ? fakeArray.push(true) : fakeArray.push(false)) + return fakeArray; + } + + step > 0 && setStep(step - 1); setActiveStep(backStepArray); + } + + const content = [ + {setStep(1); setActiveStep([true, true, false, false, false, false])}} + backStep={() => backStep()} + />, + {setStep(2); setActiveStep([true, true, true, false, false, false])}} + backStep={() => backStep()} + />, + {setStep(2); setActiveStep([true, true, true, false, false, false])}} + backStep={() => backStep()} + />, + '', + ] + + return( +
+
+

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

+ +
+ +
+
+ + { + content[step] + } + +
+ ) +} + +export default AddExam; \ No newline at end of file diff --git a/src/view/addExam/views/AddDescription.js b/src/view/addExam/views/AddDescription.js new file mode 100644 index 0000000..ff138d7 --- /dev/null +++ b/src/view/addExam/views/AddDescription.js @@ -0,0 +1,94 @@ + +import React, { useState } from "react"; +import { connect } from "react-redux"; +import Button from "../../../components/Button"; +import DatePicker from "../../../components/Calendar/CalendarComponents/DatePicker"; +import RangeDatePicker from "../../../components/RangeDatePicker"; + +const AddExamDescription = ({grades, addExamState, dispatch, stepClick, backStep}) => { + const [name, setName] = useState(null); + const [type, setType] = useState(null); + const [description, setDescription] = useState(null); + + const payload = {name: name, description: description, type: type}; + + return( + <> +
+
+
+ تنظیمات آزمون + +
+

لطفا مشخضات آزمون را تکمیل کنید

+
+ +
+
+ setName(e.target.value)} + /> + + + + +
+ + + + +
+
+ +
+
+
+ تنظیمات آزمون + +
+

لطفا یک مدل از آزمون را انتخاب کنید

+
+ +
+ +
setType('bank')}> + بانک سوالات + + +
+
setType('pdf')}> + ذفترچه سوالات + + +
+ +
+
+
+ +
+ + + ) +} + +const mapStateToProps = (state) => ({ + grades: state.publicApi.grades, + addExamState: state.addExamReduser +}) + +export default connect(mapStateToProps)(AddExamDescription); \ No newline at end of file diff --git a/src/view/addExam/views/AddGradeGroup.js b/src/view/addExam/views/AddGradeGroup.js new file mode 100644 index 0000000..84951e0 --- /dev/null +++ b/src/view/addExam/views/AddGradeGroup.js @@ -0,0 +1,85 @@ + +import React, { useState } from "react"; +import { connect } from "react-redux"; +import Button from "../../../components/Button"; + +const AddGradeGroup = ({grades, addExamState, dispatch, stepClick}) => { + const [examGrade, setExamGrade] = useState(null); + const [group, setGroup] = useState(null); + console.log(addExamState) + const payload = {grade: examGrade, groupId: group}; + + return( + <> +
+
+
+ انتخاب پایه تحصیلی + +
+

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

+
+ +
+ + + { + grades.map((item) =>( +
setExamGrade(item.id)}> + پایه {item.title} + + +
+ )) + } +
+
+ +
+
+
+ انتخاب گروه تحصیلی + +
+

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

+
+ +
+ +
setGroup(1)}> + ابر ‌ذهن + + +
+
setGroup(2)}> + تیزهوشان + + +
+ +
+
+
+ +
+ + + ) +} + +const mapStateToProps = (state) => ({ + grades: state.publicApi.grades, + addExamState: state.addExamReduser +}) + +export default connect(mapStateToProps)(AddGradeGroup); \ No newline at end of file diff --git a/src/view/addExam/views/addQuestions.js b/src/view/addExam/views/addQuestions.js new file mode 100644 index 0000000..99b077b --- /dev/null +++ b/src/view/addExam/views/addQuestions.js @@ -0,0 +1,70 @@ + +import React, { useState } from "react"; +import { connect } from "react-redux"; +import Button from "../../../components/Button"; +import DatePicker from "../../../components/Calendar/CalendarComponents/DatePicker"; +import RangeDatePicker from "../../../components/RangeDatePicker"; + +const AddQuestions = ({grades, addExamState, dispatch, stepClick, backStep}) => { + const [name, setName] = useState(null); + const [type, setType] = useState(null); + const [description, setDescription] = useState(null); + + const payload = {name: name, description: description, type: type}; + + return( + <> + +
+
+
+ تنظیمات آزمون + +
+

لطفا مشخضات آزمون را تکمیل کنید

+
+
+ +
+

+ + +

+

+ {addExamState.type == 'bank' ? 'افزودن درس' : 'افزودن دفترچه'} +

+
+ +
+ +
+ +
+ {addExamState.type === 'bank' ? 'بانک سوالات' : 'دفترچه سوالات'} +
+ + +
+ +
+ + + ) +} + +const mapStateToProps = (state) => ({ + grades: state.publicApi.grades, + addExamState: state.addExamReduser +}) + +export default connect(mapStateToProps)(AddQuestions); \ No newline at end of file diff --git a/src/view/addProduct/Main/editor.css b/src/view/addProduct/Main/editor.css index 1b9f7d7..5d6bd72 100644 --- a/src/view/addProduct/Main/editor.css +++ b/src/view/addProduct/Main/editor.css @@ -1,25 +1,28 @@ .rdw-option-wrapper { - border: 1px solid #F1F1F1; - padding: 5px; + border: 1px solid rgba(71, 71, 71, 0.08); + padding: 15px; min-width: 25px; height: 20px; - border-radius: 2px; + border-radius: 7px; margin: 0 4px; display: flex; justify-content: center; align-items: center; cursor: pointer; - background: white; + background: #fff; text-transform: capitalize; } .rdw-option-wrapper:hover { box-shadow: 1px 1px 0px #BFBDBD; } .rdw-option-wrapper:active { - box-shadow: 1px 1px 0px #BFBDBD inset; + /* box-shadow: 1px 1px 0px #BFBDBD inset; */ + color:white; + background-color: #1064cd; } .rdw-option-active { - box-shadow: 1px 1px 0px #BFBDBD inset; + color:white; + background-color: #1064cd; } .rdw-option-disabled { opacity: 0.3; @@ -842,17 +845,20 @@ height: 100%; overflow: auto; box-sizing: border-box; + } .rdw-editor-toolbar { padding: 6px 5px 0; - border-radius: 2px; + border: 2px solid #e0e0e0; + border-bottom: 0px; + border-radius: 10px 10px 0px 0px; border: 1px solid #F1F1F1; display: flex; justify-content: flex-start; - background: white; + background: #e0e0e0; flex-wrap: wrap; font-size: 15px; - margin-bottom: 5px; + user-select: none; } .public-DraftStyleDefault-block { diff --git a/src/view/addProduct/index.js b/src/view/addProduct/index.js index 8be3d50..15f943e 100644 --- a/src/view/addProduct/index.js +++ b/src/view/addProduct/index.js @@ -4,7 +4,7 @@ import SideAP from "./Sidebar"; const AddProduct = () => { return( -
+
diff --git a/src/view/admin/index.js b/src/view/admin/index.js index 9001830..a0b4082 100644 --- a/src/view/admin/index.js +++ b/src/view/admin/index.js @@ -4,9 +4,12 @@ import { Link } from 'react-router-dom'; const AdminPanel = () => { return(
- + ورود به صفحه افزودن محصول + + ورود به صفحه افزودن آزمون +
) }