ADD Exam Made To Add questions Part

main
Pedram Keshavarzi 3 years ago
parent 156a4f4364
commit 4510b210c3
  1. 5
      src/App.js
  2. 17
      src/components/Stepper/index.js
  3. 6
      src/components/nav/empty-wallet.svg
  4. 4
      src/components/nav/home-2.svg
  5. 57
      src/redux/reducers/exam.js
  6. 3
      src/redux/reducers/index.js
  7. 65
      src/redux/reducers/public.js
  8. 80
      src/view/addExam/index.js
  9. 94
      src/view/addExam/views/AddDescription.js
  10. 85
      src/view/addExam/views/AddGradeGroup.js
  11. 70
      src/view/addExam/views/addQuestions.js
  12. 24
      src/view/addProduct/Main/editor.css
  13. 2
      src/view/addProduct/index.js
  14. 5
      src/view/admin/index.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() {
/>
<Route path="/adminpanel" element={<AdminPanel />} />
<Route path="/adminpanel/add-product" element={<AddProduct />} />
<Route path="/adminpanel/add-exam" element={<AddExam />} />
<Route path="/register" element={<Register activeLogin={activeLogin}/>}/>
<Route path="/accounting" element={<Accounting />} />
<Route path="/messages" element={<Messages />} />
@ -695,7 +697,8 @@ function App() {
hideUserFullInfo={hideUserFullInfo}
/>} /> */}
<Route path='/callBack' element={<CallBack />} />
<Route path='/callBack' element={<CallBack />} />
<Route path='/contacts' element={<ContactUs />} />
<Route exact path="/azmoon_list/enter_exam/:id" element={<ENTER_EXAM />}/>
<Route exact path="/dashboard/azmoon_list/exam/:id" element={<EXAM />} />

