columns([ TextColumn::make('predicted_for') ->date('d M Y') ->sortable(), TextColumn::make('source') ->badge() ->formatStateUsing(fn (PredictionSource $state) => strtoupper($state->value)) ->color(fn (PredictionSource $state) => match ($state) { PredictionSource::Llm => 'success', PredictionSource::Ewma => 'info', }), TextColumn::make('direction') ->badge() ->color(fn (TrendDirection $state) => match ($state) { TrendDirection::Rising => 'danger', TrendDirection::Falling => 'success', TrendDirection::Flat => 'gray', }), TextColumn::make('confidence') ->suffix('%') ->sortable(), TextColumn::make('reasoning') ->limit(60) ->placeholder('—'), TextColumn::make('generated_at') ->dateTime('d M Y H:i') ->sortable(), ]) ->defaultSort('predicted_for', 'desc') ->filters([ SelectFilter::make('source') ->options([ PredictionSource::Llm->value => 'LLM', PredictionSource::Ewma->value => 'EWMA', ]), SelectFilter::make('direction') ->options([ TrendDirection::Rising->value => 'Rising', TrendDirection::Falling->value => 'Falling', TrendDirection::Flat->value => 'Flat', ]), Filter::make('predicted_for') ->schema([ DatePicker::make('from')->label('From'), DatePicker::make('until')->label('Until'), ]) ->query(function (Builder $query, array $data) { $query ->when($data['from'], fn ($q, $d) => $q->whereDate('predicted_for', '>=', $d)) ->when($data['until'], fn ($q, $d) => $q->whereDate('predicted_for', '<=', $d)); }), ]) ->recordActions([ ViewAction::make(), ]); } public static function infolist(Schema $schema): Schema { return $schema->components([ Section::make('Prediction')->schema([ TextEntry::make('predicted_for')->date('d M Y'), TextEntry::make('source') ->badge() ->formatStateUsing(fn (PredictionSource $state) => strtoupper($state->value)) ->color(fn (PredictionSource $state) => match ($state) { PredictionSource::Llm => 'success', PredictionSource::Ewma => 'info', }), TextEntry::make('direction') ->badge() ->color(fn (TrendDirection $state) => match ($state) { TrendDirection::Rising => 'danger', TrendDirection::Falling => 'success', TrendDirection::Flat => 'gray', }), TextEntry::make('confidence')->suffix('%'), TextEntry::make('generated_at')->dateTime('d M Y H:i:s'), ])->columns(3), Section::make('Reasoning')->schema([ TextEntry::make('reasoning') ->columnSpanFull() ->placeholder('No reasoning recorded'), ]), ]); } public static function getPages(): array { return [ 'index' => ListOilPredictions::route('/'), 'view' => ViewOilPrediction::route('/{record}'), ]; } }