2, 'xl' => 3, ]; public function resetFilters(): void { $filters = array_keys($this->filters); foreach ($filters as $filter) { switch ($filter) { case 'accuracy': $this->filters[$filter] = 0.125; break; 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 ''; } // protected function getHeaderActions(): array // { // return [ // Action::make('esc') // ->label('Reset') // ->icon('phosphor-x-circle') // ->color('gray') // ->keyBindings(['esc']) // ->action('resetFilters'), // Action::make('openDispatcherBoard') // ->modalHeading('') // ->label('Calculate') // ->icon('icon-player') // ->color(fn (): string => $this->filters['team_id'] ? 'primary' : 'gray') // ->disabled(fn (): string => $this->filters['team_id'] ? false : true) // ->slideOver() // ->slideOverPosition(SlideOverPosition::Start) // ->modalWidth(Width::Screen) // ->modalSubmitAction(false) // ->modalCancelAction(false) // ->modalContent(fn (): View => view('livewire.board-dispatcher-modal-wrapper', ['filters' => $this->filters])), // ]; // } 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([ Hidden::make('seasonmode'), 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('Select Country') ->afterStateUpdated(function (callable $set, $state) { $set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode')); $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) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id'))) ->placeholder('Select League') ->afterStateUpdated(function (callable $set) { $set('match_id', null); $set('team_id', null); $set('ss_player_id', null); $this->dispatch('reset-tab'); }), Select::make('match_id') ->live() ->hiddenLabel() ->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1) ->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); $this->dispatch('reset-tab'); }) ->placeholder('Select Event'), 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); $this->dispatch('reset-tab'); }) ->placeholder('Select Team'), Select::make('team_position') ->live() ->hiddenLabel() ->placeholder('Select 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('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', ]), /************************ * SMP ************************/ Select::make('similar_past_matches') ->live() // ->columnSpan(2) ->hiddenLabel() ->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1) ->suffixAction(Action::make('reset') ->icon('phosphor-x-circle') ->action(fn (callable $set) => $set('similar_past_matches', 'none')) ->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'info' : 'gray')) ->placeholder('Similar Past Matches') ->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('