Skip to content

Commit

Permalink
show award tiers on event page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiras committed Jan 19, 2025
1 parent 7790651 commit 7a99799
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions resources/views/pages-legacy/gameInfo.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
use App\Community\Enums\ArticleType;
use App\Community\Enums\AwardType;
use App\Community\Enums\ClaimSetType;
use App\Community\Enums\ClaimStatus;
use App\Community\Enums\ClaimType;
Expand All @@ -11,6 +12,7 @@
use App\Models\EventAchievement;
use App\Models\Game;
use App\Models\GameSet;
use App\Models\PlayerBadge;
use App\Models\System;
use App\Models\User;
use App\Models\UserGameListEntry;
Expand Down Expand Up @@ -1109,6 +1111,37 @@ function resize() {
@if ($gameModel->system->active && !$isEventGame)
<x-game.leaderboards-listing :game="$gameModel" />
@endif

@if (count($gameModel->event?->awards ?? []) > 0)
<?php
$badgeCounts = PlayerBadge::where('AwardType', AwardType::Event)
->where('AwardData', $gameModel->event->id)
->groupBy('AwardDataExtra')
->select(['AwardDataExtra', DB::raw('count(*) AS total')])
->get();
?>
<div class="component gamealts">
<h2 class="text-h3">Award Tiers</h2>
<table class="table-highlight"><tbody>
@foreach ($gameModel->event->awards->sortBy('acheivements_required') as $award)
<tr style="width:100%">
<td style="width:100%">
<div class="flex relative gap-x-2 items-center">
<img width="48" height="48" src="{!! media_asset($award->image_asset_path) !!}" alt="{{ $award->label }}" />
<div>
<p>{{ $award->label }}</p>
<p class="smalltext">{{ $award->achievements_required }} {{ Str::plural('point', $award->achievements_required) }}</p>
</div>
</div>
</td>
<td style="text-align: right">
{{ number_format($badgeCounts->where('AwardDataExtra', $award->tier_index)->first()?->total ?? 0) }}
</td>
</tr>
@endforeach
</tbody></table>
</div>
@endif
</x-slot>
@endif
</x-app-layout>

0 comments on commit 7a99799

Please sign in to comment.