action evaluation

This commit is contained in:
salam committed 2025-10-20 16:57:50 +02:00
1 parent d473bdc2b3
commit 9eb19cf8fd
13 files changed
+297 -132

No files matched your search

@@ -17,9 +17,12 @@ class EditProjekte extends EditRecord
{
protected static string $resource = ProjekteResource::class;
#[On('refreshAllgemeinflaechen')]
#[On('refreshAllgemeinflaechen'), On('refreshRaeumealle'), On('refreshMethods'), On('refreshOrientierung')]
public function refresh(): void {}
// #[On('refreshRaeumealle')]
// public function refresh(): void {}
protected function getHeaderActions(): array
{
return [
@@ -63,6 +66,15 @@ class EditProjekte extends EditRecord
/**
* GUTACHTEN
*/
Action::make('evaluate_gutachten')
->hidden(fn ($record): bool => $record->bezahlt_am && ! $record->evaluation_gutachten ? false : true)
->color('success')
->label('Evaluieren')
->icon('phosphor-eye')
->action(function ($record): void {
GutachtenValidation::controll($record);
$this->record->refresh();
}),
ActionGroup::make([
Action::make('gutachten')
->disabled(fn ($record): bool => ! $record->pdf_gutachten_status)
@@ -71,36 +83,21 @@ class EditProjekte extends EditRecord
1 => 'info',
default => 'gray',
})
->label('3) Herunterladen')
->icon('phosphor-file-pdf')
->label('Öffnen')
->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 ? false : true)
->color(fn ($record): string => match ($record->evaluation) {
->color(fn ($record): string => match ($record->evaluation_gutachten) {
1 => 'info',
default => 'gray',
})
->disabled(fn ($record): bool => $record->evaluation ? false : true)
->label('2) Generieren')
->icon('phosphor-math-operations')
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
->label('Berechnen')
->icon('phosphor-calculator')
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'new']))
->openUrlInNewTab(),
Action::make('evaluate_gutachten')
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->color(fn ($record): string => match ($record->evaluation) {
1 => 'success',
default => 'primary',
})
->label('1) Evaluieren')
->icon(fn ($record): string => match ($record->evaluation) {
1 => 'phosphor-check',
default => 'phosphor-eye',
})
->action(function ($record): void {
GutachtenValidation::controll($record);
$this->record->refresh();
}),
])->label('Gutachten')
->icon('heroicon-m-ellipsis-vertical')
->button()
@@ -116,13 +113,14 @@ class EditProjekte extends EditRecord
1 => 'info',
default => 'gray',
})
->label('Herunterladen')
->icon('phosphor-file-pdf')
->label('Öffnen')
->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 ? false : true)
->label('Neu Berechnen')
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
->label('Berechnen')
->icon('phosphor-calculator')
->url(fn ($record) => route('nutzwerte.download', ['record' => $record, 'mode' => 'new']))
->openUrlInNewTab(),
@@ -136,12 +134,14 @@ class EditProjekte extends EditRecord
ActionGroup::make([
Action::make('excel-nutzflaeche-nutzwerte')
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
->label('Nutzfläche & Nutzwerte')
->icon('icon-excel')
->url(fn ($record) => route('excel.download', ['record' => $record, 'mode' => 'file']))
->openUrlInNewTab(),
Action::make('excel-nutzflaechen-aufstellung')
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
->label('Nutzflächen Aufstellung')
->icon('icon-excel')
->url(fn ($record) => route('excel.download', ['record' => $record, 'mode' => 'file']))