|
2 | 2 |
|
3 | 3 | namespace Moox\Prompts\Filament\Resources; |
4 | 4 |
|
5 | | -use Filament\Actions\BulkActionGroup; |
| 5 | +use Filament\Tables\Table; |
| 6 | +use Filament\Schemas\Schema; |
| 7 | +use Filament\Actions\ViewAction; |
| 8 | +use Filament\Resources\Resource; |
6 | 9 | use Filament\Actions\DeleteAction; |
| 10 | +use Filament\Actions\BulkActionGroup; |
| 11 | +use Filament\Forms\Components\Select; |
7 | 12 | use Filament\Actions\DeleteBulkAction; |
8 | | -use Filament\Actions\ViewAction; |
9 | | -use Filament\Forms\Components\DateTimePicker; |
10 | 13 | use Filament\Forms\Components\KeyValue; |
11 | | -use Filament\Forms\Components\Select; |
12 | 14 | use Filament\Forms\Components\Textarea; |
| 15 | +use Filament\Tables\Columns\TextColumn; |
13 | 16 | use Filament\Forms\Components\TextInput; |
14 | | -use Filament\Resources\Resource; |
15 | 17 | use Filament\Schemas\Components\Section; |
16 | | -use Filament\Schemas\Schema; |
17 | 18 | use Filament\Tables\Columns\BadgeColumn; |
18 | | -use Filament\Tables\Columns\TextColumn; |
19 | 19 | use Filament\Tables\Filters\SelectFilter; |
20 | | -use Filament\Tables\Table; |
21 | | -use Moox\Prompts\Filament\Resources\CommandExecutionResource\Pages; |
22 | 20 | use Moox\Prompts\Models\CommandExecution; |
| 21 | +use Filament\Forms\Components\DateTimePicker; |
| 22 | +use Filament\Schemas\Components\Utilities\Get; |
| 23 | +use Moox\Prompts\Filament\Resources\CommandExecutionResource\Pages; |
23 | 24 |
|
24 | 25 | class CommandExecutionResource extends Resource |
25 | 26 | { |
@@ -65,17 +66,25 @@ public static function form(Schema $schema): Schema |
65 | 66 | ->label(__('moox-prompts::prompts.ui.started_at')) |
66 | 67 | ->required(), |
67 | 68 | DateTimePicker::make('completed_at') |
68 | | - ->label(__('moox-prompts::prompts.ui.completed_at')), |
| 69 | + ->label(__('moox-prompts::prompts.ui.completed_at')) |
| 70 | + ->disabled() |
| 71 | + ->visible(fn (Get $get): bool => $get('status') === 'completed'), |
69 | 72 | DateTimePicker::make('failed_at') |
70 | | - ->label(__('moox-prompts::prompts.ui.failed_at')), |
| 73 | + ->label(__('moox-prompts::prompts.ui.failed_at')) |
| 74 | + ->disabled() |
| 75 | + ->visible(fn (Get $get): bool => $get('status') === 'failed'), |
71 | 76 | TextInput::make('failed_at_step') |
72 | 77 | ->label(__('moox-prompts::prompts.ui.failed_at_step')) |
73 | | - ->disabled(), |
| 78 | + ->disabled() |
| 79 | + ->visible(fn (Get $get): bool => $get('status') === 'failed'), |
74 | 80 | DateTimePicker::make('cancelled_at') |
75 | | - ->label(__('moox-prompts::prompts.ui.cancelled_at')), |
| 81 | + ->label(__('moox-prompts::prompts.ui.cancelled_at')) |
| 82 | + ->disabled() |
| 83 | + ->visible(fn (Get $get): bool => $get('status') === 'cancelled'), |
76 | 84 | TextInput::make('cancelled_at_step') |
77 | 85 | ->label(__('moox-prompts::prompts.ui.cancelled_at_step')) |
78 | | - ->disabled(), |
| 86 | + ->disabled() |
| 87 | + ->visible(fn (Get $get): bool => $get('status') === 'cancelled'), |
79 | 88 | ]) |
80 | 89 | ->columns(2), |
81 | 90 | Section::make(__('moox-prompts::prompts.ui.details')) |
|
0 commit comments