You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
4.0 KiB

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);