exam/parentAdd api | 330

main
alireza khaji 2 years ago
parent e38efeaf6f
commit 3a7f53ca9b
  1. 30
      src/components/Product/index.js
  2. 4
      src/redux/actions/exam.js
  3. 12
      src/redux/reducers/exam.js
  4. 2
      src/redux/reducers/exam2.js
  5. 148
      src/view/addExam/views/AddDescription.js
  6. 3
      src/view/addExam/views/AddGradeGroup.js
  7. 4
      src/view/addExam/views/OkExam.js
  8. 196
      src/view/addExam/views/ViewExam.js
  9. 65
      src/view/services/service/index.js

@ -54,36 +54,6 @@ const ProductDesign = ({
); );
console.log(userInfo); console.log(userInfo);
let rulesAccepted = userInfo.rulesAccepted; let rulesAccepted = userInfo.rulesAccepted;
const emkanat = [
{
title: "دستشویی",
isActive: true,
},
{
title: "آب خوری",
isActive: true,
},
{
title: "تخته هوشمند",
isActive: true,
},
{
title: "کامپیوتر",
isActive: true,
},
{
title: "کتابخانه",
isActive: true,
},
{
title: "مشاوره تحصیلی",
isActive: true,
},
{
title: "آزمایشگاه",
isActive: false,
},
];
//budgetHandler------------- //budgetHandler-------------
const budgetHandler = (fileId) => { const budgetHandler = (fileId) => {

@ -5,6 +5,10 @@ const exam = {
(data = {}) => (data = {}) =>
async (dispatch) => async (dispatch) =>
await proxy.get("exam/info", data, { dispatch }), await proxy.get("exam/info", data, { dispatch }),
parentAdd:
(data = {}) =>
async (dispatch) =>
await proxy.post("exam/parentAdd", data, { dispatch }),
}; };
export default exam; export default exam;

@ -11,6 +11,7 @@ const initialState = {
endTime: '', endTime: '',
description: '', description: '',
type: 'bank', type: 'bank',
duration:null,
questionnaires: [ questionnaires: [
{ {
@ -211,11 +212,14 @@ export default function addExamReduser(state = initialState, { type, payload })
name: payload.name, name: payload.name,
startDate: new Date(), startDate: new Date(),
endDate: new Date(), endDate: new Date(),
startTime: '19:0', startTime: "19:0",
endTime: '', endTime: "",
description: payload.description, description: payload.description,
type: payload.type type: payload.type,
} duration: payload.duration,
startDate:payload.startDate,
endDate:payload.endDate
};
case 'ADD_EXAM_QUESTIONAIRES': case 'ADD_EXAM_QUESTIONAIRES':
return { return {

@ -12,6 +12,8 @@ export default function exam2(state = initialState, action) {
switch (type) { switch (type) {
case "exam/info": case "exam/info":
return { ...state, loading: false, info: data, error: null }; return { ...state, loading: false, info: data, error: null };
case "exam/parentAdd":
return { ...state, loading: false, error: null };
default: default:
return state; return state;
} }

@ -13,18 +13,40 @@ const AddExamDescription = ({ grades, addExamState, dispatch, stepClick, backSte
const [name, setName] = useState(null); const [name, setName] = useState(null);
const [type, setType] = useState(null); const [type, setType] = useState(null);
const [description, setDescription] = useState(null); const [description, setDescription] = useState(null);
const [duration,setDuration]=useState(null);
const payload = { name: name, description: description, type: type }; const [date, setDate] = useState({ format: "MM/DD/YYYY" });
const CostumeDatePickerInput = ({ openCalendar, value, handleValueChange, title }) => { const [startDate,setStartDate]=useState(null);
const [endDate, setEndDate] = useState(null);
const payload = {
name: name,
description: description,
type: type,
duration,
startDate,
endDate,
};
console.log("uuuuuuuuuuu")
const CostumeDatePickerInput = ({ openCalendar, value, handleValueChange, title,index }) => {
return ( return (
<input <input
onFocus={openCalendar} onFocus={openCalendar}
value={value} value={value}
onChange={handleValueChange} // onChange={(e) => changeHandler(e)}
placeholder={title} placeholder={title}
className="w-full h-14 rounded-lg p-3 border border-gray-200 text-blue3A outline-blue-300" className="create-exame-date-input w-full h-14 rounded-lg p-3 border border-gray-200 text-blue3A outline-blue-300"
/> />
) );
}
const dateChangeHandler=(index)=>{
let inputs = document.querySelectorAll(".create-exame-date-input");
console.log(inputs[index].value);
let dateList = inputs[index].value.split(" ")[0].split("/");
let timeList = inputs[index].value.split(" ")[1].split(":");
console.log(dateList);
console.log(timeList);
console.log(Number(dateList[0]));
} }
return ( return (
<> <>
@ -32,102 +54,124 @@ const AddExamDescription = ({ grades, addExamState, dispatch, stepClick, backSte
<div className="flex flex-col w-1/6"> <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 className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
تنظیمات آزمون تنظیمات آزمون
</div> </div>
<p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا مشخضات آزمون را تکمیل کنید</p> <p className="text-sm text-right font-bold pt-4 text-gray-500">
لطفا مشخضات آزمون را تکمیل کنید
</p>
</div> </div>
<div className="flex w-5/6 pl-[10%] flex-col"> <div className="flex w-5/6 pl-[10%] flex-col">
<div className="flex items-center justify-between"> <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" <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)} onChange={(e) => setName(e.target.value)}
/> />
<DatePicker <DatePicker
format="YYYY/MM/DD HH:mm:ss" format="YYYY/MM/DD HH:mm:ss"
calendar={persian} calendar={persian}
locale={persian_fa} locale={persian_fa}
// onChange={() => dateChangeHandler(0)}
onChange={setStartDate}
renderButton={(direction, handleClick) => ( renderButton={(direction, handleClick) => (
<button className="text-blue-500 font-bold mx-2" onClick={handleClick}> <button
className="text-blue-500 font-bold mx-2"
onClick={handleClick}
>
{direction === "right" ? ">" : "<"} {direction === "right" ? ">" : "<"}
</button> </button>
)} )}
render={
render={<CostumeDatePickerInput title='تاریخ و زمان شروع آزمون'/>} <CostumeDatePickerInput title="تاریخ و زمان شروع آزمون" />
plugins={[ }
<TimePicker hideSeconds position="bottom" />, plugins={[<TimePicker hideSeconds={true} position="bottom" />]}
]}
/> />
<DatePicker <DatePicker
format="YYYY/MM/DD HH:mm:ss" format="YYYY/MM/DD HH:mm:ss"
calendar={persian} calendar={persian}
locale={persian_fa} locale={persian_fa}
onChange={setEndDate}
renderButton={(direction, handleClick) => ( renderButton={(direction, handleClick) => (
<button className="text-blue-500 font-bold mx-2" onClick={handleClick}> <button
className="text-blue-500 font-bold mx-2"
onClick={handleClick}
>
{direction === "right" ? ">" : "<"} {direction === "right" ? ">" : "<"}
</button> </button>
)} )}
render={
render={<CostumeDatePickerInput title='تاریخ و زمان پایان آزمون'/>} <CostumeDatePickerInput title="تاریخ و زمان پایان آزمون" />
plugins={[ }
<TimePicker hideSeconds position="bottom" />, plugins={[<TimePicker hideSeconds={true} position="bottom" />]}
]}
/> />
</div> </div>
<textarea className="w-full mt-6 h-60 border border-gray-300 rounded-lg p-4 outline-blue65 text-blue3A" placeholder="توضیحات آزمون" <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)} onChange={(e) => setDescription(e.target.value)}
> ></textarea>
<input
</textarea> type="text"
placeholder="مدت زمان آزمون(دقیقه)"
className="w-1/3 bg-white px-4 h-14 border border-gray-300 rounded-lg text-blue3A outline-blue65 mt-6"
onChange={(e) => setDuration(e.target.value)}
/>
</div> </div>
</div> </div>
<div className="flex pt-10 items-start px-10 "> <div className="flex pt-10 items-start px-10 ">
<div className="flex flex-col w-1/6"> <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 className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
تنظیمات آزمون نوع آزمون
</div> </div>
<p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا یک مدل از آزمون را انتخاب کنید</p> <p className="text-sm text-right font-bold pt-4 text-gray-500">
لطفا یک مدل از آزمون را انتخاب کنید
</p>
</div> </div>
<div className="flex w-5/6 flex-wrap"> <div className="flex w-5/6 flex-wrap">
<div
<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')}> className={`w-1/6 border ${
type == 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={() => setType(1)}
>
بانک سوالات بانک سوالات
</div> </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
className={`w-1/6 border ${
type == 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={() => setType(2)}
>
دفترچه سوالات دفترچه سوالات
</div> </div>
</div> </div>
</div> </div>
<div className="flex fixed bottom-10 left-0 w-full px-10 justify-end"> <div className="flex fixed bottom-10 left-0 w-full px-10 justify-end">
<button className=' mx-2 h-12 mt-4 text-red52 font-bold flex items-center justify-center' onClick={() => backStep()}> بازگشت به مرحله قبل </button> <button
className=" mx-2 h-12 mt-4 text-red52 font-bold flex items-center justify-center"
onClick={() => backStep()}
>
{" "}
بازگشت به مرحله قبل{" "}
</button>
<Button <Button
title='مرحله بعدی' title="مرحله بعدی"
className='w-1/12' className="w-1/12"
onClick={() => { onClick={() => {
dispatch({ type: 'ADD_EXAM_DESCRIPTION', payload }); dispatch({ type: "ADD_EXAM_DESCRIPTION", payload });
stepClick() stepClick();
}} }}
/> />
</div> </div>
</> </>
) );
} }
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({

@ -2,6 +2,7 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import Button from "../../../components/Button"; import Button from "../../../components/Button";
import { exam } from "../../../redux/actions";
const AddGradeGroup = ({grades, addExamState, dispatch, stepClick}) => { const AddGradeGroup = ({grades, addExamState, dispatch, stepClick}) => {
const [examGrade, setExamGrade] = useState(null); const [examGrade, setExamGrade] = useState(null);
@ -82,4 +83,6 @@ const mapStateToProps = (state) => ({
addExamState: state.addExamReduser addExamState: state.addExamReduser
}) })
export default connect(mapStateToProps)(AddGradeGroup); export default connect(mapStateToProps)(AddGradeGroup);

@ -6,6 +6,8 @@ import AddQuestionnaireExam from "./addQuestionnaireExam";
import AddQuestionsFromBank from "./AddQuestionsFromBank"; import AddQuestionsFromBank from "./AddQuestionsFromBank";
const OkExam = ({ addExamState, stepClick, backStep }) => { const OkExam = ({ addExamState, stepClick, backStep }) => {
console.log("examInfo:----------------------------------------");
console.log(addExamState);
const grades = [ const grades = [
'', '',
'اول', 'اول',
@ -63,4 +65,6 @@ const mapStateToProps = (state) => ({
addExamState: state.addExamReduser addExamState: state.addExamReduser
}) })
export default connect(mapStateToProps)(OkExam); export default connect(mapStateToProps)(OkExam);

@ -9,41 +9,34 @@ import { Viewer } from '@react-pdf-viewer/core';
// Import the styles // Import the styles
import '@react-pdf-viewer/core/lib/styles/index.css'; import '@react-pdf-viewer/core/lib/styles/index.css';
import Preview from "../../../components/AnswerSheet/preview"; import Preview from "../../../components/AnswerSheet/preview";
import { exam } from "../../../redux/actions";
const ViewExam = ({ addExamState, stepClick, backStep }) => { const ViewExam = ({ addExamState, stepClick, backStep, parentAdd }) => {
useEffect(() => { useEffect(() => {
window.scrollTo(0, 0); window.scrollTo(0, 0);
console.log(addExamState.type) console.log("oooooooooooooooooooooooooooooo");
}, []) console.log(addExamState);
}, []);
const grades = [ const grades = [
'', "",
'اول', "اول",
'دوم', "دوم",
'سوم', "سوم",
'چهارم', "چهارم",
'پنجم', "پنجم",
'ششم', "ششم",
'هفتم', "هفتم",
'هشتم', "هشتم",
'نهم', "نهم",
'دهم', "دهم",
'یازدهم', "یازدهم",
'دوازدهم', "دوازدهم",
] ];
const optionNum = [ const optionNum = ["", "الف", "ب", "پ", "ت", "ث", "ج", "چ", "ح"];
'',
'الف', const [selectedCourse, setSelectedCourse] = useState(
'ب', addExamState?.questionnaires[0]
'پ', );
'ت',
'ث',
'ج',
'چ',
'ح',
]
const [selectedCourse, setSelectedCourse] = useState(addExamState?.questionnaires[0]);
const [numPages, setNumPages] = useState(1); const [numPages, setNumPages] = useState(1);
@ -51,104 +44,151 @@ const ViewExam = ({ addExamState, stepClick, backStep }) => {
setNumPages(numPages); setNumPages(numPages);
} }
return ( let questionCount = 0;
for(let i=0;i<addExamState.courses.length;i++){
questionCount += addExamState.courses[i].selectedQuestions.length;
}
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>");
console.log(addExamState.startDate);
const submitHandler=()=>{
parentAdd({
name: addExamState.name,
description: addExamState.description,
startDate: addExamState.startDate,
endDate: addExamState.endDate,
duration: addExamState?.duration || 60,
// duration:30,
type: addExamState.type,
//questionCount: addExamState.questions.length,
questionCount,
examGroupId: addExamState.groupId,
levelCriterion: null,
budgetFileId:null
});
// stepClick();
}
return (
<div className="w-[95%] flex flex-col mx-10"> <div className="w-[95%] flex flex-col mx-10">
<div className="w-4/5 py-6 flex items-center"> <div className="w-4/5 py-6 flex items-center">
<h1 className="text-2xl font-bold ml-6">آزمون {addExamState.name}</h1> <h1 className="text-2xl font-bold ml-6">آزمون {addExamState.name}</h1>
<h3 className="text-gray-500"> پایه {grades[addExamState.grade]}</h3> <h3 className="text-gray-500"> پایه {grades[addExamState.grade]}</h3>
</div> </div>
{addExamState.type !== 'pdf' ? <div className="w-full flex flex-col text-right"> {addExamState.type !== "pdf" ? (
{ <div className="w-full flex flex-col text-right">
addExamState.courses.map((item, index) => ( {addExamState.courses.map((item, index) => (
<div className={`flex flex-col w-full py-6 border-b-2 border-gray-400`}> <div
className={`flex flex-col w-full py-6 border-b-2 border-gray-400`}
>
<h1 className="text-xl">سوالات {item.title}</h1> <h1 className="text-xl">سوالات {item.title}</h1>
<p className="text-gray-500 pt-2">ضریب {item.coefficient}</p> <p className="text-gray-500 pt-2">ضریب {item.coefficient}</p>
{ {item.selectedQuestions.map((question, idx) => (
item.selectedQuestions.map((question, idx) => ( <div
<div className={`flex flex-col w-full py-4 ${item.selectedQuestions.length !== idx + 1 && 'border-b border-gray-200'}`} key={`PISHNAMAYESH__${question.questionId}`}> className={`flex flex-col w-full py-4 ${
item.selectedQuestions.length !== idx + 1 &&
"border-b border-gray-200"
}`}
key={`PISHNAMAYESH__${question.questionId}`}
>
{console.log(item.selectedQuestions.length)} {console.log(item.selectedQuestions.length)}
{console.log(idx + 1)} {console.log(idx + 1)}
<div className="flex items-start pb-4"> <div className="flex items-start pb-4">
<h1 className="text-xl">{question.title}</h1> <h1 className="text-xl">{question.title}</h1>
<p className="w-1/12 pr-4">{question.score} نمره</p> <p className="w-1/12 pr-4">{question.score} نمره</p>
</div> </div>
{ {question.options.map((option) => (
question.options.map((option) => (
<div className="flex w-full my-2 items-center"> <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`}> <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]} {optionNum[option.id]}
</div> </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`}> <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} {option.title}
</div> </div>
</div> </div>
)) ))}
}
</div> </div>
)) ))}
}
</div> </div>
)) ))}
} </div>
</div> : ) : (
addExamState.type === 'pdf' && addExamState.type === "pdf" && (
<div className="flex flex-col w-full items-center"> <div className="flex flex-col w-full items-center">
<h1 className="w-full text-right pb-4 text-lg font-bold">دفترچه ها</h1> <h1 className="w-full text-right pb-4 text-lg font-bold">
دفترچه ها
</h1>
<div className="w-full flex flex-wrap"> <div className="w-full flex flex-wrap">
{ {addExamState?.questionnaires?.map((item) => (
addExamState?.questionnaires?.map((item) => (
<div <div
className={`flex flex-col ${
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`} 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)} onClick={() => setSelectedCourse(item)}
> >
<p className="text-red52">{item.name}</p>
<p className="text-red52">
{item.name}
</p>
</div> </div>
)) ))}
}
</div> </div>
<div className="flex w-full border-t border-gray-200 mt-10"> <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' }}> <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"> <Worker workerUrl="https://unpkg.com/pdfjs-dist@2.13.216/build/pdf.worker.min.js">
<Viewer fileUrl={selectedCourse.fileUrl} /> <Viewer fileUrl={selectedCourse.fileUrl} />
</Worker> </Worker>
</div> </div>
<div className="w-1/2 my-20 flex justify-center overflow-x-hidden overflow-scroll" style={{height: '600px'}}> <div
className="w-1/2 my-20 flex justify-center overflow-x-hidden overflow-scroll"
style={{ height: "600px" }}
>
<div className="w-2/3"> <div className="w-2/3">
<Preview answers={selectedCourse.answers} /> <Preview answers={selectedCourse.answers} />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
)
} )}
<div className="w-full flex justify-end font-bold mt-6"> <div className="w-full flex justify-end font-bold mt-6">
<button className="py-4 font-bold px-6 rounded-lg text-red52 mr-4" <button
onClick={() => backStep()}> className="py-4 font-bold px-6 rounded-lg text-red52 mr-4"
onClick={() => backStep()}
>
بازگشت به مرحله قبلی بازگشت به مرحله قبلی
</button> </button>
<button className="bg-red52 py-4 px-6 rounded-lg text-white mr-4" <button
onClick={() => stepClick()}> className="bg-red52 py-4 px-6 rounded-lg text-white mr-4"
onClick={submitHandler}
>
تایید آزمون تایید آزمون
</button> </button>
</div> </div>
</div> </div>
);
};
)
}
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
grades: state.publicApi.grades, grades: state.publicApi.grades,
addExamState: state.addExamReduser addExamState: state.addExamReduser
}) })
export default connect(mapStateToProps)(ViewExam); const mapDispatchToProps = {
parentAdd: exam.parentAdd,
};
export default connect(mapStateToProps, mapDispatchToProps)(ViewExam);

@ -1,7 +1,9 @@
import moment from "jalali-moment"; import moment from "jalali-moment";
import React from "react"; import React from "react";
import { connect } from "react-redux";
import Button from "../../../components/Button"; import Button from "../../../components/Button";
import Checkbox from "../../../components/Checkbox"; import Checkbox from "../../../components/Checkbox";
import { userProduct } from "../../../redux/actions";
import separate from "../../../utils/separate"; import separate from "../../../utils/separate";
const servicePopUp = ({ const servicePopUp = ({
content, content,
@ -10,6 +12,8 @@ const servicePopUp = ({
sendPrice, sendPrice,
setShowBudget, setShowBudget,
setBudgetFileId, setBudgetFileId,
userInfo,
pushToCart
}) => { }) => {
console.log(")))))(((((((((("); console.log(")))))((((((((((");
console.log(content); console.log(content);
@ -18,6 +22,29 @@ const servicePopUp = ({
setBudgetFileId(fileId); setBudgetFileId(fileId);
setShowBudget(true); setShowBudget(true);
}; };
//addToCartHandler------
let rulesAccepted = userInfo.rulesAccepted;
const addToCartHandler = () => {
let checkBoxes = document.querySelectorAll(".exam-child-checbox");
let childList = [];
let parentLength = content?.product?.childs?.length;
console.log("buying.....................");
for (let i = 0; i < checkBoxes.length; i++) {
if (checkBoxes[i].checked) {
childList.push(content?.product?.childs[i].id);
}
}
console.log(childList);
console.log(parentLength);
if (parentLength === childList.length) {
pushToCart({ productId :content.product.id,count:1});
} else {
for(let j=0;j<childList.length;j++){
pushToCart({productId:childList[j],count:1})
}
}
};
return ( return (
<div <div
className="flex justify-center w-full items-center fixed text-right z-30 backdrop-blur" className="flex justify-center w-full items-center fixed text-right z-30 backdrop-blur"
@ -156,6 +183,7 @@ const servicePopUp = ({
</div> </div>
)} )}
{content.id === 2 && ( {content.id === 2 && (
<div className="w-full">
<div className="flex w-11/12 flex-col rounded-xl border border-red82OP"> <div className="flex w-11/12 flex-col rounded-xl border border-red82OP">
<h1 className="px-2 py-6 border-b border-red82OP bg-blueFF rounded-t-xl pr-10 text-blueE3 text-xl font-bold"> <h1 className="px-2 py-6 border-b border-red82OP bg-blueFF rounded-t-xl pr-10 text-blueE3 text-xl font-bold">
{content.title} {content.title}
@ -197,13 +225,13 @@ const servicePopUp = ({
به صورت معمول تمامی آزمون ها برای شما خریداری خواهند شد مگر به صورت معمول تمامی آزمون ها برای شما خریداری خواهند شد مگر
اینکه شما به صورت دلخواه یک یا چند آزمون را انتخاب نمایید اینکه شما به صورت دلخواه یک یا چند آزمون را انتخاب نمایید
</div> </div>
{content?.product?.exam?.childs?.map((item, index) => ( {content?.product?.childs?.map((item, index) => (
<div <div
className="flex w-full items-center justify-between border-b border-red82OP font-bold text-red26 text-xs py-3 px-6 " className="flex w-full items-center justify-between border-b border-red82OP font-bold text-red26 text-xs py-3 px-6 "
style={{ direction: "rtl" }} style={{ direction: "rtl" }}
> >
<div className="flex items-center font-bold"> <div className="flex items-center font-bold">
<Checkbox {/* <Checkbox
name={`examPackage_${item.id}_${index}`} name={`examPackage_${item.id}_${index}`}
defaultChecked={true} defaultChecked={true}
// onclick={(e) => // onclick={(e) =>
@ -211,29 +239,42 @@ const servicePopUp = ({
// ? sendPrice(item.price) // ? sendPrice(item.price)
// : sendPrice(-item.price) // : sendPrice(-item.price)
// } // }
/> */}
<input
type="checkbox"
name="exam-child-checbox"
className="exam-child-checbox w-5 h-5 rounded-sm ml-3 accent-[#DF1452]"
defaultChecked={true}
/> />
<p>{item?.name}</p> <p>{item?.name}</p>
</div> </div>
<p> <p>
تاریخ :{" "} تاریخ :{" "}
{moment(item?.startDate, "YYYY/MM/DD") {moment(item?.exam?.startDate, "YYYY/MM/DD")
.locale("fa") .locale("fa")
.format("YYYY/MM/DD")} .format("YYYY/MM/DD")}
</p> </p>
{/* <p>ساعت : {item.time}</p> */} {/* <p>ساعت : {item.time}</p> */}
<p <p
className="cursor-pointer" className="cursor-pointer"
onClick={() => onClick={() => budgetHandler(item?.exam?.budgetFileId)}
budgetHandler(item?.budgetFileId)
}
> >
بودجه بندی ! بودجه بندی !
</p> </p>
<p>تعداد سوالات: {item?.questionCount}</p> <p>تعداد سوالات: {item?.exam?.questionCount}</p>
<p>{separate(item?.price)} تومان</p> <p>{separate(item?.price)} تومان</p>
</div> </div>
))} ))}
</div> </div>
{rulesAccepted && <div className="w-full flex mt-5">
<div
className="w-40 h-12 rounded bg-[#DF1452] flex items-center justify-center text-[#fff] cursor-pointer text-sm"
onClick={addToCartHandler}
>
افزودن به سبد خرید
</div>
</div>}
</div>
)} )}
{content.id === 3 && ( {content.id === 3 && (
@ -272,4 +313,12 @@ const servicePopUp = ({
); );
}; };
export default servicePopUp; const mapStateToProps = (state) => ({
userInfo: state.user.status,
});
const mapDispatchToProps = {
pushToCart: userProduct.add,
};
export default connect(mapStateToProps, mapDispatchToProps)(servicePopUp);

Loading…
Cancel
Save