user()->konto->guthaben */ Action::make('freischalten') ->hidden(fn ($record): bool => $record->bezahlt_am ? true : false) ->visible(fn (): bool => auth()->user()->konto->guthaben) ->requiresConfirmation() ->modalHeading('Gutachten freischalten?') ->tooltip('Von Ihrem Guthaben wird ein Punkt abgezogen.') ->modalIcon('phosphor-coins') ->modalDescription('Von Ihrem Guthaben wird ein Punkt abgezogen.') ->modalSubmitActionLabel('Bezahlen') ->action(function ($record) { if (Konto::where('id', $record['konto_id'])->where('guthaben', '>', 0)->get()) { Konto::where('id', $record['konto_id'])->decrement('guthaben', 1); Projekte::where('id', $record['id'])->update(['bezahlt_am' => \Carbon\Carbon::now()]); $this->record->refresh(); Notification::make() ->title('Gutachten freischaltet') ->success() ->send(); } }), Action::make('bezahlen') ->color('danger') ->hidden(fn ($record): bool => $record->bezahlt_am ? true : false) ->visible(fn (): bool => ! auth()->user()->konto->guthaben) ->label('Konto laden') ->tooltip('Konto laden um Gutachten freizuschalten.') ->requiresConfirmation() ->modalHeading('Kein Guthaben') ->modalIcon('heroicon-o-exclamation-triangle') ->modalDescription('Bitte laden sie Ihr Konto auf') ->modalSubmitActionLabel('Konto aufladen'), /** * EVALUATE */ 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(); }), /** * 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 */ ActionGroup::make([ Action::make('excel-nutzflaeche-nutzwerte') ->label('Nutzfläche & Nutzwerte') ->icon('icon-excel') ->url(fn ($record) => route('excel.download', ['record' => $record, 'mode' => 'file'])) ->hidden(fn ($record): bool => (! $record->bezahlt_am || ! $record->evaluation_gutachten) ? true : false) ->openUrlInNewTab(), Action::make('excel-nutzflaechen-aufstellung') ->label('Nutzflächen Aufstellung') ->icon('icon-excel') ->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'), DeleteAction::make()->icon('heroicon-o-trash'), ]; } protected function getSavedNotificationTitle(): ?string { return 'Projekt Änderungen gespeichert'; } }