<?php $__env->startSection('content'); ?>
    <section class="py-5">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-8">
                    <div class="order-md-last">
                        <h4 class="d-flex justify-content-between align-items-center mb-3">
                            <span class="text-primary">Keranjang Kamu</span>
                            <span class="badge bg-primary rounded-pill"><?php echo e(count($cart)); ?></span>
                        </h4>
                        <ul class="list-group mb-3">
                            <?php if(count($cart) == 0): ?>
                                <div class="align-self-center">
                                    Data keranjang kamu masih kosong :)
                                </div>
                            <?php endif; ?>
                            <?php $__currentLoopData = $cart; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li class="list-group-item d-flex justify-content-between lh-sm">
                                    <div class="d-flex justify-content-between">
                                        <img src="<?php echo e(asset('img_assets/product/' . $item->product->image)); ?>" alt=""
                                            style="width: 100px; object-fit: contain">
                                        <div class="d-flex justify-content-center align-items-start gap-2"
                                            style="flex-direction: column; padding-left: 20px">
                                            <h6 class="my-0"><?php echo e($item->product->name); ?></h6>
                                            <small class="text-body-secondary"><?php echo e($item->amount); ?> Kg</small>
                                            <button style="color: rgb(236, 44, 44); text-decoration: underline; padding:0px !important; background-color: transparent; border: 0px;"
                                                onclick="event.preventDefault(); document.getElementById('cartDelete').submit()">
                                                Hapus Item
                                            </button>
                                        </div>
                                    </div>
                                    <div class="d-flex justify-content-between align-items-center">
                                        <span class="text-body-secondary d-flex align-items-center">
                                            <?php if($item->product->is_discount): ?>
                                                <span style="text-decoration: line-through">Rp.
                                                    <?php echo e(number_format($item->product->price * $item->amount)); ?> </span>
                                                <span style="padding-left: 20px">Rp.
                                                    <?php echo e(number_format($item->product->price * (1 - $item->product->discount_price / 100) * $item->amount)); ?></span>
                                            <?php else: ?>
                                                Rp. <?php echo e(number_format($item->product->price * $item->amount)); ?>

                                            <?php endif; ?>
                                        </span>

                                        <form action="<?php echo e(route('cart.delete')); ?>" id="cartDelete"
                                            style="display: inline-block" method="POST">
                                            <input type="hidden" name="id" value="<?php echo e($item->id); ?>">
                                            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                        </form>
                                    </div>
                                </li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ul>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="order-md-last">
                        <h4 class="d-flex justify-content-between align-items-center mb-3">
                            <span class="text-primary">Total</span>
                        </h4>
                        <ul class="list-group mb-3">
                            <li class="list-group-item d-flex justify-content-between lh-sm">
                                <div class="d-flex justify-content-between">
                                    <div class="d-flex justify-content-center"
                                        style="flex-direction: column; padding-left: 20px">
                                        <h6 class="my-0">Total Harga</h6>
                                        <small class="text-body-secondary"><?php echo e($cart->count()); ?> Item Produk</small>
                                    </div>
                                </div>
                                <div class="d-flex justify-content-between align-items-center">
                                    <span class="text-body-secondary d-flex align-items-center">
                                         Rp. <?php echo e(number_format($cartTotal)); ?>

                                    </span>
                                </div>
                            </li>
                        </ul>

                        <?php if(count($cart) != 0): ?>
                            <a href="<?php echo e(route('checkout')); ?>">
                                <button class="w-100 btn btn-primary btn-lg" type="submit">Lanjut ke Pembayaran</button>
                            </a>
                        <?php else: ?>
                            <a href="<?php echo e(route('product')); ?>">
                                <button class="w-100 btn btn-primary btn-lg" type="submit">Belanja Sekarang</button>
                            </a>
                        <?php endif; ?>

                    </div>
                </div>
            </div>
        </div>
    </section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.web', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp8\htdocs\pasar_nelayan_zaskia\resources\views/apps/web/cart.blade.php ENDPATH**/ ?>