Files
nutzwerte_fi4/app/Filament/Resources/Inhaltsverzeichnis/Schemas/InhaltsverzeichnisForm.php
T
2025-10-19 12:26:48 +02:00

70 lines
2.6 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\Flex;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class InhaltsverzeichnisForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Flex::make([
Section::make([
Textarea::make('name')
->required()
->label('Kapitel Überschrift'),
Checkbox::make('ueberschrift_nicht_anzeigen')
->label('Überschrift nicht angezeigen'),
]),
Section::make([
TextInput::make('ordnungszahl')
->label('Kapitel Index')
->placeholder('3.21')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird der Index im PDF nicht angezeigt',
]),
TextInput::make('seite')
->label('Seitenzahl')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird die Seitenzahl automatisch generiert',
]),
]),
])->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',
]),
]);
}
}