hide vorlagen in text edit (zu kompliziert für user)
This commit is contained in:
1 parent
febe2132cc
commit
df73411d06
2 files changed
+66
-66
No files matched your search
@@ -11,7 +11,7 @@ class ShowHelpInhalt
|
|||||||
{
|
{
|
||||||
return Action::make('help')
|
return Action::make('help')
|
||||||
->icon('phosphor-question')
|
->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))
|
->tooltip(fn ($record): View => view('pages.helpinhalt')->with('record', $record))
|
||||||
->iconButton();
|
->iconButton();
|
||||||
}
|
}
|
||||||
|
|||||||
+65
-65
@@ -30,7 +30,6 @@ use Filament\Tables\Columns\TextColumn;
|
|||||||
use Filament\Tables\Columns\TextInputColumn;
|
use Filament\Tables\Columns\TextInputColumn;
|
||||||
use Filament\Tables\Enums\FiltersLayout;
|
use Filament\Tables\Enums\FiltersLayout;
|
||||||
use Filament\Tables\Filters\Filter;
|
use Filament\Tables\Filters\Filter;
|
||||||
use Filament\Tables\Filters\SelectFilter;
|
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use ToneGabes\BetterOptions\Forms\Components\RadioCards;
|
use ToneGabes\BetterOptions\Forms\Components\RadioCards;
|
||||||
@@ -116,75 +115,76 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
|||||||
],
|
],
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Fieldset::make('')
|
// Fieldset::make('')
|
||||||
->contained(false)
|
// ->contained(false)
|
||||||
->schema([
|
// ->schema([
|
||||||
Action::make('sichern')
|
// Action::make('sichern')
|
||||||
->iconButton()
|
// ->iconButton()
|
||||||
->tooltip('Änderungen in der Vorlage speichern')
|
// ->tooltip('Änderungen in der Vorlage speichern')
|
||||||
->icon('phosphor-floppy-disk')
|
// ->icon('phosphor-floppy-disk')
|
||||||
->schema([
|
// ->schema([
|
||||||
TextInput::make('name')->required()
|
// TextInput::make('name')->required()
|
||||||
->label('Ändern sie gegebeben Falls den Namen')
|
// ->label('Ändern sie gegebeben Falls den Namen')
|
||||||
->default(function ($record) {
|
// ->default(function ($record) {
|
||||||
return KontoTextblock::where('id', $record?->konto_textblock_id)->pluck('name')->first();
|
// return KontoTextblock::where('id', $record?->konto_textblock_id)->pluck('name')->first();
|
||||||
}),
|
// }),
|
||||||
])
|
// ])
|
||||||
->hidden(function ($record) {
|
// ->hidden(function ($record) {
|
||||||
return (bool) ! $record?->konto_textblock_id;
|
// return (bool) ! $record?->konto_textblock_id;
|
||||||
})
|
// })
|
||||||
->action(function (array $mountedActions, array $data) {
|
// ->action(function (array $mountedActions, array $data) {
|
||||||
$record = $mountedActions[0]->getRawData();
|
// $record = $mountedActions[0]->getRawData();
|
||||||
|
|
||||||
KontoTextblock::where('id', $record['konto_textblock_id'])
|
// KontoTextblock::where('id', $record['konto_textblock_id'])
|
||||||
->update(['name' => $data['name'], 'textblock' => RichContentRenderer::make($record['textblock'])->toHtml()]);
|
// ->update(['name' => $data['name'], 'textblock' => RichContentRenderer::make($record['textblock'])->toHtml()]);
|
||||||
|
|
||||||
}),
|
// }),
|
||||||
Action::make('neu')
|
// Action::make('neu')
|
||||||
->iconButton()
|
// ->iconButton()
|
||||||
->icon('phosphor-file-plus')
|
// ->icon('phosphor-file-plus')
|
||||||
->schema([
|
// ->schema([
|
||||||
TextInput::make('name')->required()
|
// TextInput::make('name')->required()
|
||||||
->label('Geben sie der Vorlage einen eindeutigen Namen')
|
// ->label('Geben sie der Vorlage einen eindeutigen Namen')
|
||||||
->default(function ($record) {
|
// ->default(function ($record) {
|
||||||
return $record?->name;
|
// return $record?->name;
|
||||||
}),
|
// }),
|
||||||
])
|
// ])
|
||||||
->modalSubmitActionLabel('Sichern')
|
// ->modalSubmitActionLabel('Sichern')
|
||||||
->tooltip('Neue Vorlage erstellen')
|
// ->tooltip('Neue Vorlage erstellen')
|
||||||
->action(function (array $mountedActions, array $data) {
|
// ->action(function (array $mountedActions, array $data) {
|
||||||
|
|
||||||
$record = $mountedActions[0]->getRawData();
|
// $record = $mountedActions[0]->getRawData();
|
||||||
|
|
||||||
$block = new KontoTextblock;
|
// $block = new KontoTextblock;
|
||||||
$block->konto_id = auth()->user()->konto_id;
|
// $block->konto_id = auth()->user()->konto_id;
|
||||||
$block->name = $data['name'];
|
// $block->name = $data['name'];
|
||||||
$block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
|
// $block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
|
||||||
$block->save();
|
// $block->save();
|
||||||
|
|
||||||
ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $block->id]);
|
// ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $block->id]);
|
||||||
}),
|
// }),
|
||||||
Action::make('laden')
|
// Action::make('laden')
|
||||||
->iconButton()
|
// ->iconButton()
|
||||||
->icon('phosphor-article')
|
// ->icon('phosphor-article')
|
||||||
->schema([
|
// ->schema([
|
||||||
Select::make('konto_textblock_id')
|
// Select::make('konto_textblock_id')
|
||||||
->hiddenLabel()
|
// ->hiddenLabel()
|
||||||
->searchable()
|
// ->searchable()
|
||||||
->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id'))
|
// ->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id'))
|
||||||
->belowLabel([
|
// ->belowLabel([
|
||||||
'Bitte eine Vorlage auswählen',
|
// 'Bitte eine Vorlage auswählen',
|
||||||
]),
|
// ]),
|
||||||
])
|
// ])
|
||||||
->modalSubmitActionLabel('Einsetzen')
|
// ->modalSubmitActionLabel('Einsetzen')
|
||||||
->tooltip('Vorlage laden.')
|
// ->tooltip('Vorlage laden.')
|
||||||
->action(function (Set $set, array $mountedActions, array $data) {
|
// ->action(function (Set $set, array $mountedActions, array $data) {
|
||||||
$record = $mountedActions[0]->getRawData();
|
// $record = $mountedActions[0]->getRawData();
|
||||||
ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $data['konto_textblock_id']]);
|
// dd($record);
|
||||||
$set('konto_textblock_id', $data['konto_textblock_id']);
|
// ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $data['konto_textblock_id']]);
|
||||||
$set('textblock', KontoTextblock::where('id', $data['konto_textblock_id'])->pluck('textblock')->first());
|
// $set('konto_textblock_id', $data['konto_textblock_id']);
|
||||||
}),
|
// $set('textblock', KontoTextblock::where('id', $data['konto_textblock_id'])->pluck('textblock')->first());
|
||||||
])->columns(1),
|
// }),
|
||||||
|
// ])->columns(1),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
Tab::make('Inhaltselement')
|
Tab::make('Inhaltselement')
|
||||||
|
|||||||
Reference in new issue
Block a user