Files
nutzwerte_fi4/app/Filament/Resources/Inhaltsverzeichnis/Schemas/InhaltsverzeichnisForm.php
T

93 lines
4.2 KiB
PHP

<?php
namespace App\Filament\Resources\Inhaltsverzeichnis\Schemas;
use App\Models\Inhaltselement;
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\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Schemas\Schema;
class InhaltsverzeichnisForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Tabs::make('Überschrift')
->tabs([
Tab::make('Überschrift')
->schema([
Checkbox::make('neue_seite')
->label('Start neuer Seite'),
Checkbox::make('ueberschrift_anzeigen')
->label('Überschrift angezeigen'),
Textarea::make('name')
->required()
->label('Überschrift')
->columnSpan(3),
]),
Tab::make('Kapitel Index')
->schema([
TextInput::make('ordnungszahl')
->label('Kapitel Index')
->placeholder('3.21')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird der Index im Inhaltsverzeichnis und bei der Überschrift im Dokument nicht angezeigt.',
])
->columnSpan(1),
])->columnSpanFull(),
Tab::make('Seitenzahl')
->schema([
Checkbox::make('seitenzahl_anzeige')
->label('Seitenzahl angezeigen'),
TextInput::make('seite')
->label('Seitenzahl')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird die Seitenzahl automatisch generiert',
])
->columnSpan(1),
])->columnSpanFull(),
Tab::make('Inhaltselement')
->hiddenLabel()
->schema([
Select::make('inhaltselement_id')
->label('Inhaltselement')
->prefixIcon('phosphor-table')
->default(0)
->options(function () {
$res = Inhaltselement::all()->pluck('name', 'id')->toArray();
array_push($res, 'Ohne');
return $res;
}),
]),
Tab::make('Textblock')
->hiddenLabel()
->schema([
Select::make('textblock_id')
->label('Textblock')
// ->description('Ausgabe Textblock vor Tabelle')
->prefixIcon('phosphor-article')
->default(0)
->options(function () {
$res = Textblock::all()->pluck('name', 'id')->toArray();
array_push($res, 'Ohne');
return $res;
}),
]),
])->vertical()->columnSpanFull(),
]);
}
}