@php $tz = config('app.display_timezone'); $tabMeta = [ 'dormant' => ['label' => __('Due a dormant review'), 'icon' => 'arrow-trending-down', 'accent' => '#f59e0b', 'sub' => __('No order in :days days', ['days' => $dormantDays])], 'reviews' => ['label' => __('Reviews due'), 'icon' => 'calendar-days', 'accent' => '#6366f1', 'sub' => __('Planned review date reached')], 'strategic' => ['label' => __('Strategic accounts'), 'icon' => 'star', 'accent' => '#e11d48', 'sub' => __('Marked strategic')], 'all' => ['label' => __('All customers'), 'icon' => 'building-office', 'accent' => '#0ea5e9', 'sub' => __('Active, dormant and partners')], ]; $lifecycleColor = ['active' => 'emerald', 'dormant' => 'amber', 'partner' => 'violet']; $empty = [ 'dormant' => [__('Nobody has gone quiet'), __('Accounts with no order for :days days appear here for someone to review. Nothing changes on its own.', ['days' => $dormantDays])], 'reviews' => [__('No reviews due'), __('When an account\'s next review date comes round, it appears here.')], 'strategic' => [__('No strategic accounts yet'), __('Mark the accounts that matter most so they are reviewed on a plan.')], 'all' => [__('No customers yet'), __('An organisation becomes a customer on its first invoice.')], ]; @endphp
@can('create', \App\Models\Opportunity::class) {{ __('Repeat or cross-sell') }} @endcan {{-- At-risk accounts and reorders falling due (S18). Mounted once it is built. --}} @unless (\App\Livewire\Crm\Accounts\Signals::isComingSoon()) @endunless
@foreach ($tabMeta as $key => $m) @endforeach

{{ __('Growth in the pipeline') }}

{{ number_format($growth) }}

{{ __('Open repeat and cross-sell') }}
@foreach ($tabMeta as $key => $meta) @endforeach
@if ($seesTeam)
@endif
@if ($tab === 'dormant')

{{ __('A prompt, not a status. These accounts have not ordered for :days days, so someone should look at them. Recording the review is what decides: still active, dormant, or a follow-up first. Until then nothing about the account changes.', ['days' => $dormantDays]) }}

@endif

{{ $tabMeta[$tab]['label'] }}

{{ $scope === 'team' ? __('Everyone\'s accounts') : __('Accounts you are the relationship owner of') }}

@forelse ($accounts as $account) @php $lastOrder = $account->last_order_at ? \Illuminate\Support\Carbon::parse($account->last_order_at) : null; $canEdit = \Illuminate\Support\Facades\Gate::allows('updateOrganisation', $account); @endphp @empty @endforelse
{{ __('Account') }} {{ __('Owner') }} {{ __('Last invoice') }} {{ __('Open opportunities') }} {{ __('Next review') }} {{ __('Actions') }}
{{ $account->name }}
{{ __(\App\Models\Customer::LIFECYCLES[$account->lifecycle] ?? $account->lifecycle) }} @if ($account->priority_tier) {{ __(\App\Models\Customer::PRIORITY_TIERS[$account->priority_tier] ?? '') }} @endif @if ($account->is_strategic) {{ __('Strategic') }} @endif
{{ $account->relationshipOwner?->name ?? __('Nobody yet') }} @if ($lastOrder) {{ $lastOrder->copy()->timezone($tz)->format('j M Y') }} {{ trans_choice('{0}today|{1}:count day ago|[2,*]:count days ago', (int) floor($lastOrder->diffInDays($today)), ['count' => (int) floor($lastOrder->diffInDays($today))]) }} @else {{ __('No invoice yet') }} @endif {{ number_format((int) $account->open_opportunities_count) }} {{ $account->next_review_on?->format('j M Y') ?? __('Not planned') }}
@if ($canEdit) @else {{ __('Open') }} @endif
@if (trim($q) !== '' || $tier !== '') @else @endif
@if ($accounts->hasPages())
{{ $accounts->links() }}
@endif
{{ $reviewing ? __('Review :name', ['name' => $reviewing->name]) : __('Account review') }} @if ($reviewing)
@if ($reviewingIsDue)

{{ __('No order in :days days. Look at the last conversations and open opportunities before deciding.', ['days' => $dormantDays]) }}

@endif
{{ __('What did you decide?') }}
@foreach (\App\Services\Crm\Accounts\AccountReview::OUTCOMES as $value => $label) @endforeach
@if (($review['outcome'] ?? '') === 'follow_up')

{{ __('The follow-up becomes a task for the relationship owner.') }}

@endif

{{ __('The review is logged on the organisation\'s activity. Choosing Dormant changes its lifecycle to Dormant; it stays a customer you can invoice.') }}

@endif
{{ __('Cancel') }} {{ __('Record review') }} {{ __('Saving…') }}