

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



<div class="card mb-4">
    <div class="card-header">
        <div class="d-flex">
            <div class="mr-auto p-2 align-self-center"><h4>Products</h4></div>
            <div class="p-2">              
            <a class="btn btn-primary" href="<?php echo e(route('Product.create')); ?>"><i class="fa fa-plus"></i> ADD New</a>
            </div>           
        </div>
    </div>
    <div class="card-body">
        <div class="table-responsive">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>SLNO.</th>
                        <th>Product</th>
                        <th>Image</th>
                        <th>Narration</th>                     
                        <th colspan="">Actions</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    <?php $si=0 ?>
                    <?php $__currentLoopData = $Products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $Product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e(++$si); ?></td>
                        <td><?php echo e($Product->title); ?></td>
                        <td><img src="<?php echo e(asset('storage/images/products/'.$Product->image)); ?>" alt="avatar" width="50px" id="imgImage"/></td>
                        <td><?php echo e($Product->narration); ?></td>                       
                        <td style="width: 150px;"><button type="button" onclick="PropertyList(<?php echo e($Product->id); ?>)" class="btn btn-info"><i class="fa fa-plus"></i> Properties</button></td> 
                        <td style="width: 150px;"><a href="<?php echo e(route('Product.edit',$Product->id)); ?>" class="btn btn-secondary"><i class="fa fa-edit"></i> Edit</a></td>   
                        <td><form method="POST" action="<?php echo e(route('Product.destroy',$Product->id)); ?>" Id="form-delete-<?php echo e($Product->id); ?>">
                            <?php echo csrf_field(); ?>
                            <?php echo method_field('delete'); ?>
                            <button type="button" class="btn btn-danger"  onclick="
                            event.preventDefault();
                            if(confirm('Are you sure delete this'))
                            {
                                document.getElementById('form-delete-<?php echo e($Product->id); ?>').submit();
                            }"><i class="fas fa-trash"></i> Delete</button></form>
                        </td>                     
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="card-footer">
        <div class="d-flex justify-content-end font-weight-bold"><h5>Total:  <?php echo e($Products->Count()); ?></h5></div>        
    </div>
</div>

<div id="property_tbl">
        
</div>

<script>
    function PropertyList(product_id){
        
        $.ajax({
          url: '<?php echo e(route('PropertyDetails')); ?>',
         
          method: "get",
          data: {_token: '<?php echo e(csrf_token()); ?>',product_id:product_id },
                                  success: function (response){   
                                           
                                    document.getElementById('property_tbl').innerHTML=response; 
                                  
                                          }
                          });   
    } 


    function PropertyModelOpen(Title, Property, ProductID, PropertyID)
    {  
        
        document.getElementById('modal-title').innerHTML=Title;
        document.getElementById('txtProperty').value=Property;
        document.getElementById('productID').value=ProductID;
        document.getElementById('PropertyModalForm').action='/ProductPropertySettings/'+PropertyID;
    }

    </script>

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




<?php echo $__env->make('layouts.adminapp', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\tailorapp\resources\views/Product/index.blade.php ENDPATH**/ ?>