Files
laraundfelix/app/Filament/Resources/LicenseArticles/LicenseArticleResource.php
T
StommerandClaude Sonnet 5.5 f72b79fd8c
CI Feature / test (push) Successful in 1m42s
Führe Artikel, Paket und Angebot mit sichtbaren Voraussetzungen bis zum kaufbaren Angebot
Abnahmebefund Etappe 1: Nach dem Anlegen mit einem Namen fand die Verwaltung keinen Weg,
Inhalte festzulegen und Artikel, Paket, Preis und Rechte zu einem kaufbaren Angebot zu
verbinden.

- Gemeinsamer Baustein „Bis zur Veröffentlichung“ (PublicationReadiness, voraussetzungen.blade)
  auf Lizenzartikel, Paket und Angebot: erledigte und offene Schritte mit Weg dorthin,
  Zustand als Text und Symbol.
- Artikel: „Inhalt festlegen“ als Hauptaktion im Kopf statt nur im Menü; Dialog mit
  „Freigegebener Inhalt“ statt „Wurzel“, Einordnung beim ersten Stand vorbelegt.
- Auswahllisten zeigen Name, Kennung und Stand; Artikel ohne Stand sind gekennzeichnet,
  Produktseiten nennen die Auffindbarkeit im Shop, Paketfassungen ihre Artikel.
- Angebotsaktivierung lehnt Artikel ohne veröffentlichten Stand (auch in Paketen) mit
  Erklärung ab. Die Domänenregel in OfferService bleibt unverändert; das ist eine
  Oberflächenabsicherung und bei Bedarf eine fachliche Entscheidung.
- Erfolgsmeldungen nennen den nächsten Schritt.

Bestandstest geändert: OrganizationPurchaseTest::test_membership_boundaries_decide_the_club_access
setzte die Uhrzeit erst nach der Bestellung auf 12:00 Uhr und scheiterte dadurch nach 12:00 UTC.
Die feste Uhrzeit gilt jetzt vor der Bestellung; die Assertions bleiben unverändert.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 16:30:14 +01:00

89 lines
2.7 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\Filament\Support\PublicationReadiness;
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),
'voraussetzungen' => app(PublicationReadiness::class)->forArticle($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}'),
];
}
}