diff --git a/app/Filament/Widgets/StatsMedianAverage.php b/app/Filament/Widgets/StatsMedianAverage.php
index 8b2d7bd6..03b9b248 100644
--- a/app/Filament/Widgets/StatsMedianAverage.php
+++ b/app/Filament/Widgets/StatsMedianAverage.php
@@ -36,11 +36,18 @@ class StatsMedianAverage extends StatsOverviewWidget
$arr_home = [];
$arr_away = [];
+ $max_boxes = 6;
+ foreach ($data['datasets'] as $value) {
+ if ($value['label'] == "Average League") {
+ $max_boxes = 7;
+ }
+ }
+
$this->columns = [
'default' => 1,
'sm' => 2,
'md' => 3,
- 'lg' => 6,
+ 'lg' => $max_boxes,
];
$statistic_type = HelperStatisticType::get($this->filters);
@@ -104,14 +111,20 @@ class StatsMedianAverage extends StatsOverviewWidget
else
$value_away = 0;
- return [
- Stat::make('Number of events', new HtmlString('
' . $total_home . '
'))->extraAttributes(['x-init' => "animate('number-of-events', $total_home, 0)"]),
- Stat::make('Average ' . $statistic_type, self::template('avhome', 'avaway', $home_team, $away_team))->extraAttributes(['x-init' => "animate('avhome', $value_home); animate('avaway', $value_away, 0)"]),
- Stat::make('Median ' . $statistic_type, self::template('mehome', 'meaway', $home_team, $away_team))->extraAttributes(['x-init' => "animate('mehome', $median_home); animate('meaway', $median_away, 0)"]),
- Stat::make($data['similar_past_matches'] != 'none' ? '1' : 'Win: ' . $data['results']['w'], new HtmlString('' . $win . '
'))->extraAttributes(['x-init' => "animate('number-of-win', $win, 1)"]),
- Stat::make($data['similar_past_matches'] != 'none' ? 'X' : 'Draw: ' . $data['results']['d'], new HtmlString('' . $draw . '
'))->extraAttributes(['x-init' => "animate('number-of-draw', $draw, 1)"]),
- Stat::make($data['similar_past_matches'] != 'none' ? '2' : 'Lost: ' . $data['results']['l'], new HtmlString('' . $lost . '
'))->extraAttributes(['x-init' => "animate('number-of-lost', $lost, 1)"]),
- ];
+ $boxes = [];
+ $boxes[] = Stat::make('Events', new HtmlString('' . $total_home . '
'))->extraAttributes(['x-init' => "animate('number-of-events', $total_home, 0)"]);
+ $boxes[] = Stat::make('Avg ' . $statistic_type, self::template('avhome', 'avaway', $home_team, $away_team))->extraAttributes(['x-init' => "animate('avhome', $value_home); animate('avaway', $value_away, 0)"]);
+ foreach ($data['datasets'] as $value) {
+ if ($value['label'] == "Average League") {
+ $boxes[] = Stat::make('Avg League', new HtmlString('' . $total_home . '
'))->extraAttributes(['x-init' => "animate('number-of-events', $total_home, 0)"]);
+ }
+ }
+ $boxes[] = Stat::make('Med ' . $statistic_type, self::template('mehome', 'meaway', $home_team, $away_team))->extraAttributes(['x-init' => "animate('mehome', $median_home); animate('meaway', $median_away, 0)"]);
+ $boxes[] = Stat::make($data['similar_past_matches'] != 'none' ? '1' : 'Win: ' . $data['results']['w'], new HtmlString('' . $win . '
'))->extraAttributes(['x-init' => "animate('number-of-win', $win, 1)"]);
+ $boxes[] = Stat::make($data['similar_past_matches'] != 'none' ? 'X' : 'Draw: ' . $data['results']['d'], new HtmlString('' . $draw . '
'))->extraAttributes(['x-init' => "animate('number-of-draw', $draw, 1)"]);
+ $boxes[] = Stat::make($data['similar_past_matches'] != 'none' ? '2' : 'Lost: ' . $data['results']['l'], new HtmlString('' . $lost . '
'))->extraAttributes(['x-init' => "animate('number-of-lost', $lost, 1)"]);
+
+ return $boxes;
}
protected function template(string $home_id, string $away_id, string $home_name, string $away_name): HtmlString