wip player performance
This commit is contained in:
1 parent
fcbf718492
commit
37d28eec21
12 files changed
+214
-207
No files matched your search
@@ -20,6 +20,7 @@ use Filament\Schemas\Components\Utilities\Set;
|
|||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
use Illuminate\Support\HtmlString;
|
use Illuminate\Support\HtmlString;
|
||||||
|
use PhpOption\None;
|
||||||
|
|
||||||
class Statistic extends BaseDashboard
|
class Statistic extends BaseDashboard
|
||||||
{
|
{
|
||||||
@@ -29,8 +30,6 @@ class Statistic extends BaseDashboard
|
|||||||
|
|
||||||
protected string $view = 'filament.pages.statistic';
|
protected string $view = 'filament.pages.statistic';
|
||||||
|
|
||||||
protected string $activeTab = 'tab1';
|
|
||||||
|
|
||||||
protected ?string $pollingInterval = null;
|
protected ?string $pollingInterval = null;
|
||||||
|
|
||||||
protected static ?string $title = 'Statistic';
|
protected static ?string $title = 'Statistic';
|
||||||
@@ -93,6 +92,7 @@ class Statistic extends BaseDashboard
|
|||||||
->afterStateUpdated(function (callable $set, $state) {
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
$set('match_id', null);
|
$set('match_id', null);
|
||||||
$set('team_id', null);
|
$set('team_id', null);
|
||||||
|
$set('tm_player_id', null);
|
||||||
$this->dispatch('filterChanged', filterValue: $state);
|
$this->dispatch('filterChanged', filterValue: $state);
|
||||||
}),
|
}),
|
||||||
Select::make('match_id')
|
Select::make('match_id')
|
||||||
@@ -121,6 +121,7 @@ class Statistic extends BaseDashboard
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
// ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
|
// ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
|
||||||
|
// ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->prefixIcon('phosphor-users-three')
|
->prefixIcon('phosphor-users-three')
|
||||||
->disabled(fn (Get $get) => $get('similar_past_matches') != 'none')
|
->disabled(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
@@ -143,8 +144,8 @@ class Statistic extends BaseDashboard
|
|||||||
|
|
||||||
Select::make('team_position')
|
Select::make('team_position')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->placeholder('Positiom')
|
->placeholder('Team Position')
|
||||||
->prefix('Positiom')
|
->prefix('Team Position')
|
||||||
// ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
|
// ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
|
||||||
->prefixIcon('phosphor-map-pin')
|
->prefixIcon('phosphor-map-pin')
|
||||||
->disabled(fn (Get $get) => $get('similar_past_matches') != 'none')
|
->disabled(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
@@ -159,7 +160,7 @@ class Statistic extends BaseDashboard
|
|||||||
DatePicker::make('start_date')
|
DatePicker::make('start_date')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->native(false)
|
->native(false)
|
||||||
// ->prefixIconColor('primary')
|
->prefixIconColor('primary')
|
||||||
->prefixIcon('phosphor-calendar')
|
->prefixIcon('phosphor-calendar')
|
||||||
->live()
|
->live()
|
||||||
->prefix('Start')
|
->prefix('Start')
|
||||||
@@ -172,7 +173,7 @@ class Statistic extends BaseDashboard
|
|||||||
DatePicker::make('end_date')
|
DatePicker::make('end_date')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->native(false)
|
->native(false)
|
||||||
// ->prefixIconColor('primary')
|
->prefixIconColor('primary')
|
||||||
->prefixIcon('phosphor-calendar')
|
->prefixIcon('phosphor-calendar')
|
||||||
->live()
|
->live()
|
||||||
->prefix('End')
|
->prefix('End')
|
||||||
@@ -202,14 +203,14 @@ class Statistic extends BaseDashboard
|
|||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->placeholder('Similar Past Matches')
|
->placeholder('Similar Past Matches')
|
||||||
->prefixIconColor('primary')
|
->prefixIconColor('primary')
|
||||||
->prefixIcon('phosphor-approximate-equals')
|
// ->prefixIcon('phosphor-approximate-equals')
|
||||||
|
->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<span class="text-xl">'.$get('accuracy').'</span>') : '')
|
||||||
->columnSpan([
|
->columnSpan([
|
||||||
'default' => 1,
|
'default' => 1,
|
||||||
'xl' => 2,
|
'xl' => 2,
|
||||||
])
|
])
|
||||||
->suffixAction(
|
->prefixAction(
|
||||||
Action::make('iconInfo')
|
Action::make('iconInfo')
|
||||||
->color('gray')
|
|
||||||
->icon('phosphor-question')
|
->icon('phosphor-question')
|
||||||
->tooltip(fn () => $this->tooltip_similar_past_matches())
|
->tooltip(fn () => $this->tooltip_similar_past_matches())
|
||||||
)
|
)
|
||||||
@@ -226,20 +227,21 @@ class Statistic extends BaseDashboard
|
|||||||
'all' => 'Similar Past Matches All: Database',
|
'all' => 'Similar Past Matches All: Database',
|
||||||
]),
|
]),
|
||||||
Slider::make('accuracy')
|
Slider::make('accuracy')
|
||||||
->label('Accuracy max: 0.25, steps: 0.025')
|
// ->label('Accuracy min: 0, max: 0.25, steps: 0.025')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none')
|
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none')
|
||||||
// ->fillTrack()
|
// ->fillTrack()
|
||||||
->range(minValue: 0, maxValue: 0.25)
|
->range(minValue: 0, maxValue: 0.25)
|
||||||
->step(0.025)
|
->step(0.025)
|
||||||
|
->default(5)
|
||||||
->decimalPlaces(1)
|
->decimalPlaces(1)
|
||||||
->decimalPlaces(3)
|
->decimalPlaces(3)
|
||||||
->tooltips()
|
// ->tooltips()
|
||||||
->columnSpan([
|
// ->columnSpan([
|
||||||
'default' => 1,
|
// 'default' => 1,
|
||||||
'xl' => 2,
|
// 'xl' => 2,
|
||||||
])
|
// ])
|
||||||
// ->pips()
|
->pips()
|
||||||
->live(),
|
->live(),
|
||||||
Select::make('tm_player_id')
|
Select::make('tm_player_id')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
@@ -281,13 +283,13 @@ class Statistic extends BaseDashboard
|
|||||||
|
|
||||||
protected function tooltip_similar_past_matches(): HtmlString
|
protected function tooltip_similar_past_matches(): HtmlString
|
||||||
{
|
{
|
||||||
$str = '<div class="grid grid-cols-4 gap-4 max-w-lg">';
|
$str = '<div class="m-3 grid grid-cols-4 gap-2 max-w-lg">';
|
||||||
$str .= '<div class="font-bold">None</div>';
|
$str .= '<div class="font-bold">None</div>';
|
||||||
$str .= '<div class="col-span-3">Only selected team within selected league is considered.</div>';
|
$str .= '<div class="col-span-3"><u>Team</u> within selected league</div>';
|
||||||
$str .= '<div class="font-bold">League</div>';
|
$str .= '<div class="font-bold">League</div>';
|
||||||
$str .= '<div class="col-span-3">All events in seleceted league are considered, filtered expected goal handicap and total parameter in the range of <span class="text-blue-500">Accuracy Slider</span> setting.</div>';
|
$str .= '<div class="col-span-3"><u>Simmilar events</u> in league in the range of slider.</div>';
|
||||||
$str .= '<div class="font-bold">All Database</div>';
|
$str .= '<div class="font-bold">All Database</div>';
|
||||||
$str .= '<div class="col-span-3">Eintire database is considered, filtered expected goal handicap and total parameter in the range of the <br><span class="text-blue-500">Accuracy Slider</span> setting.</div>';
|
$str .= '<div class="col-span-3"><u>Simmilar events</u> in database in the range of slider.</div>';
|
||||||
$str .= '</div>';
|
$str .= '</div>';
|
||||||
|
|
||||||
return new HtmlString($str);
|
return new HtmlString($str);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class ChartEvent extends ChartWidget
|
|||||||
|
|
||||||
protected ?string $pollingInterval = null;
|
protected ?string $pollingInterval = null;
|
||||||
|
|
||||||
protected bool $isCollapsible = false;
|
protected bool $isCollapsible = true;
|
||||||
|
|
||||||
protected $f;
|
protected $f;
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ class ChartPlayer extends ChartWidget
|
|||||||
return 'line';
|
return 'line';
|
||||||
}
|
}
|
||||||
|
|
||||||
// , ' '+context.dataset.playing_date[context.dataIndex], ' '+context.dataset.events[context.dataIndex]
|
|
||||||
|
|
||||||
protected function getOptions(): RawJs
|
protected function getOptions(): RawJs
|
||||||
{
|
{
|
||||||
return RawJs::make(<<<'JS'
|
return RawJs::make(<<<'JS'
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Widgets;
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
|
use App\Filament\Widgets\Data\LoadPlayerPerformance;
|
||||||
|
use Filament\Support\RawJs;
|
||||||
use Filament\Widgets\ChartWidget;
|
use Filament\Widgets\ChartWidget;
|
||||||
use Livewire\Attributes\Reactive;
|
use Livewire\Attributes\Reactive;
|
||||||
|
|
||||||
@@ -20,13 +22,38 @@ class ChartPlayerPerf extends ChartWidget
|
|||||||
|
|
||||||
protected function getData(): array
|
protected function getData(): array
|
||||||
{
|
{
|
||||||
return [
|
return LoadPlayerPerformance::load($this->filters);
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getType(): string
|
protected function getType(): string
|
||||||
{
|
{
|
||||||
return 'line';
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Widgets;
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
|
use App\Filament\Widgets\Data\LoadPlayerPerformance;
|
||||||
|
use Filament\Support\RawJs;
|
||||||
use Filament\Widgets\ChartWidget;
|
use Filament\Widgets\ChartWidget;
|
||||||
use Livewire\Attributes\Reactive;
|
use Livewire\Attributes\Reactive;
|
||||||
|
|
||||||
@@ -20,13 +22,38 @@ class ChartPlayerPerfMoAv extends ChartWidget
|
|||||||
|
|
||||||
protected function getData(): array
|
protected function getData(): array
|
||||||
{
|
{
|
||||||
return [
|
return LoadPlayerPerformance::load($this->filters);
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getType(): string
|
protected function getType(): string
|
||||||
{
|
{
|
||||||
return 'line';
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -48,9 +48,9 @@ class LoadEvents
|
|||||||
if (! $match_id) {
|
if (! $match_id) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (! $team_id && $similar_past_matches == 'none') {
|
// if (! $team_id && $similar_past_matches == 'none') {
|
||||||
return [];
|
// return [];
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($statistic_type == 'none') {
|
if ($statistic_type == 'none') {
|
||||||
$statistic_type = 'gls';
|
$statistic_type = 'gls';
|
||||||
@@ -395,6 +395,7 @@ class LoadEvents
|
|||||||
'results' => $results,
|
'results' => $results,
|
||||||
'home_team' => $home_team,
|
'home_team' => $home_team,
|
||||||
'away_team' => $away_team,
|
'away_team' => $away_team,
|
||||||
|
'similar_past_matches' => $similar_past_matches,
|
||||||
];
|
];
|
||||||
|
|
||||||
self::$last_query = $data;
|
self::$last_query = $data;
|
||||||
|
|||||||
@@ -1,148 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Widgets\Data;
|
|
||||||
|
|
||||||
use App\Models\StatistikoDetail;
|
|
||||||
use App\Models\StatistikoPlayer;
|
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
|
|
||||||
class LoadPlayerMulti
|
|
||||||
{
|
|
||||||
public static $last_query = [];
|
|
||||||
|
|
||||||
public static function load($filter)
|
|
||||||
{
|
|
||||||
// dd($filter);
|
|
||||||
|
|
||||||
if (self::$last_query) {
|
|
||||||
return self::$last_query;
|
|
||||||
}
|
|
||||||
|
|
||||||
$league_id = (int) $filter['league_id'] ?? 0;
|
|
||||||
|
|
||||||
$team_id = (int) $filter['team_id'] ?? 0;
|
|
||||||
|
|
||||||
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
|
||||||
|
|
||||||
$start = $filter['start_date'] ?? 0;
|
|
||||||
|
|
||||||
$end = $filter['end_date'] ?? 0;
|
|
||||||
|
|
||||||
$team_position = $filter['team_position'];
|
|
||||||
|
|
||||||
if (! $league_id) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
if (! $team_id) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
if (! $tm_player_id) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$player_name = StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Widgets\Data;
|
||||||
|
|
||||||
|
use App\Models\StatistikoPlayer;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
|
class LoadPlayerPerformance
|
||||||
|
{
|
||||||
|
public static $last_query = [];
|
||||||
|
|
||||||
|
public static function load($filter)
|
||||||
|
{
|
||||||
|
if (self::$last_query) {
|
||||||
|
return self::$last_query;
|
||||||
|
}
|
||||||
|
|
||||||
|
$league_id = (int) $filter['league_id'] ?? 0;
|
||||||
|
|
||||||
|
$team_id = (int) $filter['team_id'] ?? 0;
|
||||||
|
|
||||||
|
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
||||||
|
|
||||||
|
$statistic_type = $filter['statistic_type'];
|
||||||
|
|
||||||
|
$player_on_field = $filter['player_on_field'];
|
||||||
|
|
||||||
|
if (! $league_id) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (! $team_id) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (! $tm_player_id) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($statistic_type == 'none') {
|
||||||
|
$statistic_type = 'gls';
|
||||||
|
}
|
||||||
|
|
||||||
|
$matches_played = StatistikoPlayer::with('event')
|
||||||
|
->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,8 @@ class StatsMedianAverage extends StatsOverviewWidget
|
|||||||
{
|
{
|
||||||
protected ?string $pollingInterval = null;
|
protected ?string $pollingInterval = null;
|
||||||
|
|
||||||
|
protected int|array|null $columns = null;
|
||||||
|
|
||||||
#[Reactive]
|
#[Reactive]
|
||||||
public ?array $filters = [];
|
public ?array $filters = [];
|
||||||
|
|
||||||
@@ -21,19 +23,18 @@ class StatsMedianAverage extends StatsOverviewWidget
|
|||||||
$this->filters = $filters;
|
$this->filters = $filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColumns(): int|array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'default' => 2,
|
|
||||||
'sm' => 3,
|
|
||||||
'xl' => 6,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getStats(): array
|
protected function getStats(): array
|
||||||
{
|
{
|
||||||
$data = LoadEvents::load($this->filters);
|
$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));
|
$statistic_type = ucfirst(HelperStatisticType::get($this->filters));
|
||||||
|
|
||||||
if (! isset($data['datasets'][0])) {
|
if (! isset($data['datasets'][0])) {
|
||||||
@@ -86,6 +87,7 @@ class StatsMedianAverage extends StatsOverviewWidget
|
|||||||
Stat::make('stat1', 'stat1')->view('filament.resources.events.widgets.statistic-regular', [
|
Stat::make('stat1', 'stat1')->view('filament.resources.events.widgets.statistic-regular', [
|
||||||
'titel' => 'Number of events',
|
'titel' => 'Number of events',
|
||||||
'value' => $total_home,
|
'value' => $total_home,
|
||||||
|
'hidden' => false,
|
||||||
]),
|
]),
|
||||||
Stat::make('stat2', 'stat2')->view('filament.resources.events.widgets.statistic-average', [
|
Stat::make('stat2', 'stat2')->view('filament.resources.events.widgets.statistic-average', [
|
||||||
'titel' => 'Average '.$statistic_type,
|
'titel' => 'Average '.$statistic_type,
|
||||||
@@ -101,17 +103,21 @@ class StatsMedianAverage extends StatsOverviewWidget
|
|||||||
'home' => $home_team,
|
'home' => $home_team,
|
||||||
'away' => $away_team,
|
'away' => $away_team,
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Stat::make('stat4', 'stat4')->view('filament.resources.events.widgets.statistic-regular', [
|
Stat::make('stat4', 'stat4')->view('filament.resources.events.widgets.statistic-regular', [
|
||||||
'titel' => 'Win: '.$data['results']['w'],
|
'titel' => 'Win: '.$data['results']['w'],
|
||||||
'value' => $win,
|
'value' => $win,
|
||||||
|
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
|
||||||
]),
|
]),
|
||||||
Stat::make('stat5', 'stat5')->view('filament.resources.events.widgets.statistic-regular', [
|
Stat::make('stat5', 'stat5')->view('filament.resources.events.widgets.statistic-regular', [
|
||||||
'titel' => 'Draw: '.$data['results']['d'],
|
'titel' => 'Draw: '.$data['results']['d'],
|
||||||
'value' => $draw,
|
'value' => $draw,
|
||||||
|
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
|
||||||
]),
|
]),
|
||||||
Stat::make('stat6', 'stat6')->view('filament.resources.events.widgets.statistic-regular', [
|
Stat::make('stat6', 'stat6')->view('filament.resources.events.widgets.statistic-regular', [
|
||||||
'titel' => 'Lost: '.$data['results']['l'],
|
'titel' => 'Lost: '.$data['results']['l'],
|
||||||
'value' => $lost,
|
'value' => $lost,
|
||||||
|
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+12
-12
@@ -2196,16 +2196,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/guzzle",
|
"name": "guzzlehttp/guzzle",
|
||||||
"version": "7.10.5",
|
"version": "7.10.6",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/guzzle.git",
|
"url": "https://github.com/guzzle/guzzle.git",
|
||||||
"reference": "7c8d84b39e680315f687e8662a9d6fb0865c5148"
|
"reference": "e7412b3180912c01650cc66647f18c1d1cbe9b94"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7c8d84b39e680315f687e8662a9d6fb0865c5148",
|
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/e7412b3180912c01650cc66647f18c1d1cbe9b94",
|
||||||
"reference": "7c8d84b39e680315f687e8662a9d6fb0865c5148",
|
"reference": "e7412b3180912c01650cc66647f18c1d1cbe9b94",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2303,7 +2303,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/guzzle/guzzle/issues",
|
"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": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -2319,7 +2319,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-05-27T11:53:46+00:00"
|
"time": "2026-06-01T13:06:22+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/promises",
|
"name": "guzzlehttp/promises",
|
||||||
@@ -4101,16 +4101,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "livewire/livewire",
|
"name": "livewire/livewire",
|
||||||
"version": "v4.3.0",
|
"version": "v4.3.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/livewire/livewire.git",
|
"url": "https://github.com/livewire/livewire.git",
|
||||||
"reference": "19ebb1ee4d057debceccf70ff01950e6a6114edc"
|
"reference": "6a9dd03f45a4b200abfd0ff644745b23fa7baaaa"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/livewire/livewire/zipball/19ebb1ee4d057debceccf70ff01950e6a6114edc",
|
"url": "https://api.github.com/repos/livewire/livewire/zipball/6a9dd03f45a4b200abfd0ff644745b23fa7baaaa",
|
||||||
"reference": "19ebb1ee4d057debceccf70ff01950e6a6114edc",
|
"reference": "6a9dd03f45a4b200abfd0ff644745b23fa7baaaa",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -4165,7 +4165,7 @@
|
|||||||
"description": "A front-end framework for Laravel.",
|
"description": "A front-end framework for Laravel.",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/livewire/livewire/issues",
|
"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": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -4173,7 +4173,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-05-01T00:46:07+00:00"
|
"time": "2026-06-02T08:58:52+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "masterminds/html5",
|
"name": "masterminds/html5",
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
@php
|
||||||
|
$player_name = App\Models\StatistikoDetail::where('tm_player_id', (int) $this->filters['tm_player_id'])->value('name');
|
||||||
|
@endphp
|
||||||
<x-filament-panels::page>
|
<x-filament-panels::page>
|
||||||
|
|
||||||
{{ $this->filtersForm }}
|
{{ $this->filtersForm }}
|
||||||
@@ -15,13 +18,16 @@
|
|||||||
Events Performance
|
Events Performance
|
||||||
</x-filament::tabs.item>
|
</x-filament::tabs.item>
|
||||||
|
|
||||||
<x-filament::tabs.item x-on:click="activeTab = 'tab3'" :alpine-active="'activeTab === \'' . 'tab3' . '\''" icon="icon-player">
|
@if($player_name)
|
||||||
Player
|
<x-filament::tabs.item x-on:click="activeTab = 'tab3'" :alpine-active="'activeTab === \'' . 'tab3' . '\''" icon="icon-player">
|
||||||
</x-filament::tabs.item>
|
{{ $player_name }}
|
||||||
|
</x-filament::tabs.item>
|
||||||
|
|
||||||
|
<x-filament::tabs.item x-on:click="activeTab = 'tab4'" :alpine-active="'activeTab === \'' . 'tab4' . '\''" icon="icon-player">
|
||||||
|
{{ $player_name }} Performance
|
||||||
|
</x-filament::tabs.item>
|
||||||
|
@endif
|
||||||
|
|
||||||
<x-filament::tabs.item x-on:click="activeTab = 'tab4'" :alpine-active="'activeTab === \'' . 'tab4' . '\''" icon="icon-player">
|
|
||||||
Player Performance
|
|
||||||
</x-filament::tabs.item>
|
|
||||||
</x-filament::tabs>
|
</x-filament::tabs>
|
||||||
|
|
||||||
<!-- Tab Content -->
|
<!-- Tab Content -->
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
@if(!$hidden)
|
||||||
<div class="h-full rounded-lg p-0 lg:py-2 grid grid-rows-3 gap-0 bg-green-50 dark:bg-green-900 border border-green-300 dark:border-green-700">
|
<div class="h-full rounded-lg p-0 lg:py-2 grid grid-rows-3 gap-0 bg-green-50 dark:bg-green-900 border border-green-300 dark:border-green-700">
|
||||||
<span class="font-bold flex items-center justify-center">{{ $titel }}</span>
|
<span class="font-bold flex items-center justify-center">{{ $titel }}</span>
|
||||||
<span class="font-bold text-2xl flex items-center justify-center">{{ $value }}</span>
|
<span class="font-bold text-2xl flex items-center justify-center">{{ $value }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
Reference in new issue
Block a user