@php $tz = config('app.display_timezone'); $periodLabel = __(\App\Livewire\Crm\Dashboard\My::PERIODS[$period]); $pipeline = $figures['pipeline']; $outcomes = $figures['outcomes']; $workCards = [ ['label' => __('Overdue tasks'), 'value' => number_format($figures['overdue']), 'icon' => 'exclamation-triangle', 'accent' => '#e11d48', 'sub' => $figures['overdue'] > 0 ? __('Do or reschedule') : __('All on time'), 'href' => route('crm.tasks.index', ['view' => 'overdue'])], ['label' => __('Due today'), 'value' => number_format($figures['today']), 'icon' => 'clock', 'accent' => '#f59e0b', 'sub' => __('Still to do today'), 'href' => route('crm.tasks.index', ['view' => 'today'])], ['label' => __('Due this week'), 'value' => number_format($figures['week']), 'icon' => 'calendar-days', 'accent' => '#6366f1', 'sub' => __('From now to Sunday'), 'href' => route('crm.tasks.index', ['view' => 'week'])], ['label' => __('Logged this week'), 'value' => number_format($figures['logged']), 'icon' => 'chat-bubble-left-right', 'accent' => '#0ea5e9', 'sub' => __('Calls, emails, meetings'), 'href' => route('crm.communications.index', ['period' => 'week', 'scope' => 'mine'])], ['label' => __('Next action overdue'), 'value' => number_format($figures['next_overdue']), 'icon' => 'flag', 'accent' => '#f97316', 'sub' => __('Or none recorded'), 'focus' => 'next_overdue'], ]; $pipelineCards = [ ['label' => __('Active pipeline'), 'value' => number_format($pipeline['count']), 'icon' => 'funnel', 'accent' => '#4f46e5', 'sub' => $pipeline['value_base'] !== null ? trim($baseCode.' '.number_format($pipeline['value_base'], 2)).($pipeline['not_estimated'] > 0 ? ' · '.__(':n not estimated', ['n' => $pipeline['not_estimated']]) : '') : ($pipeline['count'] > 0 ? __('Not estimated') : __('Nothing open')), 'focus' => 'pipeline'], ['label' => __('Gone quiet'), 'value' => number_format($figures['stale']), 'icon' => 'pause-circle', 'accent' => '#64748b', 'sub' => __('No activity for :days days', ['days' => $figures['stale_days']]), 'focus' => 'stale'], ['label' => __('Qualified'), 'value' => number_format($figures['qualified']), 'icon' => 'check-circle', 'accent' => '#10b981', 'sub' => __('First time, :period', ['period' => mb_strtolower($periodLabel)]), 'focus' => 'qualified'], ['label' => __('Win rate'), 'value' => $figures['win_rate'] === null ? __('Not applicable') : number_format($figures['win_rate'] * 100, 0).'%', 'icon' => 'trophy', 'accent' => '#d97706', 'sub' => __(':won won, :lost lost', ['won' => $outcomes['won'], 'lost' => $outcomes['lost']]), 'focus' => 'outcomes'], ['label' => __('Days to win'), 'value' => $figures['days_to_win'] === null ? __('Not applicable') : number_format($figures['days_to_win'], 1), 'icon' => 'arrow-trending-up', 'accent' => '#8b5cf6', 'sub' => __('Average, won :period', ['period' => mb_strtolower($periodLabel)]), 'focus' => 'won'], ]; $healthRing = $health['percent']; $healthTone = $healthRing === null ? 'text-slate-300' : ($healthRing >= 75 ? 'text-emerald-500' : ($healthRing >= 50 ? 'text-amber-500' : 'text-rose-500')); $healthWord = $healthRing === null ? __('Not assessed yet') : ($healthRing >= 75 ? __('Overall account health is good.') : ($healthRing >= 50 ? __('Some accounts need a visit.') : __('Several accounts are slipping.'))); $needAttention = $health['watch'] + $health['at_risk']; $viewWord = mb_strtolower(__(\App\Services\Crm\CrmMetrics::VIEWS[$view])); @endphp
@if ($canCreate) {{ __('New task') }} {{ __('Log activity') }} @endif {{-- My work --}}
@foreach ($workCards as $m) @include('livewire.crm.dashboard.partials.card', ['m' => $m, 'active' => isset($m['focus']) && $focus === $m['focus']]) @endforeach
{{-- Pipeline lens --}}

{{ __('My pipeline') }}

