From 83ad9f5a16edea4f46741db6c784af997911ce01 Mon Sep 17 00:00:00 2001 From: Callum Axon Date: Mon, 30 Dec 2024 13:08:28 +0000 Subject: [PATCH] fix: sort solo endorsement table by expires_at by default --- app/Filament/Resources/SoloEndorsementResource.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Filament/Resources/SoloEndorsementResource.php b/app/Filament/Resources/SoloEndorsementResource.php index 3a41b1396..bbe6b1305 100644 --- a/app/Filament/Resources/SoloEndorsementResource.php +++ b/app/Filament/Resources/SoloEndorsementResource.php @@ -45,7 +45,7 @@ public static function table(Table $table): Table Tables\Columns\TextColumn::make('endorsable.description')->label('Position'), Tables\Columns\TextColumn::make('duration')->getStateUsing(fn ($record) => $record->expires_at->diffInDays($record->created_at).' days')->label('Duration'), Tables\Columns\TextColumn::make('created_at')->label('Started At')->isoDateTimeFormat('lll'), - Tables\Columns\TextColumn::make('expires_at')->label('Expires At')->isoDateTimeFormat('lll'), + Tables\Columns\TextColumn::make('expires_at')->label('Expires At')->isoDateTimeFormat('lll')->sortable(), Tables\Columns\TextColumn::make('status')->label('Status')->badge() ->getStateUsing(fn ($record) => $record->expires_at->isPast() ? 'Expired' : 'Active') ->color( @@ -56,6 +56,7 @@ public static function table(Table $table): Table } ), ]) + ->defaultSort('expires_at', 'desc') ->filters([ Tables\Filters\TernaryFilter::make('expires_at') ->label('Endorsement Expiry Status')