<?php $__env->startSection('title', 'Sliders Management'); ?>
<?php $__env->startSection('sliders-management', 'active'); ?>
<?php echo $__env->make('adminDashboard.layout.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<div class="main-content">
    <section class="section">
        <div class="section-body">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <h4>Slider Management</h4>
                            <button type="button" onclick="" class="badge badge-success" style="border:none;" data-toggle="modal" data-target="#exampleModal">Add</button>
                        </div>
                        <div class="card-body p-0">
                            <div class="table-responsive">
                                <table class="table table-striped table-md">
                                    <tr>
                                        <th>ID</th>
                                        <th>Title</th>
                                        <th>Type</th>
                                        <th>File</th>
                                        <th>Action</th>
                                    </tr>
                                    <?php $__currentLoopData = $sliders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $slider): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e(++$key); ?></td>
                                        <td><?php echo e($slider->banner_title); ?></td>
                                        <td><?php echo e($slider->type); ?></td>
                                        <?php if($slider->type == "image"): ?>
                                        <td><img src="<?php echo e(asset('assets/img/'.$slider->path)); ?>" width="100px"></td>
                                        <?php else: ?>
                                        <td><?php echo e($slider->path); ?></td>
                                        <?php endif; ?>
                                        <td>

                                            <a href="<?php echo e(url('/admin/slider-management/delete/'.$slider->id)); ?>" class="text-decoration-none">
                                                <div class="badge badge-danger"><i class="material-icons font_size_14">delete</i></div>
                                            </a>
                                        </td>
                                    </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </table>
                            </div>
                        </div>
                        <div class="card-footer text-right">
                            <nav class="d-inline-block">
                                <?php echo e($sliders->links('adminDashboard.pagination')); ?>

                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="formModal" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="formModal">New Slider</h5>
                    <button type="button" class="close" id="modal_dismiss" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form method="post" action="<?php echo e(url('/admin/slider-management')); ?>" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <div class="row">
                            <div class="col-12">
                                <div class="form-group">
                                    <label>Title</label>
                                    <input type="text" class="form-control" name="banner_title" required>
                                </div>
                            </div>
                            <div class="col-12">
                                <div class="form-group">
                                    <label>Type</label>
                                    <select class="form-control" name="type" onchange="action_changed(this.value)">
                                        <option value="image">Image</option>
                                        <option value="video">Video</option>
                                    </select>
                                </div>
                            </div>

                            <div class="col-12">
                                <div class="form-group" id="action_field">
                                    <label>Image</label>
                                    <input type="file" class="form-control" name="file_name" required>
                                </div>
                            </div>

                            <div class="col-12 text-center" id="order_actions">
                                <div class="text-right">
                                    <button class="btn btn-primary mr-1" type="submit">Submit</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    function action_changed(value) {
        if (value == "image") {
            $('#action_field').html(`
            <label>Image</label>
            <input type="file" class="form-control" name="file_name" required>
            `);
        } else if (value == "video") {
            $('#action_field').html(`
            <label>Video Link</label>
            <input type="text" class="form-control" name="file_name" required>
            `);
        }
    }
</script>
<?php echo $__env->make('adminDashboard.layout.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/shyambabamatka/public_html/zupitogames.com/resources/views/adminDashboard/slider-management.blade.php ENDPATH**/ ?>