{{-- Flash messages --}} @if (session()->has('success'))
{{ session('success') }}
@endif {{-- Header --}}

{{ __('Deals') }}

{{ __('Track your sales pipeline and deal progress') }}

@if($this->pipelines->isNotEmpty())
{{-- New pipeline inline form --}}
@endif
@foreach(['open' => __('Open'), 'won' => __('Won'), 'lost' => __('Lost'), 'all' => __('All')] as $fKey => $fLabel) @endforeach
@if($this->stages->isNotEmpty()) {{-- Pipeline summary --}}
@foreach($this->stages as $stage)
{{-- Colored top bar --}}
{{ $stage->name }}

@currency($stage->total_value)

{{ $stage->deal_count }} {{ $stage->deal_count === 1 ? __('deal') : __('deals') }}

@endforeach
{{-- Getting started hint (shown when pipeline has no deals) --}} @if($this->stages->every(fn ($s) => $s->deal_count === 0))

{{ __('Getting started with Deals') }}

{{ __('Click') }} "+ {{ __('Add deal') }}" {{ __('in any stage column to create your first deal. You can drag deals between stages, mark them as Won/Lost, and track your pipeline value.') }}

@endif {{-- Kanban Board --}}
@foreach($this->stages as $stage) @php $stageSlug = \Illuminate\Support\Str::slug($stage->name); $isWon = $stageSlug === 'won' || $stageSlug === 'closed-won'; $isLost = $stageSlug === 'lost' || $stageSlug === 'closed-lost'; @endphp
{{-- Stage header --}}

{{ $stage->name }}

{{ $stage->deal_count }}
@currency($stage->total_value)
{{-- Cards container (drop zone) --}}
{{-- Drop indicator --}}
{{ __('Drop here') }} — {{ $stage->name }}
@foreach($stage->loaded_deals as $deal)
{{-- Colored left border via pseudo element --}}

{{ $deal->contact?->company ?? $deal->contact?->full_name ?? __('No contact') }}

@currency($deal->value)
@php $daysInStage = intval($deal->updated_at->diffInDays(now())); @endphp @if($daysInStage > 0) {{ $daysInStage }}d @endif @if($deal->assignedTo)
{{ $deal->assignedTo->initials }}
@endif
@if($deal->status !== 'open')
{{ ucfirst($deal->status) }}
@endif
@endforeach {{-- Add deal --}} @if($addingToStageId === $stage->id)
@error('newDealTitle')

{{ $message }}

@enderror
$
@else @endif
@endforeach
@else

{{ __('No pipeline found') }}

{{ __('Create a pipeline with stages to start tracking your deals and revenue.') }}

@endif {{-- Expanded Deal Detail Modal --}} @if($expandedDealId && $this->expandedDeal) @php $deal = $this->expandedDeal; @endphp @endif