Ordne Paket, Rechteprofil, Säulen, Kombinationen und Benutzer in die gemeinsamen Muster ein.
CI Feature / test (push) Successful in 1m0s
Deploy Test / test (push) Successful in 55s
Deploy Test / deploy (push) Successful in 23s

- 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>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-20 08:53:25 +01:00
1 parent 3aa1bad859
commit 51d58ac55c
14 files changed
+675 -198

No files matched your search

@@ -2,10 +2,119 @@
namespace App\Filament\Resources\RightsProfiles\Pages;
use App\Domain\Catalog\OfferLine;
use App\Domain\Catalog\OfferStatus;
use App\Domain\Catalog\RightsProfile;
use App\Domain\Catalog\RightsProfileVersion;
use App\Domain\Catalog\StatusValue;
use App\Filament\Resources\RightsProfiles\RightsProfileResource;
use App\Filament\Support\CatalogLabels;
use Filament\Resources\Pages\ViewRecord;
use Filament\Schemas\Components\View;
use Filament\Schemas\Schema;
use Filament\Support\Enums\Width;
use Illuminate\Contracts\Support\Htmlable;
/**
* Rechteprofil in der gemeinsamen Katalog-Objektseite: Zweck, erlaubte Handlungen und Verwendung in Angeboten.
* Ein Rechteprofil wird hier nur gelesen; es gibt keine Bearbeitung.
*/
class ViewRightsProfile extends ViewRecord
{
protected static string $resource = RightsProfileResource::class;
public function getTitle(): string|Htmlable
{
return (string) $this->getRecord()->name;
}
public function getHeading(): string|Htmlable
{
return '';
}
/**
* @return array<string, string>
*/
public function getBreadcrumbs(): array
{
return [];
}
public function getMaxContentWidth(): Width|string|null
{
return Width::Full;
}
public function infolist(Schema $schema): Schema
{
return $schema->components([
View::make('filament.catalog.objekt')->viewData(fn (): array => $this->profilDaten())->columnSpanFull(),
])->columns(1);
}
/**
* @return array<string, mixed>
*/
private function profilDaten(): array
{
/** @var RightsProfile $profile */
$profile = $this->getRecord();
$versions = $profile->versions()->orderByDesc('number')->get();
$current = $versions->first();
$faehigkeiten = CatalogLabels::faehigkeiten($current?->capabilities);
$optionen = collect($current?->options ?? [])->map(fn (mixed $wert, string $schluessel): array => [
'text' => $schluessel,
'neben' => is_scalar($wert) ? (string) $wert : json_encode($wert, JSON_UNESCAPED_UNICODE),
])->values()->all();
$verwendung = OfferLine::query()
->whereIn('rights_profile_version_id', $versions->pluck('id'))
->with(['offerVersion.offer', 'article', 'bundleVersion.bundle'])
->get()
->map(fn (OfferLine $line): array => [
'text' => ($line->offerVersion?->offer?->name ?? 'Angebot').' · Fassung '.($line->offerVersion?->number ?? '–'),
'zustand' => StatusValue::of($line->offerVersion?->status) === OfferStatus::Aktiv->value
? ['label' => 'Aktiv', 'ton' => 'gut']
: ['label' => StatusValue::of($line->offerVersion?->status) === OfferStatus::Beendet->value ? 'Beendet' : 'Entwurf', 'ton' => 'leise'],
'neben' => $line->article !== null ? 'Lizenzartikel '.$line->article->code : 'Paket '.($line->bundleVersion?->bundle?->name ?? '–'),
])->all();
return [
'kopf' => [
'brot' => [['label' => 'Rechteprofile', 'href' => RightsProfileResource::getUrl('index')], $profile->name],
'titel' => $profile->name,
'typ' => 'Rechteprofil',
'status' => $current === null
? ['text' => 'Noch keine Fassung', 'ton' => 'offen']
: ['text' => 'Fassung '.$current->number.' · '.CatalogLabels::zweck($current->purpose).($current->locked_at !== null ? ' · festgeschrieben seit '.$current->locked_at->format('d.m.Y') : ''), 'ton' => 'neutral'],
],
'haupt' => [
[
'titel' => 'Erlaubte Handlungen',
'zusatz' => $current !== null ? 'Fassung '.$current->number : null,
'hilfe' => $current?->locked_at !== null
? 'Diese Fassung wird in einem aktiven Angebot verwendet und ist deshalb unveränderlich.'
: 'Zweck und erlaubte Handlungen. Angebote verbinden das Profil mit Lizenzartikeln.',
'zeilen' => array_map(fn (string $label): array => ['text' => $label], $faehigkeiten),
'leer' => ['titel' => 'Keine Handlungen', 'text' => 'Diese Fassung erlaubt keine Handlung.'],
],
...($optionen !== [] ? [['titel' => 'Optionen', 'zeilen' => $optionen]] : []),
],
'seite' => [
[
'titel' => 'In Angeboten',
'zeilen' => $verwendung,
'leer' => 'In keinem Angebot verwendet.',
],
[
'titel' => 'Fassungen',
'zeilen' => $versions->map(fn (RightsProfileVersion $version): array => [
'text' => 'Fassung '.$version->number,
'zustand' => $version->locked_at !== null ? ['label' => 'Festgeschrieben', 'ton' => 'leise'] : null,
'neben' => CatalogLabels::zweck($version->purpose),
])->all(),
],
],
];
}
}