diff --git a/app/Filament/Resources/Offers/Pages/ViewOffer.php b/app/Filament/Resources/Offers/Pages/ViewOffer.php index e30f0eb..48cec2f 100644 --- a/app/Filament/Resources/Offers/Pages/ViewOffer.php +++ b/app/Filament/Resources/Offers/Pages/ViewOffer.php @@ -12,8 +12,8 @@ use App\Domain\Catalog\RightsProfileVersion; use App\Domain\Catalog\StatusValue; use App\Filament\Resources\Offers\OfferResource; +use App\Filament\Resources\RightsProfiles\Pages\ListRightsProfiles; use App\Filament\Support\CatalogOptions; -use App\Filament\Support\CatalogReading; use App\Filament\Support\ReportsDomainRules; use Filament\Actions\Action; use Filament\Forms\Components\Repeater; @@ -57,6 +57,16 @@ protected function getHeaderActions(): array return []; } + /** + * Der gemeinsame Objektkopf zeigt den Pfad; Filaments eigener Pfad entfällt wie bei Medien und Aufbau. + * + * @return array + */ + public function getBreadcrumbs(): array + { + return []; + } + public function infolist(Schema $schema): Schema { return $schema->components([ @@ -189,13 +199,12 @@ private function angebotDaten(): array /** @var Offer $offer */ $offer = $this->getRecord(); $active = $this->activeVersion(); - $reading = app(CatalogReading::class); $versions = $offer->versions()->orderByDesc('number')->get(); return [ 'offer' => $offer, 'active' => $active, - 'grants' => $active !== null ? $reading->offerGrants($offer) : [], + 'grants' => $active !== null ? $this->leistungsumfang($active) : [], 'versions' => $versions->map(fn (OfferVersion $version): array => [ 'number' => $version->number, '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 + */ + 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 { $kind = match ($version->grant_kind) { diff --git a/resources/views/filament/verwaltung/styles.blade.php b/resources/views/filament/verwaltung/styles.blade.php index cd489f6..e230128 100644 --- a/resources/views/filament/verwaltung/styles.blade.php +++ b/resources/views/filament/verwaltung/styles.blade.php @@ -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 .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 .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[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; }