This commit is contained in:
salam committed 2025-10-20 11:51:00 +02:00
1 parent 3a35ccd69d
commit 261fb0916d
38 files changed
+348 -258

No files matched your search

@@ -8,7 +8,6 @@ use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Flex;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
@@ -18,15 +17,15 @@ class InhaltsverzeichnisForm
{
return $schema
->components([
Flex::make([
Section::make([
Section::make('Überschrift')
->schema([
Textarea::make('name')
->required()
->label('Kapitel Überschrift'),
->label('Kapitel / Absatz')
->columnSpan(2),
Checkbox::make('ueberschrift_nicht_anzeigen')
->label('Überschrift nicht angezeigen'),
]),
Section::make([
->label('Überschrift nicht angezeigen')
->columnSpan(2),
TextInput::make('ordnungszahl')
->label('Kapitel Index')
->placeholder('3.21')
@@ -34,36 +33,44 @@ class InhaltsverzeichnisForm
->default(0)
->belowContent([
'Bei "0" wird der Index im PDF nicht angezeigt',
]),
])
->columnSpan(1),
TextInput::make('seite')
->label('Seitenzahl')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird die Seitenzahl automatisch generiert',
])
->columnSpan(1),
])->columnSpanFull(),
Section::make('Tabelle & Textblöcke')
->hiddenLabel()
->schema([
Select::make('tabellen_id')->label('Tabelle')
->prefixIcon('phosphor-table')
->prefixIconColor(
fn ($record): string => $record->tabellen_id == 0 ? 'gray' : 'primary'
)
->default(0)
->options(function () {
return Tabellen::all()->pluck('name', 'id')->toArray();
})->belowContent([
'Kann auch frei bleiben',
]),
]),
])->columnSpanFull(2),
Select::make('tabellen_id')->label('Tabelle')
->prefixIcon('phosphor-table')
->default(0)
->options(function () {
return Tabellen::all()->pluck('name', 'id')->toArray();
})->belowContent([
'Kann auch frei bleiben',
]),
Select::make('textblock_id')->label('Textblock')
->prefixIcon('phosphor-article')
->default(0)
->options(function () {
return Textblock::all()->pluck('name', 'id')->toArray();
// return ['100' => 'Eigener Textblock'] + $relatedOptions;
})->belowContent([
'Kann auch frei bleiben',
]),
Select::make('textblock_id')->label('Textblock')
->prefixIcon('phosphor-article')
->prefixIconColor(
fn ($record): string => $record->textblock_id == 0 ? 'gray' : 'primary'
)
->default(0)
->options(function () {
return Textblock::all()->pluck('name', 'id')->toArray();
})->belowContent([
'Kann auch frei bleiben',
]),
])->columnSpanFull(),
]);
}
}
@@ -4,6 +4,7 @@ namespace App\Filament\Resources\Inhaltsverzeichnis\Tables;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Support\Enums\FontWeight;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
@@ -22,13 +23,12 @@ class InhaltsverzeichnisTable
TextColumn::make('name')
->label('Überschrift')
->wrap()
->description(fn ($record): string => $record->textblock_kennungs->name ?? '')
->color(fn ($record): string => match ($record->ueberschrift_nicht_anzeigen) {
1 => 'primary',
default => 'gray',
->weight(fn ($record): FontWeight => match ($record->ueberschrift_nicht_anzeigen) {
1 => FontWeight::Thin,
default => FontWeight::SemiBold,
}),
// ToggleColumn::make('ueberschrift_anzeigen')->label('')->tooltip('Überschrift im PDF anzeigen'),
TextColumn::make('tabellen.name')->wrap(),
TextColumn::make('tabellen.name')->wrap()->label('Tabelle'),
TextColumn::make('textblock.name')->wrap(),
TextColumn::make('seite')
->alignCenter()
@@ -39,7 +39,7 @@ class InhaltsverzeichnisTable
->defaultSort('sort', direction: 'asc')
->reorderable('sort')
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
DeleteAction::make()->iconButton(),
]);
}