Öffne Katalog, Bibliothek und Testkauf für den MVP.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
463851d402
commit
fd6860efda
51 files changed
+2331
-31
No files matched your search
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RightsProfiles\Pages;
|
||||
|
||||
use App\Domain\Catalog\OfferService;
|
||||
use App\Filament\Resources\RightsProfiles\RightsProfileResource;
|
||||
use App\Filament\Support\ReportsDomainRules;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListRightsProfiles extends ListRecords
|
||||
{
|
||||
use ReportsDomainRules;
|
||||
|
||||
protected static string $resource = RightsProfileResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('create')->label('Rechteprofil anlegen')->schema([
|
||||
TextInput::make('name')->label('Name')->required(),
|
||||
Select::make('purpose')->label('Zweck')->options([
|
||||
'ehrenamtlich' => 'Ehrenamtlich',
|
||||
'kommerziell' => 'Kommerziell',
|
||||
'institutionell' => 'Institutionell',
|
||||
])->required(),
|
||||
CheckboxList::make('capabilities')->label('Fähigkeiten')->options([
|
||||
'film:streamen' => 'Film streamen',
|
||||
'film:ansehen' => 'Film ansehen',
|
||||
'audio:streamen' => 'Audio streamen',
|
||||
'pdf:ansehen' => 'PDF ansehen',
|
||||
'pdf:laden' => 'PDF laden',
|
||||
'text:ansehen' => 'Text ansehen',
|
||||
'bild:ansehen' => 'Bild ansehen',
|
||||
])->required(),
|
||||
])->action(function (array $data): void {
|
||||
$this->report(function () use ($data): void {
|
||||
$capabilities = [];
|
||||
|
||||
foreach ($data['capabilities'] as $entry) {
|
||||
[$class, $action] = explode(':', $entry, 2);
|
||||
$capabilities[$class][] = $action;
|
||||
}
|
||||
|
||||
app(OfferService::class)->createRightsProfile($data['name'], $data['purpose'], $capabilities);
|
||||
}, 'Das Rechteprofil ist angelegt.');
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RightsProfiles;
|
||||
|
||||
use App\Domain\Catalog\RightsProfile;
|
||||
use App\Filament\Resources\LicenseArticles\LicenseArticleResource;
|
||||
use App\Filament\Resources\RightsProfiles\Pages\ListRightsProfiles;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class RightsProfileResource extends Resource
|
||||
{
|
||||
protected static ?string $model = RightsProfile::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Katalog';
|
||||
|
||||
protected static ?string $navigationLabel = 'Rechteprofile';
|
||||
|
||||
protected static ?string $modelLabel = 'Rechteprofil';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Rechteprofile';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return LicenseArticleResource::keeper();
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema;
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table->columns([
|
||||
TextColumn::make('name')->label('Name')->searchable(),
|
||||
TextColumn::make('versions.purpose')->label('Zwecke')->badge(),
|
||||
])->recordUrl(null);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListRightsProfiles::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user