form->fill(); $this->activeBoxes = $this->boxNames(); $this->lineUpMap = $this->linUpMap(); $this->lineUpOptinos = $this->lineUpOptinos(); $this->lineup = $this->lineUpMap[$this->lineupActive]; for ($i = 1; $i <= 35; $i++) { $this->boxes[$i] = []; if (isset($this->activeBoxes[$i])) { $this->beschriftung[$i] = $this->activeBoxes[$i]; } else { $this->beschriftung[$i] = ''; } } } public function getWidgetData(): array { return [ 'beschriftung' => $this->beschriftung, 'lineup' => $this->lineup, 'boxes' => $this->boxes, ]; } public function form(Schema $schema): Schema { return $schema ->columns(4) ->components([ Select::make('cid') ->live() ->preload() ->searchable(false) ->prefixIconColor(fn (Get $get): string => $get('cid') ? 'success' : 'danger') ->prefixIcon('phosphor-globe-fill') ->hiddenLabel() ->options(fn () => LoadSofaScoreCategory::load()) ->placeholder('Country') ->afterStateUpdated(function (callable $set, $state) { $set('lid', null); $set('mid', null); $set('tid', null); }), Select::make('lid') ->live() ->preload() ->prefixIconColor(fn (Get $get): string => $get('lid') ? 'success' : 'danger') ->prefixIcon('phosphor-trophy-fill') ->hiddenLabel() ->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('cid'))) ->placeholder('League') ->afterStateUpdated(function (callable $set) { $set('mid', null); $set('tid', null); }), Select::make('mid') ->live() ->hiddenLabel() ->prefixIconColor(fn (Get $get): string => $get('mid') ? 'success' : 'danger') ->prefixIcon('phosphor-calendar-check-fill') ->options(function (Get $get) { return LoadStatisticFixturesMatchOptions::load($get('lid')); }) ->afterStateUpdated(function (callable $set) { $set('tid', null); }) ->placeholder('Events'), Select::make('tid') ->live() ->hiddenLabel() ->prefixIconColor(fn (Get $get): string => $get('tid') ? 'success' : 'danger') ->prefixIcon('phosphor-users-three-fill') ->options(function (Get $get) { if ($get('mid')) { $res = StatisticFixtures::where('id', $get('mid'))->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; } }) ->placeholder('Team')->afterStateUpdated(function ($state) { // Speichert das ausgewählte Team direkt in der Session // session(['player_props_filter_team' => $state]); // Widget informieren $this->dispatch('refreshFilters', team_id: $state); }), ])->statePath('filterData'); } protected function getFooterWidgets(): array { return [ PlayerPropsTable::class, PlayerPropsDrop::class, ]; } public function getFooterWidgetsColumns(): int|array { return 5; } private function boxNames(): array { return [2 => 'DR', 4 => 'MR', 6 => 'LW', 9 => 'DC', 10 => 'DM', 11 => 'MC', 12 => 'AM', 15 => 'SW', 16 => 'DC', 17 => 'DM', 18 => 'MC', 19 => 'AM', 20 => 'SM', 21 => 'ST', 23 => 'DC', 24 => 'DM', 25 => 'MC', 26 => 'AM', 30 => 'DL', 32 => 'ML', 34 => 'RW']; } private function lineUpOptinos(): array { return [ '3313' => '3313', '3331' => '3331', '3331-' => '3331-', '3331+' => '3331+', '3412-' => '3412-', '3412+' => '3412+', '3421-' => '3421-', '3421+' => '3421+', '343-' => '343-', '343+' => '343+', '3511' => '3511', '3511-' => '3511-', '3511+' => '3511+', '352' => '352', '352-' => '352-', '352+' => '352+', '4132' => '4132', '4213-' => '4213-', '4213+' => '4213+', '4222' => '4222', '4231' => '4231', '424' => '424', '4312' => '4312', '4312-' => '4312-', '4312+' => '4312+', '4321' => '4321', '4321-' => '4321-', '4321+' => '4321+', '433' => '433', '433-' => '433-', '433+' => '433+', '4411-' => '4411-', '4411+' => '4411+', '442' => '442', '442-' => '442-', '442+' => '442+', '451' => '451', '451-' => '451-', '451+' => '451+', '523-' => '523-', '523+' => '523+', '5311' => '5311', '5311-' => '5311-', '5311+' => '5311+', '532' => '532', '532-' => '532-', '532+' => '532+', '541-' => '541-', '541+' => '541+', ]; } private function linUpMap(): array { return [ '3313' => [9, 16, 23, 11, 18, 25, 19, 6, 34, 21], '3331' => [9, 16, 23, 17, 11, 25, 12, 19, 26, 21], '3331-' => [9, 16, 23, 10, 18, 24, 12, 19, 26, 21], '3331+' => [9, 16, 23, 11, 18, 25, 12, 19, 26, 21], '3412-' => [9, 16, 23, 4, 10, 24, 32, 19, 20, 21], '3412+' => [9, 16, 23, 4, 11, 25, 32, 19, 20, 21], '3421-' => [9, 16, 23, 4, 10, 24, 32, 12, 26, 21], '3421+' => [9, 16, 23, 4, 11, 25, 32, 12, 26, 21], '343-' => [9, 16, 23, 4, 10, 24, 32, 6, 34, 21], '343+' => [9, 16, 23, 4, 11, 25, 32, 6, 34, 21], '3511' => [9, 16, 23, 4, 11, 17, 25, 32, 19, 21], '3511-' => [9, 16, 23, 4, 10, 18, 24, 32, 19, 21], '3511+' => [9, 16, 23, 4, 11, 18, 25, 32, 19, 21], '352' => [9, 16, 23, 4, 11, 17, 25, 32, 20, 21], '352-' => [9, 16, 23, 4, 10, 18, 24, 32, 20, 21], '352+' => [9, 16, 23, 4, 11, 18, 25, 32, 20, 21], '4132' => [2, 9, 23, 30, 17, 12, 19, 26, 20, 21], '4213-' => [2, 9, 23, 30, 10, 24, 19, 6, 34, 21], '4213+' => [2, 9, 23, 30, 11, 25, 19, 6, 34, 21], '4222' => [2, 9, 23, 30, 10, 24, 12, 26, 20, 21], '4231' => [2, 9, 23, 30, 10, 24, 12, 19, 26, 21], '424' => [2, 9, 23, 30, 10, 24, 6, 34, 20, 21], '4312' => [2, 9, 23, 30, 17, 11, 25, 19, 20, 21], '4312-' => [2, 9, 23, 30, 10, 18, 24, 19, 20, 21], '4312+' => [2, 9, 23, 30, 11, 18, 25, 19, 20, 21], '4321' => [2, 9, 23, 30, 17, 11, 25, 12, 26, 21], '4321-' => [2, 9, 23, 30, 10, 18, 24, 12, 26, 21], '4321+' => [2, 9, 23, 30, 11, 18, 25, 12, 26, 21], '433' => [2, 9, 23, 30, 17, 11, 25, 6, 34, 21], '433-' => [2, 9, 23, 30, 10, 18, 24, 6, 34, 21], '433+' => [2, 9, 23, 30, 11, 18, 25, 6, 34, 21], '4411-' => [2, 9, 23, 30, 4, 10, 24, 32, 19, 21], '4411+' => [2, 9, 23, 30, 4, 11, 25, 32, 19, 21], '442' => [2, 9, 23, 30, 4, 17, 18, 32, 20, 21], '442-' => [2, 9, 23, 30, 4, 10, 24, 32, 20, 21], '442+' => [2, 9, 23, 30, 4, 11, 25, 32, 20, 21], '451' => [2, 9, 23, 30, 4, 17, 11, 25, 32, 21], '451-' => [2, 9, 23, 30, 4, 10, 18, 24, 32, 21], '451+' => [2, 9, 23, 30, 4, 11, 18, 25, 32, 21], '523-' => [2, 9, 16, 23, 30, 10, 24, 6, 34, 21], '523+' => [2, 9, 16, 23, 30, 11, 25, 6, 34, 21], '5311' => [2, 9, 16, 23, 30, 17, 11, 25, 19, 21], '5311-' => [2, 9, 16, 23, 30, 10, 18, 24, 19, 21], '5311+' => [2, 9, 16, 23, 30, 11, 18, 25, 19, 21], '532' => [2, 9, 16, 23, 30, 17, 11, 25, 20, 21], '532-' => [2, 9, 16, 23, 30, 10, 18, 24, 20, 21], '532+' => [2, 9, 16, 23, 30, 11, 18, 25, 20, 21], '541-' => [2, 9, 16, 23, 30, 4, 10, 24, 32, 21], '541+' => [2, 9, 16, 23, 30, 4, 11, 25, 32, 21], ]; } }