Führe die gemeinsame Bestandsliste für Arbeitsplatz, Module, Programme und Medien ein.
CI Feature / test (push) Successful in 59s
Deploy Test / test (push) Successful in 54s
Deploy Test / deploy (push) Successful in 23s

Dokument 14 §3 und §9: eine gepflegte Liste statt Kartenwand, Filterwand und
Filament-Tabellen.

- Gemeinsamer Eintrag x-vw.eintrag (Vorschau, Titel, Typzeile), genutzt vom
  Picker und von allen Listen.
- Ansicht verwaltung/bestand mit Trait ShowsBestand: Suche, wenige sichtbare
  Filter, „Weitere Filter“, aktive Filter als entfernbare Chips mit „Alle
  zurücksetzen“, Trefferzahl, Zeilen mit Zustand und benannten Aktionen,
  Kacheln als Option, „Weitere anzeigen“ in Schritten von 50, Leerzustand und
  eigener Dialogbereich (sonst öffnen „… anlegen“-Dialoge nicht).
- Arbeitsplatz, „Module“ und „Programme“ zeigen dieselben Zeilen
  (ListsCompositions); die Listen mit festem Typ. Ein Anlegedialog für Module
  und Programme statt Inline-Feldern und eines zweiten Filament-Dialogs; die
  Anlage nutzt wie bisher EditorialCatalog::create.
- Medien: Suche, Technische Art, Freigabe und Verwendung sichtbar, die übrigen
  acht Filter unter „Weitere Filter“; alle Adressnamen bleiben. Grundansicht ist
  jetzt die Liste (Dokument 14: kompakte Listen), Kacheln bleiben wählbar.
- Hauptknöpfe im Filament-Seitenkopf im Verwaltungsgrün.
- Entfernt: media/library, media/card, media/mark (ersetzt).

Tests bewusst angepasst: Die Medienliste öffnet als Liste; das Ersatzsymbol
nennt die Art über data-symbol.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-20 08:20:57 +01:00
1 parent f846c0b2ee
commit 532979aa86
19 files changed
+948 -557

No files matched your search

