<?php $__env->startSection('title', 'Tu carrito'); ?>

<?php $__env->startSection('content'); ?>
    <article id="cart">
        <div class="breadcrumb">
            <div class="container d-flex align-items-center">
                <a href="<?php echo e(url('/')); ?>">Inicio</a>
                <span><?php echo $__env->yieldContent('title'); ?></span>
            </div>
        </div>
        <section>
            <div class="container">
                <?php if(Cart::count()): ?>
                    <div class="table-responsive">
                        <?php echo $__env->make('partials.cart-full', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    </div>
                    <div class="btn-container mt-5 text-right">
                        <a href="<?php echo e(url('checkout')); ?>" class="btn">
                            <span>Proceder al pago</span>
                            <i class="far fa-arrow-right"></i>
                        </a>
                    </div>
                <?php else: ?>
                    <h2 class="text-center">Tu carrito está vacío</h2>
                    <div class="text-center mt-5">
                        <a href="<?php echo e(url('productos')); ?>" class="btn">
                            <span>Ir a Productos</span>
                            <i class="far fa-arrow-right"></i>
                        </a>
                    </div>
                <?php endif; ?>
            </div>
        </section>
    </article>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
    <script>
      var clickTimeout;

      $(function() {
        $('body').on('submit', 'form', function() {
          return false;
        });

        $('body').on('change', '.qty', function() {
          clearTimeout(clickTimeout);
          var $this = $(this).parents('form');
          clickTimeout = setTimeout(function(){
            $('.table').addClass('busy');
            $.post('<?php echo e(route('cart.action')); ?>', $this.serialize(), function(response) {
              $('.cart-count').text(response.count);
              $('.cart-content').html(response.cart);
              $('#cart .table-responsive').html(response.cart_full);
            }).fail(function(response) {
              alert(response.responseJSON.message);
            }).always(function() {
              $('.table').removeClass('busy');
            });
          }, 1000);
          return false;
        });
      });
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.frontend', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/bgreen/test.bgreen.com.py/resources/views/templates/cart.blade.php ENDPATH**/ ?>