2, 'xl' => 3, ]; public function getHeading(): string|Htmlable|null { return ''; } public function filtersForm(Schema $schema): Schema { return $schema ->components([ Grid::make([ 'default' => 2, 'sm' => 2, 'md' => 3, 'lg' => 4, ]) ->columnSpanFull() ->extraAttributes([ 'class' => 'p-5 bg-blue-50 dark:bg-blue-950 rounded-lg border border-blue-200 dark:border-blue-800', ]) ->schema([ Select::make('league_id') ->prefixIconColor('primary') ->prefixIcon('phosphor-trophy') ->options(fn () => LoadStatisticFixturesLeaguesOptions::load(1)) ->live() ->label('League') ->afterStateUpdated(function (callable $set) { $set('match_id', null); }), Select::make('match_id') ->prefixIconColor('primary') ->prefixIcon('phosphor-calendar-check') ->options(function (Get $get) { return LoadStatisticFixturesMatchOptions::load($get('league_id')); }) ->afterStateUpdated(function (callable $set) { $set('team_id', null); $set('tm_player_id', null); }) ->live() ->label('Events'), Select::make('team_id') ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '') ->prefixIcon('phosphor-users-three') ->disabled(fn (Get $get) => $get('similar_past_matches') != 'none') ->options(function (Get $get) { if ($get('match_id')) { $res = StatisticFixtures::where('id', $get('match_id'))->get(); $arr = []; foreach ($res as $value) { $arr[] = $value->home_id; $arr[] = $value->away_id; } return Element::query()->whereIn('id', $arr)->pluck('name', 'id'); } }) ->afterStateUpdated(function (callable $set) { $set('tm_player_id', null); }) ->live() ->label('Team'), Select::make('team_position') ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '') ->prefixIcon('phosphor-map-pin') ->disabled(fn (Get $get) => $get('similar_past_matches') != 'none') ->default('all') ->selectablePlaceholder(false) ->options([ 'all' => 'All', 'home' => 'Home', 'away' => 'Away', ]), DatePicker::make('start_date') ->native(false) ->prefixIconColor('primary') ->prefixIcon('phosphor-calendar') ->live() ->suffixAction( Action::make('clear_start') ->icon('phosphor-x') ->color('gray') ->action(fn (Set $set) => $set('start_date', null)) ), DatePicker::make('end_date') ->native(false) ->prefixIconColor('primary') ->prefixIcon('phosphor-calendar') ->live() ->suffixAction( Action::make('clear_end') ->icon('phosphor-x') ->color('gray') ->action(fn (Set $set) => $set('end_date', null)) ), Select::make('statistic_type') ->columnSpan([ 'default' => 1, 'xl' => 2, ]) ->prefixIconColor('primary') ->prefixIcon('phosphor-dots-three-outline') ->default('none') ->selectablePlaceholder(false) ->options([ 'gls' => 'Goals', 'crn' => 'Corner', 'fls' => 'Fouls Commited', 'ofs' => 'Offside', 'crd' => 'Cards', 'snt' => 'Shots On Target', 'tsh' => 'Total shots', ]), Select::make('similar_past_matches') ->prefixIconColor('primary') ->prefixIcon('phosphor-approximate-equals') ->suffixAction( Action::make('iconInfo') ->color('gray') ->icon('phosphor-question') ->tooltip(fn () => $this->tooltip_similar_past_matches()) ) ->default('none') ->live() ->selectablePlaceholder(false) ->afterStateUpdated(function (callable $set) { $set('team_id', null); $set('tm_player_id', null); }) ->options([ 'none' => 'None', 'league' => 'League', 'all' => 'All Database', ]), Slider::make('accuracy') ->label('Accuracy max: 0.25, steps: 0.025') ->hiddenLabel() ->disabled(fn (Get $get) => $get('similar_past_matches') == 'none') // ->fillTrack() ->range(minValue: 0, maxValue: 0.25) ->step(0.025) ->decimalPlaces(1) ->decimalPlaces(3) ->tooltips() // ->pips() ->live(), Select::make('tm_player_id') ->label('Player') ->disabled(fn (Get $get) => $get('similar_past_matches') != 'none') ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '') ->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() ->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') or $get('similar_past_matches') != 'none') ->prefixIconColor(fn (Get $get): string => ($get('tm_player_id') and $get('similar_past_matches') == 'none') ? 'primary' : '') ->selectablePlaceholder(false) ->options([ 'all' => 'All', 'lineup' => 'Lineup', 'substituted' => 'Substituted', ]) ->live(), ]), ]); } public function getFooterWidgetsColumns(): int|array { return [ 'default' => 1, 'md' => 2, 'lg' => 4, ]; } protected function getHeaderWidgets(): array { return [ // Events // ChartEvent::make(), // ChartEventMoAv::make(), // Players // ChartPlayer::make(), // ChartPlayerMoAv::make(), ]; } protected function getFooterWidgets(): array { return [ StatsMedianAverage::make(), // Events ChartEvent::make(), ChartEventMoAv::make(), ChartEventPerf::make(), ChartEventPerfMoAv::make(), // Players ChartPlayer::make(), ChartPlayerMoAv::make(), // ChartPlayerPerf::make(), // ChartPlayerPerfMoAv::make(), ]; } protected function tooltip_similar_past_matches(): HtmlString { $str = '
'; $str .= '
None
'; $str .= '
Only selected team within selected league is considered.
'; $str .= '
League
'; $str .= '
All events in seleceted league are considered, filtered expected goal handicap and total parameter in the range of Accuracy Slider setting.
'; $str .= '
All Database
'; $str .= '
Eintire database is considered, filtered expected goal handicap and total parameter in the range of the
Accuracy Slider setting.
'; $str .= '
'; return new HtmlString($str); } }