Raum Methode wip

This commit is contained in:
salam committed 2025-10-06 09:40:32 +02:00
1 parent 9a7e6fa248
commit 064fceaca0
4 files changed
+33 -28

No files matched your search

@@ -4,9 +4,11 @@ namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Actions\CreateProjektMethoden; use App\Actions\CreateProjektMethoden;
use App\Models\Methode; use App\Models\Methode;
use App\Models\ProjektMethode;
use Filament\Actions\Action; use Filament\Actions\Action;
use Filament\Actions\BulkAction; use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup; use Filament\Actions\BulkActionGroup;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager; use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Columns\SelectColumn; use Filament\Tables\Columns\SelectColumn;
@@ -34,7 +36,9 @@ class ProjektMethodesRelationManager extends RelationManager
->recordTitleAttribute('raumart') ->recordTitleAttribute('raumart')
->columns([ ->columns([
SelectColumn::make('methode_id') SelectColumn::make('methode_id')
->options(Methode::query()->pluck('name', 'id')), ->selectablePlaceholder(true)
->optionsRelationship('methode', 'name')
->preloadOptions(),
TextColumn::make('raumart') TextColumn::make('raumart')
->searchable(), ->searchable(),
TextInputColumn::make('faktor') TextInputColumn::make('faktor')
@@ -82,9 +86,10 @@ class ProjektMethodesRelationManager extends RelationManager
->color('primary') ->color('primary')
->label('Methode zuweisen') ->label('Methode zuweisen')
->schema([ ->schema([
TextInput::make('faktor') Select::make('methode_id')
->label('Methode')
->prefixIcon('phosphor-calculator') ->prefixIcon('phosphor-calculator')
->numeric() ->options(Methode::pluck('name', 'id'))
->required(), ->required(),
]) ])
->icon('phosphor-calculator') ->icon('phosphor-calculator')
@@ -92,7 +97,7 @@ class ProjektMethodesRelationManager extends RelationManager
foreach ($records as $record) { foreach ($records as $record) {
ProjektMethode::where('id', '=', $record->id) ProjektMethode::where('id', '=', $record->id)
->update( ->update(
['faktor' => $data['faktor']] ['methode_id' => $data['methode_id']]
); );
} }
}), }),
+2 -2
View File
@@ -14,8 +14,8 @@ class ProjektMethode extends Model
'flaeche', 'flaeche',
]; ];
public function methodes() public function methode()
{ {
return $this->hasMany(Methode::class); return $this->hasOne(Methode::class, 'id', 'methode_id');
} }
} }
+21 -21
View File
@@ -511,7 +511,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::NzP4VI5PeVTSNa8b', '_route' => 'generated::3ZvPcx4wzGcazHjY',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -531,7 +531,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::pt0LAwcB1sGBW4Oo', '_route' => 'generated::lOdfu1T7yU5apto8',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -589,7 +589,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::AOiPiqGBrqXDsS0D', '_route' => 'generated::LPhTcSOFWcUu5PaT',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -609,7 +609,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::P6HogTayo2iWezmY', '_route' => 'generated::cvHOt1jrrRN3xfiY',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -629,7 +629,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::MTlI6TBwxyNMQmB6', '_route' => 'generated::bonAslfzukOeepe8',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -649,7 +649,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::hTSXazyycB1PbjMf', '_route' => 'generated::6FKILztAKPwOYAG8',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -669,7 +669,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::72CUCq6E4ZsFkqBN', '_route' => 'generated::ztTjaopi6XfNllCu',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -2595,7 +2595,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::NzP4VI5PeVTSNa8b' => 'generated::3ZvPcx4wzGcazHjY' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2607,7 +2607,7 @@ app('router')->setCompiledRoutes(
array ( array (
'uses' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@returnJavaScriptAsFile', 'uses' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@returnJavaScriptAsFile',
'controller' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@returnJavaScriptAsFile', 'controller' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@returnJavaScriptAsFile',
'as' => 'generated::NzP4VI5PeVTSNa8b', 'as' => 'generated::3ZvPcx4wzGcazHjY',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2623,7 +2623,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::pt0LAwcB1sGBW4Oo' => 'generated::lOdfu1T7yU5apto8' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2635,7 +2635,7 @@ app('router')->setCompiledRoutes(
array ( array (
'uses' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@maps', 'uses' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@maps',
'controller' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@maps', 'controller' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@maps',
'as' => 'generated::pt0LAwcB1sGBW4Oo', 'as' => 'generated::lOdfu1T7yU5apto8',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2737,7 +2737,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::AOiPiqGBrqXDsS0D' => 'generated::LPhTcSOFWcUu5PaT' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2766,7 +2766,7 @@ app('router')->setCompiledRoutes(
\'exception\' => $exception, \'exception\' => $exception,
]), status: $exception ? 500 : 200); ]), status: $exception ? 500 : 200);
}";s:5:"scope";s:54:"Illuminate\\Foundation\\Configuration\\ApplicationBuilder";s:4:"this";N;s:4:"self";s:32:"0000000000000f2c0000000000000000";}}', }";s:5:"scope";s:54:"Illuminate\\Foundation\\Configuration\\ApplicationBuilder";s:4:"this";N;s:4:"self";s:32:"0000000000000f2c0000000000000000";}}',
'as' => 'generated::AOiPiqGBrqXDsS0D', 'as' => 'generated::LPhTcSOFWcUu5PaT',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2782,7 +2782,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::P6HogTayo2iWezmY' => 'generated::cvHOt1jrrRN3xfiY' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2804,7 +2804,7 @@ app('router')->setCompiledRoutes(
'where' => 'where' =>
array ( array (
), ),
'as' => 'generated::P6HogTayo2iWezmY', 'as' => 'generated::cvHOt1jrrRN3xfiY',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2820,7 +2820,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::MTlI6TBwxyNMQmB6' => 'generated::bonAslfzukOeepe8' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2842,7 +2842,7 @@ app('router')->setCompiledRoutes(
'where' => 'where' =>
array ( array (
), ),
'as' => 'generated::MTlI6TBwxyNMQmB6', 'as' => 'generated::bonAslfzukOeepe8',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2858,7 +2858,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::hTSXazyycB1PbjMf' => 'generated::6FKILztAKPwOYAG8' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2880,7 +2880,7 @@ app('router')->setCompiledRoutes(
'where' => 'where' =>
array ( array (
), ),
'as' => 'generated::hTSXazyycB1PbjMf', 'as' => 'generated::6FKILztAKPwOYAG8',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2896,7 +2896,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::72CUCq6E4ZsFkqBN' => 'generated::ztTjaopi6XfNllCu' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2918,7 +2918,7 @@ app('router')->setCompiledRoutes(
'where' => 'where' =>
array ( array (
), ),
'as' => 'generated::72CUCq6E4ZsFkqBN', 'as' => 'generated::ztTjaopi6XfNllCu',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -14,7 +14,7 @@ return new class extends Migration
Schema::create('projekt_methodes', function (Blueprint $table) { Schema::create('projekt_methodes', function (Blueprint $table) {
$table->id(); $table->id();
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete(); $table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
$table->integer('methode_id')->default(0); $table->integer('methode_id')->nullable()->default(0);
$table->string('geschoss')->nullable(); $table->string('geschoss')->nullable();
$table->string('raumart')->nullable(); $table->string('raumart')->nullable();
$table->decimal('faktor', 5, 2)->default(0); $table->decimal('faktor', 5, 2)->default(0);