Räume Alle wip

This commit is contained in:
salam committed 2025-10-05 08:06:24 +02:00
1 parent c446450f73
commit 4a71dcdac8
3 files changed
+64 -36

No files matched your search

+20 -12
View File
@@ -12,25 +12,42 @@ class RaeumealleImporter extends Importer
{ {
protected static ?string $model = Raeumealle::class; protected static ?string $model = Raeumealle::class;
public function resolveRecord(): Raeumealle
{
$raeumealle = new Raeumealle;
$raeumealle->projekte_id = $this->options['projekte_id'];
return $raeumealle;
}
public static function getColumns(): array public static function getColumns(): array
{ {
return [ return [
ImportColumn::make('top_nummer') ImportColumn::make('top_nummer')
->rules(['max:255']) ->validationAttribute('Geschoss')
->requiredMapping()
->example('EG')
->rules(['required', 'max:255'])
->castStateUsing(function (string $state) { ->castStateUsing(function (string $state) {
$state = trim($state); $state = trim($state);
return iconv(mb_detect_encoding($state, mb_detect_order(), true), 'UTF-8', $state); return iconv(mb_detect_encoding($state, mb_detect_order(), true), 'UTF-8', $state);
}), }),
ImportColumn::make('geschoss') ImportColumn::make('geschoss')
->rules(['max:255']) ->validationAttribute('Geschoss')
->requiredMapping()
->example('EG')
->rules(['required', 'max:255'])
->castStateUsing(function (string $state) { ->castStateUsing(function (string $state) {
$state = trim($state); $state = trim($state);
return iconv(mb_detect_encoding($state, mb_detect_order(), true), 'UTF-8', $state); return iconv(mb_detect_encoding($state, mb_detect_order(), true), 'UTF-8', $state);
}), }),
ImportColumn::make('raumart') ImportColumn::make('raumart')
->rules(['max:255']) ->validationAttribute('Raumart')
->requiredMapping()
->example('Stiegenhaus')
->rules(['required', 'max:32'])
->castStateUsing(function (string $state) { ->castStateUsing(function (string $state) {
$state = trim($state); $state = trim($state);
@@ -53,15 +70,6 @@ class RaeumealleImporter extends Importer
]; ];
} }
public function resolveRecord(): Raeumealle
{
return new Raeumealle;
$raeumealle = new Raeumealle;
$raeumealle->projekte_id = $this->options['projekte_id'];
return $raeumealle;
}
public static function getCompletedNotificationBody(Import $import): string public static function getCompletedNotificationBody(Import $import): string
{ {
$body = ' Der Import der Räume ist abgeschlossen. Es wurden '.Number::format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' importiert.'; $body = ' Der Import der Räume ist abgeschlossen. Es wurden '.Number::format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' importiert.';
@@ -3,6 +3,7 @@
namespace App\Filament\Resources\Projektes\RelationManagers; namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Filament\Imports\RaeumealleImporter; use App\Filament\Imports\RaeumealleImporter;
use App\Models\Raeumealle;
use Filament\Actions\BulkActionGroup; use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction; use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction; use Filament\Actions\DeleteAction;
@@ -12,7 +13,11 @@ use Filament\Actions\ImportAction;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager; use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
use Filament\Tables\Columns\Summarizers\Sum;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Validation\Rules\File; use Illuminate\Validation\Rules\File;
@@ -41,14 +46,29 @@ class RaeumeallesRelationManager extends RelationManager
public function table(Table $table): Table public function table(Table $table): Table
{ {
return $table return $table
->recordTitleAttribute('geschoss') ->recordTitleAttribute('top_nummer')
->columns([ ->columns([
TextColumn::make('geschoss') TextColumn::make('top_nummer')->searchable(),
TextColumn::make('geschoss')->searchable(),
TextColumn::make('raumart')->searchable(),
TextInputColumn::make('flaeche')
->summarize(Sum::make()->label('Gesammt'))
->width('2rem')
->alignment('right')
// ->formatStateUsing(fn ($state) => "{$state} m²")
->label('Fläche')
// ->numeric(decimalPlaces: 2)
->searchable(), ->searchable(),
]) ])
->filters([ ->filters([
// SelectFilter::make('top_nummer')
->searchable()
->options(function (): array {
return Raeumealle::where('projekte_id', $this->getOwnerRecord()->id)->groupBy('top_nummer')->orderBy('top_nummer')->pluck('top_nummer', 'top_nummer')->toArray();
})
->attribute('top_nummer'),
]) ])
// ], layout: FiltersLayout::AboveContentCollapsible)
->headerActions([ ->headerActions([
CreateAction::make() CreateAction::make()
->icon('phosphor-file-plus'), ->icon('phosphor-file-plus'),
+21 -21
View File
@@ -511,7 +511,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::fRgalZgdgLutYooA', '_route' => 'generated::ZKAnD1JupDI6nRdd',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -531,7 +531,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::ehGEtdVA59MvLnTN', '_route' => 'generated::s39ttVgluaaTSPQs',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -589,7 +589,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::t8jqNF3M4FSM7iYY', '_route' => 'generated::GTqxIeXqrS3yeXC2',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -609,7 +609,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::ofL3RQiGDD5QTkU1', '_route' => 'generated::CqHTEVGG8Ecd113F',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -629,7 +629,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::dp8f68KJns4OcFMw', '_route' => 'generated::cIETyLf8UfA6kLWN',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -649,7 +649,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::PWm6NXGdwH5Nl0zY', '_route' => 'generated::vAq2m1K8fDxzN7CD',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -669,7 +669,7 @@ app('router')->setCompiledRoutes(
array ( array (
0 => 0 =>
array ( array (
'_route' => 'generated::rdH5yu4CuBT2btx2', '_route' => 'generated::PslwnVFq3OKf1wWj',
), ),
1 => NULL, 1 => NULL,
2 => 2 =>
@@ -2595,7 +2595,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::fRgalZgdgLutYooA' => 'generated::ZKAnD1JupDI6nRdd' =>
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::fRgalZgdgLutYooA', 'as' => 'generated::ZKAnD1JupDI6nRdd',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2623,7 +2623,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::ehGEtdVA59MvLnTN' => 'generated::s39ttVgluaaTSPQs' =>
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::ehGEtdVA59MvLnTN', 'as' => 'generated::s39ttVgluaaTSPQs',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2737,7 +2737,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::t8jqNF3M4FSM7iYY' => 'generated::GTqxIeXqrS3yeXC2' =>
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::t8jqNF3M4FSM7iYY', 'as' => 'generated::GTqxIeXqrS3yeXC2',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2782,7 +2782,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::ofL3RQiGDD5QTkU1' => 'generated::CqHTEVGG8Ecd113F' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2804,7 +2804,7 @@ app('router')->setCompiledRoutes(
'where' => 'where' =>
array ( array (
), ),
'as' => 'generated::ofL3RQiGDD5QTkU1', 'as' => 'generated::CqHTEVGG8Ecd113F',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2820,7 +2820,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::dp8f68KJns4OcFMw' => 'generated::cIETyLf8UfA6kLWN' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2842,7 +2842,7 @@ app('router')->setCompiledRoutes(
'where' => 'where' =>
array ( array (
), ),
'as' => 'generated::dp8f68KJns4OcFMw', 'as' => 'generated::cIETyLf8UfA6kLWN',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2858,7 +2858,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::PWm6NXGdwH5Nl0zY' => 'generated::vAq2m1K8fDxzN7CD' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2880,7 +2880,7 @@ app('router')->setCompiledRoutes(
'where' => 'where' =>
array ( array (
), ),
'as' => 'generated::PWm6NXGdwH5Nl0zY', 'as' => 'generated::vAq2m1K8fDxzN7CD',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>
@@ -2896,7 +2896,7 @@ app('router')->setCompiledRoutes(
'waitSeconds' => NULL, 'waitSeconds' => NULL,
'withTrashed' => false, 'withTrashed' => false,
), ),
'generated::rdH5yu4CuBT2btx2' => 'generated::PslwnVFq3OKf1wWj' =>
array ( array (
'methods' => 'methods' =>
array ( array (
@@ -2918,7 +2918,7 @@ app('router')->setCompiledRoutes(
'where' => 'where' =>
array ( array (
), ),
'as' => 'generated::rdH5yu4CuBT2btx2', 'as' => 'generated::PslwnVFq3OKf1wWj',
), ),
'fallback' => false, 'fallback' => false,
'defaults' => 'defaults' =>