components([ Section::make() ->compact() ->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'); } }) ->preload() ->searchable() ->label('Team'), 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(4) ->columnSpanFull(), Section::make() ->compact() ->schema([ Select::make('tm_player_id') ->label('Player') ->prefixIcon('icon-player') ->options([ 'draft' => 'Sep Maier', ]) ->preload() ->searchable() ->live(), Select::make('team_position') ->prefixIcon('phosphor-map-pin') ->suffixAction( Action::make('iconInfo') ->color('gray') ->icon('phosphor-question') ->tooltip('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.') ) ->default('all') ->selectablePlaceholder(false) ->options([ 'all' => 'All', 'home' => 'Home', 'away' => 'Away', ]), Select::make('statistic_type') ->prefixIcon('phosphor-cell-signal-full') ->suffixAction( Action::make('iconInfo') ->color('gray') ->icon('phosphor-question') ->tooltip('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.') ) ->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('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.') ) ->default('none') ->live() ->selectablePlaceholder(false) ->options([ 'none' => 'None', 'league' => 'League', 'all' => 'All Database', ]), Slider::make('accuracy') ->disabled(fn (Get $get) => $get('similar_past_matches') == 'none') ->extraAttributes([ 'class' => 'pointer-events-none', // Disables cursor interaction ]) ->reactive() ->fillTrack() ->default(0.5) ->decimalPlaces(1) ->tooltips() ->range(minValue: 0, maxValue: 1), // ->pips(), ])->columns(5) ->columnSpanFull(), ]); } public function update() { dd($this->filter); } protected function getFooterWidgets(): array { return [ MedianAverageWidget::make(), PunctualChart::make(), MovingAverageChart::make(), ]; } }