66 lines
2.4 KiB
PHP
66 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Tables;
|
|
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Columns\TextInputColumn;
|
|
use Filament\Tables\Enums\FiltersLayout;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class StatistikoConfigsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('group')->formatStateUsing(fn (string $state): string => match ($state) {
|
|
'gls' => 'Goals',
|
|
'crn' => 'Corner',
|
|
'fls' => 'Fouls',
|
|
'ofs' => 'Offside',
|
|
'crd' => 'Cards',
|
|
'snt' => 'Shots On Target',
|
|
'tsh' => 'Total Shots',
|
|
'all' => 'Method B',
|
|
}),
|
|
TextColumn::make('team')->badge()
|
|
->color(fn (string $state): string => match ($state) {
|
|
'home' => 'info',
|
|
'away' => 'warning',
|
|
}),
|
|
TextColumn::make('varname')
|
|
->formatStateUsing(fn (string $state): string => strtoupper($state)),
|
|
TextInputColumn::make('value')
|
|
->prefix('xx.x')
|
|
->type('number')
|
|
->rules(['required', 'decimal:0.1,10']),
|
|
])
|
|
->filters([
|
|
SelectFilter::make('type')
|
|
->label('Calculation')
|
|
->default('B')
|
|
->options([
|
|
'A' => 'Type A',
|
|
'B' => 'Type B',
|
|
]),
|
|
SelectFilter::make('group')
|
|
->options([
|
|
'gls' => 'Goals',
|
|
'crn' => 'Corner',
|
|
'fls' => 'Fouls Commited',
|
|
'ofs' => 'Offside',
|
|
'crd' => 'Cards',
|
|
'snt' => 'Shots On Target',
|
|
'tsh' => 'Total Shots',
|
|
]),
|
|
SelectFilter::make('team')
|
|
->options([
|
|
'home' => 'Home',
|
|
'away' => 'Away',
|
|
]),
|
|
], layout: FiltersLayout::AboveContent)
|
|
->deferFilters(false);
|
|
}
|
|
}
|