@php $tz = config('app.display_timezone'); $money = fn (?float $value): ?string => $value === null ? null : trim($baseCode.' '.number_format($value, 2)); $statusColors = ['not_started' => 'slate', 'in_progress' => 'sky', 'opportunity_open' => 'indigo', 'not_a_fit' => 'amber', 'do_not_contact' => 'rose']; $stageColors = ['won' => 'emerald', 'lost' => 'rose', 'deferred' => 'amber']; $metrics = [ ['label' => __('Organisations'), 'value' => number_format($funnel['total']), 'icon' => 'building-office', 'accent' => '#6366f1', 'sub' => trans_choice(':count waiting|:count waiting', $funnel['not_started'], ['count' => number_format($funnel['not_started'])])], ['label' => __('Open pipeline'), 'value' => $money($figures['pipeline']) ?? __('Not estimated'), 'icon' => 'funnel', 'accent' => '#8b5cf6', 'sub' => $figures['unestimated'] > 0 ? trans_choice(':open open, :count not estimated|:open open, :count not estimated', $figures['unestimated'], ['open' => $figures['open'], 'count' => $figures['unestimated']]) : trans_choice(':count open opportunity|:count open opportunities', $figures['open'], ['count' => $figures['open']])], ['label' => __('Confirmed business'), 'value' => $money($figures['confirmed']) ?? __('Not available'), 'icon' => 'trophy', 'accent' => '#10b981', 'sub' => trans_choice(':count won|:count won', $figures['won'], ['count' => $figures['won']])], ['label' => __('Mode'), 'value' => __(\App\Models\Crm\Portfolio::MODES[$portfolio->mode] ?? $portfolio->mode), 'icon' => 'user-group', 'accent' => '#0ea5e9', 'sub' => $portfolio->isJoint() ? __('Sponsor collaborates on each') : __('Sponsor watches progress')], ['label' => __('Last activity'), 'value' => $figures['last_activity'] ? $figures['last_activity']->timezone($tz)->format('j M Y') : __('None yet'), 'icon' => 'clock', 'accent' => '#64748b', 'sub' => $figures['last_activity'] ? $figures['last_activity']->diffForHumans() : __('Nothing worked yet')], ]; $funnelMeta = [ 'not_started' => ['queue' => 'waiting', 'color' => 'bg-slate-400'], 'contacted' => ['queue' => 'in_progress', 'color' => 'bg-sky-500'], 'in_pipeline' => ['queue' => 'pipeline', 'color' => 'bg-indigo-500'], 'won' => ['queue' => 'pipeline', 'color' => 'bg-emerald-500'], 'lost' => ['queue' => 'pipeline', 'color' => 'bg-rose-500'], 'not_a_fit' => ['queue' => 'set_aside', 'color' => 'bg-amber-400'], ]; $funnelTotal = max(1, $funnel['total']); $pageIds = $members->pluck('id')->all(); $allOnPageSelected = $pageIds !== [] && array_diff($pageIds, array_map('intval', $selected)) === []; @endphp
{{ __('Portfolios') }}
@if ($canEdit) {{ __('Edit list') }} {{ __('Add organisations') }} @endif @if ($canPull) {{ __('Pull into pipeline') }} @endif @if ($portfolio->description)

{{ $portfolio->description }}

