glastree_on_gitea
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', 'Crea Ruolo')
|
||||
@section('page_title', 'Crea Nuovo Ruolo')
|
||||
|
||||
@section('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">Nuovo</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Nuovo Ruolo</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="/admin/ruoli">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label>Nome *</label>
|
||||
<input type="text" name="name" class="form-control" required maxlength="50" placeholder="es. Segretario">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Descrizione</label>
|
||||
<input type="text" name="description" class="form-control" maxlength="255" placeholder="es. Accesso per segretari">
|
||||
</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>
|
||||
@foreach(['individui', 'gruppi', 'eventi', 'documenti', 'mailing', 'viste'] as $module)
|
||||
<tr>
|
||||
<td><strong>{{ ucfirst($module) }}</strong></td>
|
||||
<td class="text-center"><input type="radio" name="permissions[{{ $module }}]" value="0" checked></td>
|
||||
<td class="text-center"><input type="radio" name="permissions[{{ $module }}]" value="1"></td>
|
||||
<td class="text-center"><input type="radio" name="permissions[{{ $module }}]" value="2"></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<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>
|
||||
@endsection
|
||||
@@ -0,0 +1,83 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', 'Modifica Ruolo')
|
||||
@section('page_title', 'Modifica Ruolo: ' . $ruolo->name)
|
||||
|
||||
@section('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">{{ $ruolo->name }}</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Modifica Ruolo: {{ $ruolo->name }}</h3>
|
||||
@if($usersCount > 0)
|
||||
<span class="badge badge-info ml-2">{{ $usersCount }} utenti</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success">{{ session('success') }}</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ url('/admin/ruoli/' . $ruolo->id) }}">
|
||||
@csrf @method('PUT')
|
||||
<div class="form-group">
|
||||
<label>Nome</label>
|
||||
<input type="text" class="form-control" value="{{ $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="{{ 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>
|
||||
@foreach(['individui', 'gruppi', 'eventi', 'documenti', 'mailing', 'viste'] as $module)
|
||||
<tr>
|
||||
<td><strong>{{ ucfirst($module) }}</strong></td>
|
||||
<td><input type="radio" name="permissions[{{ $module }}]" value="0" {{ ($ruolo->permissions[$module] ?? 0) == 0 ? 'checked' : '' }}></td>
|
||||
<td><input type="radio" name="permissions[{{ $module }}]" value="1" {{ ($ruolo->permissions[$module] ?? 0) == 1 ? 'checked' : '' }}></td>
|
||||
<td><input type="radio" name="permissions[{{ $module }}]" value="2" {{ ($ruolo->permissions[$module] ?? 0) == 2 ? 'checked' : '' }}></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@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 {{ $usersCount }} utenti con questo ruolo
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@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>
|
||||
@endsection
|
||||
@@ -0,0 +1,70 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', 'Gestione Ruoli')
|
||||
@section('page_title', 'Gestione Ruoli')
|
||||
|
||||
@section('breadcrumbs')
|
||||
<li class="breadcrumb-item active">Admin</li>
|
||||
<li class="breadcrumb-item active">Ruoli</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Ruoli Predefiniti</h3>
|
||||
<a href="/admin/ruoli/create" class="btn btn-success btn-sm float-right">
|
||||
<i class="fas fa-plus"></i> Nuovo Ruolo
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nome</th>
|
||||
<th>Descrizione</th>
|
||||
<th>Utenti</th>
|
||||
<th>Permessi</th>
|
||||
<th style="width: 100px;">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($ruoli as $ruolo)
|
||||
<tr>
|
||||
<td><strong>{{ $ruolo->name }}</strong></td>
|
||||
<td>{{ $ruolo->description }}</td>
|
||||
<td><span class="badge badge-info">{{ $ruolo->users_count }}</span></td>
|
||||
<td>
|
||||
@foreach($ruolo->permissions as $module => $level)
|
||||
<span class="badge badge-{{ $level == 2 ? 'success' : ($level == 1 ? 'info' : 'secondary') }}">
|
||||
{{ ucfirst($module) }}: {{ $level == 2 ? 'Full' : ($level == 1 ? 'Read' : 'None') }}
|
||||
</span>
|
||||
@endforeach
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url('/admin/ruoli/' . $ruolo->id . '/edit') }}" class="btn btn-xs btn-warning">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
@if($ruolo->users_count == 0)
|
||||
<form method="POST" action="{{ url('/admin/ruoli/' . $ruolo->id) }}" style="display: inline;">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questo ruolo?')">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<button type="button" class="btn btn-xs btn-secondary" disabled title="Utenti associati: {{ $ruolo->users_count }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user