++ fix: Show causer name from activity properties if not available in relation
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-gray-900">Utenti</h1>
|
||||
<p class="text-sm text-gray-500 mt-1">Crea utenti e assegna i permessi applicativi.</p>
|
||||
<p class="text-sm text-gray-500 mt-1">Crea utenti e assegna un ruolo applicativo.</p>
|
||||
</div>
|
||||
|
||||
@if (session()->has('success'))
|
||||
<div class="rounded-lg bg-green-50 p-3 text-sm text-green-700 border border-green-200">{{ session('success') }}</div>
|
||||
@endif
|
||||
@if (session()->has('error'))
|
||||
<div class="rounded-lg bg-red-50 p-3 text-sm text-red-700 border border-red-200">{{ session('error') }}</div>
|
||||
@endif
|
||||
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
|
||||
<h2 class="text-lg font-semibold text-gray-900 mb-4">Nuovo utente</h2>
|
||||
|
||||
@@ -34,16 +41,13 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p class="block text-sm font-medium text-gray-700 mb-2">Permessi utente</p>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2">
|
||||
@foreach($availablePermissions as $permission)
|
||||
<label class="flex items-center gap-2 rounded border border-gray-200 px-3 py-2 text-sm text-gray-700 hover:bg-gray-50">
|
||||
<input wire:model="selectedPermissions" type="checkbox" value="{{ $permission }}" class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500">
|
||||
<span>{{ $permission }}</span>
|
||||
</label>
|
||||
<label for="selectedRole" class="block text-sm font-medium text-gray-700">Ruolo *</label>
|
||||
<select wire:model="selectedRole" id="selectedRole" class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
||||
@foreach($availableRoles as $role)
|
||||
<option value="{{ $role }}">{{ ucfirst($role) }}</option>
|
||||
@endforeach
|
||||
</div>
|
||||
@error('selectedPermissions.*') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||
</select>
|
||||
@error('selectedRole') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -62,32 +66,76 @@
|
||||
<th class="px-4 py-2 text-left font-medium text-gray-600">Nome</th>
|
||||
<th class="px-4 py-2 text-left font-medium text-gray-600">Email</th>
|
||||
<th class="px-4 py-2 text-left font-medium text-gray-600">Ruoli</th>
|
||||
<th class="px-4 py-2 text-left font-medium text-gray-600">Permessi diretti</th>
|
||||
<th class="px-4 py-2 text-left font-medium text-gray-600">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
@forelse($users as $user)
|
||||
<tr>
|
||||
<td class="px-4 py-2 text-gray-900">{{ $user->name }}</td>
|
||||
<td class="px-4 py-2 text-gray-700">{{ $user->email }}</td>
|
||||
<td class="px-4 py-2">
|
||||
<div class="flex flex-wrap gap-1">
|
||||
@forelse($user->roles as $role)
|
||||
<span class="inline-flex items-center rounded-full bg-indigo-50 px-2 py-0.5 text-xs font-medium text-indigo-700">{{ $role->name }}</span>
|
||||
@empty
|
||||
<span class="text-xs text-gray-400">-</span>
|
||||
@endforelse
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<div class="flex flex-wrap gap-1">
|
||||
@forelse($user->permissions as $permission)
|
||||
<span class="inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-700">{{ $permission->name }}</span>
|
||||
@empty
|
||||
<span class="text-xs text-gray-400">-</span>
|
||||
@endforelse
|
||||
</div>
|
||||
</td>
|
||||
@if($editingUserId === $user->id)
|
||||
<td class="px-4 py-2 align-top" colspan="4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600">Nome</label>
|
||||
<input wire:model="editName" type="text" class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
||||
@error('editName') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600">Email</label>
|
||||
<input wire:model="editEmail" type="email" class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
||||
@error('editEmail') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600">Nuova password (opzionale)</label>
|
||||
<input wire:model="editPassword" type="password" class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
||||
@error('editPassword') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600">Conferma password</label>
|
||||
<input wire:model="editPassword_confirmation" type="password" class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600">Ruolo</label>
|
||||
<select wire:model="editSelectedRole" class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
||||
@foreach($availableRoles as $role)
|
||||
<option value="{{ $role }}">{{ ucfirst($role) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('editSelectedRole') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 flex gap-2">
|
||||
<button wire:click="updateUser" type="button" class="px-3 py-1.5 text-xs font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700">Salva</button>
|
||||
<button wire:click="cancelEdit" type="button" class="px-3 py-1.5 text-xs font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200">Annulla</button>
|
||||
</div>
|
||||
</td>
|
||||
@else
|
||||
<td class="px-4 py-2 text-gray-900">{{ $user->name }}</td>
|
||||
<td class="px-4 py-2 text-gray-700">{{ $user->email }}</td>
|
||||
<td class="px-4 py-2">
|
||||
<div class="flex flex-wrap gap-1">
|
||||
@forelse($user->roles as $role)
|
||||
<span class="inline-flex items-center rounded-full bg-indigo-50 px-2 py-0.5 text-xs font-medium text-indigo-700">{{ $role->name }}</span>
|
||||
@empty
|
||||
<span class="text-xs text-gray-400">-</span>
|
||||
@endforelse
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<div class="flex gap-2">
|
||||
<button wire:click="startEdit({{ $user->id }})" type="button" class="px-2 py-1 text-xs font-medium text-indigo-700 bg-indigo-50 rounded hover:bg-indigo-100">Modifica</button>
|
||||
<button
|
||||
wire:click="deleteUser({{ $user->id }})"
|
||||
onclick="if(!confirm('Confermi la cancellazione dell\'utente? I log verranno preservati.')) event.stopImmediatePropagation();"
|
||||
type="button"
|
||||
class="px-2 py-1 text-xs font-medium text-red-700 bg-red-50 rounded hover:bg-red-100"
|
||||
>
|
||||
Cancella
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user