Räume Alle wip
This commit is contained in:
1 parent
c446450f73
commit
4a71dcdac8
3 files changed
+64
-36
No files matched your search
@@ -12,25 +12,42 @@ class RaeumealleImporter extends Importer
|
||||
{
|
||||
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
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('top_nummer')
|
||||
->rules(['max:255'])
|
||||
->validationAttribute('Geschoss')
|
||||
->requiredMapping()
|
||||
->example('EG')
|
||||
->rules(['required', 'max:255'])
|
||||
->castStateUsing(function (string $state) {
|
||||
$state = trim($state);
|
||||
|
||||
return iconv(mb_detect_encoding($state, mb_detect_order(), true), 'UTF-8', $state);
|
||||
}),
|
||||
ImportColumn::make('geschoss')
|
||||
->rules(['max:255'])
|
||||
->validationAttribute('Geschoss')
|
||||
->requiredMapping()
|
||||
->example('EG')
|
||||
->rules(['required', 'max:255'])
|
||||
->castStateUsing(function (string $state) {
|
||||
$state = trim($state);
|
||||
|
||||
return iconv(mb_detect_encoding($state, mb_detect_order(), true), 'UTF-8', $state);
|
||||
}),
|
||||
ImportColumn::make('raumart')
|
||||
->rules(['max:255'])
|
||||
->validationAttribute('Raumart')
|
||||
->requiredMapping()
|
||||
->example('Stiegenhaus')
|
||||
->rules(['required', 'max:32'])
|
||||
->castStateUsing(function (string $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
|
||||
{
|
||||
$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;
|
||||
|
||||
use App\Filament\Imports\RaeumealleImporter;
|
||||
use App\Models\Raeumealle;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
@@ -12,7 +13,11 @@ use Filament\Actions\ImportAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\Summarizers\Sum;
|
||||
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 Illuminate\Validation\Rules\File;
|
||||
|
||||
@@ -41,14 +46,29 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('geschoss')
|
||||
->recordTitleAttribute('top_nummer')
|
||||
->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(),
|
||||
])
|
||||
->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([
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus'),
|
||||
|
||||
Vendored
+21
-21
@@ -511,7 +511,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::fRgalZgdgLutYooA',
|
||||
'_route' => 'generated::ZKAnD1JupDI6nRdd',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -531,7 +531,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::ehGEtdVA59MvLnTN',
|
||||
'_route' => 'generated::s39ttVgluaaTSPQs',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -589,7 +589,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::t8jqNF3M4FSM7iYY',
|
||||
'_route' => 'generated::GTqxIeXqrS3yeXC2',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -609,7 +609,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::ofL3RQiGDD5QTkU1',
|
||||
'_route' => 'generated::CqHTEVGG8Ecd113F',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -629,7 +629,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::dp8f68KJns4OcFMw',
|
||||
'_route' => 'generated::cIETyLf8UfA6kLWN',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -649,7 +649,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::PWm6NXGdwH5Nl0zY',
|
||||
'_route' => 'generated::vAq2m1K8fDxzN7CD',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -669,7 +669,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::rdH5yu4CuBT2btx2',
|
||||
'_route' => 'generated::PslwnVFq3OKf1wWj',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -2595,7 +2595,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::fRgalZgdgLutYooA' =>
|
||||
'generated::ZKAnD1JupDI6nRdd' =>
|
||||
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::fRgalZgdgLutYooA',
|
||||
'as' => 'generated::ZKAnD1JupDI6nRdd',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2623,7 +2623,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::ehGEtdVA59MvLnTN' =>
|
||||
'generated::s39ttVgluaaTSPQs' =>
|
||||
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::ehGEtdVA59MvLnTN',
|
||||
'as' => 'generated::s39ttVgluaaTSPQs',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2737,7 +2737,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::t8jqNF3M4FSM7iYY' =>
|
||||
'generated::GTqxIeXqrS3yeXC2' =>
|
||||
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:"0000000000000f2c0000000000000000";}}',
|
||||
'as' => 'generated::t8jqNF3M4FSM7iYY',
|
||||
'as' => 'generated::GTqxIeXqrS3yeXC2',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2782,7 +2782,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::ofL3RQiGDD5QTkU1' =>
|
||||
'generated::CqHTEVGG8Ecd113F' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2804,7 +2804,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::ofL3RQiGDD5QTkU1',
|
||||
'as' => 'generated::CqHTEVGG8Ecd113F',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2820,7 +2820,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::dp8f68KJns4OcFMw' =>
|
||||
'generated::cIETyLf8UfA6kLWN' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2842,7 +2842,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::dp8f68KJns4OcFMw',
|
||||
'as' => 'generated::cIETyLf8UfA6kLWN',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2858,7 +2858,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::PWm6NXGdwH5Nl0zY' =>
|
||||
'generated::vAq2m1K8fDxzN7CD' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2880,7 +2880,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::PWm6NXGdwH5Nl0zY',
|
||||
'as' => 'generated::vAq2m1K8fDxzN7CD',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2896,7 +2896,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::rdH5yu4CuBT2btx2' =>
|
||||
'generated::PslwnVFq3OKf1wWj' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2918,7 +2918,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::rdH5yu4CuBT2btx2',
|
||||
'as' => 'generated::PslwnVFq3OKf1wWj',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
|
||||
Reference in new issue
Block a user