@extends('layouts.app') @section('title', 'Executive dashboard') @section('heading', 'Executive dashboard') @section('content') @php $k = fn ($v) => number_format((float) $v); $i = $s['inventory']; $max = max(1, (float) collect($s['monthly'])->max(fn ($m) => (float) $m['revenue'])); @endphp
@if ($branches->count() > 1)
Branches
@foreach ($branches as $b)@endforeach
@endif

{{ $from->format('d M Y') }} to {{ $to->format('d M Y') }} · updated {{ now()->format('H:i:s') }} (refreshes every minute)

@can('executive.export')

{{ $export['excel'] ? 'Download Excel' : 'Download CSV' }}{{ $export['pdf'] ? 'Download PDF' : 'Printable report' }}

@endcan
@if ($canSeeProfit)

Last 12 months: revenue (bar) and gross profit (figure)

@foreach ($s['monthly'] as $n => $m)@php $h = (float) $m['revenue'] / $max * 130; $x = 10 + $n * 58; @endphp{{ $m['label'] }}{{ $m['units'] ? number_format((float) $m['gp'] / 1000).'k' : '' }}@endforeach
@endif

By branch

@if ($canSeeProfit)@endif @foreach ($s['branches'] as $r)@if ($canSeeProfit)@endif@endforeach @if ($canSeeProfit)@endif
Branches
BranchSoldRevenueGross profitMarginIn stockStock value
{{ $r['name'] }}{{ $r['units'] }}{{ $k($r['revenue']) }}{{ $k($r['gp']) }}{{ $r['margin'] !== null ? $r['margin'].'%' : '–' }}{{ $r['stock_units'] }}{{ $k($r['stock_value']) }}
All branches{{ $s['totals']['units'] }}{{ $k($s['totals']['revenue']) }}{{ $k($s['totals']['gp']) }}{{ $s['totals']['margin'] !== null ? $s['totals']['margin'].'%' : '–' }}{{ $i['units_now'] }}{{ $k($i['value_now']) }}

Inventory

Turn this period
{{ $i['turn'] ?? '–' }}×
Average stock value
KSh {{ $k($i['average_value']) }}
Average days to sell a car
{{ $i['avg_days_to_sell'] ?? '–' }}
Money tied up in cars over 90 days
KSh {{ $k($i['aged_value']) }}

Turn = cost of cars sold ÷ average stock value, using each car's landed cost. A higher number means cash is not sitting in the yard.

Pipeline and cash

Open deals
{{ $s['pipeline']['open_deals'] }} · KSh {{ $k($s['pipeline']['open_deal_value']) }}
Still to collect
KSh {{ $k($s['pipeline']['receivable']) }}
@foreach ($s['pipeline']['leads'] as $stage => $n)
Leads: {{ \App\Enums\LeadStage::from($stage)->label() }}
{{ $n }}
@endforeach
@if ($canSeeProfit && count($s['leaders']))

Top salespeople

    @foreach ($s['leaders'] as $l)
  1. {{ $l['name'] }} · {{ $l['units'] }} soldKSh {{ $k($l['gp']) }}
  2. @endforeach
@endif @php $h = $s['health']; $problems = collect($h)->filter(); @endphp

Needs attention

@if ($problems->isEmpty())

Nothing is waiting.

@else@endif
@endsection