Menü: Programme, Module, Übungen, Contentmanager (bisher Medien), dahinter die Fachlichen Kombinationen. Der Arbeitsplatz ist kein Menüpunkt mehr, die gemeinsame Übersicht bleibt über den Filterlink der Stammdaten erreichbar. Dokumente rückt vorläufig hinter die vier Einträge (Position folgt im Dokumentenauftrag). Adressen: programme, module, fachuebungen, contentmanager. Die alten Adressen kurse, uebungen (= Module) und content-elements leiten mit Objektnummer, Unterseite und Filtern per 302 weiter, hinter der Anmeldung des Panels; die Rechte prüft das Ziel. Rücklinks aus der Bearbeitung führen zur Liste der eigenen Art statt zum Arbeitsplatz. Tests: Reihenfolge in UebungNavigationTest bewusst geändert (Übungen standen vor Modulen und Programmen); 'content-elements/' in EditorialEditorTest folgt der neuen Adresse. Neu: VerwaltungNavigationTest. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
95 lines
3.3 KiB
PHP
95 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Compositions\Pages;
|
|
|
|
use App\Domain\Catalog\CompositionKind;
|
|
use App\Domain\Catalog\ContentService;
|
|
use App\Filament\Pages\Uebernahme;
|
|
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“, „Programme“ und „Fachliche Kombinationen“: dieselbe Bestandsliste wie der Arbeitsplatz, mit festem
|
|
* Typ. Module und Programme teilen den Anlegedialog des Arbeitsplatzes; Kombinationen behalten ihren.
|
|
*/
|
|
abstract class ListCompositionKind extends ListRecords
|
|
{
|
|
use ListsCompositions;
|
|
use ReportsDomainRules;
|
|
|
|
abstract protected function kind(): CompositionKind;
|
|
|
|
protected function fixedKind(): ?CompositionKind
|
|
{
|
|
return $this->kind();
|
|
}
|
|
|
|
private function onDesk(): bool
|
|
{
|
|
return in_array($this->kind(), [CompositionKind::Kurs, CompositionKind::Uebung, CompositionKind::Exercise, CompositionKind::Document], true);
|
|
}
|
|
|
|
public function getSubheading(): string|Htmlable|null
|
|
{
|
|
return $this->kind()->deskExplanation();
|
|
}
|
|
|
|
public function getMaxContentWidth(): Width|string|null
|
|
{
|
|
return Width::Full;
|
|
}
|
|
|
|
public function content(Schema $schema): Schema
|
|
{
|
|
return $schema->components([View::make('filament.verwaltung.bestand')]);
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
if ($this->kind() === CompositionKind::Exercise) {
|
|
return [
|
|
$this->createCompositionAction($this->kind()),
|
|
Action::make('shinkan')
|
|
->label('Aus Shinkan übernehmen')
|
|
->icon('heroicon-o-arrow-down-tray')
|
|
->color('gray')
|
|
->visible(fn (): bool => ContentElementResource::editor())
|
|
->url(fn (): string => Uebernahme::getUrl()),
|
|
];
|
|
}
|
|
|
|
if ($this->onDesk()) {
|
|
return [$this->createCompositionAction($this->kind())];
|
|
}
|
|
|
|
return [
|
|
Action::make('create')
|
|
->label($this->kind()->createLabel())
|
|
->modalHeading('Neue '.lcfirst($this->kind()->label()))
|
|
->modalSubmitActionLabel($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]));
|
|
}
|
|
}),
|
|
];
|
|
}
|
|
}
|