diff --git a/src/app/Filament/Resources/ParticipantResource.php b/src/app/Filament/Resources/ParticipantResource.php
index 3f613d9..d37bb6a 100644
--- a/src/app/Filament/Resources/ParticipantResource.php
+++ b/src/app/Filament/Resources/ParticipantResource.php
@@ -117,15 +117,9 @@ public static function table(Table $table): Table
->placeholder('—')
->fontFamily('mono')
->alignCenter(),
- Tables\Columns\BadgeColumn::make('status')
- ->formatStateUsing(fn (string $state): string => Participant::statuses()[$state] ?? $state)
- ->colors([
- 'gray' => 'ready',
- 'info' => 'running',
- 'success' => 'finished',
- 'warning' => 'pit',
- 'danger' => 'dnf',
- ]),
+ Tables\Columns\SelectColumn::make('status')
+ ->options(Participant::statuses())
+ ->selectablePlaceholder(false),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated')
->dateTime('H:i:s')
@@ -137,14 +131,69 @@ public static function table(Table $table): Table
->options(Participant::statuses()),
])
->actions([
- Tables\Actions\EditAction::make(),
+ Tables\Actions\Action::make('quickEdit')
+ ->label('Quick Edit')
+ ->icon('heroicon-o-bolt')
+ ->color('warning')
+ ->modalHeading(fn ($record) => 'Quick Edit: ' . $record->name)
+ ->modalWidth('md')
+ ->form([
+ Forms\Components\Select::make('status')
+ ->options(Participant::statuses())
+ ->required(),
+ Forms\Components\Grid::make(3)
+ ->schema([
+ Forms\Components\TextInput::make('time_minutes')
+ ->label('Min')
+ ->numeric()
+ ->minValue(0)
+ ->maxValue(59)
+ ->placeholder('MM'),
+ Forms\Components\TextInput::make('time_seconds')
+ ->label('Sec')
+ ->numeric()
+ ->minValue(0)
+ ->maxValue(59)
+ ->placeholder('SS'),
+ Forms\Components\TextInput::make('time_milliseconds')
+ ->label('Ms')
+ ->numeric()
+ ->minValue(0)
+ ->maxValue(999)
+ ->placeholder('ms'),
+ ]),
+ ])
+ ->fillForm(fn ($record) => [
+ 'status' => $record->status,
+ 'time_minutes' => $record->best_time_ms ? floor($record->best_time_ms / 60000) : null,
+ 'time_seconds' => $record->best_time_ms ? floor(($record->best_time_ms % 60000) / 1000) : null,
+ 'time_milliseconds' => $record->best_time_ms ? $record->best_time_ms % 1000 : null,
+ ])
+ ->action(function ($record, array $data) {
+ $minutes = $data['time_minutes'] ?? null;
+ $seconds = $data['time_seconds'] ?? null;
+ $milliseconds = $data['time_milliseconds'] ?? null;
+
+ $bestTimeMs = null;
+ if ($minutes !== null || $seconds !== null || $milliseconds !== null) {
+ $bestTimeMs = ((int)$minutes * 60000) + ((int)$seconds * 1000) + (int)$milliseconds;
+ }
+
+ $record->update([
+ 'status' => $data['status'],
+ 'best_time_ms' => $bestTimeMs,
+ ]);
+ }),
+ Tables\Actions\EditAction::make()
+ ->label('Full Edit'),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
- ]);
+ ])
+ ->poll('5s');
}
public static function getRelations(): array
diff --git a/src/resources/views/leaderboard.blade.php b/src/resources/views/leaderboard.blade.php
index 7bf2d26..5541c45 100644
--- a/src/resources/views/leaderboard.blade.php
+++ b/src/resources/views/leaderboard.blade.php
@@ -99,8 +99,32 @@
+
+
+
+
+
+ POS
+
+
+
+
+ DRIVER
+
+
+
+ STATUS
+
+
+
+ TIME
+
+
+
+
+
-
+
@if($participants->isEmpty())
@@ -156,7 +180,7 @@
-
+
@if($participant->number)
@@ -166,16 +190,21 @@
{{ $participant->name }}
-
+
+
+
+
@if($statusBadge)
-
+
{{ $statusBadge[1] }}
+ @else
+ READY
@endif
-
+
@if($timeDisplay)
{{ $timeDisplay }}