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 = ({ |
||||||
|
onClick, |
||||||
|
title, |
||||||
|
questionQuantity, |
||||||
|
coefficient, |
||||||
|
optionsQuantity, |
||||||
|
optionsNumber, |
||||||
|
}) => { |
||||||
return ( |
return ( |
||||||
<div className="w-full border border-gray-400 rounded-xl bg-white flex items-center justify-between px-6 py-8 mt-8"> |
<div className="w-full border border-gray-400 rounded-xl bg-white flex items-center justify-between px-6 py-8 mt-8"> |
||||||
<div className="flex flex-col w-full"> |
<div className="flex flex-col w-full"> |
||||||
|
|
||||||
<h1 className="w-full text-lg text-right text-blue3A font-bold"> |
<h1 className="w-full text-lg text-right text-blue3A font-bold"> |
||||||
{title} |
{title} |
||||||
</h1> |
</h1> |
||||||
<div className="w-full flex mt-4 justify-between"> |
<div className="w-full flex mt-4 justify-between"> |
||||||
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
||||||
<p>تعداد سوالات</p> |
<p>تعداد سوالات</p> |
||||||
<input type='number' className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" value={questionQuantity} /> |
<input |
||||||
|
type="number" |
||||||
|
className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" |
||||||
|
value={questionQuantity} |
||||||
|
/> |
||||||
</p> |
</p> |
||||||
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
||||||
<p className="w-full text-center"> ضریب</p> |
<p className="w-full text-center"> ضریب</p> |
||||||
<input type='number' className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" value={coefficient} /> |
<input |
||||||
|
type="number" |
||||||
|
className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" |
||||||
|
value={coefficient} |
||||||
|
/> |
||||||
</p> |
</p> |
||||||
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
<p className="flex items-center w-1/4 text-sm justify-between border-l-2 px-2 border-red52"> |
||||||
<p>تعداد گزینه</p> |
<p>تعداد گزینه</p> |
||||||
<input type='number' className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" value={4} /> |
<input |
||||||
|
type="number" |
||||||
|
className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center text-xs" |
||||||
|
value={optionsNumber || 4} |
||||||
|
/> |
||||||
</p> |
</p> |
||||||
<p className="flex items-center w-1/4 text-sm justify-between px-2 "> |
<p className="flex items-center w-1/4 text-sm justify-between px-2 "> |
||||||
<p>نمره منفی</p> |
<p>نمره منفی</p> |
||||||
<input type='number' className="w-5 h-5 ml-1 border border-red52 outline-none rounded text-center" /> |
<input |
||||||
|
type="checkbox" |
||||||
|
className="note-course-negetive-point-input w-5 h-5 ml-1 border border-red52 outline-none rounded text-center" |
||||||
|
/> |
||||||
</p> |
</p> |
||||||
|
|
||||||
|
|
||||||
</div> |
</div> |
||||||
<textarea className="border border-gray-300 mt-8 rounded-xl h-32 p-4 outline-none" placeholder="توضیحات"> |
<textarea |
||||||
|
className="border border-gray-300 mt-8 rounded-xl h-32 p-4 outline-none" |
||||||
</textarea> |
placeholder="توضیحات" |
||||||
|
></textarea> |
||||||
</div> |
</div> |
||||||
<h1 className="w-40 text-center text-lg text-blue3A font-bold cursor-pointer" onClick={onClick}> |
<h1 |
||||||
|
className="w-40 text-center text-lg text-blue3A font-bold cursor-pointer" |
||||||
|
onClick={onClick} |
||||||
|
> |
||||||
پاسخ برگ |
پاسخ برگ |
||||||
</h1> |
</h1> |
||||||
</div> |
</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