From 4a94a7e40cf1bf9c6233c5db0f762f5517c17043 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Thu, 30 May 2024 23:03:25 +0300 Subject: [PATCH] fixes and improvements for grading and disable searchable for counts column --- src/Fields/Classes/TextInput.php | 2 +- src/Fields/FieldsContract.php | 2 +- src/Filament/Resources/FormResource.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Fields/Classes/TextInput.php b/src/Fields/Classes/TextInput.php index 68820931..89a4f231 100644 --- a/src/Fields/Classes/TextInput.php +++ b/src/Fields/Classes/TextInput.php @@ -152,7 +152,7 @@ public function appendFilamentComponentsOptions($component, $zeusField, bool $ha parent::appendFilamentComponentsOptions($component, $zeusField, $hasVisibility); if (! empty($zeusField['options']['dateType'])) { - call_user_func([$component, $zeusField['options']['dateType']]); + call_user_func([$component, optional($zeusField['options'])['dateType'] ?? 'string']); } if (isset($zeusField->options['prefix']) && $zeusField->options['prefix'] !== null) { diff --git a/src/Fields/FieldsContract.php b/src/Fields/FieldsContract.php index 06b28585..925be456 100644 --- a/src/Fields/FieldsContract.php +++ b/src/Fields/FieldsContract.php @@ -94,7 +94,7 @@ public function appendFilamentComponentsOptions($component, $zeusField, bool $ha return null; } - return $zeusField->options['grades']['points'] . ' ' . __('marks'); + return optional($zeusField->options)['grades']['points'] ?? 0 . ' ' . __('marks'); }) ->helperText($zeusField->description); diff --git a/src/Filament/Resources/FormResource.php b/src/Filament/Resources/FormResource.php index b5c0ba43..ac697685 100644 --- a/src/Filament/Resources/FormResource.php +++ b/src/Filament/Resources/FormResource.php @@ -157,8 +157,8 @@ public static function table(Table $table): Table IconColumn::make('is_active')->boolean()->label(__('Is Active'))->sortable()->toggleable(), TextColumn::make('start_date')->dateTime()->searchable()->sortable()->label(__('Start Date'))->toggleable(isToggledHiddenByDefault: true), TextColumn::make('end_date')->dateTime()->searchable()->sortable()->label(__('End Date'))->toggleable(isToggledHiddenByDefault: true), - IconColumn::make('responses_exists')->boolean()->exists('responses')->label(__('Responses Exists'))->sortable()->toggleable(), - TextColumn::make('responses_count')->counts('responses')->label(__('Responses Count'))->sortable()->toggleable(), + IconColumn::make('responses_exists')->boolean()->exists('responses')->label(__('Responses Exists'))->sortable()->toggleable()->searchable(false), + TextColumn::make('responses_count')->counts('responses')->label(__('Responses Count'))->sortable()->toggleable()->searchable(false), ]) ->actions(static::getActions()) ->filters([