<!-- Main content -->
<?php if (isset($component)) { $__componentOriginal566f40242755341fef381206827a6570 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal566f40242755341fef381206827a6570 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.contents','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('admin.contents'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('title', null, []); ?> <?php echo e($data['title']); ?> <?php $__env->endSlot(); ?>
     <?php $__env->slot('menuOpen', null, []); ?> <?php echo e($data['menuOpen']); ?>  <?php $__env->endSlot(); ?>
     <?php $__env->slot('menuActive', null, []); ?> <?php echo e($data['menuActive']); ?>  <?php $__env->endSlot(); ?>
     <?php $__env->slot('page', null, []); ?> <?php echo e($data['page']); ?> <?php $__env->endSlot(); ?>
     <?php $__env->slot('head', null, []); ?> 
        <link rel="stylesheet" href="<?php echo e(asset('')); ?>assets/plugins/sweetalert2/sweetalert2.min.css">
        <style>
            .informasi {
                background-color: rgb(245, 245, 227);
                padding: 15px;
                border-radius: 10px;
                font-size: 12px;
            }
        </style>
     <?php $__env->endSlot(); ?>


    <section class="content">

        <!-- Default box -->
        <div class="row">
            <div class="col-lg-12">
                <?php if (isset($component)) { $__componentOriginal88b0e6813f5b80100a19437aa80e29ba = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal88b0e6813f5b80100a19437aa80e29ba = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.message','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('message'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?> <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal88b0e6813f5b80100a19437aa80e29ba)): ?>
<?php $attributes = $__attributesOriginal88b0e6813f5b80100a19437aa80e29ba; ?>
<?php unset($__attributesOriginal88b0e6813f5b80100a19437aa80e29ba); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal88b0e6813f5b80100a19437aa80e29ba)): ?>
<?php $component = $__componentOriginal88b0e6813f5b80100a19437aa80e29ba; ?>
<?php unset($__componentOriginal88b0e6813f5b80100a19437aa80e29ba); ?>
<?php endif; ?>
                <div class="card card-primary card-outline">
                    <div class="card-header">
                        <button class="btn btn-success float-right mb-3" data-toggle="modal" data-target="#tambah"><i
                                class="fa fa-plus-circle mr-2"></i> Banner
                            Baru</button>
                        <h3 class="card-title"><i class="fa fa-server text-primary"></i> <?php echo e($data['page']); ?></h3>
                    </div>
                    <div class="card-body">

                        <table class="table table-bordered table-hover myTable tab">
                            <thead>
                                <tr>
                                    <th width="5%">No</th>
                                    <th width="8%">Gambar</th>
                                    <th>Judul</th>
                                    <th>Link</th>
                                    <th>Status</th>
                                    <th width="15%">Tgl. Input</th>
                                    <th width="20%">Opsi</th>
                                </tr>
                            </thead>
                            <tbody id="view">
                                <?php $__empty_1 = true; $__currentLoopData = $slid; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="text-center"><?php echo e($no++); ?></td>
                                        <td class="text-center">
                                            <img src="<?php echo e(asset('/storage/banner/' . $s->gambar)); ?>" alt=" banner"
                                                class="table-avatar" width="100px">
                                        </td>
                                        <td><?php echo e($s->judul); ?></td>
                                        <td><?php echo e($s->link); ?></td>
                                        <td>
                                            <div class="custom-control custom-switch   custom-switch-on-success">
                                                <input type="checkbox" class="custom-control-input check"
                                                    data-id="<?php echo e($s->id); ?>" data-v="<?php echo e($s->status); ?>"
                                                    <?php echo e($s->status == 'Y' ? 'checked' : ''); ?>

                                                    id="status<?php echo e($s->id); ?>">
                                                <label class="custom-control-label" for="status<?php echo e($s->id); ?>">
                                                    <?php echo e($s->status == 'Y' ? 'Aktif' : 'Tidak Aktif'); ?></label>
                                            </div>

                                        </td>
                                        <td><?php echo e(tgl_inf($s->updated_at)); ?></td>
                                        <td class="text-center">
                                            <button class="btn btn-primary btn-sm" data-toggle="modal"
                                                data-target="#edit<?php echo e($s->id); ?>"><i class="fa fa-edit mr-2"></i>
                                                Edit</button>
                                            <button class="btn btn-info btn-sm detail" data-id="<?php echo e($s->id); ?>"><i
                                                    class="fa fa-search mr-2"></i>
                                                Detail</button>
                                            <button class="btn btn-danger btn-sm hapus" data-id="<?php echo e($s->id); ?>"
                                                data-nm="<?php echo e($s->judul); ?>"><i class="fa fa-trash mr-2"></i>
                                                Hapus</button>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="12" class="text-center">Data masih kosong</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div class="col-lg-12">
                <hr>
            </div>

            <div class="col-lg-12">
                <div class="card card-primary card-outline">
                    <div class="card-header">
                        <h3 class="card-title "><i class="fa fa-server text-primary"></i> Banner Atas
                        </h3>
                    </div>
                    <div class="card-body">
                        <table class="table table-bordered table-hover myTable tab">
                            <thead>
                                <tr>
                                    <th width="5%">No</th>
                                    <th width="8%">Gambar</th>
                                    <th>Judul</th>
                                    <th>Isi</th>
                                    <th>Link</th>
                                    <th width="20%">Opsi</th>
                                </tr>
                            </thead>
                            <tbody id="view2">
                                <?php
                                    $i = 1;
                                ?>
                                <?php $__empty_1 = true; $__currentLoopData = $ban_atas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="text-center"><?php echo e($i++); ?></td>
                                        <td class="text-center">
                                            <img src="<?php echo e(asset('/storage/banner/' . $b->gambar)); ?>" alt=" banner"
                                                class="table-avatar" width="100px">
                                        </td>
                                        <td><?php echo e($b->judul); ?></td>
                                        <td><?php echo e($b->isi); ?></td>
                                        <td><?php echo e($b->link); ?></td>
                                        <td class="text-center">
                                            <button class="btn btn-primary btn-sm" data-toggle="modal"
                                                data-target="#edit<?php echo e($b->id); ?>"><i class="fa fa-edit mr-2"></i>
                                                Edit</button>
                                            <button class="btn btn-info btn-sm detail" data-id="<?php echo e($b->id); ?>"><i
                                                    class="fa fa-search mr-2"></i>
                                                Detail</button>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="12" class="text-center">Data masih kosong</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div class="col-lg-12">
                <hr>
            </div>

            <div class="col-lg-12">
                <div class="card card-primary card-outline">
                    <div class="card-header">
                        <h3 class="card-title "><i class="fa fa-server text-primary"></i> Banner Bawah
                        </h3>
                    </div>
                    <div class="card-body">
                        <table class="table table-bordered table-hover myTable tab">
                            <thead>
                                <tr>
                                    <th width="5%">No</th>
                                    <th width="8%">Gambar</th>
                                    <th>Judul</th>
                                    <th>Isi</th>
                                    <th>Link</th>
                                    <th width="20%">Opsi</th>
                                </tr>
                            </thead>
                            <tbody id="view3">
                                <?php
                                    $r = 1;
                                ?>
                                <?php $__empty_1 = true; $__currentLoopData = $ban_bawah; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="text-center"><?php echo e($r++); ?></td>
                                        <td class="text-center">
                                            <img src="<?php echo e(asset('/storage/banner/' . $b->gambar)); ?>" alt=" banner"
                                                class="table-avatar" width="100px">
                                        </td>
                                        <td><?php echo e($b->judul); ?></td>
                                        <td><?php echo e($b->isi); ?></td>
                                        <td><?php echo e($b->link); ?></td>
                                        <td class="text-center">
                                            <button class="btn btn-primary btn-sm" data-toggle="modal"
                                                data-target="#edit<?php echo e($b->id); ?>"><i class="fa fa-edit mr-2"></i>
                                                Edit</button>
                                            <button class="btn btn-info btn-sm detail"
                                                data-id="<?php echo e($b->id); ?>"><i class="fa fa-search mr-2"></i>
                                                Detail</button>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="12" class="text-center">Data masih kosong</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>


        </div>
        <!-- /.card -->

    </section>

    
    <div class="modal fade" id="tambah">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header bg-primary ">
                    Tambah Data Banner
                </div>
                <form action="<?php echo e(route('banner.tambah')); ?>" method="post" enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="kode" id="" value="BNS">
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="">Judul</label>
                            <input type="text" name="judul" class="form-control" placeholder="Judul..."
                                required>
                        </div>
                        <div class="form-group">
                            <label for="">Isi Keterangan</label>
                            <textarea name="isi" id="isi" class="form-control" required></textarea>
                        </div>
                        <div class="form-group">
                            <label for="">Link Produk</label>
                            <input type="text" name="link" class="form-control" placeholder="link..."
                                required>
                        </div>
                        <div class="form-group">
                            <label for="">Gambar</label>
                            <div class="custom-file">
                                <input type="file" name="gambar" class="custom-file-input" id="exampleInputFile"
                                    required>
                                <label class="custom-file-label" for="exampleInputFile">Cari
                                    Gambar</label>
                            </div>
                        </div>

                        <div class="d-flex justify-content-center">
                            <div style="height: 180px; width: 50%; border:1px solid  #eaedf0" class="gambar"></div>
                        </div>
                    </div>
                    <div class="modal-footer justify-content-between">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="submit" class="btn btn-primary satuan"><i class="fa fa-save mr-2"></i>
                            Simpan</button>
                    </div>
                </form>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>


    <?php $__currentLoopData = $banner; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="modal fade" id="edit<?php echo e($b->id); ?>">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header bg-primary ">
                        Edit Data Banner
                    </div>
                    <form action="<?php echo e(route('banner.edit')); ?>" method="post" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="id" id="" value="<?php echo e($b->id); ?>">
                        <input type="hidden" name="gbrlama" id="" value="<?php echo e($b->gambar); ?>">
                        <div class="modal-body">
                            <div class="form-group">
                                <label for="">Judul</label>
                                <input type="text" name="judul" class="form-control" placeholder="Judul..."
                                    required value="<?php echo e($b->judul); ?>">
                            </div>
                            <div class="form-group">
                                <label for="">Isi Keterangan</label>
                                <textarea name="isi" id="isi" class="form-control" required><?php echo e($b->isi); ?></textarea>
                            </div>
                            <div class="form-group">
                                <label for="">Link Produk</label>
                                <input type="text" name="link" class="form-control" placeholder="link..."
                                    required value="<?php echo e($b->link); ?>">
                            </div>
                            <div class="form-group">
                                <label for="">Gambar</label>
                                <div class="custom-file">
                                    <input type="file" name="gambar" class="custom-file-input imeg"
                                        id="exampleInputFile">
                                    <label class="custom-file-label" for="exampleInputFile">Cari
                                        Gambar</label>
                                </div>
                            </div>

                            <div class="d-flex justify-content-center">
                                <div style="height: 180px; width: 50%; border:1px solid  #eaedf0" class="gambar">
                                    <img src="<?php echo e(asset('/storage/banner/' . $b->gambar)); ?>" alt="banner"
                                        class="vgmb" height="220px" width="100%">
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer justify-content-between">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            <button type="submit" class="btn btn-primary satuan"><i class="fa fa-save mr-2"></i>
                                Simpan</button>
                        </div>
                    </form>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

    
    <div class="modal fade" id="mdetail">
        <div class="modal-dialog ">
            <div class="modal-content">
                <div class="modal-header bg-primary ">
                    Detail Data Banner
                </div>
                <div class="modal-body" id="vdetail">

                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

     <?php $__env->slot('foot', null, []); ?> 
        <script src="<?php echo e(asset('assets/')); ?>/admin/plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
        <script src="<?php echo e(asset('')); ?>assets/admin/plugins/sweetalert2/sweetalert2.all.min.js"></script>
        <script>
            $(function() {
                bsCustomFileInput.init();

                $("#exampleInputFile").change(function() {
                    filePreview(this);
                });

                $(".imeg").change(function() {
                    filePreview(this);
                });

                function filePreview(input) {
                    if (input.files && input.files[0]) {
                        var reader = new FileReader();
                        reader.onload = function(e) {
                            $('#img').remove();
                            $('.vgmb').hide();
                            $('.gambar').append('<img src="' + e.target.result +
                                '" width="100%" height="180px" id="img">');
                        };
                        reader.readAsDataURL(input.files[0]);
                    }
                }

                $('#view').on('click', '.check', function() {
                    var token = $("meta[name='csrf-token']").attr("content");
                    var id = $(this).attr('data-id');
                    var value = $(this).attr('data-v');
                    if (value == "Y") {
                        var isi = "N";
                    } else {
                        var isi = "Y";
                    }
                    $.ajax({
                        type: 'POST',
                        url: 'status-banner',
                        data: {
                            id: id,
                            isi: isi,
                            _token: token,
                        },
                        success: function(data) {
                            document.location.href = "";
                        }
                    });
                });

                $('#view').on('click', '.detail', function() {
                    var token = $("meta[name='csrf-token']").attr("content");
                    var id = $(this).attr('data-id');
                    $.ajax({
                        type: 'POST',
                        url: 'detail-banner',
                        data: {
                            id: id,
                            _token: token,
                        },
                        success: function(data) {
                            $('#mdetail').modal('show');
                            $('#vdetail').html(data);
                        }
                    });
                });

                $('#view').on('click', '.hapus', function() {
                    var id = $(this).attr('data-id');
                    var nama = $(this).attr('data-nm');

                    Swal.fire({
                        title: "Apa anda yakin?",
                        text: "Banner dengan Judul ( " + nama + " ) akan di hapus!",
                        icon: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#3085d6",
                        cancelButtonColor: "#d33",
                        confirmButtonText: "Ya, Hapus!"
                    }).then((result) => {
                        if (result.isConfirmed) {
                            document.location.href = "delete-banner/" + id;
                        }
                    });

                });

                $('#view2').on('click', '.detail', function() {
                    var token = $("meta[name='csrf-token']").attr("content");
                    var id = $(this).attr('data-id');
                    $.ajax({
                        type: 'POST',
                        url: 'detail-banner',
                        data: {
                            id: id,
                            _token: token,
                        },
                        success: function(data) {
                            $('#mdetail').modal('show');
                            $('#vdetail').html(data);
                        }
                    });
                });

                $('#view3').on('click', '.detail', function() {
                    var token = $("meta[name='csrf-token']").attr("content");
                    var id = $(this).attr('data-id');
                    $.ajax({
                        type: 'POST',
                        url: 'detail-banner',
                        data: {
                            id: id,
                            _token: token,
                        },
                        success: function(data) {
                            $('#mdetail').modal('show');
                            $('#vdetail').html(data);
                        }
                    });
                });
            });
        </script>
     <?php $__env->endSlot(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal566f40242755341fef381206827a6570)): ?>
<?php $attributes = $__attributesOriginal566f40242755341fef381206827a6570; ?>
<?php unset($__attributesOriginal566f40242755341fef381206827a6570); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal566f40242755341fef381206827a6570)): ?>
<?php $component = $__componentOriginal566f40242755341fef381206827a6570; ?>
<?php unset($__componentOriginal566f40242755341fef381206827a6570); ?>
<?php endif; ?>
<?php /**PATH /Applications/XAMPP/xamppfiles/htdocs/e-CommerceLv11/resources/views/admin/setting/banner.blade.php ENDPATH**/ ?>