Zeige Bibliothek und Anzeigefreigabe in der Bedienung
Deploy Test / test (push) Successful in 16s
Deploy Test / deploy (push) Successful in 22s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-16 08:01:17 +01:00
1 parent 338739a882
commit fc08e6d0f2
7 files changed
+60 -18

No files matched your search

@@ -3,6 +3,7 @@
namespace App\Filament\Resources\Compositions\Pages;
use App\Domain\Catalog\Composition;
use App\Domain\Catalog\CompositionDisplayRelease;
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\CompositionVersion;
use App\Domain\Catalog\ContentElementVersion;
@@ -79,6 +80,43 @@ public function form(Schema $schema): Schema
]);
}
protected function getHeaderActions(): array
{
return [
Action::make('displayRelease')
->label('Zur Anzeige freigeben')
->requiresConfirmation()
->visible(function (): bool {
$version = $this->currentReadyVersion();
return $version !== null && ! app(CompositionDisplayRelease::class)->isReleased($version);
})
->action(function (): void {
$version = $this->currentReadyVersion();
$actor = Filament::auth()->user();
abort_unless($version !== null && $actor instanceof User, 403);
app(CompositionDisplayRelease::class)->release($version, $actor);
Notification::make()->title('Die aktuelle Fassung ist zur Anzeige freigegeben.')->success()->send();
}),
Action::make('displayRevoke')
->label('Anzeigefreigabe zurücknehmen')
->color('danger')
->requiresConfirmation()
->visible(function (): bool {
$version = $this->currentReadyVersion();
return $version !== null && app(CompositionDisplayRelease::class)->isReleased($version);
})
->action(function (): void {
$version = $this->currentReadyVersion();
$actor = Filament::auth()->user();
abort_unless($version !== null && $actor instanceof User, 403);
app(CompositionDisplayRelease::class)->revoke($version, $actor);
Notification::make()->title('Die Anzeigefreigabe dieser Fassung ist zurückgenommen.')->success()->send();
}),
];
}
protected function getSaveFormAction(): Action
{
return parent::getSaveFormAction()->label('Neue Fassung veröffentlichen');
@@ -202,6 +240,17 @@ protected function getRedirectUrl(): ?string
/**
* @param list<array{role: string, target: ContentElementVersion|CompositionVersion}> $members
*/
private function currentReadyVersion(): ?CompositionVersion
{
/** @var Composition $composition */
$composition = $this->getRecord();
return $composition->versions()
->where('status', ContentVersionStatus::Bereit)
->orderByDesc('number')
->first();
}
private function sameMembers(Composition $composition, array $members): bool
{
$version = $composition->versions()