Tomasz Boruc f376bde1b5 Role, Uzytkownicy - poprawki
Dodawanie uzytkownika z modułu Uzytkownicy

Skasowania Register na stronei głównej
2026-08-24 20:44:58 +02:00

107 lines
5.8 KiB
PHP

<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="font-semibold text-xl text-white leading-tight">
{{ __('Lista użytkowników') }}
</h2>
{{-- Dostęp tylko dla Admina i Kierownika --}}
@hasanyrole('admin|kierownik')
<a href="{{ route('users.create') }}"
class="inline-flex items-center px-4 py-2 bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-medium rounded-md shadow-sm transition ease-in-out duration-150 gap-2">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
<span>{{ __('Dodaj użytkownika') }}</span>
</a>
@endhasanyrole
</div>
</x-slot>
<!-- Styl do wymuszenia powiększonych badge'y i efektu hover niezależnie od Vite/Tailwind -->
<style>
.custom-table-row:hover {
background-color: rgba(255, 255, 255, 0.05) !important;
}
.role-badge {
display: inline-block !important;
padding: 6px 20px !important;
min-width: 120px !important;
text-align: center !important;
border-radius: 6px !important;
}
</style>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg border border-gray-700/50">
<div class="p-6 text-white">
<div class="overflow-x-auto">
<table class="w-full border-collapse" style="table-layout: fixed;">
<thead>
<tr class="border-b border-gray-700 text-xs font-semibold uppercase tracking-wider text-gray-300">
<th scope="col" class="py-3.5 px-4" style="text-align: center !important; width: 25%;">Imię i nazwisko</th>
<th scope="col" class="py-3.5 px-4" style="text-align: center !important; width: 35%;">Adres e-mail</th>
<th scope="col" class="py-3.5 px-4" style="text-align: center !important; width: 25%;">Rola</th>
<th scope="col" class="py-3.5 px-4" style="text-align: center !important; width: 15%;">Akcje</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-700/60 text-sm">
@forelse($users as $user)
<tr class="custom-table-row transition-colors duration-150">
<!-- Imię i Nazwisko -->
<td class="py-4 px-4 font-medium text-white align-middle" style="text-align: center !important;">
{{ $user->name }} {{ $user->surname }}
</td>
<!-- Email (Wymuszone wycentrowanie) -->
<td class="py-4 px-4 text-gray-300 align-middle" style="text-align: center !important;">
{{ $user->email }}
</td>
<!-- Rola (Poszerzony badge z min-width 120px) -->
<td class="py-4 px-4 text-gray-300 align-middle" style="text-align: center !important;">
<div style="display: flex; justify-content: center; align-items: center; gap: 8px;">
@forelse($user->roles as $role)
<span class="role-badge text-xs font-semibold uppercase tracking-wider bg-gray-700 text-gray-100 border border-gray-600 shadow-sm">
{{ $role->name }}
</span>
@empty
<span class="text-gray-500 text-xs">brak</span>
@endforelse
</div>
</td>
<!-- Akcje -->
<td class="py-4 px-4 align-middle" style="text-align: center !important;">
<a href="{{ route('users.edit', $user) }}" class="text-indigo-400 hover:text-indigo-300 font-medium text-sm transition">
Edytuj
</a>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="py-8 text-gray-400" style="text-align: center !important;">
Brak użytkowników do wyświetlenia.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if($users->hasPages())
<div class="mt-6 pt-4 border-t border-gray-700">
{{ $users->links() }}
</div>
@endif
</div>
</div>
</div>
</div>
</x-app-layout>