+13 -204
View File
@@ -2,20 +2,21 @@
namespace App\Filament\Pages;
use App\Domain\Catalog\Composition;
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\ContentVersionStatus;
use App\Domain\Catalog\EditorialDimension;
use App\Domain\Catalog\IdentityDimensionValue;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Filament\Support\EditorialCatalog;
use App\Filament\Support\ListsCompositions;
use Filament\Pages\Page;
use Filament\Support\Enums\Width;
use Illuminate\Contracts\Support\Htmlable;
use Livewire\Attributes\Url;
/**
* Arbeitsplatz: Programme und Module in der gemeinsamen Bestandsliste. Die Listen „Module“ und „Programme“ zeigen
* dieselben Zeilen mit festem Typ (ListsCompositions).
*/
class EditorialDesk extends Page
{
use ListsCompositions;
protected static string|\UnitEnum|null $navigationGroup = 'Inhalte';
protected static ?string $navigationLabel = 'Arbeitsplatz';
@@ -28,24 +29,6 @@ class EditorialDesk extends Page
protected string $view = 'filament.editorial.desk-page';
#[Url]
public string $query = '';
#[Url]
public string $kindFilter = 'alle';
#[Url]
public string $pillar = '';
#[Url]
public string $visibility = 'alle';
public string $programName = '';
public string $moduleName = '';
public string $feedback = '';
public function getHeading(): string|Htmlable|null
{
return 'Programme und Module';
@@ -53,7 +36,7 @@ public function getHeading(): string|Htmlable|null
public function getSubheading(): string|Htmlable|null
{
return 'Vorhandene Einträge öffnen oder einen neuen anlegen. Technische Kennungen sind dafür nicht nötig.';
return 'Vorhandene Einträge öffnen oder einen neuen anlegen. Ein Programm ordnet Module; ein Modul ordnet Medien und Texte.';
}
public function getMaxContentWidth(): Width|string|null
@@ -66,185 +49,11 @@ public static function canAccess(): bool
return ContentElementResource::editor();
}
/**
* @return list<array{label: string, values: list<array{id: int, label: string}>}>
*/
public function dimensionFilters(): array
protected function getHeaderActions(): array
{
$groups = [];
foreach (EditorialDimension::query()->with('values')->orderBy('label')->get() as $dimension) {
$values = [];
foreach ($dimension->values as $value) {
$values[] = ['id' => $value->id, 'label' => $value->label];
}
if ($values !== []) {
$groups[] = ['label' => $dimension->label, 'values' => $values];
}
}
return $groups;
}
public function resetFilters(): void
{
$this->query = '';
$this->kindFilter = 'alle';
$this->pillar = '';
$this->visibility = 'alle';
}
public function hasActiveFilters(): bool
{
return trim($this->query) !== '' || $this->kindFilter !== 'alle' || $this->pillar !== '' || $this->visibility !== 'alle';
}
/**
* @return list<array<string, mixed>>
*/
public function entries(): array
{
$query = trim($this->query);
$needle = mb_strtolower($query);
$catalog = app(EditorialCatalog::class);
$offered = $catalog->offeredCompositionIds();
$pillarIds = $this->pillar === '' ? null : $this->pillarSubjects((int) $this->pillar);
$rows = [];
$compositions = Composition::query()
->whereIn('kind', [CompositionKind::Kurs, CompositionKind::Uebung])
->with(['editorialContentKind', 'versions.members.contentElementVersion.element'])
->orderBy('designation')
->get();
foreach ($compositions as $composition) {
$kind = $composition->kind instanceof CompositionKind
? $composition->kind
: CompositionKind::from((string) $composition->kind);
if ($this->kindFilter === 'programm' && $kind !== CompositionKind::Kurs) {
continue;
}
if ($this->kindFilter === 'modul' && $kind !== CompositionKind::Uebung) {
continue;
}
if ($pillarIds !== null && ! in_array($composition->id, $pillarIds, true)) {
continue;
}
$stand = $catalog->stand($composition);
if (! $this->matchesVisibility($stand)) {
continue;
}
$title = $catalog->compositionTitle($composition);
$summary = (string) ($composition->summary ?? '');
$haystack = mb_strtolower($title.' '.$composition->designation.' '.$summary.' '.(string) $composition->description);
if ($needle !== '' && ! str_contains($haystack, $needle)) {
continue;
}
$cover = $catalog->cover($composition, $this->coverMembers($composition));
$rows[] = [
'title' => $title,
'kind' => $kind->deskLabel(),
'tone' => $kind === CompositionKind::Kurs ? 'programm' : 'modul',
'summary' => $summary,
'url' => EditorialCatalog::editUrl($composition),
'image' => $cover['url'],
'image_note' => $cover['note'],
'chips' => $catalog->statusChips($composition, in_array($composition->id, $offered, true)),
];
}
return $rows;
}
/**
* @return list<array{target: string}>
*/
private function coverMembers(Composition $composition): array
{
$draft = $composition->working_draft;
if (is_array($draft) && is_array($draft['members'] ?? null) && $draft['members'] !== []) {
return $draft['members'];
}
$version = $composition->versions
->filter(fn ($item): bool => $item->status === ContentVersionStatus::Bereit)
->sortByDesc('number')
->first();
if ($version === null) {
return [];
}
$members = [];
foreach ($version->members as $member) {
$target = $member->content_element_version_id
? 'element:'.$member->content_element_version_id
: 'composition:'.$member->nested_composition_version_id;
$members[] = ['target' => $target];
}
return $members;
}
/**
* @return list<int>
*/
private function pillarSubjects(int $valueId): array
{
return IdentityDimensionValue::query()
->where('subject_type', (new Composition)->getMorphClass())
->where('editorial_dimension_value_id', $valueId)
->pluck('subject_id')
->map(fn (mixed $id): int => (int) $id)
->all();
}
/**
* @param array{text: string, number: int|null, released_number: int|null} $stand
*/
private function matchesVisibility(array $stand): bool
{
return match ($this->visibility) {
'bibliothek' => $stand['released_number'] !== null,
'verborgen' => $stand['number'] !== null && $stand['released_number'] === null,
'entwurf' => $stand['number'] === null,
default => true,
};
}
public function createProgram(): void
{
$this->create(CompositionKind::Kurs, $this->programName);
}
public function createModule(): void
{
$this->create(CompositionKind::Uebung, $this->moduleName);
}
private function create(CompositionKind $kind, string $name): void
{
$name = trim($name);
if ($name === '') {
$this->feedback = 'Der Name fehlt.';
return;
}
$composition = app(EditorialCatalog::class)->create($name, $kind);
$this->redirect(EditorialCatalog::editUrl($composition), navigate: false);
return [
$this->createCompositionAction(CompositionKind::Uebung),
$this->createCompositionAction(CompositionKind::Kurs),
];
}
}