inhaltsangabe wip

This commit is contained in:
salam committed 2025-10-19 12:26:48 +02:00
1 parent 8ccc4a3c20
commit 3a35ccd69d
34 files changed
+281 -236

No files matched your search

@@ -179,7 +179,7 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
}
}),
BulkAction::make('a')
->label($spalten['a'].' Faktor' ?? '')
->label($spalten['a'] ?? '')
->color('info')
->hidden(isset($spalten['a']) ? false : true)
->schema([
@@ -3,7 +3,6 @@
namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Models\KontoTextblock;
use App\Models\TextblockKennung;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
@@ -11,14 +10,14 @@ use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Components\Actions;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Flex;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
@@ -42,27 +41,19 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
{
return $schema
->components([
TextInput::make('ordnungszahl')->numeric(),
TextInput::make('name'),
Select::make('textblock_kennung_id')
->label('Textblock Art')
->options(function () {
$relatedOptions = TextblockKennung::all()->pluck('name', 'id')->toArray();
return ['0' => 'ohne Textblock'] + $relatedOptions;
})
->live(),
RichEditor::make('textblock')
->hidden(fn (Get $get): bool => ! $get('textblock_kennung_id'))
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
Flex::make([
Section::make([
RichEditor::make('textblock')
->hidden(fn (Get $get): bool => ! $get('textblock_kennung_id'))
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
]),
]),
Fieldset::make('Vorlagen')
->hiddenLabel()
->hidden(fn ($record): bool => ! isset($record) || ! $record['textblock_kennung_id'])
->schema([
Section::make([
Action::make('textblock_sichern')
->schema([
Hidden::make('konto_id')->default(auth()->user()->konto_id),
@@ -88,9 +79,9 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
}),
])
->modalSubmitActionLabel('Sichern')
->iconButton()
->icon('phosphor-floppy-disk')
->tooltip('Ein veränderter Textblock kann als persönliche Vorlage gespeichert werden.')
->color('info')
->action(function (array $mountedActions, $data) {
$record = $mountedActions[0]->getRawData();
@@ -107,8 +98,9 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
Actions::make([
Action::make('textblock_laden')
->schema([
Radio::make('konto_textblock_id')
Select::make('konto_textblock_id')
->hiddenLabel()
->searchable()
->options(function ($record) {
return KontoTextblock::where('textblock_kennung_id', $record['textblock_kennung_id'])->where('konto_id', auth()->user()->konto_id)->pluck('name', 'id')->toArray();
})->belowLabel([
@@ -116,16 +108,17 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
]),
])
->icon('phosphor-article')
->iconButton()
->modalSubmitActionLabel('Einsetzen')
->color('info')
->tooltip('Personaliserten Texblock laden.')
->tooltip('Personaliserten Textblock laden.')
->action(function (Set $set, array $data) {
$set('textblock', KontoTextblock::query()->where('id', $data['konto_textblock_id'])->pluck('textblock')->first());
}),
]),
])->columns(4),
])->grow(false),
])->columnSpanFull(),
])->columns(1);
]);
}
public function table(Table $table): Table