+ {/* Table Header */}
+
+
S. No.
+
Product Image
+
Product Name
+
Unit Price
+
Quantity
+
Total
+
Remove
+
+
+ {/* Cart Items */}
+ {items.map((item, index) => {
+ const effectivePrice = item.discount
+ ? item.price * (1 - item.discount)
+ : item.price;
+ const lineTotal = effectivePrice * item.quantity;
+
+ return (
+
+
+ {index + 1}
+
+
+
+

+
+
+
+ {item.name}
+
+
+ {item.discount ? (
+
+ ${item.price.toFixed(2)}
+ ${effectivePrice.toFixed(2)}
+
+ ) : (
+
${effectivePrice.toFixed(2)}
+ )}
+
+
+ updateQuantity(item.productId, parseInt(e.target.value) || 1)}
+ className={`w-16 px-2 py-1 text-center rounded border ${darkMode ? 'bg-gray-700 border-gray-600 text-light' : 'bg-white border-gray-300 text-gray-800'} focus:border-primary focus:outline-none`}
+ aria-label={`Quantity of ${item.name}`}
+ />
+
+
+ ${lineTotal.toFixed(2)}
+
+
+
+
+
+ );
+ })}
+
+ {/* Bottom Actions */}
+
+
+ setCouponCode(e.target.value)}
+ className={`px-4 py-2 rounded-lg border ${darkMode ? 'bg-gray-700 border-gray-600 text-light placeholder-gray-500' : 'bg-white border-gray-300 text-gray-800 placeholder-gray-400'} focus:border-primary focus:outline-none`}
+ aria-label="Coupon code"
+ />
+
+
+ {couponError &&
{couponError}}
+ {appliedCoupon && (
+
+ Coupon {appliedCoupon.code} applied ({Math.round(appliedCoupon.rate * 100)}% off)
+
+ )}
+
+
+