59 lines
2.9 KiB
PHP
59 lines
2.9 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('interner_name')->label('Interner Name')->required(),
|
|
TextInput::make('offizieller_name')->label('Offizieller Name')->required(),
|
|
DatePicker::make('erstellung')->helperText('Datum am Gutachten')->required(),
|
|
]),
|
|
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('Beeschreibung')
|
|
->schema([
|
|
RichEditor::make('beschreibung')
|
|
->toolbarButtons([
|
|
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'link'],
|
|
['h2', 'h3', 'alignStart', 'alignCenter', 'alignEnd'],
|
|
['bulletList', 'orderedList', 'table'],
|
|
['undo', 'redo'],
|
|
])->columnSpan(2),
|
|
]),
|
|
]),
|
|
|
|
])->columnSpanFull(),
|
|
]);
|
|
}
|
|
}
|