- Gemeinsame Katalog-Objektseite (catalog/objekt): Kopf, Hauptabschnitte, Begleitinformation. Angebot, Paket und Rechteprofil nutzen sie; lesbare Bezeichnungen zentral in CatalogLabels. - Paket: eine Maske für erste und geänderte Fassung, bei einer Änderung mit der neuesten veröffentlichten Fassung vorbelegt; Wirkung unverändert BundleService::publish (frühere Fassungen bleiben veröffentlicht). - Rechteprofil: erlaubte Handlungen lesbar, Verwendung in Angeboten, Fassungen; der doppelte Titel „… ansehen ansehen“ entfällt. - Fachliche Säulen, Fachliche Kombinationen und Benutzer in der gemeinsamen Bestandsliste; Säulen mit Website-Zustand und Medienzahl, Konten mit Status und Rollen. - Gefüllte Filament-Hauptknöpfe überall im Verwaltungsgrün (auch Formularfuß, etwa „Speichern“ der Säule). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Users\Pages;
|
|
|
|
use App\Domain\Identity\AccountStatus;
|
|
use App\Domain\Identity\StaffRole;
|
|
use App\Filament\Resources\Users\UserResource;
|
|
use App\Filament\Support\ListsCatalog;
|
|
use App\Models\User;
|
|
use Filament\Actions\CreateAction;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
|
|
class ListUsers extends ListRecords
|
|
{
|
|
use ListsCatalog;
|
|
|
|
protected static string $resource = UserResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
CreateAction::make()->label('Benutzer anlegen'),
|
|
];
|
|
}
|
|
|
|
protected function catalogRows(): array
|
|
{
|
|
$rows = [];
|
|
|
|
foreach (User::query()->with('staffRoles')->orderBy('name')->get() as $user) {
|
|
$status = $user->status instanceof AccountStatus ? $user->status->label() : (string) $user->status;
|
|
$rollen = $user->staffRoles->map(fn ($role): string => $role->role instanceof StaffRole ? $role->role->label() : StaffRole::from((string) $role->role)->label())->all();
|
|
$url = UserResource::getUrl('edit', ['record' => $user]);
|
|
$rows[] = [
|
|
'schluessel' => 'u'.$user->id,
|
|
'titel' => (string) $user->name,
|
|
'meta' => (string) $user->email,
|
|
'symbol' => 'schluessel',
|
|
'url' => $url,
|
|
'chips' => [
|
|
['label' => $status !== '' ? $status : 'Ohne Status', 'ton' => 'neutral'],
|
|
...array_map(fn (string $rolle): array => ['label' => $rolle, 'ton' => 'gut'], $rollen),
|
|
],
|
|
'zustand' => $rollen === [] ? ['ohne-rolle'] : ['mit-rolle'],
|
|
'aktionen' => [['label' => 'Bearbeiten', 'href' => $url, 'icon' => 'stift']],
|
|
];
|
|
}
|
|
|
|
return $rows;
|
|
}
|
|
|
|
protected function zustandOptionen(): array
|
|
{
|
|
return ['alle' => 'Alle Konten', 'mit-rolle' => 'Mit Verwaltungsrolle', 'ohne-rolle' => 'Ohne Verwaltungsrolle'];
|
|
}
|
|
|
|
protected function einheit(): array
|
|
{
|
|
return ['Konto', 'Konten'];
|
|
}
|
|
|
|
protected function leer(): array
|
|
{
|
|
return ['titel' => 'Noch keine Konten', 'text' => 'Mit „Benutzer anlegen“ oben entsteht das erste Konto.'];
|
|
}
|
|
|
|
protected function suchPlatzhalter(): string
|
|
{
|
|
return 'Name oder E-Mail';
|
|
}
|
|
}
|