

<?php $__env->startSection('admin-content'); ?>
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h4 class="fw-bold mb-0"><?php echo e(__('app.roles.edit_role')); ?></h4>
            <p class="text-muted small mb-0"><?php echo e(__('app.roles.edit_description')); ?></p>
        </div>
        <a href="<?php echo e(route('admin.roles.index')); ?>" class="btn btn-outline-secondary btn-rounded">
            <i class="bi bi-arrow-left me-2"></i><?php echo e(__('app.roles.back')); ?>

        </a>
    </div>

    <form action="<?php echo e(route('admin.roles.update', $role)); ?>" method="POST">
        <?php echo csrf_field(); ?>
        <?php echo method_field('PUT'); ?>

        <div class="row g-3">
            <div class="col-12 col-md-6">
                <label for="name" class="form-label fw-semibold"><?php echo e(__('app.roles.form.name')); ?></label>
                <input type="text" class="form-control <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="name" name="name" value="<?php echo e(old('name', $role->name)); ?>" required>
                <small class="text-muted"><?php echo e(__('app.roles.form.name_hint')); ?></small>
                <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <div class="invalid-feedback"><?php echo e($message); ?></div>
                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>

            <div class="col-12 col-md-6">
                <label for="display_name" class="form-label fw-semibold"><?php echo e(__('app.roles.form.display_name')); ?></label>
                <input type="text" class="form-control <?php $__errorArgs = ['display_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="display_name" name="display_name" value="<?php echo e(old('display_name', $role->display_name)); ?>" required>
                <?php $__errorArgs = ['display_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <div class="invalid-feedback"><?php echo e($message); ?></div>
                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>

            <div class="col-12">
                <label for="description" class="form-label fw-semibold"><?php echo e(__('app.roles.form.description')); ?></label>
                <textarea class="form-control <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="description" name="description" rows="3"><?php echo e(old('description', $role->description)); ?></textarea>
                <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <div class="invalid-feedback"><?php echo e($message); ?></div>
                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>

            <div class="col-12">
                <label class="form-label fw-semibold mb-3"><?php echo e(__('app.roles.form.permissions')); ?></label>
                <div class="border rounded p-3" style="max-height: 400px; overflow-y: auto;">
                    <?php $__currentLoopData = $permissions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group => $groupPermissions): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="mb-4">
                            <h6 class="fw-semibold text-primary mb-2"><?php echo e($group ?: __('app.roles.other')); ?></h6>
                            <div class="row g-2">
                                <?php $__currentLoopData = $groupPermissions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $permission): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <div class="col-12 col-md-6 col-lg-4">
                                        <div class="form-check">
                                            <input class="form-check-input" type="checkbox" name="permissions[]" value="<?php echo e($permission->id); ?>" id="permission<?php echo e($permission->id); ?>" <?php echo e(in_array($permission->id, old('permissions', $role->permissions->pluck('id')->toArray())) ? 'checked' : ''); ?>>
                                            <label class="form-check-label" for="permission<?php echo e($permission->id); ?>">
                                                <?php echo e($permission->display_name); ?>

                                                <?php if($permission->description): ?>
                                                    <small class="text-muted d-block"><?php echo e($permission->description); ?></small>
                                                <?php endif; ?>
                                            </label>
                                        </div>
                                    </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>

            <div class="col-12">
                <div class="d-flex gap-2">
                    <button type="submit" class="btn btn-primary btn-rounded">
                        <i class="bi bi-check-lg me-2"></i><?php echo e(__('app.roles.form.save')); ?>

                    </button>
                    <a href="<?php echo e(route('admin.roles.index')); ?>" class="btn btn-outline-secondary btn-rounded">
                        <?php echo e(__('app.roles.form.cancel')); ?>

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





<?php echo $__env->make('layouts.admin', ['title' => __('app.roles.edit_title')], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\Lavandera\resources\views/admin/roles/edit.blade.php ENDPATH**/ ?>