<?php $__env->startSection('title', 'All Product '); ?>
<?php $__env->startSection('content'); ?>


































































<div class="content-wrapper">
    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <!-- Left column -->
                <div class="col-md-12">

                    <div class="card card-primary card-box-shadow">

                        <div class="card-body">
                            <a href="<?php echo e(route('admin.product.create')); ?>">
                                <button id="submit_btn" class="btn btn-primary custom_btn custom_btn_sm float-right">
                                    <i class="fas fa-arrow-circle-right"></i>
                                    Add Product
                                </button>
                            </a>
                            <h2>Product Section</h2>
                            <table id="example" class="table table-striped table-bordered" style="width:100%">
                                <thead>
                                <tr>
                                    <th>Product Name</th>
                                    <th>Product Price</th>
                                    <th>Image</th>
                                    <th>Action</th>
                                </tr>
                                </thead>

                                <tbody>
                                <?php $__currentLoopData = $get_products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($product->product_name); ?></td>
                                        <td><?php echo e($product->price); ?></td>
                                        <td>
                                            <img src="<?php echo e($product->getFirstMediaUrl('product_image')); ?>" style="width: 100px; height: 100px;">
                                        </td>
                                        <td>
                                            <div class="dropdown custom-dropdown">
                                                <button class="btn btn-info" type="button" data-toggle="dropdown" aria-expanded="false">
                                                    Click Here
                                                    <i class="fas fa-ellipsis-h fa-lg ml-2"></i>
                                                </button>
                                                <div class="dropdown-menu">
                                                    <a class="dropdown-item" href="<?php echo e(route('admin.product.edit', $product->id)); ?>">Edit</a>
                                                    <a class="dropdown-item" id='delete-btn' data-id="<?php echo e($product->id); ?>" href="<?php echo e(route('admin.product.destroy', $product->id)); ?>">Delete</a>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>

                            </table>

                        </div>
                        <!-- /.card-body -->
                    </div>
                    <!-- /.card -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
</div>

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

    <script>

        $(document).ready(function () {
            $("table").DataTable({
                order: [0, 'dec']
            });
        });

        function showImagePreview(input, previewId) {
            const preview = document.getElementById(previewId);

            if (input.files && input.files[0]) {
                const reader = new FileReader();

                reader.onload = function (e) {
                    preview.src = e.target.result;
                    preview.style.display = 'block';
                };

                reader.readAsDataURL(input.files[0]);
            }
        }
        const topBannerImageInput = document.getElementById('topBannerImageInput');
        topBannerImageInput.addEventListener('change', function () {
            showImagePreview(this, 'topBannerImagePreview');
        });
    </script>
    <script>

        // $(document).ready(function () {
        //
        
        
        
        
        


        
        

        
        
        
        
        
        
        
        
        
        

        
        
        
        
        
        
        
        
        
        

        
        
        
        

        
    </script>

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

<?php echo $__env->make('layouts.admin-layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/vagrant/projects/upsence/resources/views/admin/product/index.blade.php ENDPATH**/ ?>