LMIV-SNACKAUTOMAT/resources/views/admin/users/index.blade.php

117 lines
5.6 KiB
PHP

@extends('layouts.admin')
@section('title', 'Benutzerverwaltung')
@section('content')
<div class="max-w-7xl mx-auto">
<div class="mb-8 flex justify-between items-center">
<div>
<h1 class="text-3xl font-bold text-gray-900">Benutzerverwaltung</h1>
<p class="text-gray-600 mt-2">Verwalten Sie alle Benutzer des Systems</p>
</div>
<a href="{{ route('admin.users.create') }}"
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition-colors">
Neuer Benutzer
</a>
</div>
<div class="bg-white shadow rounded-lg overflow-hidden">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Name
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
E-Mail
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Rolle
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Mandant
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Erstellt
</th>
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
Aktionen
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@forelse($users as $user)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<div class="h-10 w-10 rounded-full bg-blue-500 flex items-center justify-center">
<span class="text-white font-medium text-sm">
{{ strtoupper(substr($user->name, 0, 2)) }}
</span>
</div>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">
{{ $user->name }}
</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
{{ $user->email }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="inline-flex px-2 py-1 text-xs font-medium rounded-full
{{ $user->isSuperAdmin() ? 'bg-purple-100 text-purple-800' : 'bg-blue-100 text-blue-800' }}">
{{ $user->isSuperAdmin() ? 'Super Admin' : 'Admin' }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
@if($user->tenant)
<span class="text-blue-600">{{ $user->tenant->name }}</span>
@else
<span class="text-gray-400 italic">Kein Mandant</span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $user->created_at->format('d.m.Y') }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium space-x-2">
<a href="{{ route('admin.users.edit', $user) }}"
class="text-blue-600 hover:text-blue-900">
Bearbeiten
</a>
@if($user->id !== Auth::id())
<form action="{{ route('admin.users.destroy', $user) }}"
method="POST"
class="inline"
onsubmit="return confirm('Sind Sie sicher, dass Sie diesen Benutzer löschen möchten?')">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-900">
Löschen
</button>
</form>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-6 py-4 text-center text-gray-500">
Keine Benutzer gefunden
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<!-- Pagination -->
@if($users->hasPages())
<div class="mt-6">
{{ $users->links() }}
</div>
@endif
</div>
@endsection