2, 'xl' => 3, ]; public function resetFilters(): void { $filters = array_keys($this->filters); foreach($filters as $filter){ switch($filter){ case 'similar_past_matches': $this->filters[$filter] = 'none'; break; case 'team_position': $this->filters[$filter] = 'all'; break; case 'statistic_type': $this->filters[$filter] = 'gls'; break; case 'season_or_date': $this->filters[$filter] = 'season'; break; default; $this->filters[$filter] = null; break; } } } public function getHeading(): string|Htmlable|null { return ''; } public function filtersForm(Schema $schema): Schema { return $schema ->components([ // ToggleButtons::make('status') // ->columnSpanFull() // ->hiddenLabel() // ->inline() // ->default(1) // ->options([ // '1' => 'Soccer', // '3' => 'Basketball', // '2' => 'Ice Hockey', // '5' => 'Tennis', // ]) // ->icons([ // '1' => 'icon-soccerball', // '3' => 'icon-basketball', // '2' => 'icon-icehockey', // '5' => 'icon-tennisball', // ]), Grid::make([ 'default' => 1, 'sm' => 3, 'md' => 5, ]) ->columnSpanFull() ->schema([ Select::make('sofascore_category_id') ->live() ->preload() ->searchable(false) ->prefixIconColor(fn (Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger') ->prefixIcon('phosphor-globe-fill') ->hiddenLabel() ->options(fn () => LoadSofaScoreCategory::load()) ->placeholder('Country') ->afterStateUpdated(function (callable $set) { $set('league_id', null); $set('match_id', null); $set('team_id', null); $set('ss_player_id', null); $set('season', null); }), Select::make('league_id') ->live() ->preload() ->prefixIconColor(fn (Get $get): string => $get('league_id') ? 'success' : 'danger') ->prefixIcon('phosphor-trophy-fill') ->hiddenLabel() // ->options(fn(Get $get) => SofaScoreTournament::with('sofascore_category')->where('sofa_score_category_id', $get('sofascore_category_id'))->pluck('name', 'tournament_id')) ->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id'))) ->placeholder('League') ->afterStateUpdated(function (callable $set, $state) { $set('match_id', null); $set('team_id', null); $set('ss_player_id', null); $set('season', null); }), Select::make('match_id') ->live() ->hiddenLabel() ->prefixIconColor(fn (Get $get): string => $get('match_id') ? 'success' : 'danger') ->prefixIcon('phosphor-calendar-check-fill') ->options(function (Get $get) { return LoadStatisticFixturesMatchOptions::load($get('league_id')); }) ->afterStateUpdated(function (callable $set) { $set('team_id', null); $set('ss_player_id', null); }) ->placeholder('Events'), Select::make('team_id') ->live() ->hiddenLabel() ->prefixIconColor(function (Get $get): string { if ($get('team_id')) { return 'success'; } elseif ($get('similar_past_matches') != 'none') { return 'gray'; } else { return 'danger'; } }) ->prefixIcon('phosphor-users-three-fill') ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') ->options(function (Get $get) { if ($get('match_id')) { $res = StatisticFixtures::where('id', $get('match_id'))->first(); $arr = []; if ($res) { $arr[$res->home_id] = SofaScoreRosa::query()->where('ss_team_id', $res->home_id)->value('ss_team_name'); $arr[$res->away_id] = SofaScoreRosa::query()->where('ss_team_id', $res->away_id)->value('ss_team_name'); } return $arr; } }) ->afterStateUpdated(function (callable $set) { $set('ss_player_id', null); }) ->placeholder('Team'), Select::make('team_position') ->live() ->hiddenLabel() ->placeholder('Team Position') ->prefix('TP') ->prefixAction( Action::make('iconInfo') ->color('success') ->icon('phosphor-question-fill') ->tooltip(fn () => 'Team Position') ) ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') ->default('all') ->selectablePlaceholder(false) ->options([ 'all' => 'All', 'home' => 'Home', 'away' => 'Away', ])->afterStateUpdated(function (callable $set) { // $set('team_id', null); $set('ss_player_id', null); }), ]), Grid::make([ 'default' => 1, 'sm' => 3, 'md' => 4, ]) ->columnSpanFull() ->schema([ Select::make('statistic_type') ->live() ->hiddenLabel() ->allowHtml() ->placeholder('Statistic Type') ->prefixIconColor('success') ->prefixIcon(function (Get $get) { return match ($get('statistic_type')) { 'gls' => 'phosphor-soccer-ball-fill', 'crn' => 'phosphor-angle', 'fls' => 'phosphor-first-aid-kit', 'ofs' => 'phosphor-arrow-fat-lines-right-fill', 'crd' => 'phosphor-cards-fill', 'snt' => 'phosphor-target-fill', 'tsh' => 'phosphor-chart-polar-fill', default => 'phosphor-soccer-ball-fill', }; }) ->default('gls') ->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') ->live() ->hiddenLabel() ->prefix('SPM') ->placeholder('Similar Past Matches') ->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('