102 lines
4.8 KiB
PHP
102 lines
4.8 KiB
PHP
@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>
|
|
<input type="hidden" name="is_admin" value="0">
|
|
<div class="form-group">
|
|
<div class="custom-control custom-switch">
|
|
<input type="checkbox" class="custom-control-input" id="isAdmin" name="is_admin" value="1" {{ old('is_admin') === '1' ? '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(\App\Models\User::MODULES as $module)
|
|
<tr>
|
|
<td><strong>{{ ucfirst($module) }}</strong></td>
|
|
<td><input type="radio" name="permissions[{{ $module }}]" value="0" {{ old('permissions.' . $module, $module === 'settings' ? '0' : '1') == '0' ? 'checked' : '' }}></td>
|
|
<td><input type="radio" name="permissions[{{ $module }}]" value="1" {{ old('permissions.' . $module, $module === 'settings' ? '0' : '1') == '1' ? 'checked' : '' }}></td>
|
|
<td><input type="radio" name="permissions[{{ $module }}]" value="2" {{ old('permissions.' . $module, $module === 'settings' ? '0' : '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 |