<?php $__env->startSection('content'); ?>
<div class="clearfix">
    <div class="full-width-container">
        <?php echo $__env->make('masterHeaderAdmin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        <main class="main-container">
            <?php echo $__env->make('masterSidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            <div class="page-body">
                <div class="nav-breadcrumbs">
                    <ul class="breadcrumbs">
                        <li>
                            <a href="<?php echo e(route('admin')); ?>" class="breadcrumbs-link">TRANG CHỦ</a>
                        </li>
                        <li>
                            <a href="<?php echo e(route('nguoidung')); ?>" class="breadcrumbs-link">QUẢN LÝ NGƯỜI DÙNG</a>
                        </li>
                        <li>
                            <a href="<?php echo e(route('phanquyen', Session::get('maNguoiDung'))); ?>" class="breadcrumbs-link">PHÂN QUYỀN</a>
                        </li>
                    </ul>
                    <a href="<?php echo e(route('nguoidung')); ?>" class="page-button">
                        <i class="fa-solid fa-rotate-left"></i> Quay lại
                    </a>
                </div>
                <form action="<?php echo e(route('save_phanquyen')); ?>" method="POST">
                    <input type="hidden" name="id" value="<?php echo e(request()->id); ?>">
                    <div class="page-form-table">
                        <label for="table-form-label"
                        class="page-button table-form__label table-form__label--float-right">
                        <i class="fas fa-save"></i>
                        <input type="submit" size="0" class="table-form__submit-button" id="table-form-label"
                            value="Lưu trạng thái">
                        </label>
                    </div>
                    <div class="page-table">
                        <table class="table table-fit">
                            <thead>
                                <tr>
                                    <th style="width: fit-content;">Nhóm quyền</th>
                                    <th style="min-width: 300px;">Tên quyền</th>
                                    <th>Cho phép tất cả</th>
                                    <th>Bật / tắt</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__currentLoopData = $quyens; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $nhomquyen): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php $__currentLoopData = $nhomquyen; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $quyen): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($quyen->maQuyen === $quyen->nhomQuyen): ?>
                                            <tr>
                                                <td><b><?php echo e($quyen->maQuyen); ?></b></td>
                                                <td><b><?php echo e($quyen->tenQuyen); ?></b></td>
                                                <td>
                                                    <input <?php echo e(in_array($quyen->maQuyen, $fullquyen) ? 'checked' : ''); ?> type="checkbox" id="nhom-<?php echo e($quyen->nhomQuyen); ?>" data-nhomquyen="<?php echo e($quyen->nhomQuyen); ?>" value="<?php echo e($quyen->maQuyen); ?>" class="table-checkbox" onclick="toggleAllQuyens(this)">
                                                </td>
                                                <td>
                                                </td>
                                            </tr>
                                        <?php else: ?>
                                            <tr>
                                                <td></td>
                                                <td><?php echo e($quyen->tenQuyen); ?></td>
                                                <td></td>
                                                <td>
                                                    <input <?php echo e($quyen->coQuyen ? 'checked' : ''); ?> type="checkbox" data-nhomquyen="<?php echo e($quyen->nhomQuyen); ?>" name="quyen[]" value="<?php echo e($key); ?>-<?php echo e($quyen->maQuyen); ?>" class="table-checkbox" onchange="toggleQuyen(this)">
                                                </td>
                                            </tr>
                                        <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                    <?php echo csrf_field(); ?>
                </form>
            </div>
        </main>

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

<?php echo $__env->make('masterAdmin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/demo/public_html/resources/views/admin/phanquyen.blade.php ENDPATH**/ ?>