wip Expectations
This commit is contained in:
1 parent
3db428899c
commit
1dbdbcf586
26 files changed
+704
-268
No files matched your search
@@ -9,7 +9,6 @@ use App\Utilities\Round;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Filament\Widgets\StatsOverviewWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
@@ -101,8 +100,11 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
$average_team_away = 0;
|
||||
$average_league_home = 0;
|
||||
$average_league_away = 0;
|
||||
$expectations_home = 0;
|
||||
$expectations_away = 0;
|
||||
|
||||
// Log::debug($data);
|
||||
$expectations_home = $data['expectations_home'] ?? 0;
|
||||
$expectations_away = $data['expectations_away'] ?? 0;
|
||||
|
||||
foreach ($data['datasets'] as $value) {
|
||||
if ($value['label'] == 'Average Team') {
|
||||
@@ -119,37 +121,58 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
|
||||
$boxes = [];
|
||||
// BOX 1
|
||||
$boxes[] = Stat::make('Number', new HtmlString('<div id="number-of-events">' . $total_home . '</div>'))
|
||||
->description('Events');
|
||||
$boxes[] = Stat::make('Total', new HtmlString('<div id="number-of-events">' . $total_home . '</div>'))
|
||||
->description('Events')
|
||||
->extraAttributes([
|
||||
'class' => 'box-info',
|
||||
]);
|
||||
// ->extraAttributes(['x-init' => "animate('number-of-events', $total_home, 0)"]);
|
||||
|
||||
// BOX 2
|
||||
$boxes[] = Stat::make('Average ' . $statistic_type, self::template('avhome', 'avaway', $home_team, $away_team, $value_home, $value_away))
|
||||
->description('Team ' . $team_position);
|
||||
->description('Team ' . $team_position)
|
||||
->extraAttributes([
|
||||
'class' => 'box-success',
|
||||
]);
|
||||
// ->extraAttributes(['x-init' => "animate('avhome', $value_home); animate('avaway', $value_away)"]);
|
||||
|
||||
// BOX 3
|
||||
// Log::debug([$average_team_home, $average_team_away]);
|
||||
$boxes[] = Stat::make('Average ' . $statistic_type, self::template('av_team_home', 'av_team_away', $home_team, $away_team, $average_team_home, $average_team_away))
|
||||
->description('Team Season');
|
||||
->description('Team Season')
|
||||
->extraAttributes([
|
||||
'class' => 'box-success',
|
||||
]);
|
||||
// ->extraAttributes(['x-init' => "animate('av_team_home', $average_team_home); animate('av_team_away', $average_team_away)"]);
|
||||
|
||||
// BOX 4
|
||||
$boxes[] = Stat::make('Average ' . $statistic_type, self::template('av_league_home', 'av_league_away', 'Home', 'Away', $average_league_home, $average_league_away))
|
||||
->description('League Season');
|
||||
->description('League Season')
|
||||
->extraAttributes([
|
||||
'class' => 'box-success',
|
||||
]);
|
||||
// ->extraAttributes(['x-init' => "animate('av_league_home', $average_league_home); animate('av_league_away', $average_league_away)"]);
|
||||
|
||||
// BOX 5
|
||||
$boxes[] = Stat::make('Odds', self::templateOdds($data, $win, $draw, $lost))
|
||||
->description($team_position);
|
||||
->description($team_position)
|
||||
->extraAttributes([
|
||||
'class' => 'box-purple',
|
||||
]);
|
||||
// ->extraAttributes(['x-init' => "animate('mehome', $median_home); animate('meaway', $median_away, 0)"]);
|
||||
|
||||
// BOX 6
|
||||
$boxes[] = Stat::make($statistic_type, self::template('expectations_home', 'expectations_away', 'Home', 'Away', $expectations_home, $expectations_away))
|
||||
->description('Expectations')
|
||||
->extraAttributes([
|
||||
'class' => 'box-yellow',
|
||||
]);
|
||||
|
||||
$this->columns = [
|
||||
'default' => 1,
|
||||
'sm' => 2,
|
||||
'md' => 3,
|
||||
'lg' => 4,
|
||||
'xl' => 5,
|
||||
'xl' => 6,
|
||||
];
|
||||
|
||||
return $boxes;
|
||||
|
||||
Reference in new issue
Block a user