This commit is contained in:
salam committed 2026-08-24 15:34:34 +02:00
1 parent f09f4f0dd0
commit 9bf5890441
3 files changed
+44 -48

No files matched your search

+21 -21
View File
@@ -86,10 +86,10 @@ class Statistic extends BaseDashboard
Select::make('league_id') Select::make('league_id')
->live() ->live()
->searchable() ->searchable()
->prefixIconColor(fn (Get $get): string => $get('league_id') ? 'success' : 'danger') ->prefixIconColor(fn(Get $get): string => $get('league_id') ? 'success' : 'danger')
->prefixIcon('phosphor-trophy-fill') ->prefixIcon('phosphor-trophy-fill')
->hiddenLabel() ->hiddenLabel()
->options(fn () => LoadStatisticFixturesLeaguesOptions::load(1)) ->options(fn() => LoadStatisticFixturesLeaguesOptions::load(1))
->placeholder('League') ->placeholder('League')
->afterStateUpdated(function (callable $set, $state) { ->afterStateUpdated(function (callable $set, $state) {
$set('match_id', null); $set('match_id', null);
@@ -100,7 +100,7 @@ class Statistic extends BaseDashboard
Select::make('match_id') Select::make('match_id')
->live() ->live()
->hiddenLabel() ->hiddenLabel()
->prefixIconColor(fn (Get $get): string => $get('match_id') ? 'success' : 'danger') ->prefixIconColor(fn(Get $get): string => $get('match_id') ? 'success' : 'danger')
->prefixIcon('phosphor-calendar-check-fill') ->prefixIcon('phosphor-calendar-check-fill')
->options(function (Get $get) { ->options(function (Get $get) {
return LoadStatisticFixturesMatchOptions::load($get('league_id')); return LoadStatisticFixturesMatchOptions::load($get('league_id'));
@@ -124,7 +124,7 @@ class Statistic extends BaseDashboard
} }
}) })
->prefixIcon('phosphor-users-three-fill') ->prefixIcon('phosphor-users-three-fill')
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') ->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
->options(function (Get $get) { ->options(function (Get $get) {
if ($get('match_id')) { if ($get('match_id')) {
$res = StatisticFixtures::where('id', $get('match_id'))->first(); $res = StatisticFixtures::where('id', $get('match_id'))->first();
@@ -152,9 +152,9 @@ class Statistic extends BaseDashboard
Action::make('iconInfo') Action::make('iconInfo')
->color('success') ->color('success')
->icon('phosphor-question-fill') ->icon('phosphor-question-fill')
->tooltip(fn () => 'Team Position') ->tooltip(fn() => 'Team Position')
) )
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') ->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
->default('all') ->default('all')
->selectablePlaceholder(false) ->selectablePlaceholder(false)
->options([ ->options([
@@ -207,13 +207,13 @@ class Statistic extends BaseDashboard
->hiddenLabel() ->hiddenLabel()
->prefix('SPM') ->prefix('SPM')
->placeholder('Similar Past Matches') ->placeholder('Similar Past Matches')
->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<div class="text-center w-24 font-bold rounded p-1 bg-blue-600 dark:bg-blue-700 text-white dark:text-gray-300">± '.$get('accuracy').'</div>') : '') ->suffix(fn(Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<div class="text-center w-24 font-bold rounded p-1 bg-blue-600 dark:bg-blue-700 text-white dark:text-gray-300">± ' . $get('accuracy') . '</div>') : '')
->prefixAction( ->prefixAction(
Action::make('iconInfo') Action::make('iconInfo')
->icon('phosphor-question-fill') ->icon('phosphor-question-fill')
// ->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'primary') // ->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'primary')
->color('success') ->color('success')
->tooltip(fn () => $this->tooltip_similar_past_matches()) ->tooltip(fn() => $this->tooltip_similar_past_matches())
) )
->default('none') ->default('none')
->selectablePlaceholder(false) ->selectablePlaceholder(false)
@@ -230,7 +230,7 @@ class Statistic extends BaseDashboard
Slider::make('accuracy') Slider::make('accuracy')
->live() ->live()
->hiddenLabel() ->hiddenLabel()
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none') ->hidden(fn(Get $get) => $get('similar_past_matches') == 'none')
->fillTrack() ->fillTrack()
->minValue(0) ->minValue(0)
->maxValue(0.25) ->maxValue(0.25)
@@ -246,17 +246,17 @@ class Statistic extends BaseDashboard
->hiddenLabel() ->hiddenLabel()
->allowHtml() ->allowHtml()
->placeholder('Player') ->placeholder('Player')
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') ->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '') ->prefixIconColor(fn(Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '')
->prefixIcon('icon-player') ->prefixIcon('icon-player')
->preload() ->preload()
->searchable() ->searchable()
->extraAttributes(fn () => ['id' => 'player_selector']) ->extraAttributes(fn() => ['id' => 'player_selector'])
->suffixAction( ->suffixAction(
Action::make('iconInfo') Action::make('iconInfo')
->icon('phosphor-question-fill') ->icon('phosphor-question-fill')
->color('success') ->color('success')
->tooltip(fn () => $this->tooltip_player_info()) ->tooltip(fn() => $this->tooltip_player_info())
) )
->options(function (Get $get) { ->options(function (Get $get) {
return LoadPlayer::load($get); return LoadPlayer::load($get);
@@ -267,7 +267,7 @@ class Statistic extends BaseDashboard
->placeholder('Time on field') ->placeholder('Time on field')
->prefixIcon('phosphor-watch-fill') ->prefixIcon('phosphor-watch-fill')
->default('all') ->default('all')
->hidden(fn (Get $get) => ! $get('ss_player_id')) ->hidden(fn(Get $get) => ! $get('ss_player_id'))
->prefixIconColor('success') ->prefixIconColor('success')
->selectablePlaceholder(false) ->selectablePlaceholder(false)
->options([ ->options([
@@ -307,7 +307,7 @@ class Statistic extends BaseDashboard
->placeholder('All Seasons') ->placeholder('All Seasons')
->prefixIconColor('success') ->prefixIconColor('success')
// ->prefixIconColor(fn(Get $get): string => $get('season') ? 'success' : 'primary') // ->prefixIconColor(fn(Get $get): string => $get('season') ? 'success' : 'primary')
->hidden(fn (Get $get) => $get('season_or_date') == 'date') ->hidden(fn(Get $get) => $get('season_or_date') == 'date')
->prefixIcon('phosphor-calendar-star-fill') ->prefixIcon('phosphor-calendar-star-fill')
->preload() ->preload()
->options(function (Get $get) { ->options(function (Get $get) {
@@ -316,30 +316,30 @@ class Statistic extends BaseDashboard
DatePicker::make('start_date') DatePicker::make('start_date')
->live() ->live()
->hiddenLabel() ->hiddenLabel()
->hidden(fn (Get $get) => $get('season_or_date') == 'season') ->hidden(fn(Get $get) => $get('season_or_date') == 'season')
->native(false) ->native(false)
->prefixIconColor(fn (Get $get): string => $get('start_date') ? 'success' : 'primary') ->prefixIconColor(fn(Get $get): string => $get('start_date') ? 'success' : 'primary')
->prefixIcon('phosphor-calendar-fill') ->prefixIcon('phosphor-calendar-fill')
->prefix('Start') ->prefix('Start')
->suffixAction( ->suffixAction(
Action::make('clear_start') Action::make('clear_start')
->icon('phosphor-x') ->icon('phosphor-x')
->color('gray') ->color('gray')
->action(fn (Set $set) => $set('start_date', null)) ->action(fn(Set $set) => $set('start_date', null))
), ),
DatePicker::make('end_date') DatePicker::make('end_date')
->live() ->live()
->hiddenLabel() ->hiddenLabel()
->hidden(fn (Get $get) => $get('season_or_date') == 'season') ->hidden(fn(Get $get) => $get('season_or_date') == 'season')
->native(false) ->native(false)
->prefixIconColor(fn (Get $get): string => $get('end_date') ? 'success' : 'primary') ->prefixIconColor(fn(Get $get): string => $get('end_date') ? 'success' : 'primary')
->prefixIcon('phosphor-calendar-fill') ->prefixIcon('phosphor-calendar-fill')
->prefix('End') ->prefix('End')
->suffixAction( ->suffixAction(
Action::make('clear_end') Action::make('clear_end')
->icon('phosphor-x') ->icon('phosphor-x')
->color('gray') ->color('gray')
->action(fn (Set $set) => $set('end_date', null)) ->action(fn(Set $set) => $set('end_date', null))
), ),
]); ]);
} }
@@ -68,8 +68,6 @@ class StatsMedianAverage extends StatsOverviewWidget
break; break;
} }
// Log::debug($data['datasets']); // Log::debug($data['datasets']);
$team_position = HelperTeamPosition::get($this->filters); $team_position = HelperTeamPosition::get($this->filters);
@@ -33,31 +33,29 @@
</x-filament::tabs> </x-filament::tabs>
@if ($this->filters['team_id']) <!-- Tab Content -->
<!-- Tab Content --> <div class="mt-2">
<div class="mt-2"> <!-- Content for Tab 1 -->
<!-- Content for Tab 1 --> <div x-show="activeTab === 'tab1'" x-cloak class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div x-show="activeTab === 'tab1'" x-cloak class="grid grid-cols-1 md:grid-cols-2 gap-4"> @livewire(\App\Filament\Widgets\ChartEvent::class, ['filters' => $this->filters])
@livewire(\App\Filament\Widgets\ChartEvent::class, ['filters' => $this->filters]) @livewire(\App\Filament\Widgets\ChartEventMoAv::class, ['filters' => $this->filters])
@livewire(\App\Filament\Widgets\ChartEventMoAv::class, ['filters' => $this->filters])
</div>
<!-- Content for Tab 2 -->
<div x-show="activeTab === 'tab2'" x-cloak class="grid grid-cols-1 md:grid-cols-2 gap-4">
@livewire(\App\Filament\Widgets\ChartEventPerf::class, ['filters' => $this->filters])
@livewire(\App\Filament\Widgets\ChartEventPerfMoAv::class, ['filters' => $this->filters])
</div>
<div x-show="activeTab === 'tab3'" x-cloak class="grid grid-cols-1 md:grid-cols-2 gap-4">
@livewire(\App\Filament\Widgets\ChartPlayer::class, ['filters' => $this->filters])
@livewire(\App\Filament\Widgets\ChartPlayerMoAv::class, ['filters' => $this->filters])
</div>
<div x-show="activeTab === 'tab4'" x-cloak class="grid grid-cols-1 md:grid-cols-2 gap-4">
@livewire(\App\Filament\Widgets\ChartPlayerPerf::class, ['filters' => $this->filters])
@livewire(\App\Filament\Widgets\ChartPlayerPerfMoAv::class, ['filters' => $this->filters])
</div>
</div> </div>
@endif
<!-- Content for Tab 2 -->
<div x-show="activeTab === 'tab2'" x-cloak class="grid grid-cols-1 md:grid-cols-2 gap-4">
@livewire(\App\Filament\Widgets\ChartEventPerf::class, ['filters' => $this->filters])
@livewire(\App\Filament\Widgets\ChartEventPerfMoAv::class, ['filters' => $this->filters])
</div>
<div x-show="activeTab === 'tab3'" x-cloak class="grid grid-cols-1 md:grid-cols-2 gap-4">
@livewire(\App\Filament\Widgets\ChartPlayer::class, ['filters' => $this->filters])
@livewire(\App\Filament\Widgets\ChartPlayerMoAv::class, ['filters' => $this->filters])
</div>
<div x-show="activeTab === 'tab4'" x-cloak class="grid grid-cols-1 md:grid-cols-2 gap-4">
@livewire(\App\Filament\Widgets\ChartPlayerPerf::class, ['filters' => $this->filters])
@livewire(\App\Filament\Widgets\ChartPlayerPerfMoAv::class, ['filters' => $this->filters])
</div>
</div>
</div> </div>
</x-filament-panels::page> </x-filament-panels::page>