InhaltsverzeichnisTable
This commit is contained in:
1 parent
b0443b583d
commit
edc3543ff1
25 files changed
+616
-3
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Inhaltsverzeichnis;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Resources\Inhaltsverzeichnis\Pages\ListInhaltsverzeichnis;
|
||||
use App\Filament\Resources\Inhaltsverzeichnis\Schemas\InhaltsverzeichnisForm;
|
||||
use App\Filament\Resources\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 $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
protected static ?string $modelLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Resources\Inhaltsverzeichnis\InhaltsverzeichnisResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateInhaltsverzeichnis extends CreateRecord
|
||||
{
|
||||
protected static string $resource = InhaltsverzeichnisResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Resources\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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Resources\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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Inhaltsverzeichnis\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class InhaltsverzeichnisForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('ordnungszahl'),
|
||||
TextInput::make('text'),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Inhaltsverzeichnis\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class InhaltsverzeichnisTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
// TextColumn::make('sort'),
|
||||
TextColumn::make('ordnungszahl')
|
||||
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
|
||||
TextColumn::make('text'),
|
||||
TextColumn::make('seite')
|
||||
->alignCenter()
|
||||
->badge()
|
||||
->color('info')
|
||||
->getStateUsing(fn ($record): string => $record->seite == '0' ? '...' : $record->seite),
|
||||
])
|
||||
->reorderable('sort')
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()->color('gray'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ class MethodeResource extends Resource
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Programm';
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-calculator';
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ class MethodeForm
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
RichEditor::make('description')
|
||||
->label('Beschreibung')
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
|
||||
]),
|
||||
|
||||
@@ -19,7 +19,6 @@ class MethodesTable
|
||||
->description(function ($record) {
|
||||
return new HtmlString($record->description);
|
||||
})
|
||||
// ->description(fn ($record): string => new HtmlString($record->description))
|
||||
->html(),
|
||||
])
|
||||
->recordActions([
|
||||
|
||||
@@ -19,7 +19,7 @@ class OrientierungResource extends Resource
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Programm';
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-compass';
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Resources\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\Resources\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Resources\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,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Resources\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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Textblocks\Schemas;
|
||||
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class TextblockForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
RichEditor::make('textblock')
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
|
||||
]),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Textblocks\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class TextblocksTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('kennung')->badge()->color('info'),
|
||||
TextColumn::make('name')
|
||||
->weight(FontWeight::Bold)
|
||||
->wrap()
|
||||
->description(function ($record) {
|
||||
return new HtmlString($record->textblock);
|
||||
})
|
||||
->html(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()->color('gray'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Textblocks;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Resources\Textblocks\Pages\ListTextblocks;
|
||||
use App\Filament\Resources\Textblocks\Schemas\TextblockForm;
|
||||
use App\Filament\Resources\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 $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Textblock';
|
||||
|
||||
protected static ?string $modelLabel = 'Textblock';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Textblöcke';
|
||||
|
||||
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