@ -30,7 +30,8 @@ function ShoppingCart({
desktopContentTransform ,
desktopContentTransform ,
pushToCart ,
pushToCart ,
pushSchoolToCart ,
pushSchoolToCart ,
paySchool
paySchool ,
setShowPaymentBox ,
} ) {
} ) {
const [ phase , setPhase ] = useState ( "products" ) ;
const [ phase , setPhase ] = useState ( "products" ) ;
@ -41,35 +42,56 @@ function ShoppingCart({
} , [ ] ) ;
} , [ ] ) ;
console . log ( "Cart----------======================-------------------" ) ;
console . log ( "Cart----------======================-------------------" ) ;
console . log ( schoolList ) ;
console . log ( schoolList ) ;
return ( isMobile ?
//payHandler---------------------------------------
< div className = "w-full flex flex-col justify-between items-center bg-gray-200 rtl left-0 pt-[3.5%]" style = { { height : '100vh' } } >
const payHandler = ( ) => {
< div className = { ` w-full flex items-center flex-col ${ list ? . length > 3 && 'overflow-x-hidden overflow-scroll' } ` } style = { { height : '35%' } } >
setShowPaymentBox ( true ) ;
} ;
{
return isMobile ? (
schoolList . map ( ( school , index ) => (
< div
< div className = "flex bg-white justify-between items-center border-2 border-gray-300 p-4 rounded-xl m-2 mt-0 " key = { ` SCHOOL_ ${ index } ` } style = { { width : '90%' } } >
className = "w-full flex flex-col justify-between items-center bg-gray-200 rtl left-0 pt-[3.5%]"
style = { { height : "100vh" } }
>
< div
className = { ` w-full flex items-center flex-col ${
list ? . length > 3 && "overflow-x-hidden overflow-scroll"
} ` }
style = { { height : "35%" } }
>
{ schoolList . map ( ( school , index ) => (
< div
className = "flex bg-white justify-between items-center border-2 border-gray-300 p-4 rounded-xl m-2 mt-0 "
key = { ` SCHOOL_ ${ index } ` }
style = { { width : "90%" } }
>
< div className = "flex flex-col items-center w-full" >
< div className = "flex flex-col items-center w-full" >
< div className = "flex items-center w-full" >
< div className = "flex items-center w-full" >
< div className = "text-xs h-10 flex items-center p-2 border-l-2 border-gray-300 text-gray-400" > رزرو پیش ثبت نام < / d i v >
< div className = "text-xs h-10 flex items-center p-2 border-l-2 border-gray-300 text-gray-400" >
< h1 className = "text-md font-black px-2 text-black40" > { school ? . product ? . name } < / h 1 >
{ " " }
رزرو پیش ثبت نام { " " }
< / d i v >
< / d i v >
< button className = "w-full px-1 h-12 mt-1 text-white bg-red52 rounded-lg text-sm font-semibold" onClick = { ( ) => paySchool ( ) } >
< h1 className = "text-md font-black px-2 text-black40" >
پرداخت مستقیم به حساب مدرسه با مبلغ { separate ( school . price ) } تومان
{ " " }
{ school ? . product ? . name }
< / h 1 >
< / d i v >
< button
className = "w-full px-1 h-12 mt-1 text-white bg-red52 rounded-lg text-sm font-semibold"
onClick = { ( ) => paySchool ( ) }
>
پرداخت مستقیم به حساب مدرسه با مبلغ { separate ( school . price ) } { " " }
تومان
< / b u t t o n >
< / b u t t o n >
< p className = "w-full text-right text-xs mt-2" >
< p className = "w-full text-right text-xs mt-2" >
< span className = "text-red-600 font-bold" > توجه : < / s p a n >
< span className = "text-red-600 font-bold" > توجه : < / s p a n >
نحوه پرداخت برای رزرو پیش ثبت نام از طریق دکمه بالا خواهد بود
نحوه پرداخت برای رزرو پیش ثبت نام از طریق دکمه بالا خواهد بود و
و می بایست ازین طریق جداگانه پرداخت گردد
می بایست ازین طریق جداگانه پرداخت گردد
< / p >
< / p >
< / d i v >
< / d i v >
< div className = "flex items-center p-0 " >
< div className = "flex items-center p-0 " >
< div
< div
className = "w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52"
className = "w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52"
style = { { transform : 'translateX(-30px)' } }
style = { { transform : "translateX(-30px)" } }
onClick = { ( ) =>
onClick = { ( ) =>
pushSchoolToCart (
pushSchoolToCart (
{
{
@ -82,35 +104,57 @@ function ShoppingCart({
)
)
}
}
>
>
{ school . count == 1 ? (
< svg
xmlns = "http://www.w3.org/2000/svg"
{ school . count == 1 ? < svg xmlns = "http://www.w3.org/2000/svg" width = "12" height = "12" viewBox = "0 0 15.044 15.044" >
width = "12"
< g id = "vuesax_linear_card-remove" data - name = "vuesax/linear/card-remove" transform = "translate(-252.46 -511.461)" >
height = "12"
viewBox = "0 0 15.044 15.044"
>
< g
id = "vuesax_linear_card-remove"
data - name = "vuesax/linear/card-remove"
transform = "translate(-252.46 -511.461)"
>
< g id = "card-remove" transform = "translate(253.309 512.31)" >
< g id = "card-remove" transform = "translate(253.309 512.31)" >
< path id = "Vector" d = "M0,13.347,13.347,0" fill = "none" stroke = "#fff" strokeLinecap = "round" strokeWidth = "2" / >
< path
< path id = "Vector-2" data - name = "Vector" d = "M13.347,13.347,0,0" fill = "none" stroke = "#fff" strokeLinecap = "round" strokeWidth = "2" / >
id = "Vector"
d = "M0,13.347,13.347,0"
fill = "none"
stroke = "#fff"
strokeLinecap = "round"
strokeWidth = "2"
/ >
< path
id = "Vector-2"
data - name = "Vector"
d = "M13.347,13.347,0,0"
fill = "none"
stroke = "#fff"
strokeLinecap = "round"
strokeWidth = "2"
/ >
< / g >
< / g >
< / g >
< / g >
< / s v g > :
< / s v g >
) : (
< svg width = "100" height = "100" viewBox = "0 0 100 100" >
< svg width = "100" height = "100" viewBox = "0 0 100 100" >
< g stroke = "#fff" strokeWidth = "5" fill = "none" >
< g stroke = "#fff" strokeWidth = "5" fill = "none" >
< path d = " M 25 50 L 75 50
< path
d = " M 25 50 L 75 50
M 50 5
M 50 5
" / >
"
/ >
< / g >
< / g >
< / s v g > }
< / s v g >
) }
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
) )
) ) }
}
{ schoolList . length > 0 && (
{
< div className = "bg-gray-300 my-2 pb-1 rounded-full w-11/12" > < / d i v >
schoolList . length > 0 && < div className = "bg-gray-300 my-2 pb-1 rounded-full w-11/12" > < / d i v >
) }
}
{ list . map ( ( product , index ) => (
{ list . map ( ( product , index ) => (
< Product key = { index } product = { product } / >
< Product key = { index } product = { product } / >
) ) }
) ) }
@ -124,52 +168,63 @@ function ShoppingCart({
< p > جمع مبالغ خدمات < / p >
< p > جمع مبالغ خدمات < / p >
< p > { factorInfo ? . sumPrice } تومان < / p >
< p > { factorInfo ? . sumPrice } تومان < / p >
< / d i v >
< / d i v >
{ factorInfo ? . offPrice && (
< div className = "flex justify-between w-full py-2 text-red26 text-lg " >
< div className = "flex justify-between w-full py-2 text-red26 text-lg " >
< p > تخفیف < / p >
< p > تخفیف < / p >
< p > { factorInfo ? . offPrice } - تومان < / p >
< p > { factorInfo ? . offPrice } - تومان < / p >
< / d i v >
< / d i v >
< div className = "flex justify-between w-full py-2 text-red26 text-lg " >
) }
< p > کسر از اعتبار < / p >
< p > - ۰ تومان < / p >
< / d i v >
< / d i v >
< / d i v >
< Button
< Button
title = { ` پرداخت هزینه : ${ factorInfo ? . payPrice ? separate ( factorInfo ? . payPrice ) : 0 } تومان ` }
title = { ` پرداخت هزینه : ${
borderType = 'rounded-xl'
factorInfo ? . payPrice ? separate ( factorInfo ? . payPrice ) : 0
className = 'h-16 w-full mx-none text-xl'
} تومان ` }
borderType = "rounded-xl"
className = "h-16 w-full mx-none text-xl"
onClick = { ( ) => payFactor ( ) }
onClick = { ( ) => payFactor ( ) }
/ >
/ >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
) : (
:
< div className = "ccc w-full h-full flex flex-col justify-between items-center bg-gray-100 left-0 pt-14" >
< div
< div className = "flex flex-col justify-between items-center bg-gray-100 left-0 pt-14" style = { { height : '100vh' } } >
className = { ` w-full flex items-center flex-col h-[60%] overflow-y-auto ` }
< div className = { ` w-full flex items-center flex-col ${ list ? . length > 1 && 'overflow-x-hidden overflow-scroll' } ` } style = { { height : '60%' } } >
>
{
{ schoolList ? . map ( ( school , index ) => (
schoolList . map ( ( school , index ) => (
< div
< div className = "flex bg-white justify-between items-center border-2 border-gray-300 p-4 rounded-xl m-2 " key = { ` SCHOOL_ ${ index } ` } style = { { width : '90%' } } >
className = "flex bg-white justify-between items-center border-2 border-gray-300 p-4 rounded-xl m-2 "
key = { ` SCHOOL_ ${ index } ` }
style = { { width : "90%" } }
>
< div className = "flex flex-col items-center w-full" >
< div className = "flex flex-col items-center w-full" >
< div className = "flex items-center w-full" >
< div className = "flex items-center w-full" >
< div className = "text-xs h-10 flex items-center p-2 border-l-2 border-gray-300 text-gray-400" > رزرو پیش ثبت نام < / d i v >
< div className = "text-xs h-10 flex items-center p-2 border-l-2 border-gray-300 text-gray-400" >
< h1 className = "text-md font-black px-2 text-black40" > { school ? . product ? . name } < / h 1 >
{ " " }
رزرو پیش ثبت نام { " " }
< / d i v >
< / d i v >
< button className = "w-full px-1 h-12 mt-1 text-white bg-red52 rounded-lg font-semibold" style = { { fontSize : '0.65vw' } } onClick = { ( ) => paySchool ( ) } >
< h1 className = "text-md font-black px-2 text-black40" >
پرداخت مستقیم به حساب مدرسه با مبلغ { separate ( school . price ) } تومان
{ " " }
{ school ? . product ? . name }
< / h 1 >
< / d i v >
< button
className = "w-full px-1 h-12 mt-1 text-white bg-red52 rounded-lg font-semibold"
style = { { fontSize : "0.65vw" } }
onClick = { ( ) => paySchool ( ) }
>
پرداخت مستقیم به حساب مدرسه با مبلغ { separate ( school . price ) } { " " }
تومان
< / b u t t o n >
< / b u t t o n >
< p className = "w-full text-right text-xs mt-2" >
< p className = "w-full text-right text-xs mt-2" >
< span className = "text-red-600 font-bold" > توجه : < / s p a n >
< span className = "text-red-600 font-bold" > توجه : < / s p a n >
نحوه پرداخت برای رزرو پیش ثبت نام از طریق دکمه بالا خواهد بود
نحوه پرداخت برای رزرو پیش ثبت نام از طریق دکمه بالا خواهد بود و
و می بایست ازین طریق جداگانه پرداخت گردد
می بایست ازین طریق جداگانه پرداخت گردد
< / p >
< / p >
< / d i v >
< / d i v >
< div className = "flex items-center p-0 " >
< div className = "flex items-center p-0 " >
< div
< div
className = "w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52"
className = "w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52"
style = { { transform : 'translateX(-30px)' } }
style = { { transform : "translateX(-30px)" } }
onClick = { ( ) =>
onClick = { ( ) =>
pushSchoolToCart (
pushSchoolToCart (
{
{
@ -182,65 +237,86 @@ function ShoppingCart({
)
)
}
}
>
>
{ school . count == 1 ? (
< svg
xmlns = "http://www.w3.org/2000/svg"
{ school . count == 1 ? < svg xmlns = "http://www.w3.org/2000/svg" width = "12" height = "12" viewBox = "0 0 15.044 15.044" >
width = "12"
< g id = "vuesax_linear_card-remove" data - name = "vuesax/linear/card-remove" transform = "translate(-252.46 -511.461)" >
height = "12"
viewBox = "0 0 15.044 15.044"
>
< g
id = "vuesax_linear_card-remove"
data - name = "vuesax/linear/card-remove"
transform = "translate(-252.46 -511.461)"
>
< g id = "card-remove" transform = "translate(253.309 512.31)" >
< g id = "card-remove" transform = "translate(253.309 512.31)" >
< path id = "Vector" d = "M0,13.347,13.347,0" fill = "none" stroke = "#fff" strokeLinecap = "round" strokeWidth = "2" / >
< path
< path id = "Vector-2" data - name = "Vector" d = "M13.347,13.347,0,0" fill = "none" stroke = "#fff" strokeLinecap = "round" strokeWidth = "2" / >
id = "Vector"
d = "M0,13.347,13.347,0"
fill = "none"
stroke = "#fff"
strokeLinecap = "round"
strokeWidth = "2"
/ >
< path
id = "Vector-2"
data - name = "Vector"
d = "M13.347,13.347,0,0"
fill = "none"
stroke = "#fff"
strokeLinecap = "round"
strokeWidth = "2"
/ >
< / g >
< / g >
< / g >
< / g >
< / s v g > :
< / s v g >
) : (
< svg width = "100" height = "100" viewBox = "0 0 100 100" >
< svg width = "100" height = "100" viewBox = "0 0 100 100" >
< g stroke = "#fff" strokeWidth = "5" fill = "none" >
< g stroke = "#fff" strokeWidth = "5" fill = "none" >
< path d = " M 25 50 L 75 50
< path
d = " M 25 50 L 75 50
M 50 5
M 50 5
" / >
"
/ >
< / g >
< / g >
< / s v g > }
< / s v g >
) }
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
) )
) ) }
}
{ schoolList . length > 0 && (
{
< div className = "bg-gray-300 my-2 pb-1 rounded-full w-11/12" > < / d i v >
schoolList . length > 0 && < div className = "bg-gray-300 my-2 pb-1 rounded-full w-11/12" > < / d i v >
) }
}
{ list . map ( ( product , index ) => (
{ list . map ( ( product , index ) => (
< Product key = { index } product = { product } / >
< Product key = { index } product = { product } / >
) ) }
) ) }
< / d i v >
< / d i v >
{ /* {console.log(list)} */ }
{ /* {console.log(list)} */ }
< div style = { { width : '80%' } } className = "mb-6" >
< div style = { { width : "80%" } } className = "mb-6" >
< Code / >
< Code / >
< div className = "flex flex-col w-full border-t border-gray-400 my-2 py-2" >
< div className = "flex flex-col w-full border-t border-gray-400 my-2 py-2" >
< div className = "flex justify-between w-full py-2 text-blue-700 text-lg " >
< div className = "flex justify-between w-full py-2 text-blue-700 text-lg " >
< p > جمع مبالغ خدمات < / p >
< p > جمع مبالغ خدمات < / p >
< p > { factorInfo ? . sumPrice } تومان < / p >
< p > { factorInfo ? . sumPrice } تومان < / p >
< / d i v >
< / d i v >
{ factorInfo ? . offPrice && (
< div className = "flex justify-between w-full py-2 text-red26 text-lg " >
< div className = "flex justify-between w-full py-2 text-red26 text-lg " >
< p > تخفیف < / p >
< p > تخفیف < / p >
< p > { factorInfo ? . offPrice } - تومان < / p >
< p > { factorInfo ? . offPrice } - تومان < / p >
< / d i v >
< / d i v >
< div className = "flex justify-between w-full py-2 text-red26 text-lg " >
) }
< p > کسر از اعتبار < / p >
< p > - ۰ تومان < / p >
< / d i v >
< / d i v >
< / d i v >
< Button
< Button
title = { ` پرداخت هزینه : ${ factorInfo ? . payPrice ? separate ( factorInfo ? . payPrice ) : 0 } تومان ` }
title = { ` پرداخت هزینه : ${
borderType = 'rounded-xl'
factorInfo ? . payPrice ? separate ( factorInfo ? . payPrice ) : 0
className = 'h-16 text-xl xl:text-sm'
} تومان ` }
onClick = { ( ) => payFactor ( ) }
borderType = "rounded-xl"
className = "h-16 text-xl xl:text-sm"
onClick = { payHandler }
/ >
/ >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
) ;
) ;
}
}