Zeige den Leistungsumfang eines Angebots lesbar und den Pfad nur einmal.
Die Fähigkeiten im aufgelösten Leistungsumfang tragen dieselben Bezeichnungen wie beim Rechteprofil („Film ansehen“ statt „film: streamen“). Filaments eigener Pfad entfällt auf der Angebotsseite wie bei Medien und Aufbau. Der Art-Umschalter der Bestandsliste bricht nicht mehr um. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
660b50f418
commit
3aa1bad859
2 files changed
+38
-4
No files matched your search
@@ -12,8 +12,8 @@
|
|||||||
use App\Domain\Catalog\RightsProfileVersion;
|
use App\Domain\Catalog\RightsProfileVersion;
|
||||||
use App\Domain\Catalog\StatusValue;
|
use App\Domain\Catalog\StatusValue;
|
||||||
use App\Filament\Resources\Offers\OfferResource;
|
use App\Filament\Resources\Offers\OfferResource;
|
||||||
|
use App\Filament\Resources\RightsProfiles\Pages\ListRightsProfiles;
|
||||||
use App\Filament\Support\CatalogOptions;
|
use App\Filament\Support\CatalogOptions;
|
||||||
use App\Filament\Support\CatalogReading;
|
|
||||||
use App\Filament\Support\ReportsDomainRules;
|
use App\Filament\Support\ReportsDomainRules;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Forms\Components\Repeater;
|
use Filament\Forms\Components\Repeater;
|
||||||
@@ -57,6 +57,16 @@ protected function getHeaderActions(): array
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Der gemeinsame Objektkopf zeigt den Pfad; Filaments eigener Pfad entfällt wie bei Medien und Aufbau.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public function getBreadcrumbs(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function infolist(Schema $schema): Schema
|
public function infolist(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
return $schema->components([
|
return $schema->components([
|
||||||
@@ -189,13 +199,12 @@ private function angebotDaten(): array
|
|||||||
/** @var Offer $offer */
|
/** @var Offer $offer */
|
||||||
$offer = $this->getRecord();
|
$offer = $this->getRecord();
|
||||||
$active = $this->activeVersion();
|
$active = $this->activeVersion();
|
||||||
$reading = app(CatalogReading::class);
|
|
||||||
$versions = $offer->versions()->orderByDesc('number')->get();
|
$versions = $offer->versions()->orderByDesc('number')->get();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'offer' => $offer,
|
'offer' => $offer,
|
||||||
'active' => $active,
|
'active' => $active,
|
||||||
'grants' => $active !== null ? $reading->offerGrants($offer) : [],
|
'grants' => $active !== null ? $this->leistungsumfang($active) : [],
|
||||||
'versions' => $versions->map(fn (OfferVersion $version): array => [
|
'versions' => $versions->map(fn (OfferVersion $version): array => [
|
||||||
'number' => $version->number,
|
'number' => $version->number,
|
||||||
'status' => match (StatusValue::of($version->status)) {
|
'status' => match (StatusValue::of($version->status)) {
|
||||||
@@ -215,6 +224,30 @@ private function angebotDaten(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aufgelöster Leistungsumfang in lesbaren Fähigkeiten (dieselben Bezeichnungen wie beim Rechteprofil).
|
||||||
|
*
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
private function leistungsumfang(OfferVersion $version): array
|
||||||
|
{
|
||||||
|
$zeilen = [];
|
||||||
|
|
||||||
|
foreach ($version->resolvedScopes()->with(['article', 'rights.profile'])->get() as $scope) {
|
||||||
|
$faehigkeiten = [];
|
||||||
|
|
||||||
|
foreach ($scope->rights?->capabilities ?? [] as $class => $actions) {
|
||||||
|
foreach ((array) $actions as $action) {
|
||||||
|
$faehigkeiten[] = ListRightsProfiles::FAEHIGKEITEN[$class.':'.$action] ?? $class.': '.$action;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$zeilen[] = 'Lizenzartikel '.$scope->article?->code.' · '.($scope->rights?->profile?->name ?? '–').' · '.($faehigkeiten === [] ? 'keine Fähigkeiten' : implode(', ', $faehigkeiten));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $zeilen === [] ? ['Diese Fassung hat keinen aufgelösten Leistungsumfang.'] : $zeilen;
|
||||||
|
}
|
||||||
|
|
||||||
private function vergabe(OfferVersion $version): string
|
private function vergabe(OfferVersion $version): string
|
||||||
{
|
{
|
||||||
$kind = match ($version->grant_kind) {
|
$kind = match ($version->grant_kind) {
|
||||||
|
|||||||
@@ -398,7 +398,8 @@
|
|||||||
.vw-suchfeld svg { position: absolute; left: 0.75rem; top: 50%; width: 1.15rem; height: 1.15rem; transform: translateY(-50%); color: var(--vw-quiet); pointer-events: none; }
|
.vw-suchfeld svg { position: absolute; left: 0.75rem; top: 50%; width: 1.15rem; height: 1.15rem; transform: translateY(-50%); color: var(--vw-quiet); pointer-events: none; }
|
||||||
.vw-suchfeld .vw-eingabe { width: 100%; padding-left: 2.4rem; }
|
.vw-suchfeld .vw-eingabe { width: 100%; padding-left: 2.4rem; }
|
||||||
.vw-bestand-filter { display: grid; gap: 0.3rem; flex: 0 1 13rem; min-width: 11rem; }
|
.vw-bestand-filter { display: grid; gap: 0.3rem; flex: 0 1 13rem; min-width: 11rem; }
|
||||||
.vw-bestand-filter .vw-segment { min-height: var(--vw-target); }
|
.vw-bestand-filter .vw-segment { min-height: var(--vw-target); flex-wrap: nowrap; }
|
||||||
|
.vw-bestand-filter:has(.vw-segment) { flex: 0 0 auto; }
|
||||||
.vw-weitere-filter { flex: 0 0 auto; }
|
.vw-weitere-filter { flex: 0 0 auto; }
|
||||||
.vw-weitere-filter[open] { flex-basis: 100%; }
|
.vw-weitere-filter[open] { flex-basis: 100%; }
|
||||||
.vw-weitere-filter summary { display: inline-flex; align-items: center; gap: 0.45rem; min-height: var(--vw-target); padding: 0.3rem 0.85rem; border: 1px solid var(--vw-line-strong); border-radius: var(--vw-radius); background: var(--vw-surface); font-weight: 650; cursor: pointer; list-style: none; }
|
.vw-weitere-filter summary { display: inline-flex; align-items: center; gap: 0.45rem; min-height: var(--vw-target); padding: 0.3rem 0.85rem; border: 1px solid var(--vw-line-strong); border-radius: var(--vw-radius); background: var(--vw-surface); font-weight: 650; cursor: pointer; list-style: none; }
|
||||||
|
|||||||
Reference in new issue
Block a user