standards wip

This commit is contained in:
salam committed 2025-10-10 13:33:29 +02:00
1 parent 4f865b52a6
commit 7eaa8c0da2
32 files changed
+326 -98

No files matched your search

@@ -29,6 +29,8 @@ class InhaltsverzeichnisResource extends Resource
protected static ?string $pluralModelLabel = 'Inhaltsverzeichnis';
protected static ?int $navigationSort = 1;
public static function form(Schema $schema): Schema
{
return InhaltsverzeichnisForm::configure($schema);
@@ -12,7 +12,7 @@ class InhaltsverzeichnisForm
return $schema
->components([
TextInput::make('ordnungszahl'),
TextInput::make('text'),
TextInput::make('name'),
])->columns(1);
}
}
@@ -15,7 +15,8 @@ class InhaltsverzeichnisTable
// TextColumn::make('sort'),
TextColumn::make('ordnungszahl')
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
TextColumn::make('text'),
TextColumn::make('name')
->description(fn ($record): string => $record->textblock_kennung->name ?? ''),
TextColumn::make('seite')
->alignCenter()
->badge()
@@ -29,6 +29,8 @@ class MethodeResource extends Resource
protected static ?string $pluralModelLabel = 'Methoden';
protected static ?int $navigationSort = 4;
public static function form(Schema $schema): Schema
{
return MethodeForm::configure($schema);
@@ -13,8 +13,9 @@ class MethodesTable
{
return $table
->columns([
TextColumn::make('kennung')->badge()->color('info'),
TextColumn::make('id'),
TextColumn::make('name')
->color('info')
->wrap()
->description(function ($record) {
return new HtmlString($record->description);
@@ -29,6 +29,8 @@ class OrientierungResource extends Resource
protected static ?string $pluralModelLabel = 'Orientierungen';
protected static ?int $navigationSort = 3;
public static function form(Schema $schema): Schema
{
return OrientierungForm::configure($schema);
@@ -0,0 +1,60 @@
<?php
namespace App\Filament\Resources\Projektes\RelationManagers;
use Filament\Actions\AssociateAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\DissociateAction;
use Filament\Actions\DissociateBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class ProjektInhaltsverzeichnisRelationManager extends RelationManager
{
protected static string $relationship = 'projekt_inhaltsverzeichnis';
public function form(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('text')
->required()
->maxLength(255),
]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('text')
->columns([
TextColumn::make('text')
->searchable(),
])
->filters([
//
])
->headerActions([
CreateAction::make(),
AssociateAction::make(),
])
->recordActions([
EditAction::make(),
DissociateAction::make(),
DeleteAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DissociateBulkAction::make(),
DeleteBulkAction::make(),
]),
]);
}
}
@@ -2,7 +2,10 @@
namespace App\Filament\Resources\Textblocks\Schemas;
use App\Models\TextblockKennung;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
@@ -14,6 +17,11 @@ class TextblockForm
->components([
TextInput::make('name')
->required(),
Textarea::make('beschreibung')
->afterLabel('Bei gleichen Textblockarten kann hier der Unterschied kurz angerissen werden.'),
Select::make('textblock_kennung_id')
->label('Textblock Art')
->options(TextblockKennung::pluck('name', 'id')),
RichEditor::make('textblock')
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
@@ -14,6 +14,12 @@ class TextblocksTable
{
return $table
->columns([
TextColumn::make('textblock_kennung.name')
->color('info')
->wrap()
->description(function ($record) {
return new HtmlString($record->beschreibung);
}),
TextColumn::make('name')
->weight(FontWeight::Bold)
->wrap()
@@ -29,6 +29,8 @@ class TextblockResource extends Resource
protected static ?string $pluralModelLabel = 'Textblöcke';
protected static ?int $navigationSort = 2;
public static function form(Schema $schema): Schema
{
return TextblockForm::configure($schema);
+7 -1
View File
@@ -7,9 +7,15 @@ use Illuminate\Database\Eloquent\Model;
class Inhaltsverzeichnis extends Model
{
protected $fillable = [
'name',
'textblock_kennung_id',
'sort',
'ordnungszahl',
'text',
'seite',
];
public function textblock_kennung()
{
return $this->hasOne(TextblockKennung::class, 'id');
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ProjektInhaltsverzeichnis extends Model
{
protected $fillable = [
'name',
'textblock',
'sort',
'ordnungszahl',
'projekte_id',
'textblock_kennung_id',
'seite',
];
}
+5
View File
@@ -47,4 +47,9 @@ class Projekte extends Model
{
return $this->hasMany(ProjektMethode::class);
}
public function projekt_inhaltsverzeichnis()
{
return $this->hasMany(ProjektInhaltsverzeichnis::class);
}
}
+7 -1
View File
@@ -7,8 +7,14 @@ use Illuminate\Database\Eloquent\Model;
class Textblock extends Model
{
protected $fillable = [
'kennung',
'name',
'beschreibung',
'textblock_kennung_id',
'textblock',
];
public function textblock_kennung()
{
return $this->hasMany(TextblockKennung::class, 'id');
}
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class TextblockKennung extends Model
{
protected $fillable = [
'name',
];
}