|
|
@ -5,6 +5,7 @@ import { connect } from "react-redux"; |
|
|
|
import { Link, useLocation } from "react-router-dom"; |
|
|
|
import { Link, useLocation } from "react-router-dom"; |
|
|
|
import Product from "../../components/Product"; |
|
|
|
import Product from "../../components/Product"; |
|
|
|
import { CgDanger } from "react-icons/cg"; |
|
|
|
import { CgDanger } from "react-icons/cg"; |
|
|
|
|
|
|
|
import { BsFillCheckCircleFill } from "react-icons/bs"; |
|
|
|
import filterIcon from "../../assets/img/vuesax-linear-filter-tick.svg"; |
|
|
|
import filterIcon from "../../assets/img/vuesax-linear-filter-tick.svg"; |
|
|
|
// import ScrollContainer from 'react-indiana-drag-scroll'
|
|
|
|
// import ScrollContainer from 'react-indiana-drag-scroll'
|
|
|
|
|
|
|
|
|
|
|
@ -42,6 +43,26 @@ const Services = ({ |
|
|
|
useEffect(()=>{ |
|
|
|
useEffect(()=>{ |
|
|
|
getUserInfo(); |
|
|
|
getUserInfo(); |
|
|
|
},[]) |
|
|
|
},[]) |
|
|
|
|
|
|
|
//------------------------------------
|
|
|
|
|
|
|
|
const [fliterList,setFilterList]=useState([]); |
|
|
|
|
|
|
|
const [fake,setFake]=useState(0); |
|
|
|
|
|
|
|
const fliterHandler=(index)=>{ |
|
|
|
|
|
|
|
let list = fliterList; |
|
|
|
|
|
|
|
if(fliterList.includes(index)){ |
|
|
|
|
|
|
|
let newList = []; |
|
|
|
|
|
|
|
for(let i=0;i<list.length;i++){ |
|
|
|
|
|
|
|
if(list[i]!==index){ |
|
|
|
|
|
|
|
newList.push(list[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setFilterList(newList); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
let newList = fliterList; |
|
|
|
|
|
|
|
newList.push(index); |
|
|
|
|
|
|
|
setFilterList(newList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setFake(fake+1); |
|
|
|
|
|
|
|
} |
|
|
|
//-------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------
|
|
|
|
const [filterCheck, setFilterCheck] = useState([ |
|
|
|
const [filterCheck, setFilterCheck] = useState([ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -75,29 +96,16 @@ const Services = ({ |
|
|
|
//handle payment response------------
|
|
|
|
//handle payment response------------
|
|
|
|
let search = useLocation().search; |
|
|
|
let search = useLocation().search; |
|
|
|
let query = Object.fromEntries(new URLSearchParams(search)); |
|
|
|
let query = Object.fromEntries(new URLSearchParams(search)); |
|
|
|
|
|
|
|
const [paymentError,setPaymentError]=useState(false); |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (query.status) { |
|
|
|
if (query.status) { |
|
|
|
if (query.status === "OK") { |
|
|
|
if (query.status === "OK") { |
|
|
|
toast.success("پرداخت با موفقیت انجام شد"); |
|
|
|
toast.success("پرداخت با موفقیت انجام شد"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
toast.error( |
|
|
|
// toast.error(
|
|
|
|
`عملیات پرداخت موفق نبود. شناسه پیگیری شما ${query.authority} میباشد` |
|
|
|
// `عملیات پرداخت موفق نبود. شناسه پیگیری شما ${query.authority} میباشد`
|
|
|
|
); |
|
|
|
// );
|
|
|
|
// fireAlert({
|
|
|
|
setPaymentError(true); |
|
|
|
// title: "پرداخت ناموفق",
|
|
|
|
|
|
|
|
// text: `عملیات پرداخت موفق نبود. شناسه پیگیری شما ${query.authority} میباشد`,
|
|
|
|
|
|
|
|
// confirmButtonText: "توضیح بیشتر",
|
|
|
|
|
|
|
|
// showCancelButton: true,
|
|
|
|
|
|
|
|
// cancelButtonText: "متوجه شدم",
|
|
|
|
|
|
|
|
// showCloseButton: false,
|
|
|
|
|
|
|
|
// customClass: {
|
|
|
|
|
|
|
|
// title: "title-error-7",
|
|
|
|
|
|
|
|
// closeButton: "close-button-7",
|
|
|
|
|
|
|
|
// confirmButton: "confirm-button-7",
|
|
|
|
|
|
|
|
// cancelButton: "cancle-button7",
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
setShowPaymentBox(true); |
|
|
|
setShowPaymentBox(true); |
|
|
|
} |
|
|
|
} |
|
|
@ -223,7 +231,7 @@ const Services = ({ |
|
|
|
// style={{ paddingTop:'5.5%', height: '100vh' }}
|
|
|
|
// style={{ paddingTop:'5.5%', height: '100vh' }}
|
|
|
|
> |
|
|
|
> |
|
|
|
<div |
|
|
|
<div |
|
|
|
className="h-48 w-full border-b border-red82OP my-4 px-6" |
|
|
|
className="h-40 w-full border-b border-red82OP my-4 px-6" |
|
|
|
style={{ direction: "ltr" }} |
|
|
|
style={{ direction: "ltr" }} |
|
|
|
> |
|
|
|
> |
|
|
|
<Games |
|
|
|
<Games |
|
|
@ -233,65 +241,63 @@ const Services = ({ |
|
|
|
setTypes={(val) => setSelectedProductTypes(val)} |
|
|
|
setTypes={(val) => setSelectedProductTypes(val)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/* filters */} |
|
|
|
{/* filters-------------------------------------- */} |
|
|
|
{gameId != 6 && ( |
|
|
|
{gameId === 3 && ( |
|
|
|
<div className="flex mx-6 justify-start"> |
|
|
|
<div className="flex mx-6 justify-start"> |
|
|
|
<div className="flex items-center "> |
|
|
|
<div className="flex items-center "> |
|
|
|
<img src={filterIcon} alt="filterIcon" className="w-9" /> |
|
|
|
<img src={filterIcon} alt="filterIcon" className="w-9" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="flex items-center mx-6 pl-6 border-l-2 border-gray-300"> |
|
|
|
<div className="flex items-center mx-6 pl-6 border-l-2 border-gray-300"> |
|
|
|
{filterCheck.map((filter) => ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
className="w-20 h-10 rounded-lg border border-gray-300 text-sm text-gray-300 flex items-center justify-center ml-2 cursor-pointer gap-x-1" |
|
|
|
key={`FILTER_${filter.id}`} |
|
|
|
style={ |
|
|
|
className={`flex w-32 border-2 p-2 px-4 mx-2 justify-center items-center rounded-md cursor-pointer
|
|
|
|
!fliterList.includes(4) |
|
|
|
hover:border-red52 hover:text-red52 hover:bg-pinkF5
|
|
|
|
? { borderColor: "#DF1452", color: "#DF1452" } |
|
|
|
${ |
|
|
|
: null |
|
|
|
selectedFilters.includes(filter.id) |
|
|
|
} |
|
|
|
? "border-red52 text-red52 bg-pinkF5" |
|
|
|
onClick={() => fliterHandler(4)} |
|
|
|
: "border-gray200 text-gray-400" |
|
|
|
> |
|
|
|
}`}
|
|
|
|
<div>آنلاین</div> |
|
|
|
onClick={(prevState) => { |
|
|
|
<BsFillCheckCircleFill /> |
|
|
|
if (selectedFilters.includes(filter.id)) { |
|
|
|
</div> |
|
|
|
setSelectedFilters( |
|
|
|
<div |
|
|
|
selectedFilters.filter((itm) => itm !== filter.id) |
|
|
|
className="w-20 h-10 rounded-lg border border-gray-300 text-sm text-gray-300 flex items-center justify-center cursor-pointer gap-x-1" |
|
|
|
); |
|
|
|
style={ |
|
|
|
} else { |
|
|
|
!fliterList.includes(3) |
|
|
|
setSelectedFilters([...selectedFilters, filter.id]); |
|
|
|
? { borderColor: "#DF1452", color: "#DF1452" } |
|
|
|
} |
|
|
|
: null |
|
|
|
}} |
|
|
|
} |
|
|
|
> |
|
|
|
onClick={() => fliterHandler(3)} |
|
|
|
<h3>{filter.title}</h3> |
|
|
|
> |
|
|
|
{selectedFilters.includes(filter.id) && ( |
|
|
|
<div>حضوری</div> |
|
|
|
<div className="flex w-full" style={{ direction: "ltr" }}> |
|
|
|
<BsFillCheckCircleFill /> |
|
|
|
<div className="w-4 h-4 text-white text-sm rounded-full flex justify-center items-center bg-red52"> |
|
|
|
</div> |
|
|
|
<svg |
|
|
|
|
|
|
|
width="37" |
|
|
|
|
|
|
|
height="37" |
|
|
|
|
|
|
|
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> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
))} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="flex items-center "> |
|
|
|
<div className="flex items-center mx-4 pl-6"> |
|
|
|
<div |
|
|
|
<select className="bg-white border-2 border-solid border-gray-300 w-72 p-3 rounded-lg text-gray-400 outline-red52"> |
|
|
|
className="w-20 h-10 rounded-lg border border-gray-300 text-sm text-gray-300 flex items-center justify-center ml-2 cursor-pointer gap-x-1" |
|
|
|
{services.map((item, index) => ( |
|
|
|
style={ |
|
|
|
<option key={`Grade__${index}`}>{item.title}</option> |
|
|
|
!fliterList.includes(1) |
|
|
|
))} |
|
|
|
? { borderColor: "#DF1452", color: "#DF1452" } |
|
|
|
</select> |
|
|
|
: null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
onClick={() => fliterHandler(1)} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<div>پسرانه</div> |
|
|
|
|
|
|
|
<BsFillCheckCircleFill /> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
className="w-20 h-10 rounded-lg border border-gray-300 text-sm text-gray-300 flex items-center justify-center cursor-pointer gap-x-1" |
|
|
|
|
|
|
|
style={ |
|
|
|
|
|
|
|
!fliterList.includes(2) |
|
|
|
|
|
|
|
? { borderColor: "#DF1452", color: "#DF1452" } |
|
|
|
|
|
|
|
: null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
onClick={() => fliterHandler(2)} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<div>دخترانه</div> |
|
|
|
|
|
|
|
<BsFillCheckCircleFill /> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
@ -300,38 +306,44 @@ const Services = ({ |
|
|
|
{books |
|
|
|
{books |
|
|
|
?.filter((itm) => selectedProductTypes.includes(itm.productType)) |
|
|
|
?.filter((itm) => selectedProductTypes.includes(itm.productType)) |
|
|
|
.map((product, index) => ( |
|
|
|
.map((product, index) => ( |
|
|
|
<div |
|
|
|
<React.Fragment key={index}> |
|
|
|
// to={"/class/" + product?.id}
|
|
|
|
{(gameId !== 3 || |
|
|
|
className="w-[30%]" |
|
|
|
(!fliterList.includes(product?.productType - 1) && |
|
|
|
key={`PRODUCT__${gameId}__${index}`} |
|
|
|
!fliterList.includes(product?.gender))) && ( |
|
|
|
style={gameId === 5 ? { width: "100%" } : null} |
|
|
|
<div |
|
|
|
> |
|
|
|
// to={"/class/" + product?.id}
|
|
|
|
{(selectedProductTypes.includes(4) || |
|
|
|
className="w-[30%]" |
|
|
|
selectedProductTypes.includes(7)) && ( |
|
|
|
key={`PRODUCT__${gameId}__${index}`} |
|
|
|
<Product |
|
|
|
style={gameId === 5 ? { width: "100%" } : null} |
|
|
|
key={index} |
|
|
|
> |
|
|
|
productsType={filter.productsType} |
|
|
|
{(selectedProductTypes.includes(4) || |
|
|
|
product={product} |
|
|
|
selectedProductTypes.includes(7)) && ( |
|
|
|
index={Number(index)} |
|
|
|
<Product |
|
|
|
productName={`${product?.name}`} |
|
|
|
key={index} |
|
|
|
productCat={`پایه ${grades[product?.gradeId]}`} |
|
|
|
productsType={filter.productsType} |
|
|
|
productPrice={separate(product?.price)} |
|
|
|
product={product} |
|
|
|
// productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds}
|
|
|
|
index={Number(index)} |
|
|
|
numberOfRegards={160} |
|
|
|
productName={`${product?.name}`} |
|
|
|
productHolderBorder="" |
|
|
|
productCat={`پایه ${grades[product?.gradeId]}`} |
|
|
|
productHolderHoverBorder="shadow-md" |
|
|
|
productPrice={separate(product?.price)} |
|
|
|
teacher={product.vodTeacher} |
|
|
|
// productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds}
|
|
|
|
catId={gameId} |
|
|
|
numberOfRegards={160} |
|
|
|
userInfo={userInfo} |
|
|
|
productHolderBorder="" |
|
|
|
onClick={() => { |
|
|
|
productHolderHoverBorder="shadow-md" |
|
|
|
productClickhandler(product); |
|
|
|
teacher={product.vodTeacher} |
|
|
|
}} |
|
|
|
catId={gameId} |
|
|
|
btnOnClick={() => { |
|
|
|
userInfo={userInfo} |
|
|
|
AddToCartHandler(product); |
|
|
|
onClick={() => { |
|
|
|
}} |
|
|
|
productClickhandler(product); |
|
|
|
/> |
|
|
|
}} |
|
|
|
|
|
|
|
btnOnClick={() => { |
|
|
|
|
|
|
|
AddToCartHandler(product); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</React.Fragment> |
|
|
|
))} |
|
|
|
))} |
|
|
|
{!selectedProductTypes.includes(4) && |
|
|
|
{!selectedProductTypes.includes(4) && |
|
|
|
!selectedProductTypes.includes(7) && |
|
|
|
!selectedProductTypes.includes(7) && |
|
|
@ -386,7 +398,12 @@ const Services = ({ |
|
|
|
)} |
|
|
|
)} |
|
|
|
{/* --------------payment-box------------------------------------- */} |
|
|
|
{/* --------------payment-box------------------------------------- */} |
|
|
|
{showPaymentBox && ( |
|
|
|
{showPaymentBox && ( |
|
|
|
<PaymentBox setShowPaymentBox={setShowPaymentBox} query={query} /> |
|
|
|
<PaymentBox |
|
|
|
|
|
|
|
setShowPaymentBox={setShowPaymentBox} |
|
|
|
|
|
|
|
query={query} |
|
|
|
|
|
|
|
paymentError={paymentError} |
|
|
|
|
|
|
|
setPaymentError={setPaymentError} |
|
|
|
|
|
|
|
/> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|