presseportale/resources/views/livewire/admin/roles/index.blade.php
Kevin Adametz 036a53499f Responsive-Härtung: Seiten-Header, Kontextleiste, Stat-Cards
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 14:08:08 +00:00

112 lines
5.1 KiB
PHP

<?php
use Livewire\Attributes\Layout;
use Livewire\Attributes\Title;
use Livewire\Volt\Component;
use Spatie\Permission\Models\Role;
new #[Layout('components.layouts.app'), Title('Rollen & Rechte')] class extends Component
{
public function with(): array
{
return [
'roles' => Role::query()
->withCount(['users', 'permissions'])
->orderBy('name')
->get(),
];
}
}; ?>
<div class="space-y-8">
{{-- ============== PAGE HEADER ============== --}}
<header class="page-header">
<div class="min-w-0">
<div class="flex items-center gap-3 mb-3 flex-nowrap whitespace-nowrap">
<span class="badge hub dot">{{ __('Admin Backend') }}</span>
<span class="eyebrow muted">{{ __('Administration · Sicherheit') }}</span>
</div>
<h1 class="text-[30px] font-bold tracking-[-0.6px] leading-[1.15] m-0 text-[color:var(--color-ink)]">
{{ __('Rollen') }}
</h1>
<p class="text-[13px] leading-[1.55] mt-2 m-0 max-w-[640px] text-[color:var(--color-ink-2)]">
{{ __('Verwaltung von Rollen und Berechtigungen') }}
</p>
</div>
<div class="flex items-center gap-2 flex-shrink-0">
@if (\Illuminate\Support\Facades\Route::has('admin.roles.create'))
<flux:button variant="primary" icon="plus" href="{{ route('admin.roles.create') }}" wire:navigate>
{{ __('Neue Rolle') }}
</flux:button>
@endif
</div>
</header>
<article class="panel overflow-hidden">
<div class="panel-head">
<span class="section-eyebrow">{{ __('Alle Rollen') }}</span>
<span class="text-[11.5px] text-[color:var(--color-ink-3)]">
{{ __(':count Einträge', ['count' => $roles->count()]) }}
</span>
</div>
<flux:table>
<flux:table.columns>
<flux:table.column>{{ __('Name') }}</flux:table.column>
<flux:table.column>{{ __('Benutzer') }}</flux:table.column>
<flux:table.column>{{ __('Berechtigungen') }}</flux:table.column>
<flux:table.column>{{ __('Typ') }}</flux:table.column>
<flux:table.column>{{ __('Aktionen') }}</flux:table.column>
</flux:table.columns>
<flux:table.rows>
@forelse ($roles as $role)
<flux:table.row :key="$role->id">
<flux:table.cell>
<div>
<div class="text-[13px] font-semibold text-[color:var(--color-ink)]">{{ str($role->name)->replace('-', ' ')->title() }}</div>
<div class="text-[11.5px] text-[color:var(--color-ink-3)] font-mono">{{ $role->name }}</div>
</div>
</flux:table.cell>
<flux:table.cell>
<span class="badge dot">{{ $role->users_count }}</span>
</flux:table.cell>
<flux:table.cell>
<span class="badge hub">{{ $role->permissions_count }}</span>
</flux:table.cell>
<flux:table.cell>
@if (in_array($role->name, ['admin', 'editor', 'customer', 'api-only'], true))
<span class="badge hub dot">{{ __('System') }}</span>
@else
<span class="badge ok dot">{{ __('Custom') }}</span>
@endif
</flux:table.cell>
<flux:table.cell>
@if (\Illuminate\Support\Facades\Route::has('admin.roles.edit'))
<flux:button size="sm" variant="filled" icon="pencil" href="{{ route('admin.roles.edit', $role->id) }}" wire:navigate />
@endif
</flux:table.cell>
</flux:table.row>
@empty
<flux:table.row>
<flux:table.cell colspan="5">
<div class="flex flex-col items-center justify-center px-4 py-10 text-center">
<div class="w-14 h-14 rounded-[6px] flex items-center justify-center mb-3
bg-[color:var(--color-hub-soft)] border border-[color:var(--color-hub-soft-2)] text-[color:var(--color-hub)]">
<flux:icon.shield-check class="size-6" />
</div>
<div class="text-[14px] font-semibold text-[color:var(--color-ink)] mb-1">
{{ __('Keine Rollen gefunden') }}
</div>
</div>
</flux:table.cell>
</flux:table.row>
@endforelse
</flux:table.rows>
</flux:table>
</article>
</div>