This commit is contained in:
salam committed 2026-05-27 11:01:08 +02:00
1 parent 6fb6fef00e
commit f5de71de09
1 file changed
+71 -84
+71 -84
View File
@@ -19,7 +19,7 @@ use Filament\Forms\Components\Select;
use Filament\Forms\Components\Slider; use Filament\Forms\Components\Slider;
use Filament\Pages\Dashboard as BaseDashboard; use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm; use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use Filament\Schemas\Components\Fieldset; use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Utilities\Set; use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
@@ -50,14 +50,14 @@ class Statistic extends BaseDashboard
{ {
return $schema return $schema
->components([ ->components([
Fieldset::make('Events') Grid::make([
->dense() 'default' => 2,
->columns([ 'sm' => 2,
'default' => 2, 'md' => 3,
'sm' => 2, 'lg' => 4,
'md' => 3, ])
'lg' => 4, ->columnSpanFull()
])->extraAttributes([ ->extraAttributes([
'class' => 'bg-gray-100 dark:bg-blue-950 rounded-lg p-5 border border-gray-400 dark:border-blue-800', 'class' => 'bg-gray-100 dark:bg-blue-950 rounded-lg p-5 border border-gray-400 dark:border-blue-800',
]) ])
->schema([ ->schema([
@@ -110,78 +110,11 @@ class Statistic extends BaseDashboard
'away' => 'Away', 'away' => 'Away',
]), ]),
Select::make('similar_past_matches')
->prefixIcon('phosphor-align-center-horizontal')
->suffixAction(
Action::make('iconInfo')
->color('gray')
->icon('phosphor-question')
->tooltip(fn () => $this->tooltip_similar_past_matches())
)
->default('none')
->live()
->selectablePlaceholder(false)
->options([
'none' => 'None',
'league' => 'League',
'all' => 'All Database',
]),
Slider::make('accuracy')
->hiddenLabel()
->disabled(fn (Get $get) => $get('similar_past_matches') == 'none')
->fillTrack()
->default(5)
->step(0.1)
->decimalPlaces(1)
->tooltips()
->range(minValue: 0, maxValue: 1)
->pips()
->live(),
])->columns(6)
->columnSpanFull(),
Fieldset::make('Player')
->dense()
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
->columns([
'default' => 2,
'sm' => 2,
'md' => 3,
'lg' => 4,
])->extraAttributes([
'class' => 'bg-gray-100 dark:bg-blue-950 rounded-lg p-5 border border-gray-400 dark:border-blue-800',
])
->schema([
Select::make('tm_player_id')
->label('Player')
->prefixIcon('icon-player')
->suffixAction(
Action::make('copyCostToPrice')
->action(function (callable $set) {
$set('tm_player_id', null);
$set('player_on_field', null);
})
->color('gray')
->icon('phosphor-x'),
)
->preload()
// ->searchable()
->options(function (Get $get) {
return StatistikoDetail::where('txodds_id', $get('team_id'))->pluck('name', 'tm_player_id');
})
->live(),
Select::make('player_on_field')
->label('Time on field')
->prefixIcon('phosphor-watch')
->default('all')
->disabled(fn (Get $get) => ! $get('tm_player_id'))
->selectablePlaceholder(false)
->options([
'all' => 'All',
'lineup' => 'Lineup',
'substituted' => 'Substituted',
])
->live(),
Select::make('statistic_type') Select::make('statistic_type')
->columnSpan([
'default' => 1,
'xl' => 2,
])
->prefixIcon('phosphor-cell-signal-full') ->prefixIcon('phosphor-cell-signal-full')
->default('none') ->default('none')
->selectablePlaceholder(false) ->selectablePlaceholder(false)
@@ -194,7 +127,6 @@ class Statistic extends BaseDashboard
'snt' => 'Shot on target', 'snt' => 'Shot on target',
'tsh' => 'Total shots', 'tsh' => 'Total shots',
]), ]),
DatePicker::make('start_date') DatePicker::make('start_date')
->native(false) ->native(false)
->prefixIcon('phosphor-calendar') ->prefixIcon('phosphor-calendar')
@@ -215,9 +147,64 @@ class Statistic extends BaseDashboard
->color('gray') ->color('gray')
->action(fn (Set $set) => $set('end_date', null)) ->action(fn (Set $set) => $set('end_date', null))
), ),
])->columns(5) Select::make('similar_past_matches')
->columnSpanFull(), ->prefixIcon('phosphor-align-center-horizontal')
->suffixAction(
Action::make('iconInfo')
->color('gray')
->icon('phosphor-question')
->tooltip(fn () => $this->tooltip_similar_past_matches())
)
->default('none')
->live()
->selectablePlaceholder(false)
->options([
'none' => 'None',
'league' => 'League',
'all' => 'All Database',
]),
Slider::make('accuracy')
->hiddenLabel()
->disabled(fn (Get $get) => $get('similar_past_matches') == 'none')
// ->fillTrack()
->default(5)
->step(0.1)
->decimalPlaces(1)
->tooltips()
->range(minValue: 0, maxValue: 1)
->pips()
->live(),
Select::make('tm_player_id')
->label('Player')
->prefixIcon('icon-player')
->suffixAction(
Action::make('copyCostToPrice')
->action(function (callable $set) {
$set('tm_player_id', null);
$set('player_on_field', null);
})
->color('gray')
->icon('phosphor-x'),
)
->preload()
// ->searchable()
->options(function (Get $get) {
return StatistikoDetail::where('txodds_id', $get('team_id'))->pluck('name', 'tm_player_id');
})
->live(),
Select::make('player_on_field')
->label('Time on field')
->prefixIcon('phosphor-watch')
->default('all')
->disabled(fn (Get $get) => ! $get('tm_player_id'))
->selectablePlaceholder(false)
->options([
'all' => 'All',
'lineup' => 'Lineup',
'substituted' => 'Substituted',
])
->live(),
]),
]); ]);
} }