glastree_on_gitea
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', 'Crea Utente')
|
||||
@section('page_title', 'Crea Nuovo Utente')
|
||||
|
||||
@section('breadcrumbs')
|
||||
<li class="breadcrumb-item"><a href="/admin/utenti">Admin</a></li>
|
||||
<li class="breadcrumb-item"><a href="/admin/utenti">Utenti</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">Dati Utente</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="/admin/utenti">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label>Nome *</label>
|
||||
<input type="text" name="name" class="form-control" required value="{{ old('name') }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Email *</label>
|
||||
<input type="email" name="email" class="form-control" required value="{{ old('email') }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Password *</label>
|
||||
<input type="password" name="password" class="form-control" required minlength="8">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Conferma Password *</label>
|
||||
<input type="password" name="password_confirmation" class="form-control" required minlength="8">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ruolo Predefinito</label>
|
||||
<select name="role_preset_id" class="form-control" id="rolePresetSelect">
|
||||
<option value="">Personalizzato</option>
|
||||
@foreach($rolePresets as $preset)
|
||||
<option value="{{ $preset->id }}">{{ $preset->name }} - {{ $preset->description }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="isAdmin" name="is_admin" value="1">
|
||||
<label class="custom-control-label" for="isAdmin">Superadmin (bypass ACL)</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="permissionsSection" class="mt-4">
|
||||
<h5>Permessi Granulari</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" {{ old('permissions.' . $module, '1') == '0' ? 'checked' : '' }}></td>
|
||||
<td><input type="radio" name="permissions[{{ $module }}]" value="1" {{ old('permissions.' . $module, '1') == '1' ? 'checked' : '' }}></td>
|
||||
<td><input type="radio" name="permissions[{{ $module }}]" value="2" {{ old('permissions.' . $module, '1') == '2' ? 'checked' : '' }}></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-save"></i> Salva
|
||||
</button>
|
||||
<a href="/admin/utenti" class="btn btn-secondary">Annulla</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$('#rolePresetSelect').change(function() {
|
||||
if ($(this).val()) {
|
||||
$('#permissionsSection').hide();
|
||||
} else {
|
||||
$('#permissionsSection').show();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,111 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', 'Modifica Utente')
|
||||
@section('page_title', 'Modifica Utente: ' . $user->name)
|
||||
|
||||
@section('breadcrumbs')
|
||||
<li class="breadcrumb-item"><a href="/admin/utenti">Admin</a></li>
|
||||
<li class="breadcrumb-item"><a href="/admin/utenti">Utenti</a></li>
|
||||
<li class="breadcrumb-item active">{{ $user->name }}</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Dati Utente</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url('/admin/utenti/' . $user->id) }}">
|
||||
@csrf @method('PUT')
|
||||
<div class="form-group">
|
||||
<label>Nome *</label>
|
||||
<input type="text" name="name" class="form-control" required value="{{ old('name', $user->name) }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Email *</label>
|
||||
<input type="email" name="email" class="form-control" required value="{{ old('email', $user->email) }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Nuova Password <small>(lascia vuoto per non cambiare)</small></label>
|
||||
<input type="password" name="password" class="form-control" minlength="8">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Conferma Password</label>
|
||||
<input type="password" name="password_confirmation" class="form-control" minlength="8">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Stato</label>
|
||||
<select name="status" class="form-control" required>
|
||||
<option value="active" {{ $user->status === 'active' ? 'selected' : '' }}>Attivo</option>
|
||||
<option value="suspended" {{ $user->status === 'suspended' ? 'selected' : '' }}>Sospeso</option>
|
||||
<option value="pending" {{ $user->status === 'pending' ? 'selected' : '' }}>In attesa</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ruolo Predefinito</label>
|
||||
<select name="role_preset_id" class="form-control" id="rolePresetSelect">
|
||||
<option value="">Personalizzato</option>
|
||||
@foreach($rolePresets as $preset)
|
||||
<option value="{{ $preset->id }}" {{ $user->role_preset_id == $preset->id ? 'selected' : '' }}>
|
||||
{{ $preset->name }} - {{ $preset->description }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="isAdmin" name="is_admin" value="1" {{ $user->isSuperAdmin() ? 'checked' : '' }}>
|
||||
<label class="custom-control-label" for="isAdmin">Superadmin (bypass ACL)</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="permissionsSection" class="mt-4">
|
||||
<h5>Permessi Granulari</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" {{ ($user->permissions[$module] ?? 0) == 0 ? 'checked' : '' }}></td>
|
||||
<td><input type="radio" name="permissions[{{ $module }}]" value="1" {{ ($user->permissions[$module] ?? 0) == 1 ? 'checked' : '' }}></td>
|
||||
<td><input type="radio" name="permissions[{{ $module }}]" value="2" {{ ($user->permissions[$module] ?? 0) == 2 ? 'checked' : '' }}></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-save"></i> Salva
|
||||
</button>
|
||||
<a href="/admin/utenti" class="btn btn-secondary">Annulla</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$('#rolePresetSelect').change(function() {
|
||||
if ($(this).val()) {
|
||||
$('#permissionsSection').hide();
|
||||
} else {
|
||||
$('#permissionsSection').show();
|
||||
}
|
||||
}).trigger('change');
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,109 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', 'Gestione Utenti')
|
||||
@section('page_title', 'Gestione Utenti')
|
||||
|
||||
@section('breadcrumbs')
|
||||
<li class="breadcrumb-item active">Admin</li>
|
||||
<li class="breadcrumb-item active">Utenti</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Utenti Registrati</h3>
|
||||
<a href="/admin/utenti/create" class="btn btn-success btn-sm float-right">
|
||||
<i class="fas fa-plus"></i> Nuovo Utente
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="GET" class="mb-3">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="search" class="form-control" placeholder="Cerca nome o email..." value="{{ request('search') }}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<select name="status" class="form-control">
|
||||
<option value="">Tutti gli stati</option>
|
||||
<option value="active" {{ request('status') == 'active' ? 'selected' : '' }}>Attivo</option>
|
||||
<option value="suspended" {{ request('status') == 'suspended' ? 'selected' : '' }}>Sospeso</option>
|
||||
<option value="pending" {{ request('status') == 'pending' ? 'selected' : '' }}>In attesa</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="submit" class="btn btn-primary">Filtra</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nome</th>
|
||||
<th>Email</th>
|
||||
<th>Stato</th>
|
||||
<th>Permessi</th>
|
||||
<th>Creato</th>
|
||||
<th style="width: 150px;">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($utenti as $utente)
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ $utente->name }}</strong>
|
||||
@if($utente->isSuperAdmin())
|
||||
<span class="badge badge-danger ml-1">Admin</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $utente->email }}</td>
|
||||
<td>
|
||||
@switch($utente->status)
|
||||
@case('active')
|
||||
<span class="badge badge-success">Attivo</span>
|
||||
@break
|
||||
@case('suspended')
|
||||
<span class="badge badge-secondary">Sospeso</span>
|
||||
@break
|
||||
@case('pending')
|
||||
<span class="badge badge-warning">In attesa</span>
|
||||
@break
|
||||
@endswitch
|
||||
</td>
|
||||
<td>
|
||||
@php $summary = $utente->getPermissionsSummary(); @endphp
|
||||
<small>
|
||||
@foreach($summary as $module => $level)
|
||||
@if($level !== 'Nessuno')
|
||||
<span class="text-{{ $level === 'Completo' ? 'success' : 'info' }}">{{ ucfirst($module) }}: {{ $level }}</span><br>
|
||||
@endif
|
||||
@endforeach
|
||||
</small>
|
||||
</td>
|
||||
<td>{{ $utente->created_at->format('d/m/Y') }}</td>
|
||||
<td>
|
||||
<a href="{{ url('/admin/utenti/' . $utente->id . '/edit') }}" class="btn btn-xs btn-warning">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
@if($utente->id !== auth()->id())
|
||||
<form method="POST" action="{{ url('/admin/utenti/' . $utente->id) }}" style="display: inline;">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questo utente?')">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ $utenti->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user