diff --git a/app/Filament/Clusters/Grapper/GrapperCluster.php b/app/Filament/Clusters/Grapper/GrapperCluster.php index 071ac452..a77d2b07 100644 --- a/app/Filament/Clusters/Grapper/GrapperCluster.php +++ b/app/Filament/Clusters/Grapper/GrapperCluster.php @@ -9,5 +9,5 @@ class GrapperCluster extends Cluster { protected static string|BackedEnum|null $navigationIcon = 'phosphor-rss'; - protected static ?int $navigationSort = 3; + protected static ?int $navigationSort = 5; } diff --git a/app/Filament/Pages/EventMapper.php b/app/Filament/Pages/EventMapper.php index b3f5805b..2ed6b7c0 100644 --- a/app/Filament/Pages/EventMapper.php +++ b/app/Filament/Pages/EventMapper.php @@ -26,7 +26,7 @@ class EventMapper extends Page protected ?string $heading = ''; - protected static ?int $navigationSort = 3; // Smaller number = higher up + protected static ?int $navigationSort = 4; // Smaller number = higher up // protected static ?int $navigationSort = 100; @@ -36,7 +36,7 @@ class EventMapper extends Page ActionGroup::make([ Action::make('bet365') ->extraAttributes(['x-on:click' => 'toggle']) - ->visible(fn(): bool => auth()->user()->provider_id != 2) + ->visible(fn (): bool => auth()->user()->provider_id != 2) ->action(function ($livewire) { User::where('id', auth()->user()->id)->update(['provider_id' => 2]); @@ -49,8 +49,8 @@ class EventMapper extends Page Action::make('magloo_nigeria') ->label('MAGLOO NIGERIA') ->extraAttributes(['x-on:click' => 'toggle']) - ->visible(fn(): bool => in_array(auth()->user()->provider_id, [2, 4])) - ->hidden(fn(): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16])) + ->visible(fn (): bool => in_array(auth()->user()->provider_id, [2, 4])) + ->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16])) ->action(function ($livewire) { User::where('id', auth()->user()->id)->update(['provider_id' => 3]); $livewire->dispatch('refresh'); @@ -63,8 +63,8 @@ class EventMapper extends Page Action::make('magloo_kenia') ->label('MAGLOO KENIA') ->extraAttributes(['x-on:click' => 'toggle']) - ->visible(fn(): bool => in_array(auth()->user()->provider_id, [2, 3])) - ->hidden(fn(): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16])) + ->visible(fn (): bool => in_array(auth()->user()->provider_id, [2, 3])) + ->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16])) ->action(function ($livewire) { User::where('id', auth()->user()->id)->update(['provider_id' => 4]); $livewire->dispatch('refresh'); @@ -77,8 +77,8 @@ class EventMapper extends Page Action::make('logifuture_nigeria') ->label('LOGIFUTURE NIGERA') ->extraAttributes(['x-on:click' => 'toggle']) - ->visible(fn(): bool => auth()->user()->provider_id == 6) - ->hidden(fn(): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36])) + ->visible(fn (): bool => auth()->user()->provider_id == 6) + ->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36])) ->action(function ($livewire) { User::where('id', auth()->user()->id)->update(['provider_id' => 5]); @@ -92,8 +92,8 @@ class EventMapper extends Page Action::make('logifuture_colombia') ->label('LOGIFUTURE COLOMBIA') ->extraAttributes(['x-on:click' => 'toggle']) - ->visible(fn(): bool => auth()->user()->provider_id == 5) - ->hidden(fn(): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36])) + ->visible(fn (): bool => auth()->user()->provider_id == 5) + ->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36])) ->action(function ($livewire) { User::where('id', auth()->user()->id)->update(['provider_id' => 6]); @@ -107,7 +107,7 @@ class EventMapper extends Page ]) ->label('Swop Bookmaker') ->icon('phosphor-dots-three-vertical') - ->visible(fn(): bool => auth()->user()->hasRole('mapper_source_betsapi')) + ->visible(fn (): bool => auth()->user()->hasRole('mapper_source_betsapi')) ->color('primary') ->button(), ]; diff --git a/app/Filament/Pages/PlayerProps.php b/app/Filament/Pages/PlayerProps.php new file mode 100644 index 00000000..21d293b0 --- /dev/null +++ b/app/Filament/Pages/PlayerProps.php @@ -0,0 +1,283 @@ +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], + ]; + } +} diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index 0af81863..d9dc653b 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -23,8 +23,8 @@ use Filament\Schemas\Components\Grid; use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Components\Utilities\Set; use Filament\Schemas\Schema; -use Filament\Support\Enums\SlideOverPosition; -use Filament\Support\Enums\Width; +// use Filament\Support\Enums\SlideOverPosition; +// use Filament\Support\Enums\Width; use Filament\Support\RawJs; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Contracts\View\View; @@ -42,6 +42,8 @@ class Statistic extends BaseDashboard protected static ?string $title = 'Statistiko'; + protected static ?int $navigationSort = 1; + protected int|string|array $columnSpan = [ 'md' => 2, 'xl' => 3, @@ -79,29 +81,29 @@ class Statistic extends BaseDashboard 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])), - ]; - } + // 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 { @@ -460,6 +462,13 @@ class Statistic extends BaseDashboard ->color('gray') ->action(fn (Set $set) => $set('end_date', null)) ), + Action::make('esc') + ->hiddenLabel() + ->tooltip('Clear all (esc)') + ->icon('phosphor-x-circle') + ->color('gray') + ->keyBindings(['esc']) + ->action('resetFilters'), ]); } diff --git a/app/Filament/Resources/Events/EventResource.php b/app/Filament/Resources/Events/EventResource.php index f0a8d4f6..990fc714 100644 --- a/app/Filament/Resources/Events/EventResource.php +++ b/app/Filament/Resources/Events/EventResource.php @@ -21,6 +21,8 @@ class EventResource extends Resource protected static string|\BackedEnum|null $navigationIcon = 'phosphor-monitor'; + protected static ?int $navigationSort = 3; + protected static ?string $navigationLabel = 'Monitor'; protected static ?string $modelLabel = 'Monitor'; diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php new file mode 100644 index 00000000..92f6e611 --- /dev/null +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -0,0 +1,16 @@ +team_name = SofaScoreRosa::where('ss_team_id', $team_id)->value('ss_team_name'); + $this->sourceRecords = PlayerCalculator::load($team_id); + $this->resetTable(); + } + } + + public function getHeadingTable(): HtmlString + { + return new HtmlString('