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
+65
-65
@@ -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')
|
||||
|
||||
Reference in new issue
Block a user