wip import

This commit is contained in:
salam committed 2025-10-25 10:11:43 +02:00
1 parent 7343c26955
commit e7fe8de435
13 files changed
+367 -341

No files matched your search

@@ -2,6 +2,7 @@
namespace App\Filament\Imports;
use App\Models\ProjektOrientierungZuAbschlaege;
use App\Models\ProjektRaeumealle;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
@@ -11,18 +12,39 @@ use Illuminate\Support\Number;
class ProjektRaeumealleImporter extends Importer
{
protected static ?string $model = ProjektRaeumealle::class;
protected function beforeValidate(): void
{
$orientierung_zu_abschlaege = ProjektOrientierungZuAbschlaege::firstOrNew([
'projekte_id' => $this->options['projekte_id'],
'top_nummer' => $this->data['top_nummer'],
]);
$this->data['$orientierung_zu_abschlaege'] = $orientierung_zu_abschlaege->id;
}
protected function beforeSave(): void
{
dd($this->data);
}
public function resolveRecord(): ProjektRaeumealle
{
$raeumealle = new ProjektRaeumealle;
$raeumealle->projekte_id = $this->options['projekte_id'];
$orientierung_zu_abschlaege = ProjektOrientierungZuAbschlaege::firstOrNew([
'projekte_id' => $this->options['projekte_id'],
'top_nummer' => $this->data['top_nummer'],
]);
return $raeumealle;
return ProjektRaeumealle::firstOrNew([
'projekt_orientierung_zu_abschlaege_id' => $orientierung_zu_abschlaege->id,
'projekte_id' => $this->options['projekte_id'],
]);
}
public static function getColumns(): array
{
return [
// ImportColumn::make('top_nummer')
// ->relationship('orientierung_zu_abschlaege'),
ImportColumn::make('top_nummer')
->label('Top Nummer')
->validationAttribute('Top Nummer')
@@ -70,7 +70,7 @@ class EditProjekte extends EditRecord
->modalHeading('Objekte im Detail Import')
->modalContent(view('filament.pages.actions.import-objektemitraeumen'))
->modalContentFooter(view('filament.pages.actions.footer-objektemitraeumen'))
->label('Objekte im Detail')
->label('Objekte')
->icon('phosphor-upload')
->extraModalFooterActions([
Action::make('delete')
@@ -28,11 +28,11 @@ class ProjekteResource extends Resource
protected static ?string $recordTitleAttribute = 'interner_name';
protected static ?string $navigationLabel = 'Gutachten';
protected static ?string $navigationLabel = 'Projekte';
protected static ?string $modelLabel = 'Gutachten';
protected static ?string $modelLabel = 'Projekt';
protected static ?string $pluralModelLabel = 'Gutachten';
protected static ?string $pluralModelLabel = 'Projekte';
public static function form(Schema $schema): Schema
{
+5
View File
@@ -31,4 +31,9 @@ class ProjektRaeumealle extends Model
]);
});
}
public function orientierung_zu_abschlaege()
{
return $this->belongsTo(ProjektOrientierungZuAbschlaege::class, 'projekt_orientierung_zu_abschlaege_id', 'id');
}
}