import React, { useState, useEffect } from "react"; import { userProduct, userFactor, publicApi } from "../../redux/actions"; // import DeliveryForm from "../DeliveryForm"; import Product from "./Product"; import Code from "./Code"; import Button from "../../components/Button"; //assets import alertIcon from "../../assets/img/alert.svg"; import { connect } from "react-redux"; import separate from "../../utils/separate"; function ShoppingCart({ isDark, isMobile, list, payPrice, factorInfo, userId, hasPhysical, getList, getInfo, getFactorInfo, payFactor, headerOptions, setHeaderOptions, schoolList, desktopContentTransform, pushToCart, pushSchoolToCart }) { const [phase, setPhase] = useState("products"); useEffect(() => { getList(); getFactorInfo({userId}); setHeaderOptions(headerOptions); }, []); return(isMobile ?
3 && 'overflow-x-hidden overflow-scroll'}`} style={{height: '35%'}}> { schoolList.map((school, index) => (
{school?.product?.book?.category}

{school?.product?.name}

{ school.count > 1 &&

{school?.count} عدد

}

{separate(school?.product?.price)} تومان

pushToCart( { productId: school?.productId, userId: school?.userId, count: school?.count == 1 ? -school?.count : -1, }, {}, { id: school?.factorId } ) } > {school.count == 1 ? : }
)) } {list.map((product, index) => ( ))}
{/* {console.log(list)} */}

جمع مبالغ خدمات

{factorInfo?.sumPrice} تومان

تخفیف

{factorInfo?.offPrice} - تومان

کسر از اعتبار

-۰ تومان

:
1 && 'overflow-x-hidden overflow-scroll'}`} style={{height: '60%'}}> { schoolList.map((school, index) => (
رزرو پیش ثبت نام

{school?.product?.name}

توجه: نحوه پرداخت برای رزرو پیش ثبت‌نام از طریق دکمه بالا خواهد بود و می بایست ازین طریق جداگانه پرداخت گردد

pushSchoolToCart( { productId: school?.productId, userId: school?.userId, count: school?.count == 1 ? -school?.count : -1, }, {}, { id: school?.factorId } ) } > {school.count == 1 ? : }
)) } { schoolList.length > 0 &&
} {list.map((product, index) => ( ))}
{/* {console.log(list)} */}

جمع مبالغ خدمات

{factorInfo?.sumPrice} تومان

تخفیف

{factorInfo?.offPrice} - تومان

کسر از اعتبار

-۰ تومان

); } const mapStateToProps = (state) => ({ isDark: state.publicApi.isDark, isMobile: state.publicApi.isMobile, list: state.userProduct.list, schoolList: state.userProduct.schoolList, payPrice: state.userProduct.sum, factorInfo: state.userFactor.info, userId: state.user.status.id, hasPhysical: state.userProduct.hasPhysical, desktopContentTransform: state.publicApi.desktopContentTransform, }); const mapDispatchToProps = { getList: userProduct.list, getInfo: userProduct.info, getFactorInfo: userFactor.info, payFactor: userFactor.payment, setHeaderOptions: publicApi.setHeaderOptions, pushToCart: userProduct.add, pushSchoolToCart: userProduct.addSchool, }; export default connect(mapStateToProps, mapDispatchToProps)(ShoppingCart);