70 lines
3.2 KiB
PHP
70 lines
3.2 KiB
PHP
@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 |