2, 'xl' => 3, ]; public function getActiveTab() { return $this->activeTab; } public function getHeading(): string|Htmlable|null { return ''; } public function filtersForm(Schema $schema): Schema { return $schema ->components([ Grid::make([ 'default' => 1, 'sm' => 3, 'md' => 4, ]) ->columnSpanFull() ->schema([ Select::make('league_id') ->live() ->prefixIconColor(fn(Get $get): string => $get('league_id') ? 'success' : 'danger') ->prefixIcon('phosphor-trophy-fill') ->hiddenLabel() ->options(fn() => LoadStatisticFixturesLeaguesOptions::load(1)) ->placeholder('League') ->afterStateUpdated(function (callable $set, $state) { $set('match_id', null); $set('team_id', null); $set('tm_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('tm_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 = []; $arr[$res->home_id] = Element::query()->where('id', $res->home_id)->value('name'); $arr[$res->away_id] = Element::query()->where('id', $res->away_id)->value('name'); return $arr; } }) ->afterStateUpdated(function (callable $set) { $set('tm_player_id', null); }) ->placeholder('Team'), Select::make('team_position') ->live() ->hiddenLabel() ->placeholder('Team Position') ->prefix('TP') ->prefixAction( Action::make('iconInfo') ->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('tm_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') ->prefixIconColor('primary') ->suffix(fn(Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('