76 lines
2.8 KiB
PHP
76 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables;
|
|
|
|
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('match_id'),
|
|
TextColumn::make('league.name')
|
|
->searchable()
|
|
->copyable()
|
|
->copyMessage('Liga name copied')
|
|
->description(fn ($record) => ucwords($record->league?->country->name))
|
|
->copyMessageDuration(1500),
|
|
TextColumn::make('home.name')
|
|
->searchable()
|
|
->copyable()
|
|
->copyMessage('Home team name copied')
|
|
->copyMessageDuration(1500),
|
|
TextColumn::make('away.name')
|
|
->searchable()
|
|
->copyable()
|
|
->copyMessage('Away team name copied')
|
|
->copyMessageDuration(1500),
|
|
TextColumn::make('starttime')->dateTime('d.m.Y H:i'),
|
|
|
|
])
|
|
->filters([
|
|
// when we do another sport make all filter depending on sport
|
|
// SelectFilter::make('sport_id')
|
|
// ->options(fn () => Sport::getSportForClient(auth()->user()->client_id))
|
|
// ->label('Sport'),
|
|
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(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|