diff --git a/app/Actions/Helper/ShowHelpInhalt.php b/app/Actions/Helper/ShowHelpInhalt.php index 977087c..453ca28 100644 --- a/app/Actions/Helper/ShowHelpInhalt.php +++ b/app/Actions/Helper/ShowHelpInhalt.php @@ -11,7 +11,7 @@ class ShowHelpInhalt { return Action::make('help') ->icon('phosphor-question') - ->hidden(fn ($record): bool => (! $record->inhaltsverzeichnis->hilfe_titel && ! $record->inhaltsverzeichnis->hilfe_description || ! $record->inhaltsverzeichnis->hilfe_image) ? true : false) + ->hidden(fn ($record): bool => (! $record?->inhaltsverzeichnis->hilfe_titel && ! $record?->inhaltsverzeichnis->hilfe_description || ! $record?->inhaltsverzeichnis->hilfe_image) ? true : false) ->tooltip(fn ($record): View => view('pages.helpinhalt')->with('record', $record)) ->iconButton(); } diff --git a/app/Filament/Resources/Projektes/RelationManagers/ProjektInhaltsverzeichnisRelationManager.php b/app/Filament/Resources/Projektes/RelationManagers/ProjektInhaltsverzeichnisRelationManager.php index d9404e2..43baa4e 100644 --- a/app/Filament/Resources/Projektes/RelationManagers/ProjektInhaltsverzeichnisRelationManager.php +++ b/app/Filament/Resources/Projektes/RelationManagers/ProjektInhaltsverzeichnisRelationManager.php @@ -30,7 +30,6 @@ use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextInputColumn; use Filament\Tables\Enums\FiltersLayout; use Filament\Tables\Filters\Filter; -use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use ToneGabes\BetterOptions\Forms\Components\RadioCards; @@ -116,75 +115,76 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager ], ]), - Fieldset::make('') - ->contained(false) - ->schema([ - Action::make('sichern') - ->iconButton() - ->tooltip('Änderungen in der Vorlage speichern') - ->icon('phosphor-floppy-disk') - ->schema([ - TextInput::make('name')->required() - ->label('Ändern sie gegebeben Falls den Namen') - ->default(function ($record) { - return KontoTextblock::where('id', $record?->konto_textblock_id)->pluck('name')->first(); - }), - ]) - ->hidden(function ($record) { - return (bool) ! $record?->konto_textblock_id; - }) - ->action(function (array $mountedActions, array $data) { - $record = $mountedActions[0]->getRawData(); + // Fieldset::make('') + // ->contained(false) + // ->schema([ + // Action::make('sichern') + // ->iconButton() + // ->tooltip('Änderungen in der Vorlage speichern') + // ->icon('phosphor-floppy-disk') + // ->schema([ + // TextInput::make('name')->required() + // ->label('Ändern sie gegebeben Falls den Namen') + // ->default(function ($record) { + // return KontoTextblock::where('id', $record?->konto_textblock_id)->pluck('name')->first(); + // }), + // ]) + // ->hidden(function ($record) { + // return (bool) ! $record?->konto_textblock_id; + // }) + // ->action(function (array $mountedActions, array $data) { + // $record = $mountedActions[0]->getRawData(); - KontoTextblock::where('id', $record['konto_textblock_id']) - ->update(['name' => $data['name'], 'textblock' => RichContentRenderer::make($record['textblock'])->toHtml()]); + // KontoTextblock::where('id', $record['konto_textblock_id']) + // ->update(['name' => $data['name'], 'textblock' => RichContentRenderer::make($record['textblock'])->toHtml()]); - }), - Action::make('neu') - ->iconButton() - ->icon('phosphor-file-plus') - ->schema([ - TextInput::make('name')->required() - ->label('Geben sie der Vorlage einen eindeutigen Namen') - ->default(function ($record) { - return $record?->name; - }), - ]) - ->modalSubmitActionLabel('Sichern') - ->tooltip('Neue Vorlage erstellen') - ->action(function (array $mountedActions, array $data) { + // }), + // Action::make('neu') + // ->iconButton() + // ->icon('phosphor-file-plus') + // ->schema([ + // TextInput::make('name')->required() + // ->label('Geben sie der Vorlage einen eindeutigen Namen') + // ->default(function ($record) { + // return $record?->name; + // }), + // ]) + // ->modalSubmitActionLabel('Sichern') + // ->tooltip('Neue Vorlage erstellen') + // ->action(function (array $mountedActions, array $data) { - $record = $mountedActions[0]->getRawData(); + // $record = $mountedActions[0]->getRawData(); - $block = new KontoTextblock; - $block->konto_id = auth()->user()->konto_id; - $block->name = $data['name']; - $block->textblock = RichContentRenderer::make($record['textblock'])->toHtml(); - $block->save(); + // $block = new KontoTextblock; + // $block->konto_id = auth()->user()->konto_id; + // $block->name = $data['name']; + // $block->textblock = RichContentRenderer::make($record['textblock'])->toHtml(); + // $block->save(); - ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $block->id]); - }), - Action::make('laden') - ->iconButton() - ->icon('phosphor-article') - ->schema([ - Select::make('konto_textblock_id') - ->hiddenLabel() - ->searchable() - ->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id')) - ->belowLabel([ - 'Bitte eine Vorlage auswählen', - ]), - ]) - ->modalSubmitActionLabel('Einsetzen') - ->tooltip('Vorlage laden.') - ->action(function (Set $set, array $mountedActions, array $data) { - $record = $mountedActions[0]->getRawData(); - ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $data['konto_textblock_id']]); - $set('konto_textblock_id', $data['konto_textblock_id']); - $set('textblock', KontoTextblock::where('id', $data['konto_textblock_id'])->pluck('textblock')->first()); - }), - ])->columns(1), + // ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $block->id]); + // }), + // Action::make('laden') + // ->iconButton() + // ->icon('phosphor-article') + // ->schema([ + // Select::make('konto_textblock_id') + // ->hiddenLabel() + // ->searchable() + // ->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id')) + // ->belowLabel([ + // 'Bitte eine Vorlage auswählen', + // ]), + // ]) + // ->modalSubmitActionLabel('Einsetzen') + // ->tooltip('Vorlage laden.') + // ->action(function (Set $set, array $mountedActions, array $data) { + // $record = $mountedActions[0]->getRawData(); + // dd($record); + // ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $data['konto_textblock_id']]); + // $set('konto_textblock_id', $data['konto_textblock_id']); + // $set('textblock', KontoTextblock::where('id', $data['konto_textblock_id'])->pluck('textblock')->first()); + // }), + // ])->columns(1), ]), ]), Tab::make('Inhaltselement')