refactoring into clusters
This commit is contained in:
1 parent
042a5a8b58
commit
48deb69379
97 files changed
+186
-198
No files matched your search
+55
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\Pages\ListInhaltsverzeichnis;
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\Schemas\InhaltsverzeichnisForm;
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\Tables\InhaltsverzeichnisTable;
|
||||
use App\Models\Inhaltsverzeichnis;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class InhaltsverzeichnisResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Inhaltsverzeichnis::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-list';
|
||||
|
||||
protected static ?string $navigationLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
protected static ?string $modelLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return InhaltsverzeichnisForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return InhaltsverzeichnisTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListInhaltsverzeichnis::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\InhaltsverzeichnisResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateInhaltsverzeichnis extends CreateRecord
|
||||
{
|
||||
protected static string $resource = InhaltsverzeichnisResource::class;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\InhaltsverzeichnisResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditInhaltsverzeichnis extends EditRecord
|
||||
{
|
||||
protected static string $resource = InhaltsverzeichnisResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\InhaltsverzeichnisResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListInhaltsverzeichnis extends ListRecords
|
||||
{
|
||||
protected static string $resource = InhaltsverzeichnisResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->modalHeading('Kapitel hinzufügen')
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Schemas;
|
||||
|
||||
use App\Models\Inhaltselement;
|
||||
use App\Models\Textblock;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class InhaltsverzeichnisForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Tabs::make('Überschrift')
|
||||
->tabs([
|
||||
Tab::make('Überschrift')
|
||||
->schema([
|
||||
Checkbox::make('neue_seite')
|
||||
->label('Start neuer Seite'),
|
||||
Checkbox::make('ueberschrift_verbergen')
|
||||
->label('Überschrift im Gutachten verbergen'),
|
||||
TextInput::make('name')
|
||||
->prefixIcon('phosphor-article')
|
||||
->required()
|
||||
->label('Überschrift')
|
||||
->columnSpan(2),
|
||||
TextInput::make('ordnungszahl')
|
||||
->label('Kapitel Index')
|
||||
->prefixIcon('phosphor-list-numbers')
|
||||
->placeholder('3.21')
|
||||
->numeric()
|
||||
->default(0)
|
||||
->belowContent([
|
||||
'Bei "0" wird der Index nicht angezeigt',
|
||||
])
|
||||
->columnSpan(2),
|
||||
// TextInput::make('seite')
|
||||
// ->label('Seitenzahl')
|
||||
// ->numeric()
|
||||
// ->default(0)
|
||||
// ->belowContent([
|
||||
// 'Bei "0" wird die Seitenzahl automatisch generiert',
|
||||
// ])
|
||||
// ->columnSpan(1),
|
||||
Section::make('Benutzer Hilfe')
|
||||
->icon('phosphor-chat-text')
|
||||
->schema([
|
||||
TextInput::make('hilfe_titel')
|
||||
->aboveLabel([
|
||||
'Erklärungen des Inhalts beim Bearbeiten des Gutachtens',
|
||||
])
|
||||
->afterLabel(['optional'])
|
||||
->label('Überschrift')
|
||||
->columnSpanFull(),
|
||||
Textarea::make('hilfe_description')
|
||||
->afterLabel(['optional'])
|
||||
->label('Beschreibung'),
|
||||
FileUpload::make('hilfe_image')
|
||||
->afterLabel(['optional'])
|
||||
->image()
|
||||
->label('Bild')
|
||||
->disk('public')
|
||||
->maxSize(3072) // 3MB limit
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->directory('gutachten_hilfe')
|
||||
->visibility('public')
|
||||
->columnSpanFull(),
|
||||
|
||||
])
|
||||
->secondary()
|
||||
->compact()
|
||||
->collapsed()
|
||||
->columnSpanFull(),
|
||||
])->columns(3),
|
||||
Tab::make('Inhaltselement')
|
||||
->hiddenLabel()
|
||||
->schema([
|
||||
Select::make('inhaltselement_id')
|
||||
->label('Inhaltselement')
|
||||
->prefixIcon('phosphor-table')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Inhaltselement::all()->pluck('name', 'id')->toArray();
|
||||
array_push($res, 'Ohne');
|
||||
|
||||
return $res;
|
||||
}),
|
||||
]),
|
||||
Tab::make('Textblock')
|
||||
->hiddenLabel()
|
||||
->schema([
|
||||
Select::make('textblock_id')
|
||||
->label('Textblock')
|
||||
// ->description('Ausgabe Textblock vor Tabelle')
|
||||
->prefixIcon('phosphor-article')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Textblock::all()->pluck('name', 'id')->toArray();
|
||||
array_push($res, 'Ohne');
|
||||
|
||||
return $res;
|
||||
}),
|
||||
]),
|
||||
])->vertical()->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Tables;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class InhaltsverzeichnisTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->heading('Inhaltsverzeichnis')
|
||||
->description('Vorlage zum Erstellen von neuen Projekte. Das Inhaltsverzeichnis ist unterteilt in drei Abschnitte (Filter).')
|
||||
->columns([
|
||||
TextColumn::make('ordnungszahl')
|
||||
->label('Index')
|
||||
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
|
||||
IconColumn::make('neue_seite')
|
||||
->tooltip('Start neue Seite')
|
||||
->color('primary')
|
||||
->label('Start')
|
||||
->icon(fn (string $state): string => match ($state) {
|
||||
'1' => 'phosphor-file-plus',
|
||||
default => ''
|
||||
}),
|
||||
TextColumn::make('name')
|
||||
->color('primary')
|
||||
->label('Überschrift')
|
||||
->wrap(),
|
||||
TextColumn::make('inhaltselement.name')
|
||||
->label('Element')
|
||||
->wrap(),
|
||||
TextColumn::make('textblock.name')
|
||||
->wrap(),
|
||||
TextInputColumn::make('seite')
|
||||
->extraInputAttributes(['onClick' => 'this.select()'])
|
||||
->alignCenter()
|
||||
->tooltip('Bei 0 wird keine Seitenzahl ausgegeben.')
|
||||
->getStateUsing(fn ($record): string => $record->seite == 0 ? '' : $record->seite),
|
||||
])
|
||||
// ->paginated(false)
|
||||
->defaultPaginationPageOption(5)
|
||||
->persistFiltersInSession()
|
||||
->deferFilters(false)
|
||||
->filtersFormColumns(3)
|
||||
->filters([
|
||||
SelectFilter::make('part')
|
||||
->selectablePlaceholder(false)
|
||||
->default('standard')
|
||||
->label('Gutachten Komponenten')
|
||||
->options([
|
||||
'standard' => 'Gutachten Standard Texte',
|
||||
'nutzwerte' => 'Nutzwerberechnung',
|
||||
'paragraph' => 'Auszug Gutachten gem. §6',
|
||||
]),
|
||||
])
|
||||
// ], layout: FiltersLayout::AboveContent)
|
||||
->defaultSort('sort', direction: 'asc')
|
||||
->reorderable('sort')
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()->hidden(fn ($record) => (bool) $record->no_edit),
|
||||
DeleteAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Methodes\Pages\ListMethodes;
|
||||
use App\Filament\Clusters\Administration\Methodes\Schemas\MethodeForm;
|
||||
use App\Filament\Clusters\Administration\Methodes\Tables\MethodesTable;
|
||||
use App\Models\Methode;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class MethodeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Methode::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-calculator';
|
||||
|
||||
protected static ?string $navigationLabel = 'Methode';
|
||||
|
||||
protected static ?string $modelLabel = 'Methode';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Methoden';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return MethodeForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return MethodesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListMethodes::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Methodes\MethodeResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMethode extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MethodeResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Methodes\MethodeResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMethode extends EditRecord
|
||||
{
|
||||
protected static string $resource = MethodeResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Methodes\MethodeResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMethodes extends ListRecords
|
||||
{
|
||||
protected static string $resource = MethodeResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// CreateAction::make()
|
||||
// ->icon('phosphor-file-plus')
|
||||
// ->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Schemas;
|
||||
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class MethodeForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
RichEditor::make('description')
|
||||
->label('Beschreibung')
|
||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
|
||||
]),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class MethodesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->paginated(false)
|
||||
->columns([
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')
|
||||
->weight(FontWeight::Bold)
|
||||
->wrap()
|
||||
->description(function ($record) {
|
||||
return new HtmlString($record->description);
|
||||
}),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Orientierungs\Pages\ListOrientierungs;
|
||||
use App\Filament\Clusters\Administration\Orientierungs\Schemas\OrientierungForm;
|
||||
use App\Filament\Clusters\Administration\Orientierungs\Tables\OrientierungsTable;
|
||||
use App\Models\Orientierung;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class OrientierungResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Orientierung::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-compass';
|
||||
|
||||
protected static ?string $navigationLabel = 'Orientierung';
|
||||
|
||||
protected static ?string $modelLabel = 'Orientierung';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Orientierungen';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return OrientierungForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return OrientierungsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListOrientierungs::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->where('selectable', true)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Orientierungs\OrientierungResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateOrientierung extends CreateRecord
|
||||
{
|
||||
protected static string $resource = OrientierungResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Orientierungs\OrientierungResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditOrientierung extends EditRecord
|
||||
{
|
||||
protected static string $resource = OrientierungResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Orientierungs\OrientierungResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListOrientierungs extends ListRecords
|
||||
{
|
||||
protected static string $resource = OrientierungResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class OrientierungForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class OrientierungsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable()
|
||||
->color(fn ($record): string => match ($record->selectable) {
|
||||
0 => 'info',
|
||||
default => 'gray',
|
||||
}),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('seitig')
|
||||
->options([
|
||||
'1' => 'E I N S E I T I G',
|
||||
'2' => 'Z W E I S E I T I G',
|
||||
'3' => 'D R E I S E I T I G',
|
||||
'4' => 'V I E R S E I T I G',
|
||||
'5' => 'E X T R A S',
|
||||
]),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Permissions\PermissionResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreatePermission extends CreateRecord
|
||||
{
|
||||
protected static string $resource = PermissionResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Permissions\PermissionResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditPermission extends EditRecord
|
||||
{
|
||||
protected static string $resource = PermissionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Permissions\PermissionResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListPermissions extends ListRecords
|
||||
{
|
||||
protected static string $resource = PermissionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// CreateAction::make()
|
||||
// ->icon('phosphor-file-plus')
|
||||
// ->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Permissions\Pages\ListPermissions;
|
||||
use App\Filament\Clusters\Administration\Permissions\Schemas\PermissionForm;
|
||||
use App\Filament\Clusters\Administration\Permissions\Tables\PermissionsTable;
|
||||
use App\Models\Permission;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class PermissionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Permission::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Benutzer';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-key-square';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Berechtigung';
|
||||
|
||||
protected static ?string $modelLabel = 'Berechtigung';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Berechtigungen';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return PermissionForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return PermissionsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListPermissions::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class PermissionForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Tables;
|
||||
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class PermissionsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')->searchable(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Textblocks\TextblockResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateTextblock extends CreateRecord
|
||||
{
|
||||
protected static string $resource = TextblockResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Textblocks\TextblockResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditTextblock extends EditRecord
|
||||
{
|
||||
protected static string $resource = TextblockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Textblocks\TextblockResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListTextblocks extends ListRecords
|
||||
{
|
||||
protected static string $resource = TextblockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Schemas;
|
||||
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class TextblockForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tab::make('Inhaltselement')
|
||||
->icon('phosphor-textbox')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Element Name')
|
||||
->afterLabel([
|
||||
'Wird im Gutachten nicht verwendet, dient nur zur Erkennen des Inhaltselements.',
|
||||
])
|
||||
->required(),
|
||||
RichEditor::make('textblock')
|
||||
->label('Abschnitt A')
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
|
||||
])->floatingToolbars([
|
||||
'paragraph' => [
|
||||
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
|
||||
],
|
||||
'heading' => [
|
||||
'h1', 'h2', 'h3',
|
||||
],
|
||||
'table' => [
|
||||
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
|
||||
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
|
||||
'tableMergeCells', 'tableSplitCell',
|
||||
'tableToggleHeaderRow',
|
||||
'tableDelete',
|
||||
],
|
||||
]),
|
||||
RichEditor::make('textblock2')
|
||||
->label('Abschnitt B')
|
||||
->afterLabel([
|
||||
'Textblock uner der Überschrift.',
|
||||
])
|
||||
->belowContent([
|
||||
'Dieses Feld kann auch leer bleiben. Sollten im selben Punkt des Inhaltsvereichnisses auch eine Tabelle verwendet werden, dann wird dieser Text nach dieser angezeigt.',
|
||||
])
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
|
||||
])->floatingToolbars([
|
||||
'paragraph' => [
|
||||
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
|
||||
],
|
||||
'heading' => [
|
||||
'h1', 'h2', 'h3',
|
||||
],
|
||||
'table' => [
|
||||
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
|
||||
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
|
||||
'tableMergeCells', 'tableSplitCell',
|
||||
'tableToggleHeaderRow',
|
||||
'tableDelete',
|
||||
],
|
||||
]),
|
||||
]),
|
||||
Tab::make('Benutzer Hilfe')
|
||||
->icon('phosphor-chat-text')
|
||||
->schema([
|
||||
TextInput::make('hilfe_titel')
|
||||
->aboveLabel([
|
||||
'Wird dem Benutzer bei der Bearbeitung dieses Inhaltselements angezeigt.',
|
||||
])
|
||||
->label('Überschrift')
|
||||
->columnSpanFull(),
|
||||
Textarea::make('hilfe_description')
|
||||
->label('Text'),
|
||||
FileUpload::make('hilfe_image')
|
||||
->image()
|
||||
->label('Bild')
|
||||
->disk('public')
|
||||
->maxSize(3072) // 3MB limit
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->directory('gutachten_hilfe')
|
||||
->visibility('public')
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
]),
|
||||
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Tables;
|
||||
|
||||
use App\Models\Textblock;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class TextblocksTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultPaginationPageOption(5)
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->description(function ($record) {
|
||||
return view('pages.textblock')->with('record', $record);
|
||||
})
|
||||
->html(),
|
||||
])
|
||||
->deferFilters(false)
|
||||
->filtersFormColumns(3)
|
||||
->filters([
|
||||
SelectFilter::make('id')
|
||||
->label('Textblock')
|
||||
->preload()
|
||||
->default(1)
|
||||
->options(function (): array {
|
||||
return Textblock::pluck('name', 'id')->toArray();
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->persistFiltersInSession()
|
||||
->paginated(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Textblocks\Pages\ListTextblocks;
|
||||
use App\Filament\Clusters\Administration\Textblocks\Schemas\TextblockForm;
|
||||
use App\Filament\Clusters\Administration\Textblocks\Tables\TextblocksTable;
|
||||
use App\Models\Textblock;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class TextblockResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Textblock::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-article';
|
||||
|
||||
protected static ?string $navigationLabel = 'Textblöcke';
|
||||
|
||||
protected static ?string $modelLabel = 'Textblock';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Textblöcke';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return TextblockForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return TextblocksTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListTextblocks::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user