

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

<?php $__env->startSection('content'); ?>
  <section class="mb-0">
    <div class="container">
      <div class="row ">

      <div class="col-md-12 bg-light text-center mb-3 p p-3" data-aos="fade-up">
      <div style="text-transform: uppercase;color: #454545;font-weight: 500;margin-left: 9px;" class="h3">
            <?php if(!empty(request()->name)): ?> 
               <?php echo e(request()->name); ?>

            <?php elseif($category_name != ""): ?> 
               <?php echo e($category_name); ?>

            <?php elseif($brand_name != ""): ?> 
               <?php echo e($brand_name); ?>

            <?php elseif(!empty(request()->type)): ?> 
               <?php echo e(request()->type); ?>

            <?php elseif(!empty(request()->condition)): ?> 
               <?php echo e(request()->condition); ?>

            <?php else: ?>
               All Products
            <?php endif; ?>
      </div>
         <div class="m-2"><a href="/" title="Home" class="home-bc">Home</a> <span aria-hidden="true">›</span><span style="text-transform: uppercase;color: #454545;font-weight: 300;margin-left: 9px;">
               <?php if(!empty(request()->name)): ?> 
               <?php echo e(request()->name); ?>

            <?php elseif($category_name != ""): ?>
               <?php echo e($category_name); ?>

            <?php elseif($brand_name != ""): ?> 
               <?php echo e($brand_name); ?>

            <?php elseif(!empty(request()->type)): ?> 
               <?php echo e(request()->type); ?>

            <?php elseif(!empty(request()->condition)): ?> 
               <?php echo e(request()->condition); ?>

            <?php else: ?>
               All Products
            <?php endif; ?>
        </span> </div>
        </div>

      <div class="col-md-3">
            <div class="t-products brand p-2 mb-2">
                <h4 class="text-uppercase">Category</h4>
                <div class="p-lists">
                   <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="d-flex justify-content-between mt-2 text-uppercase" style=" border-bottom: 1px dashed #ccc;">
                      <?php if($category_name == $category->name): ?>
                        <a href="/search/?category=<?php echo e($category->name); ?>"><span style="color:#ae0151;"><?php echo e($category->name); ?></span></a>
                      <?php else: ?>
                        <a href="/search/?category=<?php echo e($category->name); ?>"><span><?php echo e($category->name); ?></span></a>
                      <?php endif; ?>
                    </div>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>

          
            <div class="brand p-2 mb-2">
                <div class="heading d-flex justify-content-between align-items-center">
                    <h6 class="text-uppercase">Brand</h6> <span>--</span>
                </div>
            <?php $__currentLoopData = $brands; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="d-flex justify-content-between mt-2">
                     
                      <?php if($brand_name == $brand->name): ?>
                      <div class="form-check">
                          <input class="form-check-input" type="radio" name="brand" value="<?php echo e($brand->id); ?>" id="flexCheckDefault" checked onclick="brand_click(this)"> <label class="form-check-label" for="flexCheckDefault"> <?php echo e($brand->name); ?> </label>
                        </div>
                      <?php else: ?>
                          <div class="form-check">
                          <input class="form-check-input" type="radio" name="brand" value="<?php echo e($brand->id); ?>" id="flexCheckDefault" onclick="brand_click(this)"> <label class="form-check-label" for="flexCheckDefault"> <?php echo e($brand->name); ?> </label>
                        </div>
                      <?php endif; ?>
                    
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
            <div class="type p-2 mb-2">
                <div class="heading d-flex justify-content-between align-items-center">
                    <h6 class="text-uppercase">Type</h6> <span>--</span>
                </div>
                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="radio" name="type" value="digital" id="flexCheckDefault" onclick="type_click(this)"  <?php if(!empty(request()->type)): ?> <?php if(request()->type == 'digital'): ?> checked <?php endif; ?> <?php endif; ?>> <label class="form-check-label" for="flexCheckDefault"> Digital </label> </div> <span></span>
                </div>
                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="radio" name="type" value="physical" id="flexCheckChecked" onclick="type_click(this)"  <?php if(!empty(request()->type)): ?> <?php if(request()->type == 'physical'): ?> checked <?php endif; ?> <?php endif; ?>> <label class="form-check-label" for="flexCheckChecked"> Physical </label> </div> <span></span>
                </div>
                
            </div>



            <div class="type p-2 mb-2">
                <div class="heading d-flex justify-content-between align-items-center">
                    <h6 class="text-uppercase">Product Condition</h6> <span>--</span>
                </div>
                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="radio" name="condition" value="new" id="flexCheckDefault" onclick="condition_click(this)"  <?php if(!empty(request()->condition)): ?> <?php if(request()->condition == 'new'): ?> checked <?php endif; ?> <?php endif; ?>> <label class="form-check-label" for="flexCheckDefault"> New </label> </div> <span></span>
                </div>
                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="radio" name="condition" value="old" id="flexCheckChecked" onclick="condition_click(this)"  <?php if(!empty(request()->condition)): ?> <?php if(request()->condition == 'old'): ?> checked <?php endif; ?> <?php endif; ?>> <label class="form-check-label" for="flexCheckChecked"> Old </label> </div> <span></span>
                </div>
                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="radio" name="condition" value="refurbished" id="flexCheckChecked" onclick="condition_click(this)"  <?php if(!empty(request()->condition)): ?> <?php if(request()->condition == 'refurbished'): ?> checked <?php endif; ?> <?php endif; ?>> <label class="form-check-label" for="flexCheckChecked"> Refurbished </label> </div> <span></span>
                </div>
            </div>



            <div class="type p-2 mb-2">
                <div class="heading d-flex justify-content-between align-items-center">
                    <h6 class="text-uppercase">Price Range</h6> <span>--</span>
                </div>
                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault"> <label class="form-check-label" for="flexCheckDefault">INR 400 -  600 </label> </div>
                </div>
                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="checkbox" value="" id="flexCheckChecked"> <label class="form-check-label" for="flexCheckChecked">INR 600 -  1000</label> </div>
                </div>

                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" > <label class="form-check-label" for="flexCheckChecked">INR 1000 -  1500</label> </div>
                </div>

                <div class="d-flex justify-content-between mt-2">
                    <div class="form-check"> <input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" > <label class="form-check-label" for="flexCheckChecked">INR 1500 -  3000</label> </div>
                </div>
                

            </div>





        </div>
       
        <div class="col-lg-9 col-md-9 col-sm-12">
          <div class="row align-items-center g-2">
            <?php if($items->count() > 0): ?>
              <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <div class="col-sm-6 col-md-3 col-lg-4 mb-3 mb-md-0 h-100" data-aos="fade-up">
                <div class="card card-span h-100">
                 
                 <div style="overflow: hidden;width: 100%;position:relative;">
                   <a class="" href="<?php echo e(route('item.show', $item)); ?>">
                   <div class="img-style-low">
                      <img class="img-fluid h-100 w-100" src="<?php echo e(asset('storage/'.$item->image)); ?>" alt="..." /></div ></a>
                    <div class="fw-bold favorite-icon">
                       <?php if(auth()->check()): ?>
                                  <span class="" id="favorite_icon-<?php echo e($item->id); ?>" onclick="add_favorite(<?php echo e($item->id); ?>)"><i class="fa fa-thin fa-heart"></i></span>
                                 <span class="favorite-active d-none" id="favorite_icon1-<?php echo e($item->id); ?>"><i class="fa fa-thin fa-heart"></i></span>
                        <?php else: ?>
                                  <span class="" id="favorite_icon-<?php echo e($item->id); ?>" onclick="add_favorite(<?php echo e($item->id); ?>)"><a href="<?php echo e(route('login')); ?>"><i class="fa fa-thin fa-heart"></i></a></span>

                        <?php endif; ?>
                    </div>
                  
                </div> 
                <a class="" href="<?php echo e(route('item.show', $item)); ?>">
                  <div class="card-body ps-0  text-center">
                    <p class="mb-0" style="text-transform: uppercase;font-size: 19px;font-weight: 500;color: #000;"><?php echo e($item->name); ?></p>
                    <div class="fw-bold"><span class="pink-color">INR <?php echo e($item->price); ?></span></div>
                  </div>
                  </a>

                  <div class="d-flex"> 
                   
                  <div class="col-8 p-2 info-pt"><i class="fas fa-cut"></i> Processing Time: 2-5 days </br> <i class="fas fa-plane"></i>  Shipping Time: 3-6 Business Days</div>
                  
                  <div class="col-2 p-2 info-pt">
                    
                  </div>
                  

