@props([ 'battery' => null, 'entries' => [], 'variant' => 'portal', 'showCta' => true, 'headerEyebrow' => 'Top 10 participantes', 'headerTitle' => 'Ranking da bateria', 'headerSubtitle' => null, 'showAreaAndGroup' => false, 'showJobTitle' => false, ]) @php use App\Support\PortalPointsFormatter; $topThree = array_slice($entries, 0, 3); $podiumSlots = [ ['rank' => 2, 'entry' => $topThree[1] ?? null, 'medal' => 'silver'], ['rank' => 1, 'entry' => $topThree[0] ?? null, 'medal' => 'gold'], ['rank' => 3, 'entry' => $topThree[2] ?? null, 'medal' => 'bronze'], ]; $formatScore = static function (float|int|string $points): array { $display = PortalPointsFormatter::format($points); return [ 'display' => $display, 'full' => $display, 'compact' => strlen(str_replace('.', '', $display)) >= 7, ]; }; @endphp @php $rankRootClass = match ($variant) { 'game' => 'qrank qrank--game', 'management' => 'qrank qrank--management', default => 'qrank', }; $resolvedSubtitle = $headerSubtitle ?? ($battery !== null ? $battery->title : null); @endphp
merge(['class' => $rankRootClass]) }}>

{{ $headerEyebrow }}

{{ $headerTitle }}

@if($resolvedSubtitle)

{{ $resolvedSubtitle }}

@endif
@if($showCta) Ir à bateria de perguntas @endif
@if(count($entries) === 0)

@if($variant === 'management') Nenhum participante com respostas no escopo dos filtros aplicados. @else Ainda não há participantes com respostas nesta bateria. @endif

@if($variant !== 'management')

Seja o primeiro a pontuar no questionário!

@endif
@else @if(count($topThree) > 0)
@foreach($podiumSlots as $slot) @php $row = $slot['entry']; $isYou = $row !== null && ($row['is_current_user'] ?? false); $score = $row !== null ? $formatScore($row['total_points']) : null; @endphp
@if($row !== null)
$slot['medal'] === 'gold', 'qrank__card--silver' => $slot['medal'] === 'silver', 'qrank__card--bronze' => $slot['medal'] === 'bronze', 'qrank__card--you' => $isYou, ])> @if($slot['rank'] === 1) @endif
$slot['medal'] === 'gold', 'qrank__medal--silver' => $slot['medal'] === 'silver', 'qrank__medal--bronze' => $slot['medal'] === 'bronze', ])> @if($slot['medal'] === 'gold') @elseif($slot['medal'] === 'silver') @else @endif

{{ $row['name'] }}

@if($showJobTitle && ($row['job_title'] ?? null))

{{ $row['job_title'] }}

@endif @if($isYou) Você @endif
$slot['medal'] === 'gold', 'qrank__score--silver' => $slot['medal'] === 'silver', 'qrank__score--bronze' => $slot['medal'] === 'bronze', 'qrank__score--compact' => $score['compact'], ]) aria-label="{{ $score['full'] }} pontos" >

$slot['medal'] === 'gold', 'qrank__score-int--silver' => $slot['medal'] === 'silver', 'qrank__score-int--bronze' => $slot['medal'] === 'bronze', ])>{{ $score['display'] }}

pts
$slot['medal'] === 'gold', 'qrank__pedestal--silver' => $slot['medal'] === 'silver', 'qrank__pedestal--bronze' => $slot['medal'] === 'bronze', ])> {{ $slot['rank'] }}º
@else
@endif
@endforeach
@endif

Classificação completa ({{ count($entries) }} {{ count($entries) === 1 ? 'participante' : 'participantes' }})

    @foreach($entries as $row) @php $listScore = $formatScore($row['total_points']); @endphp
  • $row['is_current_user'], 'qrank__list-item--top1' => $row['rank'] === 1 && ! $row['is_current_user'], 'qrank__list-item--top2' => $row['rank'] === 2 && ! $row['is_current_user'], 'qrank__list-item--top3' => $row['rank'] === 3 && ! $row['is_current_user'], ])> $row['rank'] === 1, 'qrank__list-rank--2' => $row['rank'] === 2, 'qrank__list-rank--3' => $row['rank'] === 3, 'qrank__list-rank--default' => $row['rank'] > 3, ])> @if($row['rank'] === 1) 1º lugar @elseif($row['rank'] === 2) 2º lugar @elseif($row['rank'] === 3) 3º lugar @else {{ $row['rank'] }} @endif

    {{ $row['name'] }} @if($row['is_current_user']) Você @endif

    @if($showJobTitle && ($row['job_title'] ?? null))

    {{ $row['job_title'] }}

    @endif @if($showAreaAndGroup && (($row['sector_name'] ?? null) || ($row['team_name'] ?? null)))

    @if($row['sector_name'] ?? null) {{ $row['sector_name'] }} @endif @if(($row['sector_name'] ?? null) && ($row['team_name'] ?? null)) @endif @if($row['team_name'] ?? null) {{ $row['team_name'] }} @endif

    @endif @if(($row['elapsed_seconds'] ?? 0) > 0)

    {{ sprintf('%02d:%02d', intdiv($row['elapsed_seconds'], 60), $row['elapsed_seconds'] % 60) }}

    @endif
    $listScore['compact'], ])>

    {{ $listScore['display'] }}

    pts
  • @endforeach
@endif