@extends('layouts.app') @section('title','Drafts - GIGAX ARENA') @section('page_title','DRAFTS') @php $typeMeta = [ 'solo' => ['title'=>'DRAFT SOLO','icon'=>'♟♟','accent'=>'#20f27a','class'=>'solo','desc'=>'Entre sozinho. O sistema escolhe os capitães e monta os times por Skill e Ranking.','button'=>'PARTICIPAR'], 'clan' => ['title'=>'DRAFT CLÃS','icon'=>'⬢','accent'=>'#21b8ff','class'=>'clan','desc'=>'Entre com seu clã completo e enfrente outros clãs.','button'=>'INSCREVER CLÃ'], 'panela' => ['title'=>'DRAFT PANELAS','icon'=>'♟♟','accent'=>'#df43ff','class'=>'panela','desc'=>'Monte seu grupo de 5 jogadores e entre no Draft.','button'=>'CRIAR PANELA'], ]; $typeOrder = ['solo','clan','panela']; $typeLabel = fn($type) => ['solo'=>'SOLO','clan'=>'CLÃS','panela'=>'PANELAS'][$type] ?? strtoupper((string)$type); $statusLabel = fn($status) => ['registration'=>'INSCRIÇÕES ABERTAS','ongoing'=>'EM ANDAMENTO','finished'=>'FINALIZADO'][$status] ?? strtoupper((string)$status); $roundTitleFor = function(int $maxTeams, int $round) { $matches = max(1, (int)($maxTeams / (2 ** $round))); $teams = $matches * 2; return match ($teams) { 256 => 'FASE DE 256', 128 => 'FASE DE 128', 64 => 'FASE DE 64', 32 => 'FASE DE 32', 16 => 'OITAVAS', 8 => 'QUARTAS', 4 => 'SEMIFINAIS', 2 => 'FINAL', default => 'FASE '.$round, }; }; $phaseLabel = function($draft) use ($roundTitleFor) { if (($draft->status ?? '') === 'registration') return 'Inscrições abertas'; if (($draft->status ?? '') === 'finished') return 'Finalizado'; return $roundTitleFor(max(2,(int)($draft->max_teams ?? 4)), 1); }; $entryDisplay = function($name,$tag=null) { $name = trim((string)$name); $tag = trim((string)$tag); return $tag !== '' ? '['.$tag.']' : ($name !== '' ? $name : 'AGUARDANDO'); }; @endphp @push('styles') @endpush @section('content')
@if($isDraftAdmin)@endif
⬡

GIGAX DRAFTS

TRÊS FORMAS DE COMPETIR. UM SÓ ESPÍRITO.

✓TIMES BALANCEADOS ✓CHAVE AUTOMÁTICA ✓INTEGRAÇÃO COM TEAMSPEAK
@foreach($typeOrder as $type) @php $meta=$typeMeta[$type]; $d=$featuredDrafts->get($type); $max=$d ? (int)$d->max_teams : 0; $teamSize=$d ? (int)$d->team_size : 5; $current=$d ? ($type==='solo' ? (int)$d->member_count : (int)$d->entry_count) : 0; $capacity=$d ? ($type==='solo' ? $max*$teamSize : $max) : 0; $pct=$capacity>0 ? min(100,round(($current/$capacity)*100)) : 0; $unit=$type==='solo'?'Inscritos':($type==='clan'?'Clãs inscritos':'Times inscritos'); @endphp
{{ $meta['icon'] }}

{{ $meta['title'] }}

{{ $meta['desc'] }}

@if($type==='solo')Capitães automáticosTimes balanceadosChave eliminatóriaTS3 automático @elseif($type==='clan')Clãs registradosSorteio da chaveRanking de clãsTS3 automático @elseGrupo temporárioSorteio da chaveRanking de panelasTS3 automático@endif
{{ $d ? $current.'/'.$capacity : '0/0' }}{{ $d ? $unit : 'Nenhum Draft aberto' }}
@if($d) @if($type==='solo' && $d->status==='registration' && !in_array((int)$d->id,$myDraftIds,true))
@csrf
@else {{ in_array((int)$d->id,$myDraftIds,true)?'ABRIR MEU DRAFT':$meta['button'] }} @endif @else @endif
@endforeach

DRAFTS EM ANDAMENTO

