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');
|
||||
}
|
||||
}
|
||||
Vendored
+21
-21
@@ -511,7 +511,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::72dvlQUT3DeuMnCR',
|
||||
'_route' => 'generated::r8qwOhrBFr97OJpy',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -531,7 +531,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::2FquvPUK0QPjy898',
|
||||
'_route' => 'generated::68WmDIMECRFF2Y0d',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -589,7 +589,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::LEBDUibewTYH5vdg',
|
||||
'_route' => 'generated::U94dFsn56p7tAtAL',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -609,7 +609,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::yAZVXGYa5kOiaO48',
|
||||
'_route' => 'generated::brIvQ2hYFK9KD13e',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -629,7 +629,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::rKOO0zfHV2AtlZa8',
|
||||
'_route' => 'generated::QlCs3Yu0TXq8RHlp',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -649,7 +649,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::BULbTYn3Q6ELpchc',
|
||||
'_route' => 'generated::LwGntt2fOHLNT95n',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -669,7 +669,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::086O3CfzKAMN4O68',
|
||||
'_route' => 'generated::3c8bds3Cmtrpk7Ez',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -2595,7 +2595,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::72dvlQUT3DeuMnCR' =>
|
||||
'generated::r8qwOhrBFr97OJpy' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2607,7 +2607,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
'uses' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@returnJavaScriptAsFile',
|
||||
'controller' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@returnJavaScriptAsFile',
|
||||
'as' => 'generated::72dvlQUT3DeuMnCR',
|
||||
'as' => 'generated::r8qwOhrBFr97OJpy',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2623,7 +2623,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::2FquvPUK0QPjy898' =>
|
||||
'generated::68WmDIMECRFF2Y0d' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2635,7 +2635,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
'uses' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@maps',
|
||||
'controller' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@maps',
|
||||
'as' => 'generated::2FquvPUK0QPjy898',
|
||||
'as' => 'generated::68WmDIMECRFF2Y0d',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2737,7 +2737,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::LEBDUibewTYH5vdg' =>
|
||||
'generated::U94dFsn56p7tAtAL' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2766,7 +2766,7 @@ app('router')->setCompiledRoutes(
|
||||
\'exception\' => $exception,
|
||||
]), status: $exception ? 500 : 200);
|
||||
}";s:5:"scope";s:54:"Illuminate\\Foundation\\Configuration\\ApplicationBuilder";s:4:"this";N;s:4:"self";s:32:"0000000000000f2d0000000000000000";}}',
|
||||
'as' => 'generated::LEBDUibewTYH5vdg',
|
||||
'as' => 'generated::U94dFsn56p7tAtAL',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2782,7 +2782,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::yAZVXGYa5kOiaO48' =>
|
||||
'generated::brIvQ2hYFK9KD13e' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2804,7 +2804,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::yAZVXGYa5kOiaO48',
|
||||
'as' => 'generated::brIvQ2hYFK9KD13e',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2820,7 +2820,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::rKOO0zfHV2AtlZa8' =>
|
||||
'generated::QlCs3Yu0TXq8RHlp' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2842,7 +2842,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::rKOO0zfHV2AtlZa8',
|
||||
'as' => 'generated::QlCs3Yu0TXq8RHlp',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2858,7 +2858,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::BULbTYn3Q6ELpchc' =>
|
||||
'generated::LwGntt2fOHLNT95n' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2880,7 +2880,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::BULbTYn3Q6ELpchc',
|
||||
'as' => 'generated::LwGntt2fOHLNT95n',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2896,7 +2896,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::086O3CfzKAMN4O68' =>
|
||||
'generated::3c8bds3Cmtrpk7Ez' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2918,7 +2918,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::086O3CfzKAMN4O68',
|
||||
'as' => 'generated::3c8bds3Cmtrpk7Ez',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('konto_textblocks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('konto_id')->constrained();
|
||||
$table->string('name');
|
||||
$table->string('beschreibung')->nullable();
|
||||
$table->integer('textblock_kennung_id')->default(0)->nullable();
|
||||
$table->text('textblock');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('konto_textblocks');
|
||||
}
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
{{-- Custom block --}}
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
{{-- Custom block preview --}}
|
||||
</div>
|
||||
Reference in new issue
Block a user