{{-- Card moderna para listado de misiles. Estilo equivalente al refactor de `/my-projects/index-client.blade.php`: - Hero gradient color-coded por stage (unsent=gris, contacted=azul, interested=naranja, followup=rojo, closed=verde/dark) - Avatar circular con logo del producto (o letra inicial fallback) - Stage-badge flotante arriba a la derecha - 2 chips (industria + producto) - Footer con próxima acción contextual + WhatsApp quick action Props: - missile: App\Models\MissileDraft (con outreachAttempts cargados idealmente) - showActions: bool — muestra footer con quick actions (default true) - href: string — destino al click. Default: /closer/missiles/{id} --}} @props([ 'missile', 'showActions' => true, 'href' => null, ]) @php use App\Models\MissileDraft; use App\Models\MissileOutreachAttempt; $stage = $missile->salesStage(); $cols = MissileDraft::salesStageColumns(); $stageDef = $cols[$stage] ?? ['label' => 'N/A', 'icon' => 'fa-circle', 'class' => 'secondary']; // Gradient por stage (color-coded hero) $gradients = [ 'unsent' => 'linear-gradient(135deg, #94a3b8 0%, #64748b 100%)', 'presented' => 'linear-gradient(135deg, #818cf8 0%, #4338ca 100%)', 'contacted' => 'linear-gradient(135deg, #38bdf8 0%, #0284c7 100%)', 'interested' => 'linear-gradient(135deg, #fb923c 0%, #ea580c 100%)', 'followup' => 'linear-gradient(135deg, #f87171 0%, #dc2626 100%)', 'closed' => $missile->isClosedWon() ? 'linear-gradient(135deg, #34d399 0%, #059669 100%)' : 'linear-gradient(135deg, #475569 0%, #1e293b 100%)', ]; $gradient = $gradients[$stage] ?? $gradients['unsent']; // Letra del avatar (fallback si no hay logo del producto) $initial = strtoupper(mb_substr($missile->prospect_name ?? $missile->project_name ?? '?', 0, 1)); // URL del detalle $detailUrl = $href ?? route('closer.missiles.show', $missile->id); // Último intento + próximo paso sugerido $lastAttempt = $missile->relationLoaded('outreachAttempts') ? $missile->outreachAttempts->sortByDesc('attempted_at')->first() : $missile->latestAttempt; // ¿Quién contactó? (para badge "Contactado por X" — visibilidad cruzada // entre comerciales del mismo team). $contactedBy = null; if ($lastAttempt && $lastAttempt->relationLoaded('outreachAttempts') && $lastAttempt->relationLoaded('attemptedBy') && $lastAttempt->attemptedBy) { $contactedBy = trim($lastAttempt->attemptedBy->first_name ?: explode('@', $lastAttempt->attemptedBy->email)[0]); } elseif ($lastAttempt && $lastAttempt->attemptedBy ?? null) { $contactedBy = trim($lastAttempt->attemptedBy->first_name ?: explode('@', $lastAttempt->attemptedBy->email)[0]); } // Strategic intel — para mini-score badge en el card $intel = app(\App\Services\LeadIntelParser::class)->fromMissile($missile); $hasIntel = $intel['from_hunter'] ?? false; $nextAction = match($stage) { 'unsent' => '🚀 Contactar al prospect', 'presented' => ($missile->first_visited_at ?? null) ? '👀 Ya lo vio — escribile' : '📤 En presentación', 'contacted' => '💬 Esperando respuesta — agendar follow-up', 'interested' => '🔥 Avanzar a propuesta', 'followup' => $lastAttempt && $lastAttempt->next_followup_at ? '📞 Recontactar ' . $lastAttempt->next_followup_at->diffForHumans() : '📞 Recontactar pronto', 'closed' => $missile->isClosedWon() ? '🏆 Vendido' : '❌ Cerrado', default => '', }; // WhatsApp link si tiene phone $whatsAppHref = $missile->prospect_phone ? 'https://wa.me/' . preg_replace('/\D/', '', $missile->prospect_phone) : null; // Industria / producto (chips) $productLabel = $missile->product_slug ? ucwords(str_replace(['-', '_'], ' ', $missile->product_slug)) : null; @endphp
{{-- HERO (gradient color-coded por stage) --}}
{{-- Badge "Contactado por X" arriba izquierda (visibilidad cruzada del team) --}} @if($contactedBy)
{{ $contactedBy }}
@endif {{-- Badge flotante arriba derecha --}}
{{-- Avatar circular (con logo del producto si está cacheado, o letra fallback) --}}
{{ $initial }}
{{-- BODY --}}
{{-- Nombre + Subtítulo --}}

{{ $missile->prospect_name ?: $missile->project_name ?: 'Sin nombre' }}

@if($missile->subdomain)
{{ $missile->subdomain }}.bewpro.com
@endif @if($missile->prospect_email)
{{ $missile->prospect_email }}
@endif {{-- Web actual del prospect (link directo + tipo visible) --}} @if($missile->prospect_website) @php $w = $missile->prospect_website; $isSocial = str_contains($w, 'instagram') || str_contains($w, 'facebook') || str_contains($w, 'tiktok'); $wIcon = $isSocial ? (str_contains($w, 'instagram') ? 'fa-brands fa-instagram text-danger' : 'fa-brands fa-facebook text-primary') : 'fa-globe2 text-info'; $wLabel = $isSocial ? 'Red social' : 'Web propia'; @endphp @else
Sin web detectada
@endif {{-- Chips: producto + tier + zona + sub + intel score --}}
@if($hasIntel && $intel['recommendation']) {{ $intel['recommendation_emoji'] }} {{ $intel['lead_score'] ?? '—' }}/100 @endif @if($productLabel) {{ $productLabel }} @endif @if($missile->zone ?? null) {{ $missile->zone }} @endif @if($missile->sub_product ?? null) {{ ucwords(str_replace(['_', '-'], ' ', $missile->sub_product)) }} @endif
{{-- 2x2 Stats grid (intentos / último contacto) --}}
Contactos
{{ $missile->outreachAttempts->count() ?? 0 }}
Último
{{ $lastAttempt ? $lastAttempt->attempted_at->diffForHumans(null, true) : '—' }}
{{-- Asignado a (pool compartido OLA 5) --}} @php $assignee = $missile->relationLoaded('closer') ? $missile->closer : null; $assigneeName = null; if ($assignee) { $assigneeName = trim(($assignee->first_name ?? '') . ' ' . ($assignee->last_name ?? '')); if ($assigneeName === '') $assigneeName = $assignee->email ?? '—'; } $currentUserId = auth()->id(); $isMine = $assignee && (int) $assignee->id === (int) $currentUserId; @endphp @if($assignee)
{{ $isMine ? 'Tuyo' : 'Asignado a ' . $assigneeName }}
@else
Sin asignar — tomalo
@endif {{-- Próxima acción contextual --}} @if($nextAction)
{{ $nextAction }}
@endif {{-- Datos del prospect (web + maps) — útil para investigar antes de contactar --}} @if(!empty($missile->prospect_website) || !empty($missile->prospect_maps_url))
@if(!empty($missile->prospect_website)) Ver web @endif @if(!empty($missile->prospect_maps_url)) Maps @endif
@endif {{-- Footer Quick Actions --}} @if($showActions)
Ver detalle @if($whatsAppHref) @endif
@endif
@once @push('styles') @endpush @endonce