statistic filter player grafics wip

This commit is contained in:
salam committed 2026-05-24 09:41:52 +02:00
1 parent 4de73f9275
commit 3bc956e0b9
5 files changed
+93 -29

No files matched your search

+19 -13
View File
@@ -3,6 +3,7 @@
namespace App\Filament\Pages;
use App\Actions\LoadStatisticFixturesLeaguesOptions;
use App\Actions\LoadStatisticFixturesMatchOptions;
use App\Filament\Widgets\ChartMovingAverageEvent;
use App\Filament\Widgets\ChartMovingAveragePlayer;
use App\Filament\Widgets\ChartPunctualEvent;
@@ -58,34 +59,39 @@ class Statistic extends BaseDashboard
Select::make('league_id')
->prefixIcon('phosphor-trophy')
->options(fn () => LoadStatisticFixturesLeaguesOptions::load(1))
->preload()
->searchable()
->live()
->label('League')
->afterStateUpdated(function (callable $set) {
$set('team_id', null);
$set('match_id', null);
}),
Select::make('match_id')
->prefixIcon('icon-team')
->options(function (Get $get) {
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
})
->afterStateUpdated(function (callable $set) {
$set('team_id', null);
$set('tm_player_id', null);
})
->live()
->label('Events'),
Select::make('team_id')
->prefixIcon('icon-team')
->options(function (Get $get) {
if ($get('league_id')) {
$res = StatisticFixtures::where('league_id', $get('league_id'))->get();
if ($get('match_id')) {
$res = StatisticFixtures::where('id', $get('match_id'))->get();
$arr = [];
foreach ($res as $value) {
$arr[] = $value->home_id;
$arr[] = $value->away_id;
}
$arr = array_unique($arr);
return Element::query()->whereIn('id', $arr)->orderBy('name')->pluck('name', 'id');
return Element::query()->whereIn('id', $arr)->pluck('name', 'id');
}
})
->afterStateUpdated(function (callable $set) {
$set('tm_player_id', null);
})
->preload()
->searchable()
->live()
->label('Team'),
@@ -118,7 +124,7 @@ class Statistic extends BaseDashboard
->color('gray')
->action(fn (Set $set) => $set('end_date', null))
),
])->columns(5)
])->columns(6)
->columnSpanFull(),
Grid::make([
'default' => 2,
@@ -233,8 +239,8 @@ class Statistic extends BaseDashboard
StatsMedianAverage::make(),
ChartPunctualEvent::make(),
ChartMovingAverageEvent::make(),
// ChartPunctualPlayer::make(),
// ChartMovingAveragePlayer::make(),
ChartPunctualPlayer::make(),
ChartMovingAveragePlayer::make(),
];
}