fix h&R detail

This commit is contained in:
xiaomlove
2025-01-27 14:07:44 +08:00
parent e48932d74d
commit efb635c12b
3 changed files with 67 additions and 7 deletions

View File

@@ -5,9 +5,11 @@ namespace App\Filament\Resources\User;
use App\Filament\Resources\User\HitAndRunResource\Pages;
use App\Filament\Resources\User\HitAndRunResource\RelationManagers;
use App\Models\HitAndRun;
use App\Models\User;
use App\Repositories\HitAndRunRepository;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Infolists\Infolist;
use Filament\Resources\Resource;
use Filament\Tables\Table;
use Filament\Tables;
@@ -16,6 +18,8 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\HtmlString;
use Filament\Infolists\Components;
use Filament\Infolists;
class HitAndRunResource extends Resource
{
@@ -87,6 +91,51 @@ class HitAndRunResource extends Resource
]);
}
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
Infolists\Components\TextEntry::make('id'),
Infolists\Components\TextEntry::make('statusText')
->label(__("label.status"))
,
Infolists\Components\TextEntry::make('uid')
->formatStateUsing(fn ($record) => username_for_admin($record->uid))
->label(__("label.username"))
,
Infolists\Components\TextEntry::make('torrent_id')
->formatStateUsing(fn ($record) => $record->torrent->name)
->label(__("label.torrent.label"))
,
Infolists\Components\TextEntry::make('snatch.uploadedText')
->label(__("label.uploaded"))
,
Infolists\Components\TextEntry::make('snatch.downloadedText')
->label(__("label.downloaded"))
,
Infolists\Components\TextEntry::make('snatch.shareRatio')
->label(__("label.ratio"))
,
Infolists\Components\TextEntry::make('seedTimeRequired')
->label(__("label.seed_time_required"))
,
Infolists\Components\TextEntry::make('inspectTimeLeft')
->label(__("label.inspect_time_left"))
,
Infolists\Components\TextEntry::make('comment')
->formatStateUsing(fn ($record) => nl2br($record->comment))
->label(__("label.comment"))
,
Infolists\Components\TextEntry::make('created_at')
->label(__("label.created_at"))
,
Infolists\Components\TextEntry::make('updated_at')
->label(__("label.updated_at"))
,
])->columns(4);
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()->with(['user', 'torrent', 'snatch', 'torrent.basic_category']);