

<?php $__env->startSection('title','Cart Page'); ?>

<?php $__env->startSection('main-content'); ?>

<!-- Breadcrumbs -->
<div class="breadcrumbs">
    <div class="container">
        <ul class="bread-list">
            <li><a href="<?php echo e(route('home')); ?>">Home <i class="ti-arrow-right"></i></a></li>
            <li class="active">Cart</li>
        </ul>
    </div>
</div>

<div class="shopping-cart section">
    <div class="container">

        <?php if(Helper::cartHasSubscription() && Helper::cartHasProduct()): ?>
            <div class="alert alert-warning mb-3">
                Products and subscriptions must be ordered separately.
            </div>
        <?php endif; ?>

        <form action="<?php echo e(route('cart.update')); ?>" method="POST">
            <?php echo csrf_field(); ?>

            <table class="table shopping-summery">
                <thead>
                    <tr>
                        <th>PRODUCT</th>
                        <th>NAME</th>
                        <th class="text-center">UNIT PRICE</th>
                        <th class="text-center">QUANTITY</th>
                        <th class="text-center">TOTAL</th>
                        <th class="text-center"><i class="ti-trash"></i></th>
                    </tr>
                </thead>

                <tbody>
                <?php $__empty_1 = true; $__currentLoopData = Helper::getAllProductFromCart(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $cart): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td>
                            <?php if($cart->item_type === 'product'): ?>
                                <?php $photo = explode(',', $cart->product->photo); ?>
                                <img src="<?php echo e($photo[0]); ?>" width="60">
                            <?php else: ?>
                                <img src="<?php echo e(asset('frontend/images/subscription.png')); ?>" width="60">
                            <?php endif; ?>
                        </td>

                        <td>
                            <?php if($cart->item_type === 'product'): ?>
                                <a href="<?php echo e(route('product-detail',$cart->product->slug)); ?>">
                                    <?php echo e($cart->product->title); ?>

                                </a>
                            <?php else: ?>
                                <strong><?php echo e($cart->subscription->package_name); ?></strong><br>
                                <small class="text-muted">Subscription Kit</small>
                            <?php endif; ?>
                        </td>

                        <td class="text-center">
                            Rs. <?php echo e(number_format($cart->price,2)); ?>

                        </td>

                        <td class="text-center">
                            <?php if($cart->item_type === 'product'): ?>
                                <input type="text"
                                       name="quant[<?php echo e($key); ?>]"
                                       value="<?php echo e($cart->quantity); ?>"
                                       class="input-number">
                                <input type="hidden" name="qty_id[]" value="<?php echo e($cart->id); ?>">
                            <?php else: ?>
                                <span class="badge badge-info">1 Kit</span>
                            <?php endif; ?>
                        </td>

                        <td class="text-center">
                            Rs. <?php echo e(number_format($cart->amount,2)); ?>

                        </td>

                        <td class="text-center">
                            <a href="<?php echo e(route('cart-delete',$cart->id)); ?>">
                                <i class="ti-trash"></i>
                            </a>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="6" class="text-center">
                            Cart is empty.
                            <a href="<?php echo e(route('product-grids')); ?>">Continue shopping</a>
                        </td>
                    </tr>
                <?php endif; ?>
                </tbody>
            </table>

            <?php if(Helper::cartHasProduct()): ?>
                <button class="btn btn-primary float-right">Update Cart</button>
            <?php endif; ?>
        </form>

        <div class="total-amount mt-4">
            <ul>
                <li>
                    Subtotal
                    <span>Rs. <?php echo e(number_format(Helper::totalCartPrice(),2)); ?></span>
                </li>
            </ul>

            <div class="button5">
                <a href="<?php echo e(route('checkout')); ?>" class="btn">Checkout</a>
                <a href="<?php echo e(route('product-grids')); ?>" class="btn">Continue Shopping</a>
            </div>
        </div>

    </div>
</div>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('frontend.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/ecommerce_website/resources/views/frontend/pages/cart.blade.php ENDPATH**/ ?>