75 lines
4.1 KiB
PHP
75 lines
4.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Projektes\Schemas;
|
|
|
|
use App\Enums\ProjektStatus;
|
|
use App\Models\Projekte;
|
|
use Filament\Forms\Components\DatePicker;
|
|
use Filament\Forms\Components\Radio;
|
|
use Filament\Forms\Components\RichEditor;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Components\Section;
|
|
use Filament\Schemas\Components\Tabs;
|
|
use Filament\Schemas\Components\Tabs\Tab;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class ProjekteForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make('Projekt Daten')
|
|
->label(fn (?Projekte $record): ?string => ($record?->created_at) ? 'Erstellt: '.$record?->created_at->diffForHumans().', Geändert: '.$record?->updated_at->diffForHumans() : '')
|
|
->collapsed(fn ($operation) => $operation == 'create' ? false : true)
|
|
->icon('heroicon-o-rectangle-stack')
|
|
->schema([
|
|
Tabs::make('Tabs')
|
|
->contained(false)
|
|
->tabs([
|
|
Tab::make('Benennung')
|
|
->schema([
|
|
TextInput::make('offizieller_name')->label('Offizieller Name')->required(),
|
|
TextInput::make('interner_name')->label('Interner Name')->required(),
|
|
TextInput::make('ort')->required()->suffix('am'),
|
|
DatePicker::make('erstellung')->helperText('Datum am Gutachten')->required(),
|
|
])->columns(2),
|
|
Tab::make('Zuordnung')
|
|
->schema([
|
|
Select::make('auftraggeber_id')->relationship(name: 'auftraggeber', titleAttribute: 'name')->required(),
|
|
Select::make('gutachter_id')->relationship(name: 'gutachter', titleAttribute: 'name')->required(),
|
|
Radio::make('status')->options(ProjektStatus::class)->required(),
|
|
]),
|
|
Tab::make('Beschreibung')
|
|
->schema([
|
|
RichEditor::make('beschreibung')
|
|
->toolbarButtons([
|
|
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'link'],
|
|
['alignStart', 'alignCenter', 'alignEnd', 'horizontalRule'],
|
|
['bulletList', 'orderedList', 'table'],
|
|
['undo', 'redo'],
|
|
])->floatingToolbars([
|
|
'paragraph' => [
|
|
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
|
|
],
|
|
'heading' => [
|
|
'h1', 'h2', 'h3',
|
|
],
|
|
'table' => [
|
|
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
|
|
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
|
|
'tableMergeCells', 'tableSplitCell',
|
|
'tableToggleHeaderRow',
|
|
'tableDelete',
|
|
],
|
|
])
|
|
->columnSpan(2),
|
|
]),
|
|
]),
|
|
|
|
])->columnSpanFull(),
|
|
]);
|
|
}
|
|
}
|