<form action="<?php echo e(isset($roleEdit) ? route('admin.roles.update', $roleEdit) : route('admin.roles.store')); ?>"
    method="POST">
    <?php echo csrf_field(); ?>
    <input type="hidden" name="id" value="<?php echo e($roleEdit->id ?? null); ?>">
    <div class="form-group mb-3">
        <label for="name" class="form-label"><?php echo app('translator')->get('admin.name'); ?></label>
        <input class="form-control  slug_title" id="name" name="name" value="<?php echo e($roleEdit->name ?? null); ?>"
            type="text" placeholder="<?php echo app('translator')->get('common.enterName'); ?>" required>
    </div>
    <div class="form-group mb-3">
        <label for="description" class="form-label"><?php echo app('translator')->get('admin.description'); ?></label>
        <textarea class="form-control  slug_title" id="description" name="description" value="" type="text"><?php echo e($roleEdit->description ?? null); ?></textarea>
    </div>
    <div class="row mb-3">
        <div class="col-md-12">
            <button type="button" class="btn btn-primary btn-xs col-md-2" data-coreui-toggle="collapse"
                data-coreui-target=".multi-collapse" aria-expanded="false"
                aria-controls="permissionTextDiv permissionOptionDiv">
                <?php echo app('translator')->get('admin.manage'); ?>
            </button>
        </div>
    </div>
    <div class="row mb-3" id="permission-div">
        <div class="col-sm-12 col-md-12">
            <div class="collapse multi-collapse show" id="permissionTextDiv">
                <h3 class="col-md-10"><?php echo app('translator')->get('admin.permissions'); ?></h3>
                <?php if(isset($roleEdit)): ?>
                    <?php $__currentLoopData = $roleEdit->permissions->pluck('name'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pnames): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <span class="badge me-1 bg-success"><?php echo e($pnames); ?></span>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php endif; ?>
            </div>
        </div>
        <div class="col-sm-12 col-md-12">
            <div class="collapse multi-collapse" id="permissionOptionDiv">
                <div class="accordion" id="accordionExample">
                    <?php $__currentLoopData = $permissions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $permission): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="accordion-item">
                            <h2 class="accordion-header" id="<?php echo e($key); ?>">
                                <button class="accordion-button collapsed text-uppercase" type="button"
                                    data-coreui-toggle="collapse" data-coreui-target="#collapse_<?php echo e($key); ?>"
                                    aria-expanded="false"
                                    aria-controls="collapse_<?php echo e($key); ?>"><?php echo e($key); ?></button>
                            </h2>
                            <div class="accordion-collapse collapse" id="collapse_<?php echo e($key); ?>"
                                aria-labelledby="<?php echo e($key); ?>" data-coreui-parent="#accordionExample">
                                <div class="accordion-body">
                                    <ul class="list-group" id="parent_per_div<?php echo e($key); ?>">
                                        <?php $__currentLoopData = $permission; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $perm): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <label
                                                class="list-group-item d-flex list-group-item-action justify-content-between"
                                                id="perdiv<?php echo e($perm->id); ?>">
                                                <div>
                                                    <p class="mb-0"><?php echo e($perm->title); ?></p>
                                                    <p class="text-muted small mb-0"><?php echo e($perm->description); ?></p>
                                                </div>
                                                <input type="checkbox" class="form-check-input permission-checkbox"
                                                    data-parentdiv="parent_per_div<?php echo e($key); ?>"
                                                    data-permissiondiv="perdiv<?php echo e($perm->id); ?>"
                                                    data-cid="<?php echo e($perm->id); ?>" data-name="<?php echo e($perm->name); ?>"
                                                    name="permissions[<?php echo e($perm->id); ?>]"
                                                    value="<?php echo e($perm->id); ?>"
                                                    <?php if(isset($roleEdit) && $roleEdit->hasPermissionTo($perm->id)): ?> checked <?php endif; ?>>
                                            </label>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>
    </div>
    <hr>
    <div class="form-check form-switch mb-3">
        <input class="form-check-input" id="default" type="checkbox" <?php if(isset($roleEdit) && $roleEdit->default == 1): ?> checked <?php endif; ?>
            name="default" value="1">
        <label class="form-check-label" for="default"><?php echo app('translator')->get('admin.default'); ?></label>
        <br><span class="text-muted small"><?php echo app('translator')->get('admin.defaultHelpText'); ?></span>
    </div>
    <div class="card-footer text-end">
        <button type="submit" class="btn btn-primary"><?php echo app('translator')->get('common.save'); ?></button>
    </div>
</form>
<?php /**PATH /www/wwwroot/webtoolzone.com/resources/themes/admin/roles/partials/role_form.blade.php ENDPATH**/ ?>