</div>
                </div>
              </div>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php else: ?>
                   <div class="text-center" style="margin-top: 20%;">
                       <h3>No Product Found</h3>
                   </div>
            <?php endif; ?>
          </div>
        </div>
      </div>
    </div>
  </section>
<!-- ------------------------------------2nd--------------------------- -->
<section class="mt-0 p-1">
  <div class="container">
<div class="h2 titllee text-center ">Recently Viewed <span class="line-tt"></span></div>

<div class="row m-4">

<div class="col-lg-12 col-md-12 col-sm-12">
          <div class="row align-items-center g-2">
            <?php if($recent_items->count() > 0): ?>
              <?php $__currentLoopData = $recent_items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <div class="col-sm-6 col-md-3 col-lg-3 mb-3 mb-md-0 h-100" data-aos="fade-up">
                <div class="card card-span h-100">
                 
                 <div style="overflow: hidden;width: 100%;position:relative;">
                   <a class="" href="<?php echo e(route('item.show', $item)); ?>">
                   <div class="img-style-low">
                      <img class="img-fluid h-100 w-100" src="<?php echo e(asset('storage/'.$item->image)); ?>" alt="..." /></div ></a>
                    <div class="fw-bold favorite-icon">
                       <?php if(auth()->check()): ?>
                                  <span class="" id="recent_favorite_icon-<?php echo e($item->id); ?>" onclick="add_favorite_recent(<?php echo e($item->id); ?>)"><i class="fa fa-thin fa-heart"></i></span>
                                 <span class="favorite-active d-none" id="recent_favorite_icon1-<?php echo e($item->id); ?>"><i class="fa fa-thin fa-heart"></i></span>
                        <?php else: ?>
                                  <span class="" id="recent_favorite_icon-<?php echo e($item->id); ?>" onclick="add_favorite_recent(<?php echo e($item->id); ?>)"><a href="<?php echo e(route('login')); ?>"><i class="fa fa-thin fa-heart"></i></a></span>

                        <?php endif; ?>
                    </div>
                  
                </div> 
                <a class="" href="<?php echo e(route('item.show', $item)); ?>">
                  <div class="card-body ps-0  text-center">
                    <p class="mb-0" style="text-transform: uppercase;font-size: 19px;font-weight: 500;color: #000;"><?php echo e($item->name); ?></p>
                    <div class="fw-bold"><span class="pink-color">INR <?php echo e($item->price); ?></span></div>
                  </div>
                  </a>

                  <div class="d-flex"> 
                   
                  <div class="col-8 p-2 info-pt"><i class="fas fa-cut"></i> Processing Time: 2-5 days </br> <i class="fas fa-plane"></i>  Shipping Time: 3-6 Business Days</div>
                  
                  <div class="col-2 p-2 info-pt">
                    
                  </div>
                  

