wip
This commit is contained in:
1 parent
605a9c7562
commit
61b2435124
1 file changed
+22
-9
@@ -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('<div id="number-of-events">' . $total_home . '</div>'))->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('<div id="number-of-win">' . $win . '</div>'))->extraAttributes(['x-init' => "animate('number-of-win', $win, 1)"]),
|
||||
Stat::make($data['similar_past_matches'] != 'none' ? 'X' : 'Draw: ' . $data['results']['d'], new HtmlString('<div id="number-of-draw">' . $draw . '</div>'))->extraAttributes(['x-init' => "animate('number-of-draw', $draw, 1)"]),
|
||||
Stat::make($data['similar_past_matches'] != 'none' ? '2' : 'Lost: ' . $data['results']['l'], new HtmlString('<div id="number-of-lost">' . $lost . '</div>'))->extraAttributes(['x-init' => "animate('number-of-lost', $lost, 1)"]),
|
||||
];
|
||||
$boxes = [];
|
||||
$boxes[] = Stat::make('Events', new HtmlString('<div id="number-of-events">' . $total_home . '</div>'))->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('<div id="number-of-events">' . $total_home . '</div>'))->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('<div id="number-of-win">' . $win . '</div>'))->extraAttributes(['x-init' => "animate('number-of-win', $win, 1)"]);
|
||||
$boxes[] = Stat::make($data['similar_past_matches'] != 'none' ? 'X' : 'Draw: ' . $data['results']['d'], new HtmlString('<div id="number-of-draw">' . $draw . '</div>'))->extraAttributes(['x-init' => "animate('number-of-draw', $draw, 1)"]);
|
||||
$boxes[] = Stat::make($data['similar_past_matches'] != 'none' ? '2' : 'Lost: ' . $data['results']['l'], new HtmlString('<div id="number-of-lost">' . $lost . '</div>'))->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
|
||||
|
||||
Reference in new issue
Block a user