fix: use IconEntry for boolean fields in StationResource infolist

This commit is contained in:
Ovidiu U
2026-04-04 14:28:51 +01:00
parent 52dc225b3d
commit a3288955d8

View File

@@ -6,6 +6,7 @@ use App\Filament\Resources\StationResource\Pages\ListStations;
use App\Filament\Resources\StationResource\Pages\ViewStation; use App\Filament\Resources\StationResource\Pages\ViewStation;
use App\Models\Station; use App\Models\Station;
use Filament\Actions\ViewAction; use Filament\Actions\ViewAction;
use Filament\Infolists\Components\IconEntry;
use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Schemas\Components\Section; use Filament\Schemas\Components\Section;
@@ -71,26 +72,10 @@ class StationResource extends Resource
TextEntry::make('country'), TextEntry::make('country'),
])->columns(3), ])->columns(3),
Section::make('Status')->schema([ Section::make('Status')->schema([
TextEntry::make('is_supermarket') IconEntry::make('is_supermarket')->boolean(),
->label('Supermarket') IconEntry::make('is_motorway_service_station')->boolean(),
->badge() IconEntry::make('temporary_closure')->boolean()->trueColor('warning'),
->formatStateUsing(fn (bool $state) => $state ? 'Yes' : 'No') IconEntry::make('permanent_closure')->boolean()->trueColor('danger'),
->color(fn (bool $state) => $state ? 'success' : 'gray'),
TextEntry::make('is_motorway_service_station')
->label('Motorway')
->badge()
->formatStateUsing(fn (bool $state) => $state ? 'Yes' : 'No')
->color(fn (bool $state) => $state ? 'success' : 'gray'),
TextEntry::make('temporary_closure')
->label('Temp Closed')
->badge()
->formatStateUsing(fn (bool $state) => $state ? 'Yes' : 'No')
->color(fn (bool $state) => $state ? 'warning' : 'success'),
TextEntry::make('permanent_closure')
->label('Permanently Closed')
->badge()
->formatStateUsing(fn (bool $state) => $state ? 'Yes' : 'No')
->color(fn (bool $state) => $state ? 'danger' : 'success'),
TextEntry::make('permanent_closure_date')->date()->placeholder('—'), TextEntry::make('permanent_closure_date')->date()->placeholder('—'),
TextEntry::make('last_seen_at')->dateTime('d M Y H:i'), TextEntry::make('last_seen_at')->dateTime('d M Y H:i'),
])->columns(3), ])->columns(3),