{{ __('Managed, originated and supported overlap by design and are never added together.') }}

@foreach (\App\Services\Crm\CrmMetrics::VIEWS as $key => $label) @endforeach
@foreach (\App\Livewire\Crm\Dashboard\My::PERIODS as $key => $label) @endforeach
@foreach ($pipelineCards as $m) @include('livewire.crm.dashboard.partials.card', ['m' => $m, 'active' => $focus === $m['focus']]) @endforeach
{{-- Pipeline overview --}}

{{ __('Pipeline overview') }}

{{ $chart['mode'] === 'value' ? __('Estimated value by stage, :view', ['view' => $viewWord]) : __('Opportunities by stage, :view', ['view' => $viewWord]) }}

@if ($pipeline['count'] === 0)
@else
@endif
{{-- Relationship pulse --}}

{{ __('Relationship pulse') }}

{{ __('The organisations you own as relationship owner') }}

@if ($healthRing !== null) @endif
{{ $healthRing === null ? '–' : $healthRing.'%' }}

{{ __('Healthy accounts') }}

{{ $healthWord }}

@if ($health['assessed'] + $health['unknown'] === 0)

{{ __('No organisations have you as relationship owner yet.') }}

@else

{{ trans_choice(':n account|:n accounts', $health['assessed'] + $health['unknown'], ['n' => $health['assessed'] + $health['unknown']]) }}{{ $health['unknown'] > 0 ? ' · '.trans_choice(':n not assessed|:n not assessed', $health['unknown'], ['n' => $health['unknown']]) : '' }}

@endif
{{ __('View account health') }}
{{-- The list behind the chosen card --}} @if ($focusList !== null)

{{ __(\App\Livewire\Crm\Dashboard\My::FOCUSES[$focus]) }}

{{ __(\App\Services\Crm\CrmMetrics::VIEWS[$view]) }} · {{ in_array($focus, ['qualified', 'won', 'outcomes'], true) ? $periodLabel : __('As it stands now') }}

@forelse ($focusList as $o) @php $late = $o->isOpen() && $o->next_action_due && $o->next_action_due->lt(now($tz)->startOfDay()); @endphp @empty @endforelse
{{ __('Opportunity') }} {{ __('Stage') }} {{ __('Estimated value') }} {{ __('Next action') }} {{ __('Last activity') }} {{ __('Actions') }}
{{ $o->title }} {{ $o->customer?->name }}{{ $view !== 'managed' && $o->owner ? ' · '.__('owner :name', ['name' => $o->owner->name]) : '' }} {{ __(\App\Models\Opportunity::STAGES[$o->stage] ?? $o->stage) }} @if ($o->estimated_value === null) {{ __('Not estimated') }} @else {{ $o->currency_code }} {{ number_format((float) $o->estimated_value, 2) }} @endif {{ $o->next_action ?: __('None recorded') }} @if ($o->next_action_due) {{ $o->next_action_due->format('D j M') }} @endif {{ $o->last_activity_at ? $o->last_activity_at->diffForHumans() : __('Nothing logged') }} @if ($canCreate && $o->isOpen()) @endif
@include('livewire.crm.partials.paginator', ['rows' => $focusList])
@endif
{{-- Up next --}}

{{ __('Up next') }}

{{ __('Overdue and due this week, soonest first') }}

{{ __('All my tasks') }}
    @forelse ($upNext as $task)
  • {{ $task->title }}

    {{ $task->due_at->copy()->timezone($tz)->format(\App\Services\Crm\TaskService::isDateOnly($task->due_at) ? 'D j M' : 'D j M, H:i') }} @if ($task->opportunity) · {{ $task->opportunity->title }} @elseif ($task->customer) · {{ $task->customer->name }} @endif

  • @empty
  • @endforelse
{{-- Recently logged --}}

{{ __('Recently logged') }}

{{ __('Your latest activity') }}

{{ __('Communications') }}
    @forelse ($recent as $entry)
  • {{ __(\App\Models\Interaction::CRM_TYPES[$entry->type] ?? ucfirst($entry->type)) }} · {{ $entry->subject instanceof \App\Models\Opportunity ? $entry->subject->title : ($entry->customer?->name ?? __('Not recorded')) }} {{ $entry->occurred_at?->diffForHumans() }}

    {{ \Illuminate\Support\Str::limit($entry->outcome ?: $entry->body, 140) }}

  • @empty
  • @endforelse