parent
294ca885ac
commit
eeeefa7870
25 changed files with 1890 additions and 138 deletions
Binary file not shown.
@ -0,0 +1,198 @@ |
||||
%PDF-1.3 |
||||
%âãÏÓ |
||||
|
||||
1 0 obj |
||||
<< |
||||
/Type /Catalog |
||||
/Outlines 2 0 R |
||||
/Pages 3 0 R |
||||
>> |
||||
endobj |
||||
|
||||
2 0 obj |
||||
<< |
||||
/Type /Outlines |
||||
/Count 0 |
||||
>> |
||||
endobj |
||||
|
||||
3 0 obj |
||||
<< |
||||
/Type /Pages |
||||
/Count 2 |
||||
/Kids [ 4 0 R 6 0 R ] |
||||
>> |
||||
endobj |
||||
|
||||
4 0 obj |
||||
<< |
||||
/Type /Page |
||||
/Parent 3 0 R |
||||
/Resources << |
||||
/Font << |
||||
/F1 9 0 R |
||||
>> |
||||
/ProcSet 8 0 R |
||||
>> |
||||
/MediaBox [0 0 612.0000 792.0000] |
||||
/Contents 5 0 R |
||||
>> |
||||
endobj |
||||
|
||||
5 0 obj |
||||
<< /Length 1074 >> |
||||
stream |
||||
2 J |
||||
BT |
||||
0 0 0 rg |
||||
/F1 0027 Tf |
||||
57.3750 722.2800 Td |
||||
( A Simple PDF File ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 688.6080 Td |
||||
( This is a small demonstration .pdf file - ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 664.7040 Td |
||||
( just for use in the Virtual Mechanics tutorials. More text. And more ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 652.7520 Td |
||||
( text. And more text. And more text. And more text. ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 628.8480 Td |
||||
( And more text. And more text. And more text. And more text. And more ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 616.8960 Td |
||||
( text. And more text. Boring, zzzzz. And more text. And more text. And ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 604.9440 Td |
||||
( more text. And more text. And more text. And more text. And more text. ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 592.9920 Td |
||||
( And more text. And more text. ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 569.0880 Td |
||||
( And more text. And more text. And more text. And more text. And more ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 557.1360 Td |
||||
( text. And more text. And more text. Even more. Continued on page 2 ...) Tj |
||||
ET |
||||
endstream |
||||
endobj |
||||
|
||||
6 0 obj |
||||
<< |
||||
/Type /Page |
||||
/Parent 3 0 R |
||||
/Resources << |
||||
/Font << |
||||
/F1 9 0 R |
||||
>> |
||||
/ProcSet 8 0 R |
||||
>> |
||||
/MediaBox [0 0 612.0000 792.0000] |
||||
/Contents 7 0 R |
||||
>> |
||||
endobj |
||||
|
||||
7 0 obj |
||||
<< /Length 676 >> |
||||
stream |
||||
2 J |
||||
BT |
||||
0 0 0 rg |
||||
/F1 0027 Tf |
||||
57.3750 722.2800 Td |
||||
( Simple PDF File 2 ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 688.6080 Td |
||||
( ...continued from page 1. Yet more text. And more text. And more text. ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 676.6560 Td |
||||
( And more text. And more text. And more text. And more text. And more ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 664.7040 Td |
||||
( text. Oh, how boring typing this stuff. But not as boring as watching ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 652.7520 Td |
||||
( paint dry. And more text. And more text. And more text. And more text. ) Tj |
||||
ET |
||||
BT |
||||
/F1 0010 Tf |
||||
69.2500 640.8000 Td |
||||
( Boring. More, a little more text. The end, and just as well. ) Tj |
||||
ET |
||||
endstream |
||||
endobj |
||||
|
||||
8 0 obj |
||||
[/PDF /Text] |
||||
endobj |
||||
|
||||
9 0 obj |
||||
<< |
||||
/Type /Font |
||||
/Subtype /Type1 |
||||
/Name /F1 |
||||
/BaseFont /Helvetica |
||||
/Encoding /WinAnsiEncoding |
||||
>> |
||||
endobj |
||||
|
||||
10 0 obj |
||||
<< |
||||
/Creator (Rave \(http://www.nevrona.com/rave\)) |
||||
/Producer (Nevrona Designs) |
||||
/CreationDate (D:20060301072826) |
||||
>> |
||||
endobj |
||||
|
||||
xref |
||||
0 11 |
||||
0000000000 65535 f |
||||
0000000019 00000 n |
||||
0000000093 00000 n |
||||
0000000147 00000 n |
||||
0000000222 00000 n |
||||
0000000390 00000 n |
||||
0000001522 00000 n |
||||
0000001690 00000 n |
||||
0000002423 00000 n |
||||
0000002456 00000 n |
||||
0000002574 00000 n |
||||
|
||||
trailer |
||||
<< |
||||
/Size 11 |
||||
/Root 1 0 R |
||||
/Info 10 0 R |
||||
>> |
||||
|
||||
startxref |
||||
2714 |
||||
%%EOF |
@ -0,0 +1,78 @@ |
||||
import React, { useEffect, useState } from "react"; |
||||
import { connect } from "react-redux"; |
||||
const PreviewAnswerSheet = ({ questionStart, questionEnd, optionsQuantity, selectedCourseId, passAnswers,selectedQId, answers }) => { |
||||
const [data, setData] = useState([]); |
||||
const [options, setOptions] = useState([]); |
||||
const [success, setSuccess] = useState(selectedCourseId); |
||||
useEffect(() => { |
||||
let array = []; |
||||
let optionsArray = []; |
||||
for (var i = questionStart; i < questionEnd; i++) { |
||||
array.push({ |
||||
questionId:i, |
||||
answer: null, |
||||
courseId: selectedCourseId, |
||||
questionnaierId: selectedQId |
||||
}); |
||||
} |
||||
for (var i = 1; optionsQuantity ? i <= optionsQuantity : i <=4 ; i++) { |
||||
optionsArray.push({ |
||||
id: i, |
||||
active: false, |
||||
}) |
||||
} |
||||
|
||||
setOptions(optionsArray); |
||||
setData(array) |
||||
// passAnswers(data)
|
||||
|
||||
// console.log(data, options)
|
||||
}, [selectedCourseId]) |
||||
console.log(selectedCourseId) |
||||
|
||||
return ( |
||||
|
||||
<div className="w-full flex flex-col border border-gray-200 rounded-xl bg-white"> |
||||
{ |
||||
answers.map((item, index) => ( |
||||
<div className="w-full flex items-center justify-between h-14 border-b border-gray-200"> |
||||
<p className="w-14 flex items-center h-full justify-center border-l border-gray-200"> |
||||
{item.questionId} |
||||
</p> |
||||
<form className="flex w-full h-full px-8 items-center justify-between border-l border-gray-200"> |
||||
|
||||
{ |
||||
options.map( |
||||
(option) => ( |
||||
|
||||
<p type='radio' value={option.id} className={`w-8 h-6 rounded-full border border-gray-400 cursor-pointer ${option.id == item.answer ? 'bg-green-500' : 'bg-white'}`} |
||||
> |
||||
|
||||
</p> |
||||
|
||||
|
||||
) |
||||
) |
||||
} |
||||
|
||||
</form> |
||||
|
||||
|
||||
<div className="w-32 "> |
||||
نمره : ۱ |
||||
</div> |
||||
|
||||
</div> |
||||
)) |
||||
} |
||||
|
||||
|
||||
</div> |
||||
) |
||||
} |
||||
const mapStateToProps = (state) => ({ |
||||
grades: state.publicApi.grades, |
||||
addExamState: state.addExamReduser |
||||
}) |
||||
|
||||
export default connect(mapStateToProps)(PreviewAnswerSheet); |
@ -0,0 +1,405 @@ |
||||
import React, { useEffect, useState, useRef } from "react"; |
||||
import { Link } from "react-router-dom"; |
||||
import logo from "../../../assets/img/logo.png"; |
||||
import { useNavigate } from "react-router-dom"; |
||||
import Input from "../../../components/input/signUpInput"; |
||||
import onInput from "../../../utils/onInput"; |
||||
import Timer from "../../../components/Timer"; |
||||
|
||||
|
||||
import { connect } from "react-redux"; |
||||
import { user, publicApi } from "../../../redux/actions"; |
||||
|
||||
const LoginSignUpMobile = ({ |
||||
activeLogin, |
||||
sendOtp, |
||||
sendPhoneNumber, |
||||
loginFlag, |
||||
theme, |
||||
headerOptions, |
||||
setHeaderOptions, |
||||
isMobile, |
||||
}) => { |
||||
const [steps, setSteps] = useState(0); |
||||
const [index, setIndex] = useState(1); |
||||
const [register, setRegister] = useState(false); |
||||
const timeoutRef = useRef(null); |
||||
|
||||
const focusHandler = (id) => { |
||||
let inputs = document.querySelectorAll(".Login-box-form-item"); |
||||
let label = document.querySelectorAll(".Login-box-form-item-label"); |
||||
let line = document.querySelectorAll(".Login-box-form-item-line"); |
||||
inputs[id].style.borderColor = "#df1452"; |
||||
inputs[id].style.backgroundColor = "#fff"; |
||||
label[id].style.transform = "translate(-10px,-27px)"; |
||||
label[id].style.color = "#df1452"; |
||||
line[id].style.backgroundColor = "#fff"; |
||||
}; |
||||
|
||||
const blurHandler = (id) => { |
||||
let inputsBox = document.querySelectorAll(".Login-box-form-item"); |
||||
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 === "") { |
||||
inputsBox[id].style.borderColor = "#EBEBEB"; |
||||
label[id].style.transform = "translate(0px,0px)"; |
||||
label[id].style.color = "#959595"; |
||||
line[id].style.backgroundColor = "#EBEBEB"; |
||||
} |
||||
}; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const [level, setLevel] = useState("phonenumber"); |
||||
const [signUpFields, setSignUpFiels] = useState({}); |
||||
const [error, setError] = useState(""); |
||||
const [resend, setResend] = useState(false); |
||||
const navigate = useNavigate(); |
||||
|
||||
const otp1 = useRef(); |
||||
const otp2 = useRef(); |
||||
const otp3 = useRef(); |
||||
const otp4 = useRef(); |
||||
|
||||
const onChange = (name, value) => { |
||||
setSignUpFiels({ ...signUpFields, [name]: value }); |
||||
switch (name) { |
||||
case "otp1": |
||||
if (value) { |
||||
otp2.current.focus(); |
||||
} |
||||
break; |
||||
case "otp2": |
||||
if (value) { |
||||
otp3.current.focus(); |
||||
} else { |
||||
otp1.current.focus(); |
||||
} |
||||
break; |
||||
case "otp3": |
||||
if (value) { |
||||
otp4.current.focus(); |
||||
} else { |
||||
otp2.current.focus(); |
||||
} |
||||
break; |
||||
case "otp4": |
||||
if (value) { |
||||
checkOtp(); |
||||
} else { |
||||
otp3.current.focus(); |
||||
} |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
}; |
||||
|
||||
const checkPhoneNumber = (e) => { |
||||
if ( |
||||
signUpFields?.cellphone?.slice(0, 2) === "09" && |
||||
signUpFields?.cellphone.length === 11 |
||||
) { |
||||
|
||||
setSteps(2) |
||||
|
||||
sendPhoneNumber({ cellphone: signUpFields?.cellphone }); |
||||
setError(undefined); |
||||
console.log(signUpFields.cellphone) |
||||
} else { |
||||
setError("شماره موبایل خود را چک کنید."); |
||||
} |
||||
}; |
||||
|
||||
const checkOtp = () => { |
||||
if ( |
||||
signUpFields?.otp1 && |
||||
signUpFields?.otp2 && |
||||
signUpFields?.otp3 && |
||||
signUpFields?.otp4 |
||||
) { |
||||
sendOtp({ |
||||
cellphone: signUpFields?.cellphone, |
||||
otp: |
||||
signUpFields?.otp1 + |
||||
signUpFields?.otp2 + |
||||
signUpFields?.otp3 + |
||||
signUpFields?.otp4, |
||||
userToken: "2", |
||||
applicationToken: "22", |
||||
}); |
||||
setError(undefined); |
||||
|
||||
} else { |
||||
setError("کد وارد شده را چک کنید."); |
||||
} |
||||
}; |
||||
|
||||
const numberInput = useRef(); |
||||
|
||||
// useEffect(() => {
|
||||
// // numberInput.current.focus();
|
||||
// setHeaderOptions(headerOptions);
|
||||
// }, []);
|
||||
|
||||
useEffect(() => { |
||||
if (signUpFields?.otp?.length === 4) { |
||||
sendOtp({ |
||||
cellphone: signUpFields?.cellphone, |
||||
otp: signUpFields?.otp, |
||||
userToken: "2", |
||||
applicationToken: "22", |
||||
}); |
||||
} |
||||
}, [signUpFields]); |
||||
|
||||
useEffect(() => { |
||||
if (level === "phonenumber") { |
||||
// numberInput.current.focus();
|
||||
} else { |
||||
// otpInput.current.focus();
|
||||
} |
||||
}, [level]); |
||||
|
||||
useEffect(() => { |
||||
if (loginFlag) { |
||||
navigate("/"); |
||||
} |
||||
}, [loginFlag]); |
||||
const light = theme === "light"; |
||||
return ( |
||||
|
||||
<div className="w-full flex items-center justify-center" style={{ height: '100vh', direction: 'rtl' }}> |
||||
<div className="w-fullflex rounded-xl"> |
||||
{/* form */} |
||||
|
||||
<div className="flex w-full border-0 border-l border-solid border flex-col items-center p-6"> |
||||
<div className="h-12 w-full flex justify-end"> |
||||
{steps != 0 && |
||||
<div className="w-12 h-full bg-gray-200 rounded-xl flex items-center justify-center text-gray-500 m-0 text-2xl font-light cursor-pointer" onClick={() => setSteps(steps - 1)}> |
||||
{`>`} |
||||
</div> |
||||
} |
||||
</div> |
||||
<img src={logo} className="w-1/3 m-6" /> |
||||
<div className="flex flex-col items-start justify-start leading-normal"> |
||||
{ |
||||
steps == 2 ? <h1 className="text-red26 text-lg font-bold">تاییدیه ثبت نام</h1> : <> |
||||
<h1 className="text-red26 text-lg font-bold">ورود یا ثبت نام</h1> |
||||
<h1 className="text-red26 text-lg font-bold">سامانه ثبت نام مدارس موسسه علمی اندیشمند</h1> |
||||
</> |
||||
} |
||||
|
||||
<p className="text-gray-500 text-sm mt-2"> |
||||
|
||||
{ |
||||
steps == 2 ? <div> |
||||
یک کد چهار رقمی تا {" "} |
||||
<Timer seconds={120} refresh={setResend} /> دیگر برای شماره |
||||
{" "} |
||||
<span className="text-greenBA text-sm"> |
||||
{signUpFields?.cellphone} |
||||
</span>{" "} |
||||
ارسال خواهد شد. |
||||
</div> : <div> |
||||
کاربر گرامی لطفا یکی از دو گزینه زیر را انتخاب نمایید. |
||||
<br /> |
||||
در صورتی که عضو نیستید روی دکمه ثبت نام بزنید |
||||
</div> |
||||
} |
||||
|
||||
</p> |
||||
|
||||
{ |
||||
steps == 0 && |
||||
<> |
||||
<Link |
||||
to="" |
||||
className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center mt-6" |
||||
onClick={() => { |
||||
setSteps(1); |
||||
|
||||
}} |
||||
> |
||||
ورود |
||||
</Link> |
||||
<Link |
||||
to="" |
||||
className="Login-box-form-btn w-full h-12 rounded-lg border border-solid border-red52 text-red52 flex items-center justify-center mt-4" |
||||
onClick={() => { |
||||
setSteps(1); |
||||
setRegister(true); |
||||
|
||||
}} |
||||
> |
||||
ثبت نام |
||||
</Link> |
||||
</> |
||||
} |
||||
{ |
||||
steps == 1 && |
||||
<> |
||||
|
||||
<Input |
||||
title={"شماره موبایل"} |
||||
name="cellphone" |
||||
regex={onInput.numberOnly} |
||||
onChange={(name, value) => onChange(name, value)} |
||||
value={signUpFields?.cellphone} |
||||
|
||||
maxLength="11" |
||||
direction="ltr" |
||||
/> |
||||
<span className="text-red-500 text-xs">{error}</span> |
||||
|
||||
<Link |
||||
to="" |
||||
className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center mt-4" |
||||
onClick={(e) => { |
||||
// setSteps(2);
|
||||
checkPhoneNumber(e) |
||||
}} |
||||
> |
||||
ارسال کد تاییدیه |
||||
</Link> |
||||
|
||||
|
||||
|
||||
|
||||
</> |
||||
} |
||||
{ |
||||
steps == 2 && |
||||
<> |
||||
|
||||
|
||||
<div className="w-full flex flex-col mt-5"> |
||||
<div className="w-full flex flex-row-reverse justify-center"> |
||||
<input |
||||
inputMode="numeric" |
||||
style={{ direction: "ltr" }} |
||||
name="otp1" |
||||
className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" |
||||
onChange={(e) => |
||||
onChange( |
||||
e.target.name, |
||||
(e.target.value = onInput.numberOnly(e.target.value)) |
||||
) |
||||
} |
||||
maxlength="1" |
||||
ref={otp1} |
||||
/> |
||||
<input |
||||
inputMode="numeric" |
||||
style={{ direction: "ltr" }} |
||||
name="otp2" |
||||
className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" |
||||
onChange={(e) => |
||||
onChange( |
||||
e.target.name, |
||||
(e.target.value = onInput.numberOnly(e.target.value)) |
||||
) |
||||
} |
||||
maxlength="1" |
||||
ref={otp2} |
||||
/> |
||||
<input |
||||
inputMode="numeric" |
||||
style={{ direction: "ltr" }} |
||||
name="otp3" |
||||
className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" |
||||
onChange={(e) => |
||||
onChange( |
||||
e.target.name, |
||||
(e.target.value = onInput.numberOnly(e.target.value)) |
||||
) |
||||
} |
||||
maxlength="1" |
||||
ref={otp3} |
||||
/> |
||||
<input |
||||
inputMode="numeric" |
||||
style={{ direction: "ltr" }} |
||||
name="otp4" |
||||
className="bg-red82OP rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" |
||||
onChange={(e) => |
||||
onChange( |
||||
e.target.name, |
||||
(e.target.value = onInput.englishAndNumberWithoutSpace(e.target.value)) |
||||
) |
||||
} |
||||
maxlength="1" |
||||
ref={otp4} |
||||
/> |
||||
</div> |
||||
|
||||
<Link |
||||
to={register == true ? '/register' : `/`} |
||||
className="Login-box-form-btn w-full h-12 rounded-lg bg-red52 text-white flex items-center justify-center mt-4" |
||||
onClick={(e) => { |
||||
|
||||
checkOtp(e) |
||||
activeLogin() |
||||
|
||||
}} |
||||
> |
||||
تایید |
||||
</Link> |
||||
<div className="mt-2 flex flex-row text-center w-full justify-center"> |
||||
<div className="text-xs text-gray1"> |
||||
شماره خود را اشتباه وارد کردید؟{" "} |
||||
<button |
||||
className="bg-transparent border-none text-greenBA font-medium" |
||||
onClick={() => setLevel("phonenumber")} |
||||
> |
||||
اصلاح شماره تلفن |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</> |
||||
} |
||||
|
||||
|
||||
<div className="w-full flex flex-col items-center justify-center"> |
||||
<p className="w-3/5 text-xs my-20 text-center text-red26"> |
||||
ثبت نام شما در سامانه به منزله قبول |
||||
<Link to="" className="font-bold"> شرایط و قوانین استفاده </Link> |
||||
میباشد |
||||
</p> |
||||
<p className="text-gray-300 text-xs">1401 - 1400</p> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
); |
||||
}; |
||||
|
||||
const mapStateToProps = (state) => ({ |
||||
loginFlag : state.user.status, |
||||
isMobile: state.publicApi.isMobile, |
||||
}); |
||||
|
||||
const mapDispatchToProps = { |
||||
sendOtp: user.otp_login, |
||||
sendPhoneNumber: user.otp, |
||||
setHeaderOptions: publicApi.setHeaderOptions, |
||||
}; |
||||
|
||||
export default connect( |
||||
mapStateToProps, |
||||
mapDispatchToProps |
||||
)(LoginSignUpMobile); |
||||
|
@ -0,0 +1,66 @@ |
||||
|
||||
import React, { useEffect, useState } from "react"; |
||||
import { connect } from "react-redux"; |
||||
import { Link } from "react-router-dom"; |
||||
import AddQuestionnaireExam from "./addQuestionnaireExam"; |
||||
import AddQuestionsFromBank from "./AddQuestionsFromBank"; |
||||
|
||||
const OkExam = ({ addExamState, stepClick, backStep }) => { |
||||
const grades = [ |
||||
'', |
||||
'اول', |
||||
'دوم', |
||||
'سوم', |
||||
'چهارم', |
||||
'پنجم', |
||||
'ششم', |
||||
'هفتم', |
||||
'هشتم', |
||||
'نهم', |
||||
'دهم', |
||||
'یازدهم', |
||||
'دوازدهم', |
||||
] |
||||
const optionNum = [ |
||||
'', |
||||
'الف', |
||||
'ب', |
||||
'پ', |
||||
'ت', |
||||
'ث', |
||||
'ج', |
||||
'چ', |
||||
'ح', |
||||
|
||||
] |
||||
return ( |
||||
<div className="w-[95%] flex items-center justify-center flex-col py-40 mx-10"> |
||||
<div className="w-2/5 bg-white rounded-xl flex flex-col items-center justify-center p-6 py-10 border border-gray-200"> |
||||
<div className="w-52 rounded-full flex items-center justify-center h-52 bg-green-500"> |
||||
<svg width="237" height="237" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
||||
<path d="M7.75 12L10.58 14.83L16.25 9.17004" stroke="#fff" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" /> |
||||
</svg> |
||||
</div> |
||||
<h1 className="text-xl font-bold w-full px-6 py-10"> |
||||
آزمون {addExamState.name} با موفقیت به پایگاه داده افزوده شد |
||||
</h1> |
||||
<div className="flex justify-between w-3/5"> |
||||
<Link to='/adminpanel' className="text-red52 w-full py-4 flex justify-center ml-2"> |
||||
بازگشت به پنل ادمین |
||||
</Link> |
||||
<button className="text-white rounded-xl w-full py-4 flex justify-center bg-green-400 mr-2"> |
||||
ساخت آزمون دیگر |
||||
</button> |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
) |
||||
} |
||||
|
||||
const mapStateToProps = (state) => ({ |
||||
grades: state.publicApi.grades, |
||||
addExamState: state.addExamReduser |
||||
}) |
||||
|
||||
export default connect(mapStateToProps)(OkExam); |
@ -0,0 +1,152 @@ |
||||
|
||||
import React, { useEffect, useState } from "react"; |
||||
import { connect } from "react-redux"; |
||||
import { Worker } from '@react-pdf-viewer/core'; |
||||
import fizikPdf from '../../../assets/sample.pdf' |
||||
import pdfpdf from '../../../assets/fizik.pdf' |
||||
import { Viewer } from '@react-pdf-viewer/core'; |
||||
|
||||
// Import the styles
|
||||
import '@react-pdf-viewer/core/lib/styles/index.css'; |
||||
import Preview from "../../../components/AnswerSheet/preview"; |
||||
|
||||
const ViewExam = ({ addExamState, stepClick, backStep }) => { |
||||
useEffect(() => { |
||||
window.scrollTo(0, 0); |
||||
console.log(addExamState.type) |
||||
}, []) |
||||
const grades = [ |
||||
'', |
||||
'اول', |
||||
'دوم', |
||||
'سوم', |
||||
'چهارم', |
||||
'پنجم', |
||||
'ششم', |
||||
'هفتم', |
||||
'هشتم', |
||||
'نهم', |
||||
'دهم', |
||||
'یازدهم', |
||||
'دوازدهم', |
||||
] |
||||
const optionNum = [ |
||||
'', |
||||
'الف', |
||||
'ب', |
||||
'پ', |
||||
'ت', |
||||
'ث', |
||||
'ج', |
||||
'چ', |
||||
'ح', |
||||
|
||||
] |
||||
|
||||
const [selectedCourse, setSelectedCourse] = useState(addExamState?.questionnaires[0]); |
||||
|
||||
const [numPages, setNumPages] = useState(1); |
||||
|
||||
function onDocumentLoadSuccess({ numPages }) { |
||||
setNumPages(numPages); |
||||
} |
||||
|
||||
return ( |
||||
|
||||
<div className="w-[95%] flex flex-col mx-10"> |
||||
<div className="w-4/5 py-6 flex items-center"> |
||||
<h1 className="text-2xl font-bold ml-6">آزمون {addExamState.name}</h1> |
||||
<h3 className="text-gray-500"> پایه {grades[addExamState.grade]}</h3> |
||||
</div> |
||||
{addExamState.type !== 'pdf' ? <div className="w-full flex flex-col text-right"> |
||||
{ |
||||
addExamState.courses.map((item) => ( |
||||
<div className="flex flex-col w-full py-6 border-b border-gray-400"> |
||||
<h1 className="text-xl">سوالات {item.title}</h1> |
||||
<p className="text-gray-500 pt-2">ضریب {item.coefficient}</p> |
||||
{ |
||||
item.selectedQuestions.map((question) => ( |
||||
<div className="flex flex-col w-full py-4 border-b border-gray-200" key={`PISHNAMAYESH__${question.questionId}`}> |
||||
<div className="flex items-start pb-4"> |
||||
<h1 className="text-xl">{question.title}</h1> |
||||
<p className="w-1/12 pr-4">{question.score} نمره</p> |
||||
</div> |
||||
{ |
||||
question.options.map((option) => ( |
||||
<div className="flex w-full my-2 items-center"> |
||||
<div className={`${option.isAnswer ? 'bg-green-400 text-white' : 'bg-gray-300'} w-16 h-14 text-xl flex items-center justify-center rounded-xl rounded-l-none`}> |
||||
{optionNum[option.id]} |
||||
</div> |
||||
<div className={`w-1/4 flex items-center px-6 ${option.isAnswer ? 'bg-green-200' : 'bg-gray-200'} h-14 rounded-xl rounded-r-none`}> |
||||
{option.title} |
||||
</div> |
||||
</div> |
||||
)) |
||||
} |
||||
</div> |
||||
)) |
||||
} |
||||
</div> |
||||
)) |
||||
} |
||||
</div> : |
||||
addExamState.type === 'pdf' && |
||||
<div className="flex flex-col w-full items-center"> |
||||
<h1 className="w-full text-right pb-4 text-lg font-bold">دفترچه ها</h1> |
||||
<div className="w-full flex flex-wrap"> |
||||
{ |
||||
addExamState?.questionnaires?.map((item) => ( |
||||
<div |
||||
|
||||
className={`flex flex-col ${selectedCourse.id === item?.id ? 'bg-pinkF5 border border-red52 text-red52' : 'bg-white border border-gray-300 text-blue3A'} items-center justify-center w-36 h-32 mx-2 font-bold rounded-xl cursor-pointer`} |
||||
onClick={() => setSelectedCourse(item)} |
||||
> |
||||
|
||||
|
||||
<p className="text-red52"> |
||||
{item.name} |
||||
</p> |
||||
</div> |
||||
)) |
||||
} |
||||
</div> |
||||
|
||||
<div className="flex w-full border-t border-gray-200 mt-10"> |
||||
<div className="w-1/2 border-l border-gray-200 py-20 " style={{ height: '750px' }}> |
||||
<Worker workerUrl="https://unpkg.com/pdfjs-dist@2.13.216/build/pdf.worker.min.js"> |
||||
<Viewer fileUrl={selectedCourse.fileUrl} /> |
||||
</Worker> |
||||
</div> |
||||
<div className="w-1/2 my-20 flex justify-center overflow-x-hidden overflow-scroll" style={{height: '600px'}}> |
||||
<div className="w-2/3"> |
||||
<Preview answers={selectedCourse.answers}/> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
} |
||||
<div className="w-full flex justify-end mt-6"> |
||||
<button className="py-4 px-6 rounded-lg text-red52 mr-4" |
||||
onClick={() => backStep()}> |
||||
بازگشت به مرحله قبلی |
||||
</button> |
||||
<button className="bg-red52 py-4 px-6 rounded-lg text-white mr-4" |
||||
onClick={() => stepClick()}> |
||||
تایید آزمون |
||||
</button> |
||||
|
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
) |
||||
} |
||||
|
||||
const mapStateToProps = (state) => ({ |
||||
grades: state.publicApi.grades, |
||||
addExamState: state.addExamReduser |
||||
}) |
||||
|
||||
export default connect(mapStateToProps)(ViewExam); |
Loading…
Reference in new issue