allgemeinflaechen
This commit is contained in:
1 parent
4204c74406
commit
0b18eea9d7
15 files changed
+140
-145
No files matched your search
+5
-1
@@ -21,4 +21,8 @@ a make:mode ProjekteImport -ms
|
||||
a make:filament-resource ProjekteImport --nested
|
||||
a make:filament-relation-manager ProjekteResource ProjekteImports name
|
||||
|
||||
a make:filament-relation-manager ProjekteResource projekte_imports name
|
||||
a make:filament-relation-manager AllgemeinflaechenResource projekte_imports name
|
||||
|
||||
|
||||
a make:model Allgemeinflaechen -ms
|
||||
a make:model Raeumealle -ms
|
||||
@@ -16,4 +16,12 @@ class EditProjekte extends EditRecord
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
// protected function getFormActions(): array
|
||||
// {
|
||||
// return [
|
||||
// $this->getSaveFormAction()->label('Sichern'),
|
||||
// $this->getCancelFormAction()->label('Zurück zu Liste'),
|
||||
// ];
|
||||
// }
|
||||
}
|
||||
@@ -6,7 +6,6 @@ use App\Filament\Clusters\Projekte\ProjekteCluster;
|
||||
use App\Filament\Resources\Projektes\Pages\CreateProjekte;
|
||||
use App\Filament\Resources\Projektes\Pages\EditProjekte;
|
||||
use App\Filament\Resources\Projektes\Pages\ListProjektes;
|
||||
use App\Filament\Resources\Projektes\RelationManagers\ProjekteImportsRelationManager;
|
||||
use App\Filament\Resources\Projektes\Schemas\ProjekteForm;
|
||||
use App\Filament\Resources\Projektes\Tables\ProjektesTable;
|
||||
use App\Models\Projekte;
|
||||
@@ -46,7 +45,6 @@ class ProjekteResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
ProjekteImportsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Projektes\RelationManagers;
|
||||
|
||||
use Filament\Actions\AssociateAction;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class ProjekteImportsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'projekte_imports';
|
||||
|
||||
protected static ?string $title = 'Import Daten';
|
||||
|
||||
protected static ?string $navigationLabel = 'Import';
|
||||
|
||||
protected static ?string $modelLabel = 'Import';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Import';
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('filetype')
|
||||
->label('Dokument Type')
|
||||
->required()
|
||||
->options([
|
||||
'allgemein' => 'Allgemeinflächen',
|
||||
'nutzwerte' => 'Nutzwerte',
|
||||
]),
|
||||
FileUpload::make('file')
|
||||
->required()
|
||||
->disabledOn('edit')
|
||||
->label('Datei (csv/txt) auswählen')
|
||||
->directory('projekt-data-files')
|
||||
->storeFileNamesIn('original_name')
|
||||
->moveFiles()
|
||||
->acceptedFileTypes(['text/csv', 'text/plain']),
|
||||
Textarea::make('beschreibung')
|
||||
->maxLength(255),
|
||||
])->columns(1);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
TextColumn::make('filetype')
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'allgemein' => 'success',
|
||||
'nutzwerte' => 'info',
|
||||
}),
|
||||
TextColumn::make('original_name')
|
||||
->label('name')
|
||||
->wrap()
|
||||
->description(function ($record) {
|
||||
return new HtmlString($record->beschreibung);
|
||||
}),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
// CreateAction::make(),
|
||||
// AssociateAction::make(),
|
||||
CreateAction::make()
|
||||
->createAnother(false)
|
||||
->label('Hochladen')
|
||||
->color('primary')
|
||||
->icon('heroicon-o-document-arrow-up')
|
||||
->before(function (array $data) {
|
||||
|
||||
$path = Storage::disk('private')->path($data['file']);
|
||||
$contents = file_get_contents($path);
|
||||
$arr = preg_split("/\r\n|\n|\r/", $contents);
|
||||
dd($arr);
|
||||
// Runs before the form fields are saved to the database.
|
||||
}),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()->color('gray'),
|
||||
DeleteAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Allgemeinflaechen extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'geschoss',
|
||||
'raumart',
|
||||
'flaeche',
|
||||
];
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjekteImport extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'projekte_id',
|
||||
'file',
|
||||
'beschreibung',
|
||||
'filetype',
|
||||
'original_name',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Raeumealle extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'methode_id',
|
||||
'orientierung_id',
|
||||
'top_nummer',
|
||||
'geschoss',
|
||||
'raumart',
|
||||
'faktor',
|
||||
'flaeche',
|
||||
];
|
||||
}
|
||||
-1
@@ -28,7 +28,6 @@
|
||||
'app.filament.resources.projektes.pages.create-projekte' => 'App\\Filament\\Resources\\Projektes\\Pages\\CreateProjekte',
|
||||
'app.filament.resources.projektes.pages.edit-projekte' => 'App\\Filament\\Resources\\Projektes\\Pages\\EditProjekte',
|
||||
'app.filament.resources.projektes.pages.list-projektes' => 'App\\Filament\\Resources\\Projektes\\Pages\\ListProjektes',
|
||||
'app.filament.resources.projektes.relation-managers.projekte-imports-relation-manager' => 'App\\Filament\\Resources\\Projektes\\RelationManagers\\ProjekteImportsRelationManager',
|
||||
'app.filament.resources.textblocks.pages.create-textblock' => 'App\\Filament\\Resources\\Textblocks\\Pages\\CreateTextblock',
|
||||
'app.filament.resources.textblocks.pages.edit-textblock' => 'App\\Filament\\Resources\\Textblocks\\Pages\\EditTextblock',
|
||||
'app.filament.resources.textblocks.pages.list-textblocks' => 'App\\Filament\\Resources\\Textblocks\\Pages\\ListTextblocks',
|
||||
|
||||
Vendored
+21
-21
@@ -511,7 +511,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::zqpbCvTHQoq5WxIY',
|
||||
'_route' => 'generated::X482zXQEOVr3Myjb',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -531,7 +531,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::g4GN37DOWUCZHuyI',
|
||||
'_route' => 'generated::uIJywcuAMbX2MINg',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -589,7 +589,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::dlPEM3gdRiuQN3hD',
|
||||
'_route' => 'generated::eSMnXX8jqZoglDWN',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -609,7 +609,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::POapuQ1WmiUqo47Z',
|
||||
'_route' => 'generated::PvxYx4DJHy1oBzQj',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -629,7 +629,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::jWWTYVcaYTDh7eGh',
|
||||
'_route' => 'generated::pqiNnwUGYHEq9jrd',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -649,7 +649,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::pSOEU1x3jfHSGZlL',
|
||||
'_route' => 'generated::opVQamp7XU92vBQa',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -669,7 +669,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::1myIUinqVKT2Vqiy',
|
||||
'_route' => 'generated::I1AnhcLcct9zeww5',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -2595,7 +2595,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::zqpbCvTHQoq5WxIY' =>
|
||||
'generated::X482zXQEOVr3Myjb' =>
|
||||
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::zqpbCvTHQoq5WxIY',
|
||||
'as' => 'generated::X482zXQEOVr3Myjb',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2623,7 +2623,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::g4GN37DOWUCZHuyI' =>
|
||||
'generated::uIJywcuAMbX2MINg' =>
|
||||
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::g4GN37DOWUCZHuyI',
|
||||
'as' => 'generated::uIJywcuAMbX2MINg',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2737,7 +2737,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::dlPEM3gdRiuQN3hD' =>
|
||||
'generated::eSMnXX8jqZoglDWN' =>
|
||||
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::dlPEM3gdRiuQN3hD',
|
||||
'as' => 'generated::eSMnXX8jqZoglDWN',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2782,7 +2782,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::POapuQ1WmiUqo47Z' =>
|
||||
'generated::PvxYx4DJHy1oBzQj' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2804,7 +2804,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::POapuQ1WmiUqo47Z',
|
||||
'as' => 'generated::PvxYx4DJHy1oBzQj',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2820,7 +2820,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::jWWTYVcaYTDh7eGh' =>
|
||||
'generated::pqiNnwUGYHEq9jrd' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2842,7 +2842,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::jWWTYVcaYTDh7eGh',
|
||||
'as' => 'generated::pqiNnwUGYHEq9jrd',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2858,7 +2858,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::pSOEU1x3jfHSGZlL' =>
|
||||
'generated::opVQamp7XU92vBQa' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2880,7 +2880,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::pSOEU1x3jfHSGZlL',
|
||||
'as' => 'generated::opVQamp7XU92vBQa',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2896,7 +2896,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::1myIUinqVKT2Vqiy' =>
|
||||
'generated::I1AnhcLcct9zeww5' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2918,7 +2918,7 @@ app('router')->setCompiledRoutes(
|
||||
'where' =>
|
||||
array (
|
||||
),
|
||||
'as' => 'generated::1myIUinqVKT2Vqiy',
|
||||
'as' => 'generated::I1AnhcLcct9zeww5',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
|
||||
File renamed without changes.
File renamed without changes.
+5
-6
@@ -11,13 +11,12 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('projekte_imports', function (Blueprint $table) {
|
||||
Schema::create('allgemeinflaechens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete()->default(0);
|
||||
$table->string('file')->nullable();
|
||||
$table->text('beschreibung')->nullable();
|
||||
$table->string('filetype')->nullable();
|
||||
$table->string('original_name')->nullable();
|
||||
$table->string('geschoss')->nullable();
|
||||
$table->string('raumart')->nullable();
|
||||
$table->string('flaeche')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
@@ -27,6 +26,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('projekte_imports');
|
||||
Schema::dropIfExists('allgemeinflaechens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('raeumealles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete()->default(0);
|
||||
$table->integer('methode_id')->default(0);
|
||||
$table->integer('orientierung_id')->default(0);
|
||||
$table->string('top_nummer')->nullable();
|
||||
$table->string('geschoss')->nullable();
|
||||
$table->string('raumart')->nullable();
|
||||
$table->double('faktor')->nullable();
|
||||
$table->double('flaeche')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('raeumealles');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AllgemeinflaechenSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RaeumealleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user