CI Feature / test (push) Successful in 56s
Medium, Modul, Programm und Lizenzartikel nutzen denselben Objektkopf, dieselben Register (Texte, Präsentationsmedien, Einordnung) und denselben visuellen Picker. Präsentationsmedien, Abweichungen und Texte bilden einen Arbeitsstand, den nur „Redaktion speichern“ schreibt; Austausch behält die Position, Sortierung bleibt in der Rolle. Der Wechsel zur Redaktion und zurück erhält offene Eingaben des Ausgangseditors. Entfernt versteckte Mitspeicherungen: Der Didaktikdialog schreibt keine Redaktionstexte mehr, die Website-Freigabe keine offenen Quellenzeilen, Entwurf verwerfen setzt keine offenen Redaktionseingaben zurück. Tests, die alte Orte oder CSS-Zeichenketten prüften, sind auf die neue Bedienung umgestellt; neue Tests decken Arbeitsstand, Austausch, Abbrechen und Rückweg ab. Datenmodell, Fassungen und Rechte bleiben unverändert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
87 lines
2.6 KiB
PHP
87 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\LicenseArticles;
|
|
|
|
use App\Domain\Catalog\LicenseArticle;
|
|
use App\Domain\Identity\StaffRole;
|
|
use App\Filament\Resources\LicenseArticles\Pages\ListLicenseArticles;
|
|
use App\Filament\Resources\LicenseArticles\Pages\ViewLicenseArticle;
|
|
use App\Filament\Support\CatalogReading;
|
|
use App\Models\User;
|
|
use Filament\Facades\Filament;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Components\View;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Auth\Access\Response;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class LicenseArticleResource extends Resource
|
|
{
|
|
protected static ?string $model = LicenseArticle::class;
|
|
|
|
protected static string|\UnitEnum|null $navigationGroup = 'Katalog';
|
|
|
|
protected static ?string $navigationLabel = 'Lizenzartikel';
|
|
|
|
protected static ?string $modelLabel = 'Lizenzartikel';
|
|
|
|
protected static ?string $pluralModelLabel = 'Lizenzartikel';
|
|
|
|
protected static ?string $recordTitleAttribute = 'code';
|
|
|
|
protected static ?int $navigationSort = 1;
|
|
|
|
public static function canViewAny(): bool
|
|
{
|
|
return self::keeper();
|
|
}
|
|
|
|
public static function keeper(): bool
|
|
{
|
|
$user = Filament::auth()->user();
|
|
|
|
return $user instanceof User && $user->hasStaffRole(StaffRole::Katalogverwalter);
|
|
}
|
|
|
|
public static function getViewAuthorizationResponse(Model $record): Response
|
|
{
|
|
return self::keeper() ? Response::allow() : Response::deny();
|
|
}
|
|
|
|
public static function infolist(Schema $schema): Schema
|
|
{
|
|
return $schema->columns(1)->components([
|
|
View::make('filament.editorial.license-desk')
|
|
->viewData(fn (LicenseArticle $record): array => [
|
|
'stand' => app(CatalogReading::class)->articleStand($record),
|
|
'kontext' => app(CatalogReading::class)->articleContext($record),
|
|
])
|
|
->columnSpanFull(),
|
|
]);
|
|
}
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return $schema;
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table->columns([
|
|
TextColumn::make('code')->label('Kennung')->searchable(),
|
|
TextColumn::make('product_line')->label('Produktlinie'),
|
|
TextColumn::make('currentRelease.number')->label('Aktueller Stand'),
|
|
]);
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ListLicenseArticles::route('/'),
|
|
'view' => ViewLicenseArticle::route('/{record}'),
|
|
];
|
|
}
|
|
}
|