components([ Grid::make() ->schema([ Select::make('league_id') ->prefixIcon('phosphor-trophy') ->options(fn () => LoadStatisticFixturesLeaguesOptions::load(1)) ->preload() ->searchable() ->live() ->label('League') ->afterStateUpdated(function (callable $set) { $set('team_id', null); }), Select::make('team_id') ->prefixIcon('icon-team') ->options(function (Get $get) { if ($get('league_id')) { $res = StatisticFixtures::where('league_id', $get('league_id'))->get(); $arr = []; foreach ($res as $value) { $arr[] = $value->home_id; $arr[] = $value->away_id; } $arr = array_unique($arr); return Element::query()->whereIn('id', $arr)->orderBy('name')->pluck('name', 'id'); } }) ->afterStateUpdated(function (callable $set) { $set('tm_player_id', null); }) ->preload() ->searchable() ->live() ->label('Team'), Select::make('team_position') ->prefixIcon('phosphor-map-pin') ->default('all') ->selectablePlaceholder(false) ->options([ 'all' => 'All', 'home' => 'Home', 'away' => 'Away', ]), DatePicker::make('start_date') ->native(false) ->prefixIcon('phosphor-calendar') ->suffixAction( Action::make('clear_start') ->icon('phosphor-x') ->color('gray') ->action(fn (Set $set) => $set('start_date', null)) ), DatePicker::make('end_date') ->native(false) ->prefixIcon('phosphor-calendar') ->suffixAction( Action::make('clear_end') ->icon('phosphor-x') ->color('gray') ->action(fn (Set $set) => $set('end_date', null)) ), ])->columns(5) ->columnSpanFull(), Grid::make() ->schema([ Select::make('tm_player_id') ->label('Player') ->prefixIcon('icon-player') ->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') ->prefixIcon('phosphor-watch') ->default('all') ->selectablePlaceholder(false) ->options([ 'all' => 'All', 'lineup' => 'Lineup', 'substituted' => 'Substituted', ]), Select::make('statistic_type') ->prefixIcon('phosphor-cell-signal-full') ->default('none') ->selectablePlaceholder(false) ->options([ 'gls' => 'Goals', 'crn' => 'Corner', 'fls' => 'Fouls commited', 'ofs' => 'Offside', 'crd' => 'Cards', 'snt' => 'Shot on target', 'tsh' => 'Total shots', ]), 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', ]), Select::make('accuracy') ->disabled(fn (Get $get) => $get('similar_past_matches') == 'none') ->default(0.5) ->options([ '0.1' => '0.1', '0.2' => '0.2', '0.3' => '0.3', '0.4' => '0.4', '0.5' => '0.5', '0.6' => '0.6', '0.7' => '0.7', '0.8' => '0.8', '0.9' => '0.9', '1' => '1.0', ]) ->native(false), // Slider::make('accuracy') // ->disabled(fn (Get $get) => $get('similar_past_matches') == 'none') // ->fillTrack() // ->default(5) // ->step(0.1) // ->decimalPlaces(1) // ->tooltips() // ->range(minValue: 0, maxValue: 1) // ->pips(), ])->columns(5) ->columnSpanFull(), ]); } protected function getFooterWidgets(): array { return [ MedianAverage::make(), PunctualChart::make(), MovingAverageChart::make(), PunctualChartPlayer::make(), // MovingAverageChartPlayer::make(), ]; } protected function tooltip_similar_past_matches(): HtmlString { $str = '