@ -6,20 +6,21 @@ function Stepper({
deactiveColor,
count,
currentStep,
steps
steps,
onStepClick
}) {
return (
<div
className={`flex items-center ${
direction === "horizontal" ? "flex-row" : "flex-col"
direction === "horizontal" ? "flex-row justify-between" : "flex-col"
}`}
>
{steps.map((item, index) => (
<div
className={`flex items-center w-full justify-start relative ${
direction === "horizontal" ? "flex-row" : "flex-col"
className={`flex items-center w-full relative ${
direction === "horizontal" ? "flex-row justify-between" : "flex-col justify-start"
}`}
>
<div className="flex items-center justify-start w-full">
@ -38,14 +39,14 @@ function Stepper({
: null
}
</div>
<p className={`mr-4 font-bold ${item.active ? 'text-red26' : 'text-gray-400'}`}>{item.title}</p>
<p className={`mr-4 font-bold ${item.active ? 'text-red26' : 'text-gray-400'} ${direction === 'horizontal' && 'text-xs' }`}>{item.title}</p>
</div>
{count !== (Number(index) + 1) && (
<span
className={`transform my-1 rounded-xl ${
className={`transform my-1 ${
direction === "horizontal"
? "w-8 h-1"
: "h-8 w-1"
? "w-full h-2 mx-4"
: "h-8 w-1 rounded-xl"
}`}
style={{
opacity: '0.5',

@ -1,9 +1,9 @@
<svg id="empty-wallet" xmlns="http://www.w3.org/2000/svg" width="46.091" height="46.091" viewBox="0 0 46.091 46.091">
<g id="Group" transform="translate(4.801 3.929)">
<path id="Vector" d="M29.844,11.139a3.857,3.857,0,0,0-1.152,3.13A4.1,4.1,0,0,0,32.84,17.86h3.649v2.285a7.237,7.237,0,0,1-7.221,7.221H7.221A7.237,7.237,0,0,1,0,20.146V7.221A7.237,7.237,0,0,1,7.221,0H29.268a7.237,7.237,0,0,1,7.221,7.221V9.986H32.61A3.827,3.827,0,0,0,29.844,11.139Z" transform="translate(0 10.955)" fill="none" stroke="#c82b5b" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"/>
<path id="Vector-2" data-name="Vector" d="M0,19.9V11.128A5.469,5.469,0,0,1,3.534,6L18.782.239a3.649,3.649,0,0,1,4.936,3.418v7.3" transform="translate(0 0)" fill="none" stroke="#c82b5b" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"/>
<path id="Vector-2" data-name="Vector" d="M0,19.9V11.128A5.469,5.469,0,0,1,3.534,6L18.782.239a3.649,3.649,0,0,1,4.936,3.418v7.3" transform="translate(0 0)" fill="none" stroke="#c82b5b" strokeLinecap="round" strokeLinejoin="round" strokeWidth="50"/>
</g>
<path id="Vector-3" data-name="Vector" d="M9.85,1.959V5.915A1.972,1.972,0,0,1,7.93,7.874H4.166A4.1,4.1,0,0,1,.018,4.283,3.857,3.857,0,0,1,1.17,1.152,3.827,3.827,0,0,1,3.935,0H7.93A1.972,1.972,0,0,1,9.85,1.959Z" transform="translate(33.473 24.87)" fill="none" stroke="#c82b5b" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"/>
<path id="Vector-4" data-name="Vector" d="M0,0H13.443" transform="translate(13.443 23.046)" fill="none" stroke="#c82b5b" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"/>
<path id="Vector-3" data-name="Vector" d="M9.85,1.959V5.915A1.972,1.972,0,0,1,7.93,7.874H4.166A4.1,4.1,0,0,1,.018,4.283,3.857,3.857,0,0,1,1.17,1.152,3.827,3.827,0,0,1,3.935,0H7.93A1.972,1.972,0,0,1,9.85,1.959Z" transform="translate(33.473 24.87)" fill="none" stroke="#c82b5b" strokeLinecap="round" strokeLinejoin="round" strokeWidth="50"/>
<path id="Vector-4" data-name="Vector" d="M0,0H13.443" transform="translate(13.443 23.046)" fill="none" stroke="#c82b5b" strokeLinecap="round" strokeLinejoin="round" strokeWidth="50"/>
<path id="Vector-5" data-name="Vector" d="M0,0H46.091V46.091H0Z" fill="none" opacity="0"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -1,4 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.02 2.84004L3.63 7.04004C2.73 7.74004 2 9.23004 2 10.36V17.77C2 20.09 3.89 21.99 6.21 21.99H17.79C20.11 21.99 22 20.09 22 17.78V10.5C22 9.29004 21.19 7.74004 20.2 7.05004L14.02 2.72004C12.62 1.74004 10.37 1.79004 9.02 2.84004Z" stroke="#c82b5b" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
<path d="M12 17.99V14.99" stroke="#c82b5b" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
<path d="M9.02 2.84004L3.63 7.04004C2.73 7.74004 2 9.23004 2 10.36V17.77C2 20.09 3.89 21.99 6.21 21.99H17.79C20.11 21.99 22 20.09 22 17.78V10.5C22 9.29004 21.19 7.74004 20.2 7.05004L14.02 2.72004C12.62 1.74004 10.37 1.79004 9.02 2.84004Z" stroke="#c82b5b" strokeWidth="5" strokeLinecap="round" strokeLinejoin="round"/>
<path d="M12 17.99V14.99" stroke="#c82b5b" strokeWidth="5" strokeLinecap="round" strokeLinejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 528 B

@ -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;
}
}

@ -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";
export {default as qr} from "./qr";
export {default as addExamReduser} from "./exam";

@ -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,

@ -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 = [
<AddGradeGroup
stepClick={() => {setStep(1); setActiveStep([true, true, false, false, false, false])}}
backStep={() => backStep()}
/>,
<AddExamDescription
stepClick={() => {setStep(2); setActiveStep([true, true, true, false, false, false])}}
backStep={() => backStep()}
/>,
<AddQuestions
stepClick={() => {setStep(2); setActiveStep([true, true, true, false, false, false])}}
backStep={() => backStep()}
/>,
'',
]
return(
<div className='flex flex-col w-[96%] py-[6%] bg-gray-100 rtl'>
<div className='flex w-full items-center py-4 pb-8 px-10 border-b border-gray-300'>
<h1 className="text-blue3A text-lg font-bold w-1/5 text-right px-4 border-r-4 border-blue65">
ساخت آزمون جدید
</h1>
<div className='w-full '>
<Stepper steps={steps} count={5} direction="horizontal"/>
</div>
</div>
{
content[step]
}
</div>
)
}
export default AddExam;

@ -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(
<>
<div className="flex py-10 items-start px-10 border-b border-gray-300">
<div className="flex flex-col w-1/6">
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
تنظیمات آزمون
</div>
<p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا مشخضات آزمون را تکمیل کنید</p>
</div>
<div className="flex w-5/6 pl-[10%] flex-col">
<div className="flex items-center justify-between">
<input type='text' placeholder="نام آزمون" className="w-1/2 bg-white px-4 h-14 border border-gray-300 rounded-lg text-blue3A outline-blue65"
onChange={(e) => setName(e.target.value)}
/>
<RangeDatePicker title='تاریخ شروع و پایان آزمون'/>
<RangeDatePicker title='تاریخ شروع و پایان آزمون'/>
</div>
<textarea className="w-full mt-6 h-60 border border-gray-300 rounded-lg p-4 outline-blue65 text-blue3A" placeholder="توضیحات آزمون"
onChange={(e) => setDescription(e.target.value)}
>
</textarea>
</div>
</div>
<div className="flex pt-10 items-start px-10 ">
<div className="flex flex-col w-1/6">
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
تنظیمات آزمون
</div>
<p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا یک مدل از آزمون را انتخاب کنید</p>
</div>
<div className="flex w-5/6 flex-wrap">
<div className={`w-1/6 border ${type == 'bank' ? 'border-red52 text-red52 bg-pinkF5' : ' border-gray-300 text-blue3A bg-white'} font-bold cursor-pointer py-10 m-4 rounded-xl`} onClick={() => setType('bank')}>
بانک سوالات
</div>
<div className={`w-1/6 border ${type == 'pdf' ? 'border-red52 text-red52 bg-pinkF5' : ' border-gray-300 text-blue3A bg-white'} font-bold cursor-pointer py-10 m-4 rounded-xl`} onClick={() => setType('pdf')}>
ذفترچه سوالات
</div>
</div>
</div>
<div className="flex w-full px-10 justify-end">
<button className='w-1/12 mx-2 h-12 mt-4 text-red52 font-bold flex items-center justify-center' onClick={() => backStep()}> بازگشت به مرحله قبل </button>
<Button
title='ارسال پیام'
className='w-1/12'
onClick={() => {
dispatch({type: 'ADD_EXAM_DESCRIPTION',payload });
stepClick()
}}
/>
</div>
</>
)
}
const mapStateToProps = (state) => ({
grades: state.publicApi.grades,
addExamState: state.addExamReduser
})
export default connect(mapStateToProps)(AddExamDescription);

@ -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(
<>
<div className="flex py-10 items-start px-10 border-b border-gray-300">
<div className="flex flex-col w-1/6">
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
انتخاب پایه تحصیلی
</div>
<p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا یک پایه تحصیلی برای آزمون انتخاب کنید</p>
</div>
<div className="flex w-5/6 flex-wrap">
{
grades.map((item) =>(
<div className={`w-1/6 border ${examGrade == item.id ? 'border-red52 text-red52 bg-pinkF5' : ' border-gray-300 text-blue3A bg-white'} font-bold cursor-pointer py-10 m-4 rounded-xl`} key={`ADD_EXAM_GRADE__${item.id}`} onClick={() => setExamGrade(item.id)}>
پایه {item.title}
</div>
))
}
</div>
</div>
<div className="flex pt-10 items-start px-10 ">
<div className="flex flex-col w-1/6">
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
انتخاب گروه تحصیلی
</div>
<p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا یک گروه تحصیلی برای آزمون انتخاب کنید</p>
</div>
<div className="flex w-5/6 flex-wrap">
<div className={`w-1/6 border ${group == 1 ? 'border-red52 text-red52 bg-pinkF5' : ' border-gray-300 text-blue3A bg-white'} font-bold cursor-pointer py-10 m-4 rounded-xl`} onClick={() => setGroup(1)}>
ابر ذهن
</div>
<div className={`w-1/6 border ${group == 2 ? 'border-red52 text-red52 bg-pinkF5' : ' border-gray-300 text-blue3A bg-white'} font-bold cursor-pointer py-10 m-4 rounded-xl`} onClick={() => setGroup(2)}>
تیزهوشان
</div>
</div>
</div>
<div className="flex w-full px-10 justify-end">
<Button
title='ارسال پیام'
className='w-1/12'
onClick={() => {
dispatch({type: 'ADD_EXAM_GRADE_AND_GROUP',payload });
stepClick()
}}
/>
</div>
</>
)
}
const mapStateToProps = (state) => ({
grades: state.publicApi.grades,
addExamState: state.addExamReduser
})
export default connect(mapStateToProps)(AddGradeGroup);

@ -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(
<>
<div className="flex py-10 items-start px-10 border-b border-gray-300">
<div className="flex flex-col w-1/6">
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
تنظیمات آزمون
</div>
<p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا مشخضات آزمون را تکمیل کنید</p>
</div>
<div className="w-5/6 flex flex-row">
<div className="flex flex-col bg-white items-center justify-center w-36 h-32 font-bold border border-gray-300 text-blue3A rounded-xl cursor-pointer">
<p className="" style={{fontSize: '40px'}}>
+
</p>
<p className="">
{addExamState.type == 'bank' ? 'افزودن درس' : 'افزودن دفترچه'}
</p>
</div>
</div>
</div>
<div>
{addExamState.type === 'bank' ? 'بانک سوالات' : 'دفترچه سوالات'}
</div>
<div className="flex w-full px-10 items-center justify-end">
<button className=' mx-6 h-12 mt-4 text-red52 font-bold flex items-center justify-center' onClick={() => backStep()}> بازگشت به مرحله قبل </button>
<Button
title='ارسال پیام'
className='w-1/12'
onClick={() => {
dispatch({type: 'ADD_EXAM_DESCRIPTION',payload });
stepClick()
}}
/>
</div>
</>
)
}
const mapStateToProps = (state) => ({
grades: state.publicApi.grades,
addExamState: state.addExamReduser
})
export default connect(mapStateToProps)(AddQuestions);

@ -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 {

@ -4,7 +4,7 @@ import SideAP from "./Sidebar";
const AddProduct = () => {
return(
<div className="w-[93%] h-screen bg-grayFD flex items-start mt-20 py-10 justify-center">
<div className="w-[96%] h-screen bg-grayFD flex items-start mt-20 py-10 justify-center">
<div className="w-1/4">
<SideAP />
</div>

@ -4,9 +4,12 @@ import { Link } from 'react-router-dom';
const AdminPanel = () => {
return(
<div className='flex justify-center bg-gray-100 items-center w-full h-screen'>
<Link to="add-product">
<Link to="add-product" className='bg-red52 text-white p-4 mx-2 rounded shadow-xl hover:shadow-none transition duration-500'>
ورود به صفحه افزودن محصول
</Link>
<Link to="add-exam" className='bg-red52 text-white p-4 mx-2 rounded shadow-xl hover:shadow-none transition duration-500'>
ورود به صفحه افزودن آزمون
</Link>
</div>
)
}

Loading…
Cancel
Save