diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php
index da7cdc02..1e691c85 100644
--- a/app/Filament/Pages/Statistic.php
+++ b/app/Filament/Pages/Statistic.php
@@ -20,6 +20,7 @@ use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\HtmlString;
+use PhpOption\None;
class Statistic extends BaseDashboard
{
@@ -29,8 +30,6 @@ class Statistic extends BaseDashboard
protected string $view = 'filament.pages.statistic';
- protected string $activeTab = 'tab1';
-
protected ?string $pollingInterval = null;
protected static ?string $title = 'Statistic';
@@ -93,6 +92,7 @@ class Statistic extends BaseDashboard
->afterStateUpdated(function (callable $set, $state) {
$set('match_id', null);
$set('team_id', null);
+ $set('tm_player_id', null);
$this->dispatch('filterChanged', filterValue: $state);
}),
Select::make('match_id')
@@ -121,6 +121,7 @@ class Statistic extends BaseDashboard
}
})
// ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
+ // ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
->prefixIcon('phosphor-users-three')
->disabled(fn (Get $get) => $get('similar_past_matches') != 'none')
->options(function (Get $get) {
@@ -143,8 +144,8 @@ class Statistic extends BaseDashboard
Select::make('team_position')
->hiddenLabel()
- ->placeholder('Positiom')
- ->prefix('Positiom')
+ ->placeholder('Team Position')
+ ->prefix('Team Position')
// ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
->prefixIcon('phosphor-map-pin')
->disabled(fn (Get $get) => $get('similar_past_matches') != 'none')
@@ -159,7 +160,7 @@ class Statistic extends BaseDashboard
DatePicker::make('start_date')
->hiddenLabel()
->native(false)
- // ->prefixIconColor('primary')
+ ->prefixIconColor('primary')
->prefixIcon('phosphor-calendar')
->live()
->prefix('Start')
@@ -172,7 +173,7 @@ class Statistic extends BaseDashboard
DatePicker::make('end_date')
->hiddenLabel()
->native(false)
- // ->prefixIconColor('primary')
+ ->prefixIconColor('primary')
->prefixIcon('phosphor-calendar')
->live()
->prefix('End')
@@ -202,14 +203,14 @@ class Statistic extends BaseDashboard
->hiddenLabel()
->placeholder('Similar Past Matches')
->prefixIconColor('primary')
- ->prefixIcon('phosphor-approximate-equals')
+ // ->prefixIcon('phosphor-approximate-equals')
+ ->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString(''.$get('accuracy').'') : '')
->columnSpan([
'default' => 1,
'xl' => 2,
])
- ->suffixAction(
+ ->prefixAction(
Action::make('iconInfo')
- ->color('gray')
->icon('phosphor-question')
->tooltip(fn () => $this->tooltip_similar_past_matches())
)
@@ -226,20 +227,21 @@ class Statistic extends BaseDashboard
'all' => 'Similar Past Matches All: Database',
]),
Slider::make('accuracy')
- ->label('Accuracy max: 0.25, steps: 0.025')
+ // ->label('Accuracy min: 0, max: 0.25, steps: 0.025')
->hiddenLabel()
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none')
// ->fillTrack()
->range(minValue: 0, maxValue: 0.25)
->step(0.025)
+ ->default(5)
->decimalPlaces(1)
->decimalPlaces(3)
- ->tooltips()
- ->columnSpan([
- 'default' => 1,
- 'xl' => 2,
- ])
- // ->pips()
+ // ->tooltips()
+ // ->columnSpan([
+ // 'default' => 1,
+ // 'xl' => 2,
+ // ])
+ ->pips()
->live(),
Select::make('tm_player_id')
->hiddenLabel()
@@ -281,13 +283,13 @@ class Statistic extends BaseDashboard
protected function tooltip_similar_past_matches(): HtmlString
{
- $str = '
';
+ $str = '
';
$str .= '
None
';
- $str .= '
Only selected team within selected league is considered.
';
+ $str .= '
Team within selected league
';
$str .= '
League
';
- $str .= '
All events in seleceted league are considered, filtered expected goal handicap and total parameter in the range of Accuracy Slider setting.
';
+ $str .= '
Simmilar events in league in the range of slider.
';
$str .= '
All Database
';
- $str .= '
Eintire database is considered, filtered expected goal handicap and total parameter in the range of the
Accuracy Slider setting.
';
+ $str .= '
Simmilar events in database in the range of slider.
';
$str .= '
';
return new HtmlString($str);
diff --git a/app/Filament/Widgets/ChartEvent.php b/app/Filament/Widgets/ChartEvent.php
index 98a0ed70..ee465e96 100644
--- a/app/Filament/Widgets/ChartEvent.php
+++ b/app/Filament/Widgets/ChartEvent.php
@@ -17,7 +17,7 @@ class ChartEvent extends ChartWidget
protected ?string $pollingInterval = null;
- protected bool $isCollapsible = false;
+ protected bool $isCollapsible = true;
protected $f;
diff --git a/app/Filament/Widgets/ChartPlayer.php b/app/Filament/Widgets/ChartPlayer.php
index 42c13006..26e890e8 100644
--- a/app/Filament/Widgets/ChartPlayer.php
+++ b/app/Filament/Widgets/ChartPlayer.php
@@ -40,8 +40,6 @@ class ChartPlayer extends ChartWidget
return 'line';
}
- // , ' '+context.dataset.playing_date[context.dataIndex], ' '+context.dataset.events[context.dataIndex]
-
protected function getOptions(): RawJs
{
return RawJs::make(<<<'JS'
diff --git a/app/Filament/Widgets/ChartPlayerPerf.php b/app/Filament/Widgets/ChartPlayerPerf.php
index 86309ba2..159a9b9b 100644
--- a/app/Filament/Widgets/ChartPlayerPerf.php
+++ b/app/Filament/Widgets/ChartPlayerPerf.php
@@ -2,6 +2,8 @@
namespace App\Filament\Widgets;
+use App\Filament\Widgets\Data\LoadPlayerPerformance;
+use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget;
use Livewire\Attributes\Reactive;
@@ -20,13 +22,38 @@ class ChartPlayerPerf extends ChartWidget
protected function getData(): array
{
- return [
- //
- ];
+ return LoadPlayerPerformance::load($this->filters);
}
protected function getType(): string
{
return 'line';
}
+
+ protected function getOptions(): RawJs
+ {
+ return RawJs::make(<<<'JS'
+ {
+ interaction: {
+ intersect: false,
+ },
+ scales: {
+ x: {
+ title: {
+ display: true,
+ text: 'Days since today'
+ }
+ },
+ y: {
+ beginAtZero:true,
+ ticks: {
+ callback: function(value, index, ticks) {
+ return value % 1 === 0 ? value : '';
+ }
+ }
+ },
+ },
+ }
+ JS);
+ }
}
diff --git a/app/Filament/Widgets/ChartPlayerPerfMoAv.php b/app/Filament/Widgets/ChartPlayerPerfMoAv.php
index 1c812881..3ad045ed 100644
--- a/app/Filament/Widgets/ChartPlayerPerfMoAv.php
+++ b/app/Filament/Widgets/ChartPlayerPerfMoAv.php
@@ -2,6 +2,8 @@
namespace App\Filament\Widgets;
+use App\Filament\Widgets\Data\LoadPlayerPerformance;
+use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget;
use Livewire\Attributes\Reactive;
@@ -20,13 +22,38 @@ class ChartPlayerPerfMoAv extends ChartWidget
protected function getData(): array
{
- return [
- //
- ];
+ return LoadPlayerPerformance::load($this->filters);
}
protected function getType(): string
{
return 'line';
}
+
+ protected function getOptions(): RawJs
+ {
+ return RawJs::make(<<<'JS'
+ {
+ interaction: {
+ intersect: false,
+ },
+ scales: {
+ x: {
+ title: {
+ display: true,
+ text: 'Days since today'
+ }
+ },
+ y: {
+ beginAtZero:true,
+ ticks: {
+ callback: function(value, index, ticks) {
+ return value % 1 === 0 ? value : '';
+ }
+ }
+ },
+ },
+ }
+ JS);
+ }
}
diff --git a/app/Filament/Widgets/Data/LoadEvents.php b/app/Filament/Widgets/Data/LoadEvents.php
index e24c6245..ef83f83d 100644
--- a/app/Filament/Widgets/Data/LoadEvents.php
+++ b/app/Filament/Widgets/Data/LoadEvents.php
@@ -48,9 +48,9 @@ class LoadEvents
if (! $match_id) {
return [];
}
- if (! $team_id && $similar_past_matches == 'none') {
- return [];
- }
+ // if (! $team_id && $similar_past_matches == 'none') {
+ // return [];
+ // }
if ($statistic_type == 'none') {
$statistic_type = 'gls';
@@ -395,6 +395,7 @@ class LoadEvents
'results' => $results,
'home_team' => $home_team,
'away_team' => $away_team,
+ 'similar_past_matches' => $similar_past_matches,
];
self::$last_query = $data;
diff --git a/app/Filament/Widgets/Data/LoadPlayerMulti.php b/app/Filament/Widgets/Data/LoadPlayerMulti.php
deleted file mode 100644
index a787663d..00000000
--- a/app/Filament/Widgets/Data/LoadPlayerMulti.php
+++ /dev/null
@@ -1,148 +0,0 @@
-value('name');
-
- $res = StatistikoPlayer::with('event.home')->with('event.away')->where('tm_player_id', (int) $tm_player_id)->get();
-
- $labels = [];
- $playing_date = [];
- $events = [];
- $datasets_goals = [];
- $datasets_fouls = [];
- $datasets_offside = [];
- $datasets_card = [];
- $datasets_shots_on = [];
- $datasets_shots_off = [];
- foreach ($res as $value) {
-
- if (isset($value->event->starttime)) {
-
- $labels[] = round($value->event->starttime->diffInDays(Carbon::now()));
-
- $events[] = $value->event->home->name.' vs '.$value->event->away->name;
-
- $playing_date[] = $value->event->starttime->format('d. F Y H:i');
-
- $datasets_goals[] = (int) $value->goals;
-
- $datasets_fouls[] = (int) $value->fouls;
-
- $datasets_offside[] = (int) $value->offsides;
-
- $datasets_card[] = (int) $value->card_yellow + $value->card_red + $value->card_yellowred;
-
- $datasets_shots_on[] = (int) $value->shots_on_target;
-
- $datasets_shots_off[] = (int) $value->shots_off_target;
-
- }
- }
-
- $data = [
- 'datasets' => [
- [
- 'label' => 'Goals',
- 'data' => $datasets_goals,
- 'dates' => $playing_date,
- 'events' => $events,
- 'tension' => 0.5,
- 'borderColor' => '#fb2c36',
- 'backgroundColor' => '#fb2c36',
- ],
- [
- 'label' => 'Fouls Commited',
- 'data' => $datasets_fouls,
- 'dates' => $playing_date,
- 'events' => $events,
- 'tension' => 0.5,
- 'borderColor' => '#f0b100',
- 'backgroundColor' => '#f0b100',
- 'dates' => $playing_date,
- 'events' => $events,
- ],
- [
- 'label' => 'Offside',
- 'data' => $datasets_offside,
- 'dates' => $playing_date,
- 'events' => $events,
- 'tension' => 0.5,
- 'borderColor' => '#7ccf00',
- 'backgroundColor' => '#7ccf00',
- ],
- [
- 'label' => 'Cards',
- 'data' => $datasets_card,
- 'dates' => $playing_date,
- 'events' => $events,
- 'tension' => 0.5,
- 'borderColor' => '#00b8db',
- 'backgroundColor' => '#00b8db',
- ],
- [
- 'label' => 'Shots On Target',
- 'data' => $datasets_shots_on,
- 'dates' => $playing_date,
- 'events' => $events,
- 'tension' => 0.5,
- 'borderColor' => '#615fff',
- 'backgroundColor' => '#615fff',
- ],
- [
- 'label' => 'Shots Off Target',
- 'data' => $datasets_shots_off,
- 'dates' => $playing_date,
- 'events' => $events,
- 'tension' => 0.5,
- 'borderColor' => '#e12afb',
- 'backgroundColor' => '#e12afb',
- ],
- ],
- 'labels' => $labels,
- 'player_name' => $player_name,
- ];
-
- self::$last_query = $data;
-
- return $data;
- }
-}
diff --git a/app/Filament/Widgets/Data/LoadPlayerPerformance.php b/app/Filament/Widgets/Data/LoadPlayerPerformance.php
new file mode 100644
index 00000000..8b75179e
--- /dev/null
+++ b/app/Filament/Widgets/Data/LoadPlayerPerformance.php
@@ -0,0 +1,86 @@
+where('tm_player_id', (int) $tm_player_id)
+ ->when($player_on_field, function ($query) use ($player_on_field) {
+ switch ($player_on_field) {
+ case 'lineup':
+ return $query->where('lineup', 'T');
+ case 'substituted':
+ return $query->where('lineup', 'P');
+ }
+ })->get();
+
+ $tmp = [];
+ foreach ($matches_played as $value) {
+ $key = round($value->event->starttime->diffInDays(Carbon::now()));
+ $val = $value->playerrating_value;
+ $tmp[$key] = $val;
+ }
+
+ ksort($tmp);
+ $dataset = [];
+ $labels = [];
+ foreach ($tmp as $key => $value) {
+ $labels[] = $key;
+ $dataset[] = $value;
+ }
+
+ $labels = array_keys($dataset);
+
+ $data = [
+ 'datasets' => [
+ [
+ 'label' => 'Player Rating',
+ 'data' => $dataset,
+ 'tension' => 0.5,
+ 'borderColor' => '#36A2EB',
+ ],
+ ],
+ 'labels' => $labels,
+ ];
+
+ self::$last_query = $data;
+
+ return $data;
+ }
+}
diff --git a/app/Filament/Widgets/StatsMedianAverage.php b/app/Filament/Widgets/StatsMedianAverage.php
index 8cfa2896..fa74b035 100644
--- a/app/Filament/Widgets/StatsMedianAverage.php
+++ b/app/Filament/Widgets/StatsMedianAverage.php
@@ -13,6 +13,8 @@ class StatsMedianAverage extends StatsOverviewWidget
{
protected ?string $pollingInterval = null;
+ protected int|array|null $columns = null;
+
#[Reactive]
public ?array $filters = [];
@@ -21,19 +23,18 @@ class StatsMedianAverage extends StatsOverviewWidget
$this->filters = $filters;
}
- public function getColumns(): int|array
- {
- return [
- 'default' => 2,
- 'sm' => 3,
- 'xl' => 6,
- ];
- }
-
protected function getStats(): array
{
$data = LoadEvents::load($this->filters);
+ // dd($data);
+
+ $this->columns = [
+ 'default' => 2,
+ 'sm' => 3,
+ 'xl' => ! isset($data['similar_past_matches']) || $data['similar_past_matches'] == 'none' ? 6 : 3,
+ ];
+
$statistic_type = ucfirst(HelperStatisticType::get($this->filters));
if (! isset($data['datasets'][0])) {
@@ -86,6 +87,7 @@ class StatsMedianAverage extends StatsOverviewWidget
Stat::make('stat1', 'stat1')->view('filament.resources.events.widgets.statistic-regular', [
'titel' => 'Number of events',
'value' => $total_home,
+ 'hidden' => false,
]),
Stat::make('stat2', 'stat2')->view('filament.resources.events.widgets.statistic-average', [
'titel' => 'Average '.$statistic_type,
@@ -101,17 +103,21 @@ class StatsMedianAverage extends StatsOverviewWidget
'home' => $home_team,
'away' => $away_team,
]),
+
Stat::make('stat4', 'stat4')->view('filament.resources.events.widgets.statistic-regular', [
'titel' => 'Win: '.$data['results']['w'],
'value' => $win,
+ 'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
]),
Stat::make('stat5', 'stat5')->view('filament.resources.events.widgets.statistic-regular', [
'titel' => 'Draw: '.$data['results']['d'],
'value' => $draw,
+ 'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
]),
Stat::make('stat6', 'stat6')->view('filament.resources.events.widgets.statistic-regular', [
'titel' => 'Lost: '.$data['results']['l'],
'value' => $lost,
+ 'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
]),
];
}
diff --git a/composer.lock b/composer.lock
index 0f611f8f..56f8f9ce 100644
--- a/composer.lock
+++ b/composer.lock
@@ -2196,16 +2196,16 @@
},
{
"name": "guzzlehttp/guzzle",
- "version": "7.10.5",
+ "version": "7.10.6",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
- "reference": "7c8d84b39e680315f687e8662a9d6fb0865c5148"
+ "reference": "e7412b3180912c01650cc66647f18c1d1cbe9b94"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7c8d84b39e680315f687e8662a9d6fb0865c5148",
- "reference": "7c8d84b39e680315f687e8662a9d6fb0865c5148",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e7412b3180912c01650cc66647f18c1d1cbe9b94",
+ "reference": "e7412b3180912c01650cc66647f18c1d1cbe9b94",
"shasum": ""
},
"require": {
@@ -2303,7 +2303,7 @@
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
- "source": "https://github.com/guzzle/guzzle/tree/7.10.5"
+ "source": "https://github.com/guzzle/guzzle/tree/7.10.6"
},
"funding": [
{
@@ -2319,7 +2319,7 @@
"type": "tidelift"
}
],
- "time": "2026-05-27T11:53:46+00:00"
+ "time": "2026-06-01T13:06:22+00:00"
},
{
"name": "guzzlehttp/promises",
@@ -4101,16 +4101,16 @@
},
{
"name": "livewire/livewire",
- "version": "v4.3.0",
+ "version": "v4.3.1",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
- "reference": "19ebb1ee4d057debceccf70ff01950e6a6114edc"
+ "reference": "6a9dd03f45a4b200abfd0ff644745b23fa7baaaa"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/livewire/livewire/zipball/19ebb1ee4d057debceccf70ff01950e6a6114edc",
- "reference": "19ebb1ee4d057debceccf70ff01950e6a6114edc",
+ "url": "https://api.github.com/repos/livewire/livewire/zipball/6a9dd03f45a4b200abfd0ff644745b23fa7baaaa",
+ "reference": "6a9dd03f45a4b200abfd0ff644745b23fa7baaaa",
"shasum": ""
},
"require": {
@@ -4165,7 +4165,7 @@
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
- "source": "https://github.com/livewire/livewire/tree/v4.3.0"
+ "source": "https://github.com/livewire/livewire/tree/v4.3.1"
},
"funding": [
{
@@ -4173,7 +4173,7 @@
"type": "github"
}
],
- "time": "2026-05-01T00:46:07+00:00"
+ "time": "2026-06-02T08:58:52+00:00"
},
{
"name": "masterminds/html5",
diff --git a/resources/views/filament/pages/statistic.blade.php b/resources/views/filament/pages/statistic.blade.php
index 73b5f5ff..c61c205e 100644
--- a/resources/views/filament/pages/statistic.blade.php
+++ b/resources/views/filament/pages/statistic.blade.php
@@ -1,3 +1,6 @@
+@php
+ $player_name = App\Models\StatistikoDetail::where('tm_player_id', (int) $this->filters['tm_player_id'])->value('name');
+@endphp
{{ $this->filtersForm }}
@@ -15,13 +18,16 @@
Events Performance
-
- Player
-
+ @if($player_name)
+
+ {{ $player_name }}
+
+
+
+ {{ $player_name }} Performance
+
+ @endif
-
- Player Performance
-
diff --git a/resources/views/filament/resources/events/widgets/statistic-regular.blade.php b/resources/views/filament/resources/events/widgets/statistic-regular.blade.php
index 6752bff2..ae604adf 100644
--- a/resources/views/filament/resources/events/widgets/statistic-regular.blade.php
+++ b/resources/views/filament/resources/events/widgets/statistic-regular.blade.php
@@ -1,4 +1,6 @@
+@if(!$hidden)
{{ $titel }}
{{ $value }}
+@endif