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') ->suffixAction( Action::make('copy') ->tooltip('Kopieren') ->icon('heroicon-s-clipboard-document-check') ->action(function ($livewire, $state) { $livewire->js('window.navigator.clipboard.writeText("'.$state.'");'); }) ) ->belowContent([ 'Als Platzhalter "###OFFIZIELLER_NAME###"', ]) ->required(), TextInput::make('interner_name') ->label('Interner Name') ->suffixAction( Action::make('copy') ->tooltip('Kopieren') ->icon('heroicon-s-clipboard-document-check') ->action(function ($livewire, $state) { $livewire->js('window.navigator.clipboard.writeText("'.$state.'");'); }) ) ->belowContent([ 'Als Platzhalter "###INTERNER_NAME###"', ]) ->required(), TextInput::make('ort')->required()->suffix('am') ->belowContent([ 'Als Platzhalter "###ORT###"', ]), DatePicker::make('erstellung') ->label('Datum der Erstellung') ->required() ->belowContent([ 'Als Platzhalter "###DATUM###"', ]), ])->columns(2), Tab::make('Zuordnung') ->schema([ Select::make('gutachter_id')->relationship(name: 'gutachter', titleAttribute: 'company')->required(), Select::make('auftraggeber_id') ->searchable() ->loadingMessage('Lade Auftraggeber...') ->relationship(name: 'auftraggeber', titleAttribute: 'company') ->required(), Radio::make('status')->options(ProjektStatus::class)->required(), ]), Tab::make('Beschreibung') ->schema([ RichEditor::make('beschreibung') ->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;']) ->toolbarButtons([ ['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'link', 'textColor', 'clearFormatting'], ['alignStart', 'alignCenter', 'alignEnd'], ['bulletList', 'orderedList', 'table'], ['undo', 'redo'], ])->floatingToolbars([ 'table' => [ 'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn', 'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow', 'tableMergeCells', 'tableSplitCell', 'tableToggleHeaderRow', 'tableDelete', ], ]) ->columnSpan(2), ]), ]), ])->columnSpanFull(), ]); } }