
<?php $__env->startSection('content'); ?>
<div class="py-3 py-md-5 bg-light">

        <div class="container">
            <div class="row">
                <div class="col-md-1 mt-3">
                <?php
    // Split the photos string into an array
    $photos = $product->photos ? explode(',', $product->photos) : [];
?>

<div class="thumb-carousel">
    <?php $__currentLoopData = $photos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $photo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <img
            src="<?php echo e(asset('storage/' . $photo)); ?>"
            class="thumb-img <?php echo e($key == 0 ? 'active' : ''); ?>"
            onclick="changeMainImage(this)"
        >
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>

                </div>
                <div class="col-md-5 mt-3">
                    <div class="bg-white border">
                        <img src=<?php echo e(asset('/storage/'.$product->thumbnail_img)); ?> id="mainProductImage" class="w-100" height="500" alt="Img">
                    </div>
                </div>
                <div class="col-md-6 mt-3">
                    <div class="product-view">
                        <h4 class="product-name">
                        <?php echo e($product->name); ?> 
                        <?php if($product->current_stock >= 1): ?>
                            <label class="label-stock bg-success">In Stock</label>
                         <?php else: ?>
                            <label class="label-stock bg-danger">Out of Stock</label>
                         <?php endif; ?>
                        </h4>
                        <hr>
                        <div class="row mt-2">
                                <div class="col-sm-2">
                                     <div class="opacity-50 my-2">Orignal Price:</div>
                                </div>
                               <div class="col-sm-10">
                                <span class="original-price" id="orignal_price"><?php echo e(number_format($product->unit_price,2)); ?></span>
                                <?php if($product->unit != null): ?>
                                      <span class="original-price">/<?php echo e($product->unit); ?></span>
                                 <?php endif; ?>
                                </div>
                        </div>
                        <div class="row mt-2">
                            <div class="col-sm-2">
                                     <div class="opacity-50 my-2">Discount Price:</div>
                            </div>
                            <?php
                                 $price= $product->unit_price-$product->discount;
                            ?>
                           <div class="col-sm-10">
                              <span class="selling-price">Rs:</span><span class="selling-price" id="price2"><?php echo e(number_format($price,2)); ?></span>
                              <?php if($product->unit != null): ?>
                                                        <span class="selling-price">/<?php echo e($product->unit); ?></span>
                                 <?php endif; ?>
                           
                           </div>
                           
                          
                        </div>
                        <?php
                        $quan='1';
                        ?>
                         
                        <form id="option-choice-form" action="<?php echo e(route('addtomycart',[$product->id])); ?>" method="post">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" id="id" name="id" value="<?php echo e($product->id); ?>">
                            <div class="row mt-2">
                                  <div class="col-sm-2">
                                     <div class="opacity-50 my-2">Quantity:</div>
                                   </div>
                                  <div class="col-sm-10">
                                    <div class="input-group">
                                       <span class="btn btn1"> <a class="bi bi-dash" href="javascript:void(0)" onclick="myFunctionminus()"></a></span>
                                       <input type="text" value="<?php echo e($quan ?? 1); ?>" id="quantity" name="quantity" class="input-quantity" data-max="<?php echo e($product->stocks->sum('qty')); ?>" readonly />
                                       <span class="btn btn1"> <a class="bi bi-plus" href="javascript:void(0)" onclick="myFunctionadd()"></a></span>
                                    </div>
                                 </div>
                             </div>

                          <hr>
                          <?php if($product->choice_options != null): ?>
                                    <?php $__currentLoopData = json_decode($product->choice_options); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $choice): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                    <div class="row no-gutters">
                                        <div class="col-sm-2">
                                            <div class="opacity-50 my-2"><?php echo e(\App\Models\Attribute::find($choice->attribute_id)->name); ?>:</div>
                                        </div>
                                        <div class="col-sm-10">
                                            <div class="aiz-radio-inline">
                                                <?php $__currentLoopData = $choice->values; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <label class="aiz-megabox pl-0 mr-2">
                                                <input
                                                    type="radio"
                                                     name="attribute_id_<?php echo e($choice->attribute_id); ?>"
                                                     value="<?php echo e($value); ?>"
                                                     class="variant-option"
                                                     onclick="updateStockBySelection()"
                                                     <?php if($key == 0): ?> checked <?php endif; ?> >
                                                    <span class="aiz-megabox-elem rounded d-flex align-items-center justify-content-center py-2 px-3 mb-2">
                                                        <?php echo e($value); ?>

                                                    </span>
                                                </label>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </div>
                                        </div>
                                    </div>

                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php endif; ?>
                          <?php if(count(json_decode($product->colors)) > 0): ?>
                                    <div class="row no-gutters">
                                        <div class="col-sm-2">
                                            <div class="opacity-50 my-2">Color:</div>
                                        </div>
                                        <div class="col-sm-10">
                                            <div class="aiz-radio-inline">
                                                <?php $__currentLoopData = json_decode($product->colors); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $color): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php
                                                   $colorObj = \App\Models\Color::where('code', $color)->first();
                                                ?>
                                                <label class="aiz-megabox pl-0 mr-2" data-toggle="tooltip" data-title="<?php echo e(\App\Models\Color::where('code', $color)->first()->name); ?>">
                                                <input
                                                   type="radio"
                                                    name="color"
                                                    value="<?php echo e(\App\Models\Color::where('code', $color)->first()->name); ?>"
                                                    data-code="<?php echo e(\App\Models\Color::where('code', $color)->first()->name); ?>" 
                                                    class="variant-option"
                                                    onclick="updateStockBySelection()"
                                                 <?php if($key == 0): ?> checked <?php endif; ?>>
                                                    <span class="aiz-megabox-elem rounded d-flex align-items-center justify-content-center p-1 mb-2">
                                                         <span class="my-box" style="background-color:<?php echo e($color); ?>;"></span>
                                                    </span>
                                                </label>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </div>
                                        </div>
                                    </div>

                                    <hr>
                         <?php endif; ?>

                               
                                
                                <div class="row mt-2">
                                    <div class="col-sm-2">
                                      <div class="opacity-50 my-2">Total Price:</div>
                                    </div>
                                    <div class="col-sm-10">
                                      <span class="selling-price">Rs:</span><span class="selling-price" id="price"><?php echo e(number_format($price,2)); ?></span>
                                    </div>
                                </div>
                                <div class="mt-2">
                                   <button type="submit" class="btn button1 bi bi-cart">Add To Cart</button>
                                   <button type="button" class="btn button1 bi bi-heart" data-redirect-url="">Add To Wishlist</button>
                                </div>
                                <input type="hidden" id="descount" value="<?php echo e($product->discount); ?>">
                                <input type="hidden" id="stock_id" name="stock_id">
                                <input type="hidden" id="unitprice" value="<?php echo e($product->unit_price); ?>">
                                <input type="hidden" id="price1" value="<?php echo e($product->unit_price); ?>">
                        </form>
                        
                        <div class="mt-3">
                           <div class="card">
                               
                                <div class="card-body">
                                <p> <?php echo e($product->description); ?>    </p>
                                </div>
                    
                            </div>  
                            
                        </div>

                    </div>
                </div>
            </div>
       


 <div class="tab">
  <button class="tablinks" onclick="openCity(event, 'description')">Description</button>
  <button class="tablinks" onclick="openCity(event, 'reviews')">Reviews</button>
</div>

<div id="description" class="tabcontent">
  <h3><?php echo e($product->name); ?> </h3>
  <p><?php echo e($product->long_desc); ?> </p>
</div>

<div id="reviews" class="tabcontent"> 
    
<span class="fa fa-star ratingchecked"></span>
<span class="fa fa-star ratingchecked"></span>
<span class="fa fa-star ratingchecked"></span>
<span class="fa fa-star "></span>
<span class="fa fa-star "></span>
</div>



        </div>
    </div>
   
<?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/product_view.blade.php ENDPATH**/ ?>