@endif
@foreach ($metrics as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach
{{-- Progress funnel --}}

{{ __('Progress') }}

{{ ctype_digit($assignee) ? __('For the person chosen below') : __('The whole list') }} @if ($funnel['nurture'] > 0) · {{ trans_choice(':count deferred to nurture|:count deferred to nurture', $funnel['nurture'], ['count' => $funnel['nurture']]) }} @endif

@foreach ($funnelMeta as $key => $meta) @if ($funnel[$key] > 0)
@endif @endforeach
@foreach ($funnelMeta as $key => $meta) @endforeach
{{-- Each person's share --}} @if ($progress->isNotEmpty())
@foreach ($progress as $row) @php $met = $row['target'] !== null && $row['pulled_this_week'] >= $row['target']; @endphp

{{ $row['user']->name }}

{{ $row['target'] !== null ? __(':pulled of :target pulled this week', ['pulled' => $row['pulled_this_week'], 'target' => $row['target']]) : __(':pulled pulled this week', ['pulled' => $row['pulled_this_week']]) }}

{{ __(':count waiting', ['count' => number_format($row['waiting'])]) }}
@endforeach
@endif {{-- Work queue --}}
@foreach (\App\Livewire\Crm\Portfolios\Show::QUEUES as $key => $meta) @endforeach

{{ __('Work queue') }}

{{ __('Tier 1 first. Pull a batch at a time: each one opens an opportunity with a dated next action.') }}

@if ($selected !== [] && $canPull)
{{ trans_choice(':count selected|:count selected', count($selected), ['count' => count($selected)]) }} @if ($canReassign) @endif
@endif
@if ($canPull) @endif @forelse ($members as $member) @php $opportunity = $member->opportunity; $inQueue = in_array($member->work_status, \App\Models\Crm\PortfolioMember::QUEUE_STATUSES, true); $step = (int) $member->cadence_step; $cadence = \App\Services\Crm\Portfolios\WorkQueue::CADENCE; @endphp @if ($canPull) @endif @empty @endforelse
{{ __('Organisation') }} {{ __('Tier') }} {{ __('Worked by') }} {{ __('Status') }} {{ __('Next') }} {{ __('Actions') }}
@if ($orgLinks && $member->customer) {{ $member->customer->name }} @else {{ $member->customer?->name ?? __('Not available') }} @endif @if ($member->customer?->sector)

{{ $sectors[$member->customer->sector] ?? $member->customer->sector }}

@endif
{{ $member->tier ? __('Tier :n', ['n' => $member->tier]) : '-' }} {{ $member->assignee?->name ?? __('Unassigned') }} @if ($opportunity) @if ($oppLinks) {{ __(\App\Models\Opportunity::STAGES[$opportunity->stage] ?? $opportunity->stage) }} @else {{ __(\App\Models\Opportunity::STAGES[$opportunity->stage] ?? $opportunity->stage) }} @endif @else {{ __(\App\Models\Crm\PortfolioMember::WORK_STATUSES[$member->work_status] ?? $member->work_status) }} @endif @if ($member->status_reason)

{{ $member->status_reason }}

@endif
@if ($opportunity && $opportunity->next_action) {{ $opportunity->next_action }} @if ($opportunity->next_action_due) · {{ $opportunity->next_action_due->format('j M') }} @endif @elseif ($inQueue) @if ($step < count($cadence)) {{ __('Touch :n of :total: :touch', ['n' => $step + 1, 'total' => count($cadence), 'touch' => __($cadence[$step])]) }} @else {{ __('Sequence finished with no reply') }} @endif @if ($member->last_touch_at) · {{ __('last :when', ['when' => $member->last_touch_at->diffForHumans()]) }} @endif @else - @endif @if ($canPull && $inQueue)
@if ($step < count($cadence)) @endif
@elseif ($canPull && in_array($member->work_status, ['not_a_fit', 'do_not_contact'], true)) @endif
@if ($funnel['total'] === 0) @elseif (trim($search) !== '' || $assignee !== '' || $tier !== '') @else @endif
@if ($members->hasPages())
{{ $members->links() }}
@endif
@if ($portfolio->importBatch && $canImport)

{{ __('Loaded from :file.', ['file' => $portfolio->importBatch->file_name]) }} {{ __('See the import') }}

@endif
{{-- Pull --}} {{ __('Pull into the pipeline') }}

{{ __('Each organisation becomes an opportunity at Prospect. :sponsor is the originator and whoever works it is the owner.', ['sponsor' => $portfolio->sponsor?->name ?? __('The sponsor')]) }} @if ($portfolio->isJoint()) {{ __('On this Joint list the sponsor is added to each as a collaborator.') }} @endif

@if ($selected !== []) @endif
@if ($pullMode === 'next')
@endif
{{ __('Cancel') }} {{ __('Open opportunities') }} {{ __('Opening…') }}
{{-- Status --}} {{ __('Set the work status') }}
@if ($statusTo === 'do_not_contact')

{{ __('A prospect marked Do not contact is marked so everywhere in the CRM. A trading customer keeps its lifecycle.') }}

@endif
{{ __('Cancel') }} {{ __('Save') }}
{{-- Reassign --}} {{ __('Reassign organisations') }}

{{ trans_choice('Move :count organisation to someone else. The reason is noted on the list.|Move :count organisations to someone else. The reason is noted on the list.', count($selected), ['count' => count($selected)]) }}

{{ __('Cancel') }} {{ __('Reassign') }}
{{-- Edit the list --}} {{ __('Edit list') }}

{{ __('Applies to opportunities pulled from now on.') }}

@foreach ($teamUsers as $person)
@if (in_array((string) $person->id, array_map('strval', $formAssignees), true)) @endif
@endforeach

{{ __('The sponsor cannot be changed: they originated every opportunity pulled from this list.') }}

{{ __('Cancel') }} {{ __('Save') }}
{{-- Add organisations --}} {{ __('Add organisations to the list') }}
@forelse ($addResults as $customer) @empty

{{ mb_strlen(trim($addSearch)) < 2 ? __('Type at least two letters of a name.') : __('No organisation on record matches, or they are all on this list already.') }}

@endforelse
{{ __('Cancel') }} {{ __('Add to the queue') }}
{{-- The contact sequence's touch dialog (S7). --}} @if ($canPull) @endif