@props([ 'stages', 'hrefFor' => null, ]) @php $stages = collect($stages); $max = max(1, (int) $stages->max('count')); @endphp {{-- Funnel built from the workspace's own pipeline_stages — names, order, colours and won/lost flags all come from the database, nothing is hard-coded. Each row shows the step conversion from the stage above it and the share retained from the funnel's top. --}}
    merge(['class' => 'space-y-3']) }}> @foreach ($stages as $stage) @php $href = $hrefFor ? $hrefFor($stage) : null; $width = max(6, $stage['count'] / $max * 100); $color = $stage['color'] ?: ($stage['isWon'] ? '#059669' : ($stage['isLost'] ? '#e11d48' : 'var(--panel-primary)')); @endphp
  1. <{{ $href ? 'a' : 'div' }} @if ($href) href="{{ $href }}" wire:navigate @endif class="group block {{ $href ? 'cursor-pointer' : '' }}" >
    {{ $stage['name'] }} @if ($stage['isWon']) برنده @elseif ($stage['isLost']) ازدست‌رفته @endif {{ $stage['count'] }} معامله · {{ number_format($stage['amount']) }}
    @if ($stage['totalRate'] !== null && $width > 18) {{ $stage['totalRate'] }}٪ @endif
    @if ($stage['stepRate'] !== null && ! $loop->first)

    {{-- RTL: the arrow points left, following the reading direction. --}} {{ $stage['stepRate'] }}٪ تبدیل از مرحله قبل

    @endif
  2. @endforeach