<?php $__env->startSection('title', 'Modifica Ruolo'); ?>
<?php $__env->startSection('page_title', 'Modifica Ruolo: ' . $ruolo->name); ?>

<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item"><a href="/admin/ruoli">Admin</a></li>
    <li class="breadcrumb-item"><a href="/admin/ruoli">Ruoli</a></li>
    <li class="breadcrumb-item active"><?php echo e($ruolo->name); ?></li>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header">
                <h3 class="card-title">Modifica Ruolo: <?php echo e($ruolo->name); ?></h3>
                <?php if($usersCount > 0): ?>
                    <span class="badge badge-info ml-2"><?php echo e($usersCount); ?> utenti</span>
                <?php endif; ?>
            </div>
            <div class="card-body">
                <?php if(session('success')): ?>
                    <div class="alert alert-success"><?php echo e(session('success')); ?></div>
                <?php endif; ?>

                <form method="POST" action="<?php echo e(url('/admin/ruoli/' . $ruolo->id)); ?>">
                    <?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
                    <div class="form-group">
                        <label>Nome</label>
                        <input type="text" class="form-control" value="<?php echo e($ruolo->name); ?>" disabled>
                        <small class="text-muted">Il nome del ruolo non può essere modificato</small>
                    </div>
                    <div class="form-group">
                        <label>Descrizione</label>
                        <input type="text" name="description" class="form-control" value="<?php echo e(old('description', $ruolo->description)); ?>">
                    </div>

                    <h5 class="mt-4">Permessi</h5>
                    <table class="table table-sm">
                        <thead>
                            <tr>
                                <th>Modulo</th>
                                <th>Nessuno</th>
                                <th>Lettura</th>
                                <th>Completo</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = ['individui', 'gruppi', 'eventi', 'documenti', 'mailing', 'viste']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $module): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td><strong><?php echo e(ucfirst($module)); ?></strong></td>
                                <td><input type="radio" name="permissions[<?php echo e($module); ?>]" value="0" <?php echo e(($ruolo->permissions[$module] ?? 0) == 0 ? 'checked' : ''); ?>></td>
                                <td><input type="radio" name="permissions[<?php echo e($module); ?>]" value="1" <?php echo e(($ruolo->permissions[$module] ?? 0) == 1 ? 'checked' : ''); ?>></td>
                                <td><input type="radio" name="permissions[<?php echo e($module); ?>]" value="2" <?php echo e(($ruolo->permissions[$module] ?? 0) == 2 ? 'checked' : ''); ?>></td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>

                    <?php if($usersCount > 0): ?>
                    <div class="form-group mt-3">
                        <div class="custom-control custom-checkbox">
                            <input type="checkbox" class="custom-control-input" id="updateUsers" name="update_users" value="1">
                            <label class="custom-control-label" for="updateUsers">
                                Applica queste modifiche a tutti i <?php echo e($usersCount); ?> utenti con questo ruolo
                            </label>
                        </div>
                    </div>
                    <?php endif; ?>

                    <div class="mt-4">
                        <button type="submit" class="btn btn-primary">
                            <i class="fas fa-save"></i> Salva
                        </button>
                        <a href="/admin/ruoli" class="btn btn-secondary">Annulla</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/admin/ruoli/edit.blade.php ENDPATH**/ ?>