VER TODOS
@forelse($ongoingDrafts as $d) @php $rows=collect($draftMatches->get((int)$d->id,collect())); $meta=$typeMeta[$d->draft_type] ?? $typeMeta['solo']; $participants=$d->draft_type==='solo' ? ((int)$d->member_count.' Jogadores') : ((int)$d->entry_count.'/'.(int)$d->max_teams.' '.$typeLabel($d->draft_type)); $treeTeams=max(2,(int)$d->max_teams); $treeRounds=(int)round(log($treeTeams,2)); // V2.7: a chave fica sempre aberta. O card cresce conforme a quantidade de times. $treeGridClass = $treeTeams <= 8 ? '' : ($treeTeams === 16 ? 'gd2-event-span-2 gd2-event-large' : 'gd2-event-span-3 gd2-event-large'); $treeSizeClass = $treeTeams >= 256 ? 't256' : ($treeTeams >= 128 ? 't128' : ($treeTeams >= 64 ? 't64' : ($treeTeams >= 32 ? 't32' : ($treeTeams >= 16 ? 't16' : ($treeTeams>=8?'eight':($treeTeams>=4?'four':'two')))))); // Altura-base suficiente para manter os confrontos abertos sem sobreposicao. $treeTeamH = $treeTeams >= 128 ? 17 : ($treeTeams >= 64 ? 18 : ($treeTeams >= 32 ? 19 : 20)); $treeMatchH = ($treeTeamH * 2) + 3; $treeHeight = $treeTeams > 8 ? max(330, (int)(($treeTeams / 2) * ($treeMatchH + 5))) : 0; $treeColW = $treeTeams >= 128 ? 104 : ($treeTeams >= 64 ? 110 : 118); $treeChampW = $treeTeams >= 64 ? 92 : 104; $treeGap = $treeTeams >= 64 ? 14 : 18; $roundNames=[]; for($ri=1;$ri<=$treeRounds;$ri++) $roundNames[$ri]=$roundTitleFor($treeTeams,$ri); $championName=trim((string)($d->champion_name ?? '')); $championTag=trim((string)($d->champion_tag ?? '')); $championDisplay=$championName!=='' ? ($championTag!==''?'['.$championTag.'] ':'').$championName : 'AGUARDANDO'; @endphp
DRAFT {{ $typeLabel($d->draft_type) }} #{{ str_pad((string)$d->id,4,'0',STR_PAD_LEFT) }}♟ {{ $participants }} ♟ {{ (int)$d->max_teams }} Times ⚔ 5v5 🇧🇷 {{ $d->region==='BRASIL'?'BR':$d->region }}
{{ $statusLabel($d->status) }}
@if($treeTeams>8)
CHAVE COMPLETA • {{ $treeTeams }} TIMES{{ $treeTeams-1 }} JOGOS • {{ $treeRounds }} FASES • arraste para navegar
@endif
@for($round=1;$round<=$treeRounds;$round++) @php $roundRows=$rows->where('round_number',$round)->values(); $expectedMatches=max(1,(int)($treeTeams/(2 ** $round))); $mergeHeight = ($treeTeams > 8 && $round > 1) ? max(8, (int)round($treeHeight / (2 * $expectedMatches))) : 0; $roundTitle=$roundNames[$round] ?? ('FASE '.$round); if ($roundTitle === 'QUARTAS') $roundTitle='QUARTAS DE FINAL'; if ($roundTitle === 'SEMIFINAL') $roundTitle='SEMIFINAIS'; @endphp
{{ $roundTitle }}
@for($mi=0;$mi<$expectedMatches;$mi++) @php $m=$roundRows->get($mi); $aName=$m ? $entryDisplay($m->entry_a_name,$m->entry_a_tag) : 'AGUARDANDO'; $bName=$m ? $entryDisplay($m->entry_b_name,$m->entry_b_tag) : 'AGUARDANDO'; $aWin=$m && !empty($m->winner_entry_id) && (int)$m->winner_entry_id === (int)($m->entry_a_id ?? -1); $bWin=$m && !empty($m->winner_entry_id) && (int)$m->winner_entry_id === (int)($m->entry_b_id ?? -1); $globalGame=0; for($rr=1;$rr<$round;$rr++) $globalGame += max(1,(int)($treeTeams/(2 ** $rr))); $globalGame += $mi+1; @endphp
@if($treeTeams>8 && $round>1)@endif JOGO {{ str_pad((string)$globalGame,2,'0',STR_PAD_LEFT) }}
●{{ $aName }}
●{{ $bName }}
@endfor
@endfor
CAMPEÃO
🏆{{ $championDisplay }}VENCEDOR DO DRAFT
@if($treeTeams>8)
ÁRVORE ABERTA: todos os confrontos permanecem visíveis da primeira fase até o campeão.
@endif @if($d->status==='registration')
A chave será preenchida automaticamente ao completar as vagas. Cada vencedor aparece diretamente na fase seguinte até chegar ao campeão.
@endif
Início: {{ $d->started_at ? \Carbon\Carbon::parse($d->started_at)->format('d/m • H:i') : 'ao completar as vagas' }}Fase atual: {{ $phaseLabel($d) }}
◉ ACOMPANHAR
@empty
Nenhum Draft em andamento. Quando houver inscrições ou chave ativa, ela aparecerá aqui.
@endforelse

ÚLTIMOS CAMPEÕES

@forelse($recentChampions as $d)
🏆
DRAFT {{ $typeLabel($d->draft_type) }} #{{ str_pad((string)$d->id,4,'0',STR_PAD_LEFT) }}Campeão: {{ $d->champion_tag?'['.$d->champion_tag.'] ':'' }}{{ $d->champion_name }}{{ $d->finished_at ? \Carbon\Carbon::parse($d->finished_at)->format('d/m/Y') : '' }}
@empty @foreach(['SOLO','CLÃS','PANELAS'] as $label)
🏆
DRAFT {{ $label }}Aguardando primeiro campeãoO histórico será preenchido automaticamente.
@endforeach @endforelse
@if($isDraftAdmin) @endif @endsection @push('scripts') @if($isDraftAdmin) @endif @endpush