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'),
];
}