@extends('layouts.app') @section('title', $tournament->title) @section('content')

{{ $tournament->title }}

{{ $tournament->game->name }} {{ ucfirst($tournament->type) }} Tournament {{ ucfirst($tournament->status) }}
@auth @if($tournament->host_id === auth()->id()) @if($tournament->isUpcoming()) Invite Players @if($tournament->canStart())
@csrf
@else Need {{ $tournament->requiresEvenParticipants() ? 'power of 2' : 'more' }} participants to start @endif @endif @else @if($tournament->canBeJoinedBy(auth()->user()))
@csrf
@elseif($tournament->users->contains(auth()->user())) ✓ You're participating @endif @endif @endauth
₦{{ number_format($tournament->prize_pool) }}
Prize Pool
{{ $tournament->participants->count() }}
Participants
₦{{ number_format($tournament->entry_fee) }}
Entry Fee
{{ $tournament->host->username }}
Host
@if($tournament->description)

Description

{{ $tournament->description }}

@endif
@if($tournament->type === 'knockout' && $tournament->bracket_json)

Tournament Bracket

@include('tournaments.partials.bracket', ['bracket' => $tournament->bracket_json])
@endif

Participants ({{ $tournament->participants->count() }})

@forelse($tournament->participants as $participant)
{{ $participant->seed ?? '#' }}
{{ $participant->user->username }} @if($participant->result === 'winner') 👑 @elseif($participant->result === 'runner_up') 🥈 @endif
Level {{ $participant->user->level }}
@empty

No participants yet

@endforelse
@if(auth()->check() && $tournament->host_id === auth()->id() && $tournament->pendingInvites->count() > 0)

Pending Invites ({{ $tournament->pendingInvites->count() }})

@foreach($tournament->pendingInvites as $invite)
{{ $invite->invitee->username }}
Invited {{ $invite->created_at->diffForHumans() }}
⏳ Pending
@endforeach
@endif
@if($tournament->matches->count() > 0)

Matches

@foreach($tournament->matches->groupBy('round') as $round => $roundMatches)

Round {{ $round }}

@foreach($roundMatches as $match)
{{ $match->playerA->username }} vs {{ $match->playerB->username }}
@if($match->result === 'none') Pending @elseif($match->result === 'player_a_win') {{ $match->playerA->username }} Won @else {{ $match->playerB->username }} Won @endif
@endforeach
@endforeach
@endif
@endsection