@ -4,9 +4,9 @@ import { connect } from "react-redux";
import { Link } from "react-router-dom" ;
import Product from "../../components/Product" ;
import { CgDanger } from "react-icons/cg" ;
import { AiOutlinePlus , AiFillDelete } from "react-icons/ai" ;
// import ScrollContainer from 'react-indiana-drag-scroll'
import img1 from "../../assets/img/Group 1344.svg" ;
import img2 from "../../assets/img/Group 1345.svg" ;
import img3 from "../../assets/img/Group 1349.svg" ;
@ -18,9 +18,7 @@ import ServicePopUp from "./service";
import Games from "../dashboard2/Games" ;
// import Packages from "../dashboard2/Packages";
import './index.css'
import "./index.css" ;
import separate from "../../utils/separate" ;
const Services = ( {
@ -35,20 +33,19 @@ const Services = ({
headerOptions ,
videos ,
pushToCart ,
pushSchoolToCart
pushSchoolToCart ,
} ) => {
const [ filterCheck , setFilterCheck ] = useState ( [
{
id : 1 ,
title : 'حضوری' ,
id : 1 ,
title : "حضوری" ,
} ,
{
id : 2 ,
title : 'آنلاین' ,
id : 2 ,
title : "آنلاین" ,
} ,
] ) ;
const [ selectedFilters , setSelectedFilters ] = useState ( [ ] )
const [ selectedFilters , setSelectedFilters ] = useState ( [ ] ) ;
const [ filter , setFilter ] = useState ( {
search : "" ,
grade : "" ,
@ -66,7 +63,7 @@ const Services = ({
classHour : "" ,
classMinute : "" ,
} ) ;
const [ sharzhVal , setSharzhVal ] = useState ( '' ) ;
const [ sharzhVal , setSharzhVal ] = useState ( "" ) ;
const [ selectedProductTypes , setSelectedProductTypes ] = useState ( [ 7 ] ) ;
// const onChange = (name, value) => {
// setFilter({ ...filter, [name]: value });
@ -119,9 +116,51 @@ const Services = ({
const [ gameId , setGameId ] = useState ( 5 ) ;
const chooseGame = ( id ) => {
setGameId ( id ) ;
console . log ( selectedProductTypes )
console . log ( selectedProductTypes ) ;
} ;
console . log ( gameId )
console . log ( gameId ) ;
//-------------------------------------
const [ fake , setFake ] = useState ( 0 ) ;
const [ paymentList , setPaymentList ] = useState ( [
{
id : 1 ,
amount : null ,
status : 4 ,
type : 1 ,
} ,
] ) ;
const changeType = ( e , index ) => {
let newList = paymentList ;
newList [ index ] = { ... newList [ index ] , type : Number ( e . target . value ) } ;
console . log ( "g:" )
console . log ( newList [ index ] ) ;
setPaymentList ( newList ) ;
setFake ( fake + 1 ) ;
}
const [ showPaymentBox , setShowPaymentBox ] = useState ( false ) ;
const addPaymentHandler = ( ) => {
let newList = paymentList ;
newList . push ( {
id : newList . length + 1 ,
amount : null ,
status : 4 ,
type : 1 ,
} ) ;
setPaymentList ( newList ) ;
setFake ( fake + 1 ) ;
}
const deletePayment = ( index ) => {
let newList = [ ] ;
for ( let i = 0 ; i < paymentList . length ; i ++ ) {
if ( i !== index ) {
newList . push ( paymentList [ i ] ) ;
}
}
setPaymentList ( newList ) ;
setFake ( fake + 1 ) ;
}
//-==========================================================
if ( ! isMobile ) {
return (
< div
@ -317,7 +356,7 @@ const Services = ({
// to={"/class/" + product?.id}
className = "w-[30%]"
key = { ` PRODUCT__ ${ gameId } __ ${ index } ` }
style = { gameId === 5 ? { width : "100%" } : null }
style = { gameId === 5 ? { width : "100%" } : null }
>
{ /* {console.log(product)} */ }
{ ( selectedProductTypes . includes ( 4 ) ||
@ -340,38 +379,16 @@ const Services = ({
setPopUpContent ( {
id : gameId ,
title : product ? . name ,
video : "" ,
teacher : product ? . vodTeacher ,
description :
"در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار می گیرد در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت" ,
video : product ? . fileId ,
teacher : product ? . teacherName ,
description : product ? . description ,
price : gameId == 2 ? 0 : product ? . price ,
classHour : 21 ,
classMinute : 56 ,
classHour : product ? . duration ,
classMinute : "" ,
image :
"https://narafella.ir/wp-content/uploads/2021/08/books-min.jpg" ,
examCont : [
{
title : "بخش اول آزمون " + product . name ,
date : "۱۴۰۰/۱۲/۱۳" ,
time : "۱۴:۴۶" ,
numberOfQ : "۱۸" ,
price : 10000 ,
} ,
{
title : "بخش دوم آزمون " + product . name ,
date : "۱۴۰۰/۱۲/۱۴" ,
time : "۱۴:۴۶" ,
numberOfQ : "۱۸" ,
price : 10000 ,
} ,
{
title : "بخش سوم آزمون " + product . name ,
date : "۱۴۰۰/۱۲/۱۵" ,
time : "۱۴:۴۶" ,
numberOfQ : "۳۲" ,
price : 250000 ,
} ,
] ,
examCont : [ ] ,
type : product ? . productType ,
} ) ;
if ( gameId !== 5 ) {
setPopUp ( true ) ;
@ -401,8 +418,9 @@ const Services = ({
) }
< / d i v >
) ) }
{ ( ! selectedProductTypes . includes ( 4 ) &&
! selectedProductTypes . includes ( 7 ) && gameId !== 6 ) && (
{ ! selectedProductTypes . includes ( 4 ) &&
! selectedProductTypes . includes ( 7 ) &&
gameId !== 6 && (
< div className = "w-full h-28 flex flex-col items-center justify-center mx-auto rounded" >
< CgDanger className = "text-4xl" / >
< div className = "text-xl mt-4" style = { { direction : "rtl" } } >
@ -447,10 +465,154 @@ const Services = ({
< / d i v >
{ /* --------------left-part------------------------------------- */ }
{ ! isMobile && (
< div className = "w-[23.5%] left-0" style = { { height : "100vh" } } >
< div className = "w-[23.5%] left-0 " style = { { height : "100vh" } } >
< ShoppingCart / >
< / d i v >
) }
{ /* --------------payment-box------------------------------------- */ }
< div className = "w-[93.5vw] h-[93.5vh] bg-black fixed top-[6.5%] left-0 backdrop-blur-md bg-[#0000004D] flex items-center justify-center" >
< div className = "w-[80%] h-[80%] bg-white rounded-lg px-8 py-2" >
< div className = "w-full text-right text-2xl text-[#DF1452]" >
پرداخت و ثبت تراکنش ها
< / d i v >
< div className = "payment-container w-full mt-6" >
{ paymentList . map ( ( item , index ) => (
< div
key = { index }
className = "w-full mb-2 flex justify-between text-black"
>
< select
className = "w-[17%] h-10 rounded outline-0 border text-black px-1 py-0"
onChange = { ( e ) => changeType ( e , index ) }
>
{ /* <option value={null}>نوع پرداخت</option> */ }
< option value = { 1 } > پرداخت اینترنتی < / o p t i o n >
< option value = { 2 } > کارت به کارت < / o p t i o n >
{ / * < o p t i o n v a l u e = { 3 } > پ ر د ا خ ت ب ا چ ک < / o p t i o n >
< option value = { 4 } > پرداخت نقدی < /option> */ }
< / s e l e c t >
{ /* ------------ */ }
< div className = "w-[58%]" >
< div className = "w-full h-10 flex box-border rounded overflow-hidden border" >
< div className = "w-1/5 bg-[#000] flex items-center justify-center text-white rounded-r" >
مبلغ
< / d i v >
< input
type = "text"
name = "payment-box-amount-input"
id = "payment-box-amount-input"
className = "w-[70%] h-10 px-1 outline-0 text-center"
/ >
< div className = "w-[10%] h-full flex items-center justify-center text-sm" >
تومان
< / d i v >
< / d i v >
{ /* - */ }
{ item . type === 2 && (
< div className = "w-full h-10 flex box-border rounded overflow-hidden border mt-2" >
< div className = "w-1/5 bg-[#000] flex items-center justify-center text-white rounded-r" >
شماره کارت
< / d i v >
< input
type = "text"
name = "payment-box-amount-input"
id = "payment-box-amount-input"
className = "w-[80%] h-10 px-1 outline-0 text-center"
/ >
< / d i v >
) }
{ /* - */ }
{ item . type === 2 && (
< div className = "w-full h-10 flex items-center justify-between mt-1" >
< div className = "w-[60%] h-10 flex box-border rounded overflow-hidden border mt-2" >
< div className = "w-[40%] bg-[#000] flex items-center justify-center text-white rounded-r text-sm" >
تاریخ پرداخت
< / d i v >
< div className = "w-[60%] h-full flex items-center justify-between p-1" >
< input
type = "text"
className = "w-[29%] h-full rounded border text-center text-sm"
/ >
< div className = "h-full w-[5%] flex items-center justify-center" >
/
< / d i v >
< input
type = "text"
className = "w-[29%] h-full rounded border text-center text-sm"
/ >
< div className = "h-full w-[5%] flex items-center justify-center" >
/
< / d i v >
< input
type = "text"
className = "w-[29%] h-full rounded border text-center text-sm"
/ >
< / d i v >
< / d i v >
{ /* ---- */ }
< div className = "w-[39%] h-10 flex box-border rounded overflow-hidden border mt-2" >
< div className = "w-[40%] bg-[#000] flex items-center justify-center text-white rounded-r text-sm" >
ساعت پرداخت
< / d i v >
< div className = "w-[60%] h-full flex justify-between items-center p-1" >
< input
type = "text"
className = "w-[45%] h-full rounded border text-center text-sm"
/ >
< div className = "h-full w-[5%] flex items-center justify-center" >
:
< / d i v >
< input
type = "text"
className = "w-[45%] h-full rounded border text-center text-sm"
/ >
< / d i v >
< / d i v >
< / d i v >
) }
{ /* - */ }
{ item . type === 2 && (
< div className = "w-full h-10 flex box-border rounded overflow-hidden border mt-2" >
< div className = "w-1/5 bg-[#000] flex items-center justify-center text-white rounded-r" >
شماره پیگیری
< / d i v >
< input
type = "text"
name = "payment-box-amount-input"
id = "payment-box-amount-input"
className = "w-[80%] h-10 px-1 outline-0 text-center"
/ >
< / d i v >
) }
< / d i v >
{ /* ------------------ */ }
< div className = "w-[17%] h-10" >
{ item . type === 1 && (
< div className = "w-full h-full rounded bg-[#DF1452] flex items-center justify-center text-white cursor-pointer" >
پرداخت
< / d i v >
) }
{ item . type === 2 && (
< div className = "w-full h-full rounded bg-[#DF1452] flex items-center justify-center text-white cursor-pointer" >
ثبت پرداخت
< / d i v >
) }
< / d i v >
{ /* ------------------ */ }
< div className = "w-[4%] h-10 rounded flex items-center justify-center cursor-pointer bg-red-600 text-white" style = { index === 0 ? { pointerEvents : "none" , filter : "grayscale(100%)" } : null } onClick = { ( ) => deletePayment ( index ) } >
< AiFillDelete className = "text-xl text-white" / >
< / d i v >
< / d i v >
) ) }
< / d i v >
{ / * < d i v
className = "w-10 h-10 rounded-full mt-4 border mx-auto border-[#DF1452] cursor-pointer flex items-center justify-center"
onClick = { addPaymentHandler }
>
< AiOutlinePlus className = "text-2xl text-[#DF1452]" / >
< /div> */ }
< / d i v >
< / d i v >
< / d i v >
) ;
}
@ -576,10 +738,7 @@ const Services = ({
{ books
? . filter ( ( itm ) => selectedProductTypes . includes ( itm . productType ) )
. map ( ( product , index ) => (
< div
className = "bg-black"
key = { ` PRODUCT__ ${ gameId } __ ${ index } ` }
>
< div className = "bg-black" key = { ` PRODUCT__ ${ gameId } __ ${ index } ` } >
{ selectedProductTypes . includes ( 4 ) && (
< Product
key = { index }
@ -700,7 +859,6 @@ const Services = ({
< / d i v >
) ;
}
} ;
const mapStateToProps = ( state ) => ( {