- Gemeinsame Katalog-Objektseite (catalog/objekt): Kopf, Hauptabschnitte, Begleitinformation. Angebot, Paket und Rechteprofil nutzen sie; lesbare Bezeichnungen zentral in CatalogLabels. - Paket: eine Maske für erste und geänderte Fassung, bei einer Änderung mit der neuesten veröffentlichten Fassung vorbelegt; Wirkung unverändert BundleService::publish (frühere Fassungen bleiben veröffentlicht). - Rechteprofil: erlaubte Handlungen lesbar, Verwendung in Angeboten, Fassungen; der doppelte Titel „… ansehen ansehen“ entfällt. - Fachliche Säulen, Fachliche Kombinationen und Benutzer in der gemeinsamen Bestandsliste; Säulen mit Website-Zustand und Medienzahl, Konten mit Status und Rollen. - Gefüllte Filament-Hauptknöpfe überall im Verwaltungsgrün (auch Formularfuß, etwa „Speichern“ der Säule). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
94 lines
3.6 KiB
PHP
94 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Pillars\Pages;
|
|
|
|
use App\Domain\Catalog\Pillar;
|
|
use App\Domain\Catalog\PillarService;
|
|
use App\Filament\Resources\ContentElements\ContentElementResource;
|
|
use App\Filament\Resources\Pillars\PillarResource;
|
|
use App\Filament\Support\ListsCatalog;
|
|
use App\Filament\Support\ReportsDomainRules;
|
|
use Filament\Actions\Action;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
|
|
class ListPillars extends ListRecords
|
|
{
|
|
use ListsCatalog;
|
|
use ReportsDomainRules;
|
|
|
|
protected static string $resource = PillarResource::class;
|
|
|
|
public function getSubheading(): string|Htmlable|null
|
|
{
|
|
return 'Die fachlichen Säulen des Materials. Eine veröffentlichte Säule ist ein Themenbereich der Website. Ein Medium und eine Seite können mehreren Säulen zugeordnet sein.';
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Action::make('create')
|
|
->label('Säule anlegen')
|
|
->modalHeading('Neue fachliche Säule')
|
|
->modalDescription('Der Name genügt. Website-Text, Adresse und Veröffentlichung legst du danach fest.')
|
|
->modalSubmitActionLabel('Säule anlegen')
|
|
->visible(fn (): bool => ContentElementResource::editor())
|
|
->schema([
|
|
TextInput::make('name')->label('Name')->required(),
|
|
])
|
|
->action(function (array $data): void {
|
|
$pillar = null;
|
|
$this->report(function () use ($data, &$pillar): void {
|
|
$pillar = app(PillarService::class)->create($data['name']);
|
|
}, 'Die Säule ist angelegt.');
|
|
|
|
if ($pillar !== null) {
|
|
$this->redirect(PillarResource::getUrl('edit', ['record' => $pillar]));
|
|
}
|
|
}),
|
|
];
|
|
}
|
|
|
|
protected function catalogRows(): array
|
|
{
|
|
$rows = [];
|
|
|
|
foreach (Pillar::query()->withCount('elements')->orderBy('sort_order')->orderBy('name')->get() as $pillar) {
|
|
$public = $pillar->published_at !== null;
|
|
$url = PillarResource::getUrl('edit', ['record' => $pillar]);
|
|
$rows[] = [
|
|
'schluessel' => 's'.$pillar->id,
|
|
'titel' => $pillar->name,
|
|
'meta' => 'Fachliche Säule'.(filled($pillar->slug) ? ' · /themen/'.$pillar->slug : ''),
|
|
'text' => (string) ($pillar->public_summary ?? ''),
|
|
'symbol' => 'modul',
|
|
'url' => $url,
|
|
'chips' => [
|
|
$public ? ['label' => 'Auf der Website veröffentlicht', 'ton' => 'gut'] : ['label' => 'Intern', 'ton' => 'leise'],
|
|
['label' => $pillar->elements_count === 1 ? '1 Medium' : $pillar->elements_count.' Medien', 'ton' => 'neutral'],
|
|
],
|
|
'zustand' => [$public ? 'oeffentlich' : 'intern'],
|
|
'aktionen' => [['label' => 'Bearbeiten', 'href' => $url, 'icon' => 'stift']],
|
|
];
|
|
}
|
|
|
|
return $rows;
|
|
}
|
|
|
|
protected function zustandOptionen(): array
|
|
{
|
|
return ['alle' => 'Jeder Zustand', 'oeffentlich' => 'Auf der Website veröffentlicht', 'intern' => 'Intern'];
|
|
}
|
|
|
|
protected function einheit(): array
|
|
{
|
|
return ['Fachliche Säule', 'Fachliche Säulen'];
|
|
}
|
|
|
|
protected function leer(): array
|
|
{
|
|
return ['titel' => 'Noch keine Säulen', 'text' => 'Mit „Säule anlegen“ oben entsteht die erste Säule.'];
|
|
}
|
|
}
|