{{-- ════════ Hero + greeting ════════ --}}
@php
$user = auth()->user();
$firstName = trim($user->first_name ?? $user->email);
$resellerName = $resellerParent ? trim(($resellerParent->first_name ?? '') . ' ' . ($resellerParent->last_name ?? '')) ?: $resellerParent->email : null;
@endphp
Hola {{ $firstName }} 👋
Estás trabajando la cartera comercial @if($resellerName)de {{ $resellerName }} @endif.
Cada misil es un lead esperando que lo contactes y registres su devolución.
{{-- ════════ Tablero de progreso (estilo Tokko) ════════ --}}
@php
$qsBase = request()->except(['tkstage','contact','filter','page']);
$toneBg = [
'warning' => '#ffa800',
'orange' => '#ff7e3d',
'pink' => '#f1416c',
'danger' => '#d63384',
'secondary' => '#7e8299',
'success' => '#1bc5bd',
];
$totalLeads = array_sum($stageCounts);
@endphp
Tablero de progreso · {{ $totalLeads }} oportunidades
@if($activeStage)
Ver todos
@endif
@foreach($stageColumns as $stageKey => $cfg)
@php
$isActive = $activeStage === $stageKey;
$bg = $toneBg[$cfg['tone']] ?? '#7e8299';
$count = $stageCounts[$stageKey] ?? 0;
$url = route('reseller.missiles.index', array_merge($qsBase, ['tkstage' => $stageKey]));
@endphp
{{ $count }}
{{ $cfg['label'] }}
@if($isActive)
@endif
@endforeach
{{-- ════════ Filtros simples ════════ --}}
{{-- ════════ Helper inline para renderear cada misil ════════ --}}
@php
$readyTotal = $readyByProduct->sum(fn($b) => $b['missiles']->count());
$pendingTotal = $pendingByProduct->sum(fn($b) => $b['missiles']->count());
@endphp
{{-- ════════ SECCIÓN 1: Listos para trabajar (LAUNCHED) ════════ --}}
Listos para trabajar
{{ $readyTotal }} {{ $readyTotal === 1 ? 'misil' : 'misiles' }} con demo provisionado — contactá ahora
@forelse($readyByProduct as $productSlug => $bucket)
@php
$count = $bucket['missiles']->count();
$untouchedInBucket = $bucket['missiles']->filter(fn($m) => $m->outreach_attempts_count === 0)->count();
$collapseId = 'ready_' . str_replace('-', '_', $productSlug);
$expanded = $loop->first;
@endphp
@php $LAZY_LIMIT = 10; @endphp
@foreach($bucket['missiles']->take($LAZY_LIMIT) as $m)
@include('modules.clients.reseller.missiles._closer_row', ['m' => $m, 'mode' => 'ready'])
@endforeach
@if($count > $LAZY_LIMIT)
Ver los {{ $count - $LAZY_LIMIT }} restantes
@endif
@empty
@if(!request()->hasAny(['q','product','contact','filter']))
Todavía no hay misiles con demo provisionado en tu cartera —
cuando CD lance algún misil, vas a verlo acá listo para contactar al lead.
@endif
@endforelse
{{-- ════════ SECCIÓN 2: Por solicitar lanzamiento (DRAFT/READY/BRANDING) ════════ --}}
@if($pendingTotal > 0)
Pre-provisión
{{ $pendingTotal }} {{ $pendingTotal === 1 ? 'misil' : 'misiles' }} sin demo todavía —
solicitá lanzamiento para empezar a contactar
@foreach($pendingByProduct as $productSlug => $bucket)
@php
$count = $bucket['missiles']->count();
$collapseId = 'pending_' . str_replace('-', '_', $productSlug);
@endphp
@php $LAZY_LIMIT = 10; @endphp
@foreach($bucket['missiles']->take($LAZY_LIMIT) as $m)
@include('modules.clients.reseller.missiles._closer_row', ['m' => $m, 'mode' => 'pending'])
@endforeach
@if($count > $LAZY_LIMIT)
Ver los {{ $count - $LAZY_LIMIT }} restantes
@endif
@endforeach
@endif
{{-- Empty state global cuando NO hay nada en ningún bucket --}}
@if($readyTotal === 0 && $pendingTotal === 0)
Sin misiles para mostrar
Probá limpiar los filtros — o tu Reseller todavía no preparó misiles asignados a tu cartera.
@endif
{{-- Paginación si hay --}}
@if(isset($missilesPagination))
{{ $missilesPagination->withQueryString()->links() }}
@endif
{{-- ════════ Modal de outreach ════════ --}}