<?php $__env->startSection('title', 'Data Menu'); ?>

<?php $__env->startSection('content'); ?>
    <div class="page-content">
        <nav class="page-breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Dashboard</a></li>
                <li class="breadcrumb-item active" aria-current="page">Data Menu</li>
            </ol>
        </nav>
        <div class="row">
            <div class="col-md-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h1 class="card-title">Data Menu</h1>
                        <div class="panel-heading">
                            <a href="<?php echo e(route('menu.create')); ?>" class="btn btn-primary mb-3">
                                <i class="fa fa-plus fa-fw"></i> Add Menu
                            </a>
                        </div>
                        <div class="panel-body">
                            <?php if(session('success')): ?>
                                <div class="alert alert-success alert-dismissible fade show" role="alert">
                                    <?php echo e(session('success')); ?>

                                    <button type="button" class="btn-close" data-bs-dismiss="alert"
                                        aria-label="Close"></button>
                                </div>
                            <?php endif; ?>
                            <div class="table-responsive">
                                <table class="table table-bordered table-striped">
                                    <thead>
                                        <tr>
                                            <th>Order</th>
                                            <th>Menu</th>
                                            <th>URL</th>
                                            <th>Active</th>
                                            <th>Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $menu): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                                <td><?php echo e($menu->urutan); ?></td>
                                                <td><?php echo e($menu->menu); ?></td>
                                                <td><?php echo e($menu->url); ?></td>
                                                <td><?php echo e($menu->active ? 'Active' : 'Inactive'); ?></td>
                                                <td>
                                                    <div class="d-flex flex-wrap gap-2">
                                                        <!-- Edit Menu -->
                                                        <a href="<?php echo e(route('menu.edit', $menu->menu_id)); ?>"
                                                            class="btn btn-warning btn-sm">Edit</a>
                                                        <!-- Delete Menu -->
                                                        <form action="<?php echo e(route('menu.destroy', $menu->menu_id)); ?>"
                                                            method="POST" style="display:inline;">
                                                            <?php echo csrf_field(); ?>
                                                            <?php echo method_field('DELETE'); ?>
                                                            <button type="submit" class="btn btn-danger btn-sm"
                                                                onclick="return confirm('Are you sure?')">Delete</button>
                                                        </form>
                                                    </div>
                                                </td>
                                            </tr>

                                            <?php $__currentLoopData = $menu->submenus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $submenu): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <tr>
                                                    <td>-- <?php echo e($submenu->urutan); ?></td>
                                                    <td>-- <?php echo e($submenu->menu); ?></td>
                                                    <td><?php echo e($submenu->url); ?></td>
                                                    <td><?php echo e($submenu->active ? 'Active' : 'Inactive'); ?></td>
                                                    <td>
                                                        <div class="d-flex flex-wrap gap-2">

                                                            <!-- Edit Submenu -->
                                                            <a href="<?php echo e(route('menu.edit', $submenu->menu_id)); ?>"
                                                                class="btn btn-warning btn-sm">Edit</a>
                                                            <!-- Delete Submenu -->
                                                            <form action="<?php echo e(route('menu.destroy', $submenu->menu_id)); ?>"
                                                                method="POST" style="display:inline;">
                                                                <?php echo csrf_field(); ?>
                                                                <?php echo method_field('DELETE'); ?>
                                                                <button type="submit" class="btn btn-danger btn-sm"
                                                                    onclick="return confirm('Are you sure?')">Delete</button>
                                                            </form>
                                                        </div>
                                                    </td>
                                                </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                                <div class="d-flex justify-content-start mt-4">
                                    <?php echo e($menus->links('vendor.pagination.simple-bootstrap-5')); ?>

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

<?php echo $__env->make('dashboard.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/edunesiaserver/public_html/K2/WEB_KAMPUS/WEB_TEMPLATE/Ijo-Ungu/resources/views/admin/menu/index.blade.php ENDPATH**/ ?>