import table make raumealle table depending on orientierung

This commit is contained in:
salam committed 2025-10-25 08:09:16 +02:00
1 parent 92bdc77eee
commit 7343c26955
14 files changed
+182 -108

No files matched your search

@@ -3,14 +3,21 @@
namespace App\Filament\Resources\Projektes\Pages;
use App\Actions\Validation\GutachtenValidation;
use App\Filament\Imports\ProjektAllgemeinflaechenImporter;
use App\Filament\Imports\ProjektRaeumealleImporter;
use App\Filament\Resources\Projektes\ProjekteResource;
use App\Models\Konto;
use App\Models\ProjektAllgemeinflaechen;
use App\Models\Projekte;
use App\Models\ProjektOrientierungZuAbschlaege;
use App\Models\ProjektRaeumealle;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\ImportAction;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Validation\Rules\File;
use Livewire\Attributes\On;
class EditProjekte extends EditRecord
@@ -20,12 +27,78 @@ class EditProjekte extends EditRecord
#[On('refreshProjektAllgemeinflaechen'), On('refreshProjektRaeumealle'), On('refreshMethods'), On('refreshOrientierung')]
public function refresh(): void {}
// #[On('refreshProjektRaeumealle')]
// public function refresh(): void {}
protected function getHeaderActions(): array
{
return [
/**
* IMPORT
*/
ActionGroup::make([
ImportAction::make('allgemeinflaechen')
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->importer(ProjektAllgemeinflaechenImporter::class)
->modalHeading('Allgemeinflächen Import')
->modalContent(view('filament.pages.actions.import-allgemeinflaechen'))
->modalContentFooter(view('filament.pages.actions.footer-allgemeinflaechen'))
->label('Allgemeinflächen')
->icon('phosphor-upload')
->extraModalFooterActions([
Action::make('delete')
->label('Tabelle leeren')
->color('danger')
->requiresConfirmation()
->action(function ($record) {
ProjektAllgemeinflaechen::where('projekte_id', $record->id)->delete();
$this->record->refresh();
Notification::make()
->title('Tabelle geleert')
->success()
->send();
}),
])
->options(function ($record) {
return ['projekte_id' => $record->id];
})
->fileRules([
File::types(['csv', 'txt'])->max(1024),
]),
ImportAction::make()
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->importer(ProjektRaeumealleImporter::class)
->modalHeading('Objekte im Detail Import')
->modalContent(view('filament.pages.actions.import-objektemitraeumen'))
->modalContentFooter(view('filament.pages.actions.footer-objektemitraeumen'))
->label('Objekte im Detail')
->icon('phosphor-upload')
->extraModalFooterActions([
Action::make('delete')
->label('Tabellen leeren')
->color('danger')
->requiresConfirmation()
->action(function ($record) {
ProjektRaeumealle::where('projekte_id', $record->id)->delete();
ProjektOrientierungZuAbschlaege::where('projekte_id', $record->id)->delete();
$this->record->refresh();
Notification::make()
->title('Tabellen geleert')
->success()
->send();
}),
])
->options(function ($record) {
return ['projekte_id' => $record->id];
})
->fileRules([
File::types(['csv', 'txt'])->max(1024),
]),
])->label('Importieren')
->icon('phosphor-upload')
->color('info')
->button(),
/**
* FREISCHALTEN
* auth()->user()->konto->guthaben
@@ -77,43 +150,56 @@ class EditProjekte extends EditRecord
}),
/**
* GUTACHTEN
*/
Action::make('gutachten')
->hidden(fn ($record): bool => (! $record->bezahlt_am || ! $record->pdf_gutachten_status) ? true : false)
->color('primary')
->label('Gutachten')
->icon('icon-pdf')
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'file']))
->openUrlInNewTab(),
Action::make('make_gutachten')
->hidden(fn ($record): bool => (! $record->bezahlt_am || $record->pdf_gutachten_status || ! $record->evaluation_gutachten) ? true : false)
->label('Gutachten')
->icon('phosphor-calculator')
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'new']))
->openUrlInNewTab(),
/**
* NUTZWERTE
*/
Action::make('nutzwerte')
->hidden(fn ($record): bool => (! $record->bezahlt_am || ! $record->pdf_nutzwerte_status) ? true : false)
->color('success')
->label('Nutzwerte')
->icon('icon-pdf')
->url(fn ($record) => route('nutzwerte.download', ['record' => $record, 'mode' => 'file']))
->openUrlInNewTab(),
Action::make('make_nutzwerte')
->hidden(fn ($record): bool => (! $record->bezahlt_am || $record->pdf_nutzwerte_status || ! $record->evaluation_gutachten) ? true : false)
->label('Nutzwerte')
->icon('phosphor-calculator')
->url(fn ($record) => route('nutzwerte.download', ['record' => $record, 'mode' => 'new']))
->openUrlInNewTab(),
/**
* EXCEL
* BERECHNEN
*/
ActionGroup::make([
Action::make('make_gutachten')
->hidden(fn ($record): bool => (! $record->bezahlt_am || $record->pdf_gutachten_status || ! $record->evaluation_gutachten) ? true : false)
->label('Gutachten berechnen')
->icon('phosphor-calculator')
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'new']))
->openUrlInNewTab(),
/**
* NUTZWERTE
*/
Action::make('make_nutzwerte')
->hidden(fn ($record): bool => (! $record->bezahlt_am || $record->pdf_nutzwerte_status || ! $record->evaluation_gutachten) ? true : false)
->label('Nutzwerte berechnen')
->icon('phosphor-calculator')
->url(fn ($record) => route('nutzwerte.download', ['record' => $record, 'mode' => 'new']))
->openUrlInNewTab(),
])->label('Berechnen')
->icon('phosphor-calculator')
->color('info')
->button(),
/**
* DOWNLOAD
*/
ActionGroup::make([
/**
* GUTACHTEN
*/
Action::make('download-gutachten')
->hidden(fn ($record): bool => (! $record->bezahlt_am || ! $record->pdf_gutachten_status) ? true : false)
->color('success')
->label('Download Gutachten')
->icon('icon-pdf')
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'file']))
->openUrlInNewTab(),
/**
* NUTZWERTE
*/
Action::make('download-nutzwerte')
->hidden(fn ($record): bool => (! $record->bezahlt_am || ! $record->pdf_nutzwerte_status) ? true : false)
->color('success')
->label('Download Nutzwerte')
->icon('icon-pdf')
->url(fn ($record) => route('nutzwerte.download', ['record' => $record, 'mode' => 'file']))
->openUrlInNewTab(),
/**
* EXCEL
*/
Action::make('excel-nutzflaeche-nutzwerte')
->label('Nutzfläche & Nutzwerte')
->icon('icon-excel')
@@ -126,10 +212,10 @@ class EditProjekte extends EditRecord
->url(fn ($record) => route('excel.download', ['record' => $record, 'mode' => 'file']))
->hidden(fn ($record): bool => (! $record->bezahlt_am || ! $record->evaluation_gutachten) ? true : false)
->openUrlInNewTab(),
])->label('Spreadsheet')
->icon('icon-excel')
->button()
->color('info'),
])->label('Export')
->icon('phosphor-download')
->color('info')
->button(),
DeleteAction::make()->icon('heroicon-o-trash'),
];
}
@@ -48,9 +48,9 @@ class ProjekteResource extends Resource
{
return [
ProjektAllgemeinflaechensRelationManager::class,
ProjektOrientierungZuAbschlaegesRelationManager::class,
ProjektRaeumeallesRelationManager::class,
ProjektMethodesRelationManager::class,
ProjektOrientierungZuAbschlaegesRelationManager::class,
ProjektInhaltsverzeichnisRelationManager::class,
ProjektPlatzhalterRelationManager::class,
];
@@ -2,13 +2,11 @@
namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Filament\Imports\ProjektAllgemeinflaechenImporter;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ImportAction;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
@@ -17,7 +15,6 @@ use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Table;
use Illuminate\Support\HtmlString;
use Illuminate\Validation\Rules\File;
use Livewire\Component;
class ProjektAllgemeinflaechensRelationManager extends RelationManager
@@ -87,19 +84,6 @@ class ProjektAllgemeinflaechensRelationManager extends RelationManager
CreateAction::make()
->icon('phosphor-file-plus')
->createAnother(false),
ImportAction::make()
->importer(ProjektAllgemeinflaechenImporter::class)
->modalHeading('Allgemeinflächen Import')
// ->modalSubmitActionLabel('Yes, delete it')
->label('Hochladen')
->icon('phosphor-upload')
->color('info')
->options([
'projekte_id' => $this->getOwnerRecord()->id,
])
->fileRules([
File::types(['csv', 'txt'])->max(1024),
]),
])
->recordActions([
EditAction::make()->iconButton()
@@ -29,13 +29,13 @@ class ProjektOrientierungZuAbschlaegesRelationManager extends RelationManager
{
protected static string $relationship = 'projekt_orientierung_zu_abschlaeges';
protected static ?string $title = 'Orientierung Zu/Abschläge';
protected static ?string $title = 'Objekte';
protected static ?string $navigationLabel = 'Orientierung Zu/Abschläge';
protected static ?string $navigationLabel = 'Objekte';
protected static ?string $modelLabel = 'Orientierung Zu/Abschläge';
protected static ?string $modelLabel = 'Objekte';
protected static ?string $pluralModelLabel = 'Orientierung Zu/Abschläge';
protected static ?string $pluralModelLabel = 'Objekte';
public function table(Table $table): Table
{
@@ -45,7 +45,7 @@ class ProjektOrientierungZuAbschlaegesRelationManager extends RelationManager
return $table
// ->striped()
->recordTitleAttribute('top_nummer')
->description('Objekte "NiO" (Nicht in Orientierung) sind auch ohne "Type"')
->description('Orientierungen, Zu- und Abschläge')
->columns([
TextColumn::make('top_nummer')
->alignCenter()
@@ -232,7 +232,7 @@ class ProjektOrientierungZuAbschlaegesRelationManager extends RelationManager
Action::make('erstellen')
->action(fn (CreateProjektOrientierungZuAbschlaege $createProjektOrientierungZuAbschlaege) => $createProjektOrientierungZuAbschlaege->create($this->ownerRecord))
->requiresConfirmation()
->modalHeading('Orientierung Zu/Abschläge erstellen')
->modalHeading('Objekte erstellen')
->modalDescription('Alle bestehenden Daten in dieser Tabelle werden vorher gelöscht.')
->modalSubmitActionLabel('Generieren')
->label('Generieren')
@@ -2,7 +2,6 @@
namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Filament\Imports\ProjektRaeumealleImporter;
use App\Models\ProjektRaeumealle;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
@@ -10,7 +9,6 @@ use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ImportAction;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
@@ -22,20 +20,19 @@ use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\HtmlString;
use Illuminate\Validation\Rules\File;
use Livewire\Component;
class ProjektRaeumeallesRelationManager extends RelationManager
{
protected static string $relationship = 'projekt_raeumealles';
protected static ?string $title = 'Räume Alle';
protected static ?string $title = 'Objekte im Detail';
protected static ?string $navigationLabel = 'Räume';
protected static ?string $navigationLabel = 'Objekte im Detail';
protected static ?string $modelLabel = 'Raum';
protected static ?string $modelLabel = 'Objekt im Detail';
protected static ?string $pluralModelLabel = 'Räume';
protected static ?string $pluralModelLabel = 'Objekte';
public function form(Schema $schema): Schema
{
@@ -140,17 +137,6 @@ class ProjektRaeumeallesRelationManager extends RelationManager
CreateAction::make()
->icon('phosphor-file-plus')
->createAnother(false),
ImportAction::make()
->importer(ProjektRaeumealleImporter::class)
->label('Hochladen')
->icon('phosphor-upload')
->color('info')
->options([
'projekte_id' => $this->getOwnerRecord()->id,
])
->fileRules([
File::types(['csv', 'txt'])->max(1024),
]),
])
->recordActions([
EditAction::make()->iconButton()