

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

<section class="pt-4 mb-4">
    <div class="container">
        <div class="row">
            <div class="col-lg-3 text-center ">
                <h1 class="fw-600 h4">Category/<?php echo e($category->name); ?></h1>
            </div>
            <div class="col-lg-9">
                <ul class="breadcrumb bg-transparent p-0 justify-content-center justify-content-lg-end">
                    <li class="breadcrumb-item opacity-50">
                        <a class="text-reset" href="<?php echo e(route('home')); ?>">Home</a>
                    </li>
                    <li class="text-dark fw-600 breadcrumb-item">
                        <a class="text-reset" href="">Products</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</section>

<section class="mb-4">
    <div class="container">
            <div class="row">
            <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="col-6 col-md-3 product-display">
                            <div class="product-all-card-img">
                                <img src=<?php echo e(asset('/storage/'.$product->thumbnail_img)); ?> class="img_center" >
                            </div>    
                            
                            <div class="p-3 text-left">
                                    <p class="product-all-brand"> <?php echo e($product->category->name); ?> </p>
                                        <h4 class="product-name">
                                            <a href=<?php echo e(route('viewproduct',[$product->id])); ?>  tabindex="0"><?php echo e($product->name); ?></a>
                                        </h4>
                                    <div class="rating rating-sm mb-2">

                                    </div>
                                            <?php
                                              $prignalprice=$product->unit_price;
                                              $descount=$product->discount;
                                              $price=$prignalprice-$descount;
                                             ?>

                                             <?php
                                                 $choices = [];
                                                 if($product->choice_options){
                                                 $rawChoices = json_decode($product->choice_options, true);
                                                 foreach($rawChoices as $choice){
                                                 $choices[] = [
                                                 'attribute_id' => $choice['attribute_id'],
                                                 'attribute_name' => \App\Models\Attribute::find($choice['attribute_id'])->name ?? '',
                                                 'values' => $choice['values']
                                                  ];}}
                                             ?>
                                         <span class="selling-price">Rs:<?php echo e(number_format($price,2)); ?></span>
                                         <span class="original-price"><?php echo e(number_format($product->unit_price,2)); ?></span>
                                        
                                        
                                       <div class="card-footer d-flex justify-content-between bg-light">
                                          <a href="<?php echo e(route('viewproduct',[$product->id])); ?>" class="btn btn-sm text-dark p-0"><i class="fas fa-eye text-primary mr-1"></i>View Detail</a>
                                          <a href="javascript:void(0);"
                                             class="btn btn-sm text-dark p-0"
                                             onclick="show_addtocart_modal(this)"
                                             data-id="<?php echo e($product->id); ?>"
                                             data-name="<?php echo e($product->name); ?>"
                                             data-images="<?php echo e($product->photos); ?>"
                                             data-unitprice="<?php echo e($product->unit_price); ?>"
                                             data-discount="<?php echo e($product->discount); ?>"
                                             data-unit="<?php echo e($product->unit); ?>"
                                             data-choice='<?php echo json_encode($choices, 15, 512) ?>'
                                             data-colors='<?php echo json_encode(json_decode($product->colors, true), 512) ?>'
                                             data-stocks='<?php echo json_encode($product->stocks, 15, 512) ?>'>
                                            <i class="fas fa-shopping-cart text-primary me-1"></i> Add To Cart
                                           </a>
                                       </div>
                                       
                                    
                            </div>
                    </div>               
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
            
     </div>
</section>   

<?php $__env->startSection('modal'); ?>
<?php echo $__env->make('frontend.modal.addtocartmodal', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php $__env->stopSection(); ?>


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






<?php $__env->startSection('script'); ?>
<script>
 const STORAGE_URL = "<?php echo e(asset('storage')); ?>/";
</script>
<script>
    const COLORS = <?php echo json_encode(\App\Models\Color::select('name', 'code')->get(), 512) ?>;
</script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="<?php echo e(asset('storage/assets/js/script.js')); ?>"></script>
<?php $__env->stopSection(); ?>




<?php echo $__env->make('frontend.layout.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\wamp64\www\ecommerce\resources\views/frontend/pages/allProducts.blade.php ENDPATH**/ ?>