

<?php $__env->startSection('content'); ?>
    <div class="container-fluid">
        <!-- ========== title-wrapper start ========== -->
        <div class="title-wrapper pt-30">
            <div class="row align-items-center">
                <div class="col-md-6">
                    <div class="title">
                        <h2>Materi</h2>
                    </div>
                </div>
                <!-- end col -->
                <div class="col-md-6">
                    <div class="breadcrumb-wrapper">
                        <nav aria-label="breadcrumb">
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item">
                                    <a href="#0">Materi</a>
                                </li>
                                <li class="breadcrumb-item active" aria-current="page">
                                    Dashboard
                                </li>
                            </ol>
                        </nav>
                    </div>
                </div>
                <!-- end col -->
            </div>
            <!-- end row -->
        </div>
        <!-- ========== title-wrapper end ========== -->
        <div class="tables-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <div class="card-style mb-30">
                        <div class="d-flex justify-content-end">
                            <a href="<?php echo e(URL::to('/materi/create')); ?>" class="btn btn-primary">Tambah</a>
                        </div>
                        <div class="table-wrapper table-responsive">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>
                                            <h6>Kategori Kasus</h6>
                                        </th>
                                        <th>
                                            <h6>Kasus</h6>
                                        </th>
                                        <th>
                                            <h6>Action</h6>
                                        </th>
                                    </tr>
                                    <!-- end table row-->
                                </thead>
                                <tbody>
                                    <?php $__currentLoopData = $materi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td>
                                                <?php echo e($item->category->nama_kategori); ?>

                                            </td>
                                            <td>
                                                <?php echo e($item->judul); ?>

                                            </td>
                                            <td>
                                                <a href="<?php echo e(URL::to('/materi/' . Crypt::encrypt($item->id))); ?>"
                                                    class="btn btn-sm btn-primary">Detail</a>
                                                <button class="btn btn-sm btn-danger btn-delete"
                                                    data-id="<?php echo e($item->id); ?>">Delete</button>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                            <!-- end table -->
                        </div>
                    </div>
                    <!-- end card -->
                </div>
                <!-- end col -->
            </div>
            <!-- end row -->
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
    <script>
        $('.btn-delete').click(function () {
            var id = $(this).data('id');
            deleteData(id);
        })

        function deleteData(id) {        
            Swal.fire({
                title: "Hapus?",
                icon: "warning",
                showCancelButton: true,
                confirmButtonColor: "#3085d6",
                cancelButtonColor: "#d33",
                confirmButtonText: "Hapus"
            }).then((result) => {
                if (result.isConfirmed) {
                    window.location.href = "<?php echo e(URL::to('/materi/delete')); ?>" + '/' + id;
                }
            });
        }

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

<!-- ========== section end ========== -->

<!-- ========== footer start =========== -->
<?php echo $__env->make('layouts.v_template', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\Yudi\WEB\project\a\project_learning\resources\views/admin/materi/index.blade.php ENDPATH**/ ?>