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