66 lines
2.4 KiB
PHP
66 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Supervisors\Tables;
|
|
|
|
use App\Models\Bookmaker;
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\IconColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Columns\ToggleColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class SupervisorsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('id')->badge(),
|
|
TextColumn::make('name')->searchable(),
|
|
TextColumn::make('type')->badge(),
|
|
TextColumn::make('provider.name')
|
|
->badge()->color(fn (string $state): string => match ($state) {
|
|
'txodds' => 'danger',
|
|
'bestapi' => 'success',
|
|
'direct' => 'primary',
|
|
default => 'warning',
|
|
}),
|
|
TextColumn::make('sport.name')->label('Sport'),
|
|
IconColumn::make('bookmaker_id')
|
|
->label('Book')
|
|
->icon(function ($state): string {
|
|
if ($state) {
|
|
return 'bkm-'.Bookmaker::where('id', $state)->pluck('icon')->first();
|
|
}
|
|
}),
|
|
TextColumn::make('sleep')->numeric(),
|
|
TextColumn::make('runtime'),
|
|
TextColumn::make('lastcall'),
|
|
IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'),
|
|
TextColumn::make('filetype')->badge()->alignCenter(),
|
|
TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
TextColumn::make('updated_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
ToggleColumn::make('is_active')->label('On/Off'),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->recordActions([
|
|
EditAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|