Files
nutzwerte_fi4/app/Filament/Resources/Inhaltsverzeichnis/Schemas/InhaltsverzeichnisForm.php
T
2025-10-20 11:51:00 +02:00

77 lines
3.2 KiB
PHP

<?php
namespace App\Filament\Resources\Inhaltsverzeichnis\Schemas;
use App\Models\Tabellen;
use App\Models\Textblock;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class InhaltsverzeichnisForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Section::make('Überschrift')
->schema([
Textarea::make('name')
->required()
->label('Kapitel / Absatz')
->columnSpan(2),
Checkbox::make('ueberschrift_nicht_anzeigen')
->label('Überschrift nicht angezeigen')
->columnSpan(2),
TextInput::make('ordnungszahl')
->label('Kapitel Index')
->placeholder('3.21')
->numeric()
->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',
]),
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(),
]);
}
}