<?php $__env->startSection('content'); ?>
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
 <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>Products </h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="<?php echo e(url('')); ?>">Home</a>
                        </li>
                     
                        <li class="active">
                            <strong>Products</strong>
                        </li>
                    </ol>
                </div>
                <div class="col-lg-2">

                </div>
            </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>Products </h5>
                        <div class="ibox-tools">
						<a href="<?php echo e(url('products/create')); ?>" class="btn btn-primary btn-xs">Add New</a>
						
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
							
                          
                           
                        </div>
                    </div>
                    <div class="ibox-content">

                        <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover" >
					
					 <thead>
                        <tr>
                            <th>#</th>
                            <th>Photo</th>
                            <th>Name</th>
                            <th>Price</th>
                            <th>Show/Hide</th>
                            <th>Options</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr class="gradeX">
                            <td><?php echo e($products->firstItem() + $key); ?></td>
                            <td><img width="100px" src="<?php echo e(url('uploads/products/thumb/' .$product->id . '.jpg')); ?>"></td>
                            <td><?php echo e($product->name); ?></td>
                            <td><?php echo e($product->price); ?></td>
							<td> <input class="archived"  data-id="<?php echo $product->id; ?>"  type="checkbox" <?php if ($product->is_delete == 1) {
                                echo "checked";
                            }
                            ?> data-toggle="toggle" data-on="Yes" data-off="No" data-onstyle="primary" data-size="small" data-offstyle="danger"> </td>
                        
                            <td>
                                <form id="delete-product" action="<?php echo e(url('products/' . $product->id)); ?>" method="POST" class="form-inline">
                                    <input type="hidden" name="_method" value="delete">
                                    <?php echo e(csrf_field()); ?>

                                    <input type="submit" value="Delete" class="btn btn-danger btn-xs pull-right btn-delete">
                                </form>
                                 <a href="<?php echo e(url('products/' . $product->id . '/edit')); ?>" class="btn btn-primary btn-xs pull-right"><i class="fa fa-pencil-square-o"> </i> </a>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr> 
						  <td colspan="5">
								  No Record Found
									
                                </td>
								</tr>
                    <?php endif; ?>
						<tr> 
						  <td colspan="6">
						<?php echo $products->render(); ?>

						</td>
								</tr>
                    </tbody>
					
					
                    </table>
                        </div>

                    </div>
                </div>
            </div>
            </div>
           
        </div>
		
		<script> 
		$("body").on("change", ".archived", function () {
    var product_id = $(this).attr("data-id");

    var form_data = {
        product_id: product_id
    };
    $.ajax({
        type: 'POST',
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        },
        url: '<?php echo url("product/addToArchive"); ?>',
        data: form_data,
        success: function (msg) {
            //$(this).attr('data-value', value_new)
        }
    });

});

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

<?php echo $__env->make('layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>