<?php if (isset($component)) { $__componentOriginal91fdd17964e43374ae18c674f95cdaa3 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal91fdd17964e43374ae18c674f95cdaa3 = $attributes; } ?>
<?php $component = App\View\Components\AdminLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AdminLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <h1 class="text-2xl font-bold">Roles</h1>
     <?php $__env->endSlot(); ?>

    <div class="p-6 bg-white rounded-lg shadow-md dark:bg-gray-800">
        <form method="POST" action="<?php echo e(route('admin.roles.store')); ?>">
            <?php echo csrf_field(); ?>

            <!-- Role Name -->
            <div class="mb-4">
                <label for="role_name" class="block text-gray-700 font-bold">Role Name</label>
                <input type="text" name="name" id="role_name" class="w-full px-3 py-2 border rounded-lg" required>
            </div>

            <!-- Permissions Heading -->
            <h3 class="text-lg font-semibold mb-4">Permissions</h3>

            <!-- Permissions Grid (2 Cards per Row) -->
            <div class="grid grid-cols-2 gap-4">
                <?php $__currentLoopData = $modules; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $module => $permissions): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg shadow-md">

                        <!-- Module Checkbox -->
                        <div class="flex items-center mb-3">
                            <input type="checkbox" id="module-<?php echo e($module); ?>"
                                onclick="toggleModule('<?php echo e($module); ?>')">
                            <label for="module-<?php echo e($module); ?>" class="font-bold ml-2 text-lg capitalize">
                                <?php echo e($module); ?>

                            </label>
                        </div>

                        <!-- Permissions List -->
                        <div class="space-y-1">
                            <?php $__currentLoopData = $permissions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $permission): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="flex items-center p-1">
                                    <input type="checkbox" name="permissions[]" value="<?php echo e($permission->id); ?>"
                                        class="<?php echo e($module); ?>-permission">
                                    <label class="ml-2 text-sm"><?php echo e($permission->name); ?></label>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>

                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>

            <!-- Submit Button -->
            <div class="flex items-center justify-end mt-6">
                <button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded-md shadow-md hover:bg-blue-600">
                    Save Role
                </button>
            </div>
        </form>
    </div>

    <script>
        function toggleModule(module) {
            let moduleCheckbox = document.getElementById('module-' + module);
            let permissionCheckboxes = document.querySelectorAll('.' + module + '-permission');

            permissionCheckboxes.forEach(checkbox => {
                checkbox.checked = moduleCheckbox.checked;
            });
        }
    </script>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal91fdd17964e43374ae18c674f95cdaa3)): ?>
<?php $attributes = $__attributesOriginal91fdd17964e43374ae18c674f95cdaa3; ?>
<?php unset($__attributesOriginal91fdd17964e43374ae18c674f95cdaa3); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal91fdd17964e43374ae18c674f95cdaa3)): ?>
<?php $component = $__componentOriginal91fdd17964e43374ae18c674f95cdaa3; ?>
<?php unset($__componentOriginal91fdd17964e43374ae18c674f95cdaa3); ?>
<?php endif; ?>
<?php /**PATH C:\xampp8.2\htdocs\Portal\resources\views/admin/roles/create.blade.php ENDPATH**/ ?>