parent
093924033b
commit
d92199f6b0
11 changed files with 405 additions and 102 deletions
@ -1,42 +1,65 @@ |
|||||||
import React from "react"; |
import React from "react"; |
||||||
|
|
||||||
const SelectedCourse = ({ onClick, title, questionQuantity, coefficient, optionsQuantity }) => { |
const SelectedCourse = ({ |
||||||
return ( |
onClick, |
||||||
<div className="w-full border border-gray-400 rounded-xl bg-white flex items-center justify-between px-6 py-8 mt-8"> |
title, |
||||||
<div className="flex flex-col w-full"> |
questionQuantity, |
||||||
|
coefficient, |
||||||
<h1 className="w-full text-lg text-right text-blue3A font-bold"> |
optionsQuantity, |
||||||
{title} |
optionsNumber, |
||||||
</h1> |
}) => { |
||||||
<div className="w-full flex mt-4 justify-between"> |
return ( |
||||||
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
<div className="w-full border border-gray-400 rounded-xl bg-white flex items-center justify-between px-6 py-8 mt-8"> |
||||||
<p>تعداد سوالات</p> |
<div className="flex flex-col w-full"> |
||||||
<input type='number' className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" value={questionQuantity} /> |
<h1 className="w-full text-lg text-right text-blue3A font-bold"> |
||||||
</p> |
{title} |
||||||
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
</h1> |
||||||
<p className="w-full text-center"> ضریب</p> |
<div className="w-full flex mt-4 justify-between"> |
||||||
<input type='number' className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" value={coefficient} /> |
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
||||||
</p> |
<p>تعداد سوالات</p> |
||||||
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
<input |
||||||
<p>تعداد گزینه</p> |
type="number" |
||||||
<input type='number' className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" value={4} /> |
className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" |
||||||
</p> |
value={questionQuantity} |
||||||
<p className="flex items-center w-1/4 text-sm justify-between px-2 "> |
/> |
||||||
<p>نمره منفی</p> |
</p> |
||||||
<input type='number' className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center" /> |
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
||||||
</p> |
<p className="w-full text-center"> ضریب</p> |
||||||
|
<input |
||||||
|
type="number" |
||||||
</div> |
className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" |
||||||
<textarea className="border border-gray-300 mt-8 rounded-xl h-32 p-4 outline-none" placeholder="توضیحات"> |
value={coefficient} |
||||||
|
/> |
||||||
</textarea> |
</p> |
||||||
</div> |
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
||||||
<h1 className="w-40 text-center text-lg text-blue3A font-bold cursor-pointer" onClick={onClick}> |
<p>تعداد گزینه</p> |
||||||
پاسخ برگ |
<input |
||||||
</h1> |
type="number" |
||||||
|
className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" |
||||||
|
value={optionsNumber || 4} |
||||||
|
/> |
||||||
|
</p> |
||||||
|
<p className="flex items-center w-1/4 text-sm justify-between px-2 "> |
||||||
|
<p>نمره منفی</p> |
||||||
|
<input |
||||||
|
type="checkbox" |
||||||
|
className="note-course-negetive-point-input w-5 h-5 ml-1 border border-red52 outline-none rounded text-center" |
||||||
|
/> |
||||||
|
</p> |
||||||
</div> |
</div> |
||||||
) |
<textarea |
||||||
} |
className="border border-gray-300 mt-8 rounded-xl h-32 p-4 outline-none" |
||||||
|
placeholder="توضیحات" |
||||||
|
></textarea> |
||||||
|
</div> |
||||||
|
<h1 |
||||||
|
className="w-40 text-center text-lg text-blue3A font-bold cursor-pointer" |
||||||
|
onClick={onClick} |
||||||
|
> |
||||||
|
پاسخ برگ |
||||||
|
</h1> |
||||||
|
</div> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
export default SelectedCourse; |
export default SelectedCourse; |
@ -0,0 +1,23 @@ |
|||||||
|
|
||||||
|
|
||||||
|
import proxy from "../proxy"; |
||||||
|
const note = { |
||||||
|
info: |
||||||
|
(data = {}) => |
||||||
|
async (dispatch) => |
||||||
|
await proxy.get("note/info", data, { dispatch }), |
||||||
|
list: |
||||||
|
(data = {}) => |
||||||
|
async (dispatch) => |
||||||
|
await proxy.get("note/list", data, { dispatch }), |
||||||
|
add: |
||||||
|
(data = {}) => |
||||||
|
async (dispatch) => |
||||||
|
await proxy.post("note/add", data, { dispatch }), |
||||||
|
delete: |
||||||
|
(data = {}) => |
||||||
|
async (dispatch) => |
||||||
|
await proxy.delete("note/delete", data, { dispatch }), |
||||||
|
}; |
||||||
|
|
||||||
|
export default note; |
@ -0,0 +1,37 @@ |
|||||||
|
|
||||||
|
|
||||||
|
import { toast } from "react-toastify"; |
||||||
|
|
||||||
|
const initialState = { |
||||||
|
loading: false, |
||||||
|
error: null, |
||||||
|
info: null, |
||||||
|
list: null, |
||||||
|
lastAdd: null, |
||||||
|
myNotes:[] |
||||||
|
}; |
||||||
|
export default function note(state = initialState, action) { |
||||||
|
let { type, data } = action; |
||||||
|
switch (type) { |
||||||
|
case "note/info": |
||||||
|
return { ...state, loading: false, info: data, error: null }; |
||||||
|
case "note/add": |
||||||
|
toast.success("درخواست با موفقیت انجام شد"); |
||||||
|
return { |
||||||
|
...state, |
||||||
|
loading: false, |
||||||
|
error: null, |
||||||
|
lastAdd: data.id, |
||||||
|
myNotes:[...state.myNotes,data.id] |
||||||
|
}; |
||||||
|
case "note/list": |
||||||
|
return { ...state, loading: false, error: null, list: data }; |
||||||
|
case "note/loading": |
||||||
|
return { ...state, loading: true }; |
||||||
|
case "note/error": |
||||||
|
toast.error(data.message); |
||||||
|
return { ...state, loading: false, error: data.message }; |
||||||
|
default: |
||||||
|
return state; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue