import { Box, Button, Container, Grid, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography, } from '@mui/material' import React from 'react' import { useSelector } from 'react-redux' import { selectCartSubtotal } from '../../../redux-store/CartStore/ducs' const ReviewOrder = ({ orderId, billTo, shipTo, paymentMode, cartItem, handleTabChange }) => { const subtotal = useSelector(selectCartSubtotal) // Calculate total GST for the entire cart const totalGST = cartItem.reduce((acc, item) => { // console.log(item) const gstAmount = (item.price * item.GST.tax) / 100 return acc + gstAmount * item.count }, 0) return ( Bill Address {billTo} Ship Address {shipTo} Payment mode : {paymentMode} Product HSN Quantity Price GST Subtotal {cartItem.map((row, index) => { const gstAmount = (row.price * row.GST.tax) / 100 return ( {/* {row.product.name} */} {row.name} {row.SKU} {row.count} ₹{row.price} ₹{gstAmount} ₹{row.price * row.count} ) })} Subtotal: ₹ {subtotal} Total GST: ₹ {totalGST} Grand Total: ₹ {subtotal + totalGST}
) } export default ReviewOrder