wip
This commit is contained in:
1 parent
c149ed0a9f
commit
5604423af9
6 files changed
+141
-22
No files matched your search
+62
-1
@@ -2,12 +2,15 @@
|
||||
|
||||
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;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -84,7 +87,65 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
CreateAction::make(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()->color('gray'),
|
||||
EditAction::make()->iconButton()->color('gray')
|
||||
->extraModalFooterActions([
|
||||
|
||||
Action::make('vorlage-sichern')
|
||||
->label('Textblock als Vorlage sichern')
|
||||
->schema([
|
||||
Hidden::make('namecheck')->default(function ($record) {
|
||||
return $record['name'];
|
||||
}),
|
||||
TextInput::make('name')->required()
|
||||
->label('Name der Vorlage')
|
||||
->validationMessages([
|
||||
'different' => 'Name ist schon in Verwendung bitte verwenden Sie einen eindeutig Namen.',
|
||||
])
|
||||
->different('namecheck')
|
||||
->default(function ($record) {
|
||||
return $record['name'];
|
||||
}),
|
||||
RichEditor::make('textblock')
|
||||
->label('Textblock Vorlage')
|
||||
->default(function ($record) {
|
||||
return $record['textblock'];
|
||||
})
|
||||
// ->default($this->ownerRecord->textblock)
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
|
||||
]),
|
||||
])
|
||||
->icon('phosphor-floppy-disk')
|
||||
->tooltip('Ein personalisierter Textblock kann als neue Vorlage gespeichert werden.')
|
||||
->hidden(fn ($record): bool => ! $record['textblock_kennung_id'])
|
||||
->color('info')
|
||||
->action(function (array $mountedActions, $data) {
|
||||
|
||||
$record = $mountedActions[0]->getRawData();
|
||||
|
||||
dd($record['textblock']);
|
||||
|
||||
KontoTextblock::updateOrCreate(
|
||||
[
|
||||
'konto_id' => auth()->user()->konto_id,
|
||||
'name' => $data['name'],
|
||||
'textblock_kennung_id' => $record['textblock_kennung_id'],
|
||||
],
|
||||
[
|
||||
'textblock' => $record['textblock'],
|
||||
]);
|
||||
}),
|
||||
|
||||
Action::make('vorlage-importieren')
|
||||
->icon('phosphor-article')
|
||||
->tooltip('Ein veränderter Textblock kann als persönliche Vorlage gespeichert werden.')
|
||||
->hidden(fn ($record): bool => ! $record['textblock_kennung_id'])
|
||||
->color('info')
|
||||
->requiresConfirmation()
|
||||
->action(function (array $mountedActions) {
|
||||
dd($mountedActions[0]->getRawData());
|
||||
}),
|
||||
]),
|
||||
DeleteAction::make()->iconButton(),
|
||||
])
|
||||
->toolbarActions([
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class KontoTextblock extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'konto_id',
|
||||
'name',
|
||||
'textblock_kennung_id',
|
||||
'textblock',
|
||||
];
|
||||
|
||||
public function textblock_kennung()
|
||||
{
|
||||
return $this->hasMany(TextblockKennung::class, 'id');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user