62 lines
2.2 KiB
PHP
62 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Supervisors\Tables;
|
|
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\SelectColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Columns\ToggleColumn;
|
|
use Filament\Tables\Enums\FiltersLayout;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class SupervisorsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->striped()
|
|
->columns([
|
|
TextColumn::make('id')->badge(),
|
|
TextColumn::make('provider.name')->badge()
|
|
->color(fn ($record): string => match ($record->provider_id) {
|
|
1 => 'danger',
|
|
2 => 'success',
|
|
default => 'warning',
|
|
}),
|
|
SelectColumn::make('name')
|
|
->options([
|
|
'Fixtures' => 'Fixtures',
|
|
'Odds' => 'Odds',
|
|
'Willhill' => 'Willhill',
|
|
'Bwin' => 'Bwin',
|
|
'Bet365' => 'Bet365',
|
|
'Betfair' => 'Betfair',
|
|
]),
|
|
TextColumn::make('sport.name')->label('Sport')->color(fn ($record): string => $record->sport->color),
|
|
TextColumn::make('sleep')->numeric(),
|
|
TextColumn::make('runtime')->label('Run Time'),
|
|
TextColumn::make('maxsconds')->label('Max Time'),
|
|
TextColumn::make('lastcall'),
|
|
ToggleColumn::make('is_cron')->label('Cron'),
|
|
ToggleColumn::make('is_active')->label('On/Off'),
|
|
])
|
|
->filters([
|
|
SelectFilter::make('provider_id')
|
|
->relationship('provider', 'name')
|
|
->label('Provider'),
|
|
], layout: FiltersLayout::AboveContent)
|
|
->deferFilters(false)
|
|
->recordActions([
|
|
EditAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|