components([ Grid::make() ->schema([ Section::make(__('lab_tests.sections.info')) ->schema([ TextInput::make('name') ->label(__('lab_tests.fields.name')) ->required() ->maxLength(255), Textarea::make('notes') ->label(__('lab_tests.fields.notes')) ->rows(2) ->columnSpanFull(), Toggle::make('is_default') ->label(__('lab_tests.fields.is_default')), Toggle::make('is_active') ->label(__('lab_tests.fields.is_active')) ->default(true), ]) ->columns(3) ->columnSpanFull() ->footerActions([ fn (string $operation) => Action::make('create') ->label(__('filament-panels::resources/pages/create-record.form.actions.create.label')) ->submit('create') ->keyBindings(['mod+s']) ->visible($operation === 'create'), fn (string $operation) => Action::make('createAnother') ->label(__('filament-panels::resources/pages/create-record.form.actions.create_another.label')) ->action('createAnother') ->keyBindings(['mod+shift+s']) ->color('gray') ->visible($operation === 'create'), fn (string $operation) => Action::make('cancelCreate') ->label(__('filament-panels::resources/pages/create-record.form.actions.cancel.label')) ->url(static::getUrl('index')) ->color('gray') ->visible($operation === 'create'), fn (string $operation) => Action::make('save') ->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label')) ->submit('save') ->keyBindings(['mod+s']) ->visible($operation === 'edit'), fn (string $operation) => Action::make('cancelEdit') ->label(__('filament-panels::resources/pages/edit-record.form.actions.cancel.label')) ->url(static::getUrl('index')) ->color('gray') ->visible($operation === 'edit'), ]), ]) ->columnSpanFull(), ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('name') ->label(__('lab_tests.fields.name')) ->searchable() ->sortable(), IconColumn::make('is_default') ->label(__('lab_tests.fields.is_default')) ->boolean(), IconColumn::make('is_active') ->label(__('lab_tests.fields.is_active')) ->boolean(), TextColumn::make('created_at') ->label(__('lab_tests.fields.created_at')) ->sortable(), ]) ->defaultSort('name') ->recordActions([ EditAction::make(), DeleteAction::make(), ]) ->toolbarActions([ \Filament\Actions\BulkActionGroup::make([ DeleteBulkAction::make(), ]), ]); } public static function getPages(): array { return [ 'index' => Pages\ListLabTests::route('/'), 'create' => Pages\CreateLabTest::route('/create'), 'edit' => Pages\EditLabTest::route('/{record}/edit'), ]; } }