wip
This commit is contained in:
1 parent
ec60adb074
commit
f17a70ce7c
4 files changed
+62
-23
No files matched your search
@@ -58,7 +58,8 @@ class Statistic extends BaseDashboard
|
||||
Grid::make([
|
||||
'default' => 1,
|
||||
'sm' => 3,
|
||||
'md' => 5,
|
||||
'md' => 4,
|
||||
'xl' => 5,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->extraAttributes([
|
||||
@@ -77,6 +78,7 @@ class Statistic extends BaseDashboard
|
||||
$set('match_id', null);
|
||||
$set('team_id', null);
|
||||
$set('tm_player_id', null);
|
||||
$set('season', null);
|
||||
}),
|
||||
Select::make('match_id')
|
||||
->hiddenLabel()
|
||||
@@ -136,20 +138,6 @@ class Statistic extends BaseDashboard
|
||||
'home' => 'Home',
|
||||
'away' => 'Away',
|
||||
]),
|
||||
Select::make('season')
|
||||
->hiddenLabel()
|
||||
->placeholder('Season')
|
||||
->hidden(fn(Get $get) => $get('season_or_date') == 'date')
|
||||
->prefixIcon('phosphor-calendar-star')
|
||||
->prefixIconColor('primary')
|
||||
->options(function (Get $get) {
|
||||
return LoadSeasons::load($get('league_id'));
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('team_id', null);
|
||||
$set('tm_player_id', null);
|
||||
})
|
||||
->live(),
|
||||
Select::make('statistic_type')
|
||||
->hiddenLabel()
|
||||
->placeholder('Statistic Type')
|
||||
@@ -247,6 +235,23 @@ class Statistic extends BaseDashboard
|
||||
'substituted' => 'Substituted',
|
||||
])
|
||||
->live(),
|
||||
Select::make('season')
|
||||
->columns(2)
|
||||
->hiddenLabel()
|
||||
->multiple()
|
||||
->placeholder('Season')
|
||||
->hidden(fn(Get $get) => $get('season_or_date') == 'date')
|
||||
->prefixIcon('phosphor-calendar-star')
|
||||
->prefixIconColor('primary')
|
||||
->preload()
|
||||
->options(function (Get $get) {
|
||||
return LoadSeasons::load($get('league_id'));
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('team_id', null);
|
||||
$set('tm_player_id', null);
|
||||
})
|
||||
->live(),
|
||||
DatePicker::make('start_date')
|
||||
->hiddenLabel()
|
||||
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
|
||||
@@ -276,14 +281,18 @@ class Statistic extends BaseDashboard
|
||||
->action(fn(Set $set) => $set('end_date', null))
|
||||
),
|
||||
Radio::make('season_or_date')
|
||||
->columnSpan(2)
|
||||
->columnSpan([
|
||||
'default' => 1,
|
||||
'sm' => 2,
|
||||
'md' => 3,
|
||||
])
|
||||
->inline()
|
||||
->live()
|
||||
->default('season')
|
||||
->hiddenLabel()
|
||||
->options([
|
||||
'season' => 'Season',
|
||||
'date' => 'Date Picker',
|
||||
'date' => 'Date',
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
|
||||
@@ -48,6 +48,15 @@ class ChartEventPerf extends ChartWidget
|
||||
intersect: false,
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'left',
|
||||
labels: {
|
||||
font: {
|
||||
size: 11,
|
||||
lineHeight: 1.1,
|
||||
},
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: (context) => {
|
||||
|
||||
@@ -56,6 +56,15 @@ class ChartEventPerfMoAv extends ChartWidget
|
||||
intersect: false,
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'left',
|
||||
labels: {
|
||||
font: {
|
||||
size: 11,
|
||||
lineHeight: 1.1,
|
||||
},
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: (context) => {
|
||||
|
||||
@@ -28,8 +28,8 @@ class LoadEvents
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
|
||||
$season_or_date = $filter['season_or_date'] ?? 'season';
|
||||
|
||||
// dd($season_or_date);
|
||||
|
||||
$season = $filter['season'] ?? 0;
|
||||
|
||||
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
||||
|
||||
@@ -58,6 +58,16 @@ class LoadEvents
|
||||
$statistic_type = 'gls';
|
||||
}
|
||||
|
||||
switch ($season_or_date) {
|
||||
case 'season':
|
||||
$start = 0;
|
||||
$end = 0;
|
||||
break;
|
||||
default:
|
||||
$season = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* IF WITH SIMILAR_PAST_MATCHES
|
||||
*
|
||||
@@ -145,6 +155,8 @@ class LoadEvents
|
||||
return $query->where('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->where('starttime', '<=', $end);
|
||||
})->when($season , function ($query) use ($season) {
|
||||
return $query->whereIn('season', $season);
|
||||
})
|
||||
->orderBy('starttime', 'ASC')
|
||||
->get();
|
||||
@@ -592,19 +604,19 @@ class LoadEvents
|
||||
}
|
||||
}
|
||||
$average_team = 0;
|
||||
if ($team_id)
|
||||
if ($team_id && $media_team)
|
||||
$average_team = round(array_sum($media_team) / \count($media_team), 2);
|
||||
|
||||
switch ($team_position) {
|
||||
case 'home':
|
||||
$average_league = round(array_sum($media_league_h) / \count($media_league_h), 2);
|
||||
$average_league = $media_league_h ? round(array_sum($media_league_h) / \count($media_league_h), 2):0;
|
||||
break;
|
||||
case 'away':
|
||||
$average_league = round(array_sum($media_league_a) / \count($media_league_a), 2);
|
||||
$average_league = $media_league_h ? round(array_sum($media_league_a) / \count($media_league_a), 2):0;
|
||||
break;
|
||||
default:
|
||||
$media_league = $media_league_a + $media_league_h;
|
||||
$average_league = round(array_sum($media_league) / \count($media_league), 2);
|
||||
$average_league = $media_league ? round(array_sum($media_league) / \count($media_league), 2) : 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user