Was sieht wer? (0.55.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 13m13s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 13m34s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 9m41s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 10m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 12m16s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 12m54s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 11m10s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 10m38s

Admin-Seite je Rolle: Bereiche direkt ein-/ausblenden, Menü, Schnellzugriffe,
Rechte und „Als … ansehen“.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-30 14:51:37 +00:00
parent eef5cec357
commit 027caecf8f
8 changed files with 334 additions and 3 deletions

View file

@ -0,0 +1,114 @@
<x-filament-panels::page>
<style>
.ih-roles { display: flex; flex-wrap: wrap; gap: .5rem; }
.ih-role { padding: .375rem .75rem; border-radius: 999px; font-size: .875rem; border: 1px solid rgb(229 231 235); background: white; }
.ih-role[aria-pressed="true"] { background: var(--primary-600, #0f4c5c); border-color: transparent; color: white; }
.ih-role small { opacity: .7; }
.ih-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); align-items: start; }
.ih-list { display: grid; gap: .125rem; }
.ih-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid rgb(243 244 246); font-size: .875rem; }
.ih-row:first-child { border-top: 0; }
.ih-state { font-size: .75rem; font-weight: 600; border-radius: 999px; padding: .125rem .5rem; white-space: nowrap; }
.ih-on { background: rgb(220 252 231); color: rgb(22 101 52); }
.ih-off { background: rgb(243 244 246); color: rgb(107 114 128); }
.ih-muted { color: rgb(107 114 128); font-size: .875rem; }
.ih-switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
.dark .ih-role { background: rgb(17 24 39); border-color: rgb(55 65 81); }
.dark .ih-row { border-color: rgb(55 65 81); }
.dark .ih-off { background: rgb(31 41 55); color: rgb(156 163 175); }
.dark .ih-on { background: rgb(20 83 45); color: rgb(187 247 208); }
.dark .ih-muted { color: rgb(156 163 175); }
</style>
<x-filament::section heading="Rolle wählen" description="Was sieht eine Person mit dieser Rolle im Portal? Bereiche lassen sich hier direkt ein- und ausblenden.">
<div class="ih-roles">
@foreach ($roles as $item)
<button type="button" class="ih-role" aria-pressed="{{ $role && $role->id === $item->id ? 'true' : 'false' }}" wire:click="selectRole({{ $item->id }})">
{{ $item->name }} <small>· {{ $item->users_count }}</small>
</button>
@endforeach
</div>
</x-filament::section>
@if ($role)
@if ($isAdministration)
<x-filament::section>
<p class="ih-muted">„{{ $role->name }}“ hat Vollzugriff und sieht alles – Bereiche lassen sich für diese Rolle nicht ausblenden.</p>
</x-filament::section>
@else
<x-filament::section :heading="'Portal ansehen als „'.$role->name.'“'" compact>
@if ($preview)
<form method="POST" action="{{ url('/anmelden-als/'.$preview->id) }}" style="display: flex; align-items: center; gap: 1rem; flex-wrap: wrap">
@csrf
<x-filament::button type="submit" icon="heroicon-o-eye">Als {{ $preview->name }} ansehen</x-filament::button>
<span class="ih-muted">Sie sehen das Portal genau so wie diese Person – oben erscheint „Zurück zu meinem Konto“.</span>
</form>
@else
<p class="ih-muted">Niemand mit dieser Rolle, als den Sie das Portal ansehen dürfen. Weisen Sie die Rolle z. B. einem Testkonto zu.</p>
@endif
</x-filament::section>
@endif
<div class="ih-grid">
<x-filament::section heading="Bereiche" :description="$canToggle ? 'Ausgeblendete Bereiche verschwinden ganz: Menüpunkt, Seiten, Kacheln, Suche, Feed und Aufgaben.' : null">
<div class="ih-list">
@foreach ($areas as $area)
<div class="ih-row">
<span>{{ $area['name'] }}</span>
@if ($canToggle)
<button type="button" class="ih-switch" wire:click="toggleArea('{{ $area['slug'] }}')" wire:loading.attr="disabled"
aria-label="{{ $area['name'] }} {{ $area['visible'] ? 'ausblenden' : 'einblenden' }}">
<span class="ih-state {{ $area['visible'] ? 'ih-on' : 'ih-off' }}">{{ $area['visible'] ? 'sichtbar' : 'ausgeblendet' }}</span>
<x-filament::icon :icon="$area['visible'] ? 'heroicon-o-eye-slash' : 'heroicon-o-eye'" style="width: 1.1rem; height: 1.1rem; color: rgb(107 114 128)" />
</button>
@else
<span class="ih-state {{ $area['visible'] ? 'ih-on' : 'ih-off' }}">{{ $area['visible'] ? 'sichtbar' : 'ausgeblendet' }}</span>
@endif
</div>
@endforeach
</div>
</x-filament::section>
<div style="display: grid; gap: 1.5rem">
<x-filament::section heading="Menü">
@if ($menu === null)
<p class="ih-muted">Automatisches Menü – es folgt den sichtbaren Bereichen.</p>
@else
<div class="ih-list">
@foreach ($menu as $item)
<div class="ih-row">
<span>{{ $item['label'] }} @if ($item['restricted'])<span class="ih-muted">· eingeschränkt</span>@endif</span>
<span class="ih-state {{ $item['visible'] ? 'ih-on' : 'ih-off' }}">{{ $item['visible'] ? 'sichtbar' : 'ausgeblendet' }}</span>
</div>
@endforeach
</div>
@endif
<p class="ih-muted" style="margin-top: .75rem"><a href="{{ \App\Filament\Pages\MenuSettings::getUrl() }}" style="text-decoration: underline">Menü bearbeiten</a> – dort je Punkt „Sichtbar für“.</p>
</x-filament::section>
<x-filament::section heading="Schnellzugriffe">
<div class="ih-list">
@forelse ($quickLinks as $link)
<div class="ih-row">
<span>{{ $link['label'] }} @if ($link['restricted'])<span class="ih-muted">· eingeschränkt</span>@endif</span>
<span class="ih-state {{ $link['visible'] ? 'ih-on' : 'ih-off' }}">{{ $link['visible'] ? 'sichtbar' : 'ausgeblendet' }}</span>
</div>
@empty
<p class="ih-muted">Keine Schnellzugriffe angelegt.</p>
@endforelse
</div>
<p class="ih-muted" style="margin-top: .75rem"><a href="{{ \App\Filament\Pages\QuickLinksSettings::getUrl() }}" style="text-decoration: underline">Schnellzugriffe bearbeiten</a> – dort je Eintrag „Sichtbar für“.</p>
</x-filament::section>
<x-filament::section heading="Rechte der Rolle">
@forelse ($grants as $grant)
<x-filament::badge color="gray" style="margin: 0 .375rem .375rem 0; display: inline-flex">{{ $grant['label'] }}@if ($grant['scope']) · {{ $grant['scope'] }}@endif</x-filament::badge>
@empty
<p class="ih-muted">Keine besonderen Rechte – lesen, was für alle freigegeben ist.</p>
@endforelse
<p class="ih-muted" style="margin-top: .75rem"><a href="{{ \App\Filament\Resources\Roles\RoleResource::getUrl('edit', ['record' => $role]) }}" style="text-decoration: underline">Rolle bearbeiten</a></p>
</x-filament::section>
</div>
</div>
@endif
</x-filament-panels::page>