This commit is contained in:
salam committed 2026-06-16 17:08:51 +02:00
1 parent 640328c1ca
commit 3376eb6d2e
3 files changed
+85 -33

No files matched your search

+5 -5
View File
@@ -112,15 +112,15 @@ class StatsMedianAverage extends StatsOverviewWidget
$value_away = 0;
$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)"]);
$boxes[] = Stat::make('Events', new HtmlString('<div id="number-of-events">' . $total_home . '</div>'))->description('Number')->extraAttributes(['x-init' => "animate('number-of-events', $total_home, 0)"]);
$boxes[] = Stat::make($statistic_type, self::template('avhome', 'avaway', $home_team, $away_team))->description('Average Team')->extraAttributes(['x-init' => "animate('avhome', $value_home); animate('avaway', $value_away, 0)"]);
foreach ($data['datasets'] as $value) {
if ($value['label'] == "Average League") {
$str = $value['data'][0] ?? 0;
$boxes[] = Stat::make('Avg League', new HtmlString('<div id="number-of-events">' . $str . '</div>'))->extraAttributes(['x-init' => "animate('number-of-events', $total_home, 0)"]);
$boxes[] = Stat::make($statistic_type, new HtmlString('<div id="number-of-events">' . $str . '</div>'))->description('Average League')->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($statistic_type, self::template('mehome', 'meaway', $home_team, $away_team))->description('Median')->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)"]);
@@ -130,7 +130,7 @@ class StatsMedianAverage extends StatsOverviewWidget
protected function template(string $home_id, string $away_id, string $home_name, string $away_name): HtmlString
{
return new HtmlString('<div class="grid grid-cols-2 justify-center font-bold text-4xl">
return new HtmlString('<div class="grid grid-cols-2 justify-center font-bold text-3xl">
<span class="text-center" id="' . $home_id . '">0</span>
<span class="text-center" id="' . $away_id . '">0</span>
<span class="text-center text-xs text-gray-500 dark:text-gray-400">' . $home_name . '</span>