[Back]
<?php $__env->startSection('content'); ?>
<h1 class="text-2xl font-bold mb-6">Your Cart</h1>
<?php if($cart->items->isEmpty()): ?>
<div class="bg-white p-6 rounded-xl shadow">Cart is empty.</div>
<?php else: ?>
<div class="bg-white rounded-xl shadow overflow-hidden">
<table class="w-full text-sm">
<thead class="bg-gray-50">
<tr>
<th class="text-left p-4">Product</th>
<th class="text-left p-4">Price</th>
<th class="text-left p-4">Qty</th>
<th class="text-left p-4">Total</th>
<th class="p-4"></th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $cart->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr class="border-t">
<td class="p-4 font-medium"><?php echo e($item->product->name); ?></td>
<td class="p-4">RM <?php echo e(number_format($item->unit_price_cents/100, 2)); ?></td>
<td class="p-4">
<form method="POST" action="<?php echo e(route('cart.update', $item->product)); ?>" class="flex gap-2">
<?php echo csrf_field(); ?>
<input type="number" name="quantity" min="1" value="<?php echo e($item->quantity); ?>"
class="w-24 rounded border-gray-300" />
<button class="px-3 py-2 rounded border">Update</button>
</form>
</td>
<td class="p-4">
RM <?php echo e(number_format(($item->quantity * $item->unit_price_cents)/100, 2)); ?>
</td>
<td class="p-4 text-right">
<form method="POST" action="<?php echo e(route('cart.remove', $item->product)); ?>">
<?php echo csrf_field(); ?>
<button class="text-red-600 underline">Remove</button>
</form>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
<div class="mt-6 flex items-center justify-between">
<div class="text-lg font-bold">
Subtotal: RM <?php echo e(number_format($subtotalCents/100, 2)); ?>
</div>
<a href="<?php echo e(route('checkout.show')); ?>" class="px-5 py-3 rounded bg-black text-white">
Checkout
</a>
</div>
<?php endif; ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.public', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\nashr\Repo\landing-fpx\resources\views/cart/index.blade.php ENDPATH**/ ?>