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>
86 lines
2.8 KiB
PHP
86 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Compositions\Pages;
|
|
|
|
use App\Domain\Catalog\CompositionKind;
|
|
use App\Domain\Catalog\ContentService;
|
|
use App\Filament\Resources\ContentElements\ContentElementResource;
|
|
use App\Filament\Support\ListsCompositions;
|
|
use App\Filament\Support\ReportsDomainRules;
|
|
use Filament\Actions\Action;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
use Filament\Schemas\Components\View;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Support\Enums\Width;
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
|
|
/**
|
|
* Listen „Module“ und „Programme“: dieselbe Bestandsliste wie der Arbeitsplatz, mit festem Typ. Fachliche
|
|
* Kombinationen behalten vorerst ihre Tabelle (Teil B, Abschnitt 3).
|
|
*/
|
|
abstract class ListCompositionKind extends ListRecords
|
|
{
|
|
use ListsCompositions;
|
|
use ReportsDomainRules;
|
|
|
|
abstract protected function kind(): CompositionKind;
|
|
|
|
protected function fixedKind(): ?CompositionKind
|
|
{
|
|
return $this->kind();
|
|
}
|
|
|
|
private function usesBestand(): bool
|
|
{
|
|
return in_array($this->kind(), [CompositionKind::Kurs, CompositionKind::Uebung], true);
|
|
}
|
|
|
|
public function getSubheading(): string|Htmlable|null
|
|
{
|
|
$desk = $this->usesBestand() ? ' Programme und Module stehen gemeinsam auch auf dem Arbeitsplatz.' : '';
|
|
|
|
return $this->kind()->deskExplanation().$desk;
|
|
}
|
|
|
|
public function getMaxContentWidth(): Width|string|null
|
|
{
|
|
return $this->usesBestand() ? Width::Full : parent::getMaxContentWidth();
|
|
}
|
|
|
|
public function content(Schema $schema): Schema
|
|
{
|
|
if (! $this->usesBestand()) {
|
|
return parent::content($schema);
|
|
}
|
|
|
|
return $schema->components([View::make('filament.verwaltung.bestand')]);
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
if ($this->usesBestand()) {
|
|
return [$this->createCompositionAction($this->kind())];
|
|
}
|
|
|
|
return [
|
|
Action::make('create')
|
|
->label($this->kind()->createLabel())
|
|
->visible(fn (): bool => ContentElementResource::editor())
|
|
->schema([
|
|
TextInput::make('designation')->label('Bezeichnung')->required(),
|
|
])
|
|
->action(function (array $data): void {
|
|
$composition = null;
|
|
$this->report(function () use ($data, &$composition): void {
|
|
$composition = app(ContentService::class)->createComposition($data['designation'], $this->kind());
|
|
}, $this->kind()->label().' ist angelegt.');
|
|
|
|
if ($composition !== null) {
|
|
$this->redirect(static::getResource()::getUrl('edit', ['record' => $composition]));
|
|
}
|
|
}),
|
|
];
|
|
}
|
|
}
|