</div>
                </div>
              </div>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php else: ?>
                   <div class="text-center" style="margin-top: 20%;">
                       <h3>No Product Found</h3>
                   </div>
            <?php endif; ?>
          </div>
        </div>
        </div>
</div>
</section>


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

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






<script>

  function brand_click(element){
      window.location.replace(window.location.origin + '/search/?brand='+element.value);
  }

  function type_click(element){
      window.location.replace(window.location.origin + '/search/?type='+element.value);
  }

  function condition_click(element){
      window.location.replace(window.location.origin + '/search/?condition='+element.value);
  }

   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()); ?>",
                        'item_id' : id,
                    },
                    success: function (data) {
                        const obj = JSON.parse(data);
                         
                           document.getElementById('add-'+id).classList.add('d-none');
                           document.getElementById('added-'+id).classList.remove('d-none');
                           document.getElementById('cart_no').textContent = parseInt(cart_no) + 1;

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

    }

function add_favorite(id){
       
            $.ajax({
                    type: "Get",
                    url: '<?php echo e(route('add_favorite')); ?>',
                    datatype: 'json',
                    data: {
                        'item_id' : id,
                    },
                    success: function (data) {
                        const obj = JSON.parse(data);
                         
                           document.getElementById('favorite_icon-'+id).classList.add('d-none');
                           document.getElementById('favorite_icon1-'+id).classList.remove('d-none');

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

    }

    function add_cart_recent(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()); ?>",
                        'item_id' : id,
                    },
                    success: function (data) {
                        const obj = JSON.parse(data);
                         
                           document.getElementById('recent_add-'+id).classList.add('d-none');
                           document.getElementById('recent_added-'+id).classList.remove('d-none');
                           document.getElementById('cart_no').textContent = parseInt(cart_no) + 1;

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

    }

function add_favorite_recent(id){
       
            $.ajax({
                    type: "Get",
                    url: '<?php echo e(route('add_favorite')); ?>',
                    datatype: 'json',
                    data: {
                        'item_id' : id,
                    },
                    success: function (data) {
                        const obj = JSON.parse(data);
                         
                           document.getElementById('recent_favorite_icon-'+id).classList.add('d-none');
                           document.getElementById('recent_favorite_icon1-'+id).classList.remove('d-none');

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

    }

</script>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\chittar\resources\views/search/index.blade.php ENDPATH**/ ?>