Stelle die Kataloglisten und das Angebot auf die gemeinsamen Muster um.
- Lizenzartikel, Pakete, Rechteprofile und Angebote nutzen die gemeinsame Bestandsliste (ListsCatalog): Suche, Zustandsfilter, lesbare Zustände aus vorhandenen Daten statt „Aktueller Stand: 1“ oder „Fassungen: aktiv“ (Stand veröffentlicht/in Arbeit/gesperrt, in aktivem Angebot, Fassung aktiv mit Vergabe und Preis, Bestandteile, Zweck und Fähigkeiten). Lizenzartikel zeigen ihr Titelbild. - Anlegedialoge benennen Zweck und Bestätigung und öffnen danach den neuen Eintrag, statt in der Liste stehen zu bleiben. - Angebot im gemeinsamen Rahmen (Kopf, Positionen, aufgelöster Leistungsumfang, Fassungsverlauf). Eine Maske für Anlegen und Ändern (FACH-20): „Fassung aktivieren“ bzw. „Geänderte Fassung aktivieren“, bei einer Änderung mit der aktiven Fassung vorbelegt (FACH-08). Wirkung unverändert OfferService::activate: die bisherige Fassung wird beendet und bleibt gespeichert. „Als Vorlage verwenden“ (FACH-09) bleibt offen (OFF-04). - Entfernt: editorial/catalog-card (ersetzt). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
532979aa86
commit
660b50f418
10 files changed
+828
-80
No files matched your search
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Support;
|
||||
|
||||
use Filament\Schemas\Components\View;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Livewire\Attributes\Url;
|
||||
|
||||
/**
|
||||
* Kataloglisten (Lizenzartikel, Pakete, Rechteprofile, Angebote) in der gemeinsamen Bestandsliste. Die Seite liefert
|
||||
* Zeilen mit 'suchtext' und 'zustand' (Liste von Zustandsschlüsseln) sowie die Zustandsoptionen.
|
||||
*/
|
||||
trait ListsCatalog
|
||||
{
|
||||
use ShowsBestand;
|
||||
|
||||
#[Url(as: 'suche', except: '')]
|
||||
public string $suche = '';
|
||||
|
||||
#[Url(as: 'zustand', except: 'alle')]
|
||||
public string $zustand = 'alle';
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
abstract protected function catalogRows(): array;
|
||||
|
||||
/**
|
||||
* @return array<string, string> Zustandsschlüssel => Bezeichnung, beginnend mit 'alle'
|
||||
*/
|
||||
abstract protected function zustandOptionen(): array;
|
||||
|
||||
/**
|
||||
* @return array{0: string, 1: string}
|
||||
*/
|
||||
abstract protected function einheit(): array;
|
||||
|
||||
/**
|
||||
* @return array{titel: string, text: string}
|
||||
*/
|
||||
abstract protected function leer(): array;
|
||||
|
||||
protected function suchPlatzhalter(): string
|
||||
{
|
||||
return 'Name oder Beschreibung';
|
||||
}
|
||||
|
||||
public function getMaxContentWidth(): Width|string|null
|
||||
{
|
||||
return Width::Full;
|
||||
}
|
||||
|
||||
public function content(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([View::make('filament.verwaltung.bestand')]);
|
||||
}
|
||||
|
||||
public function resetFilters(): void
|
||||
{
|
||||
$this->suche = '';
|
||||
$this->zustand = 'alle';
|
||||
$this->bestandGrenze = Bestand::SCHRITT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function bestand(): array
|
||||
{
|
||||
$needle = mb_strtolower(trim($this->suche));
|
||||
$rows = array_values(array_filter($this->catalogRows(), function (array $row) use ($needle): bool {
|
||||
if ($this->zustand !== 'alle' && ! in_array($this->zustand, $row['zustand'] ?? [], true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $needle === '' || str_contains(mb_strtolower(implode(' ', array_filter([
|
||||
$row['titel'], $row['meta'] ?? '', $row['text'] ?? '', $row['suchtext'] ?? '',
|
||||
]))), $needle);
|
||||
}));
|
||||
|
||||
return [
|
||||
'suche' => ['eigenschaft' => 'suche', 'label' => 'Suche', 'platzhalter' => $this->suchPlatzhalter()],
|
||||
'filter' => [['eigenschaft' => 'zustand', 'label' => 'Zustand', 'vorgabe' => 'alle', 'optionen' => $this->zustandOptionen()]],
|
||||
'zeilen' => $rows,
|
||||
'einheit' => $this->einheit(),
|
||||
'leer' => $this->leer(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user