64 lines
2.1 KiB
PHP
64 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables;
|
|
|
|
use App\Models\Sport;
|
|
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\Enums\FiltersLayout;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class StatistikoEventsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->poll('10sec')
|
|
->striped()
|
|
->columns([
|
|
IconColumn::make('sport_id')
|
|
->label('')
|
|
->icon(fn (string $state): string => match ($state) {
|
|
'1' => 'icon-soccerball',
|
|
}),
|
|
TextColumn::make('league.name')->searchable(),
|
|
TextColumn::make('home.name')->searchable(),
|
|
TextColumn::make('away.name')->searchable(),
|
|
TextColumn::make('starttime')->dateTime('d. m. Y H:i'),
|
|
|
|
])
|
|
->filters([
|
|
SelectFilter::make('sport_id')
|
|
->default(1)
|
|
->label('Sport')
|
|
->preload()
|
|
->options(Sport::where('is_active', 1)->pluck('name', 'id')),
|
|
SelectFilter::make('league_id')
|
|
->relationship('league', 'name')
|
|
->searchable()
|
|
->label('League'),
|
|
SelectFilter::make('home_id')
|
|
->relationship('home', 'name')
|
|
->searchable()
|
|
->label('Home'),
|
|
SelectFilter::make('away_id')
|
|
->relationship('away', 'name')
|
|
->searchable()
|
|
->label('Away'),
|
|
], layout: FiltersLayout::AboveContent)
|
|
->deferFilters(false)
|
|
->recordActions([
|
|
EditAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|