From faa65194faeb66ffd0dcc6fa7d952eaf2e029e1d Mon Sep 17 00:00:00 2001 From: Sven van Ginkel Date: Tue, 17 Dec 2024 22:02:16 +0100 Subject: [PATCH] Add edit option --- app/Filament/Resources/ResultResource.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Filament/Resources/ResultResource.php b/app/Filament/Resources/ResultResource.php index b97148752..e0de63686 100644 --- a/app/Filament/Resources/ResultResource.php +++ b/app/Filament/Resources/ResultResource.php @@ -392,6 +392,22 @@ public static function table(Table $table): Table ->maxLength(500), ]) ->modalButton('Save'), + Tables\Actions\Action::make('updateHealthy') + ->icon('heroicon-o-check-circle') + ->hidden(fn (): bool => ! auth()->user()->is_admin && ! auth()->user()->is_user) + ->hidden(fn (Result $record): bool => $record->status !== ResultStatus::Completed) + ->mountUsing(fn (Forms\ComponentContainer $form, Result $record) => $form->fill([ + 'healthy' => $record->healthy, + ])) + ->action(function (Result $record, array $data): void { + $record->healthy = $data['healthy']; + $record->save(); + }) + ->form([ + Forms\Components\Checkbox::make('healthy') + ->label('Healthy'), + ]) + ->modalButton('Save'), Tables\Actions\DeleteAction::make(), ]), ])