

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

<?php $__env->startSection('content'); ?>
  
      
      <section class="my-7">
        <div class="container">
            <?php echo html_entity_decode($package->description) ?>
    <div class="row d-flex justify-content-center mt-3">
        <div class="col-md-12">
            <div class="card">
                <div class="row">
                    <div class="col-md-6">
                        <div class="images p-3">
                            <div class="text-center pb-4"> <img id="main-image" src="<?php echo e(asset('images/package/' . $package->image)); ?>" class="img-fluid" /> </div>
                            
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="product p-4">
                            <div class="d-flex justify-content-between align-items-center">
                                <div class="d-flex align-items-center"> <a href="/"><i class="fa fa-long-arrow-left"></i> <span class="ml-1">Back</span></a> </div>
                            </div>
                            <div class="mt-4 mb-3"> <span class="text-uppercase text-muted brand"><?php echo e($package->category->name); ?></span>
                                <h5 class="text-uppercase"><?php echo e($package->name); ?></h5>
                                <div class="price d-flex flex-row align-items-center"> <h6 class="act-price">Rs.<?php echo e($package->price); ?></h6>
                                    
                                </div>
                            </div>
                            
                            
                            
                            <div class="cart mt-4 align-items-center">
                            <?php if(session()->has('user_id')): ?>
                              <?php if(!\Cart::session(session()->get('user_id'))->get($package->id)): ?>
                              
                                <button id="add" class="btn-pink text-uppercase mr-2 px-4" onclick="add_cart(<?php echo e($package->id); ?>)">Add to Cart</button>

                                <button id="added" type="button" disabled class="btn-pink text-uppercase mr-2 px-4 d-none" disabled>Added to Cart</button>

                              <?php else: ?>
                                <button type="button" disabled class="btn-pink text-uppercase mr-2 px-4" disabled>Added to Cart</button>
                              <?php endif; ?>
                            <?php else: ?>
                              <a href="<?php echo e(route('login')); ?>" class="btn-pink text-uppercase mr-2 px-4">Login to add</a>
                            <?php endif; ?>
                            <i class="fa fa-heart text-muted"></i> <i class="fa fa-share-alt text-muted"></i>
                            </div>
                            
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
      </section>

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

 <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

<script>

  function add_cart(id){

          var cart_no = document.getElementById('cart_no').textContent;

                  $.ajax({
                          type: "Post",
                          url: '<?php echo e(route('add.to.cart')); ?>',
                          datatype: 'json',
                          data: {
                            "_token": "<?php echo e(csrf_token()); ?>",
                              'package_id' : id,
                          },
                          success: function (data) {
                              const obj = JSON.parse(data);
                              
                                document.getElementById('add').classList.add('d-none');
                                document.getElementById('added').classList.remove('d-none');
                                document.getElementById('cart_no').textContent = parseInt(cart_no) + 1;

                            },
                          complete: function () {
                          },
                          error: function () {
                          }
                      });

    }

</script>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/603031.cloudwaysapps.com/pvusfnxuud/public_html/suymedia/resources/views/items/view-item.blade.php ENDPATH**/ ?>