{{-- Four controls in a non-wrapping row was 120px wider than a phone screen, which pushed the whole document — and therefore the fixed bottom dock — past the viewport. --}}
{{ __('Aged AR / AP') }} {{ __('Budget vs Actual') }}
@php $reportTabs = [ 'overview' => __('Overview'), 'sales' => __('Sales'), 'production' => __('Production'), 'finance' => __('Finance'), ]; @endphp

{{ __('Executive Overview') }}

{{ $executive['periodLabel'] }}

@if ($period === 'custom') {{ __('to') }} @endif
@foreach ($reportTabs as $key => $label) @endforeach
{{-- =================================================================== OVERVIEW TAB, Executive command center (approved mockup). Every figure read from the shared services via the overview payload. ==================================================================== --}} @php $ov = $overview; $hex = ['emerald' => '#10b981', 'sky' => '#0ea5e9', 'amber' => '#f59e0b', 'rose' => '#f43f5e', 'slate' => '#94a3b8', 'indigo' => '#6366f1']; $toneText = ['emerald' => 'text-emerald-600', 'sky' => 'text-sky-600', 'amber' => 'text-amber-600', 'rose' => 'text-rose-600', 'slate' => 'text-slate-500']; $toneBg = ['emerald' => 'bg-emerald-50 text-emerald-700', 'sky' => 'bg-sky-50 text-sky-700', 'amber' => 'bg-amber-50 text-amber-700', 'rose' => 'bg-rose-50 text-rose-700', 'slate' => 'bg-slate-100 text-slate-600']; $toneBar = ['emerald' => 'bg-emerald-500', 'sky' => 'bg-sky-500', 'amber' => 'bg-amber-500', 'rose' => 'bg-rose-500', 'slate' => 'bg-slate-400']; $sevBg = ['critical' => 'bg-rose-50 text-rose-700', 'high' => 'bg-orange-50 text-orange-700', 'medium' => 'bg-amber-50 text-amber-700', 'low' => 'bg-slate-100 text-slate-600']; // Coloured delta chip for a percent change. $delta = function (?float $v, bool $up = true): array { if ($v === null) { return ['—', 'text-slate-400', 'minus']; } $good = $v >= 0 ? $up : ! $up; return [($v > 0 ? '+' : '') . number_format($v, 1) . '%', $good ? 'text-emerald-600' : 'text-rose-600', $v >= 0 ? 'arrow-trending-up' : 'arrow-trending-down']; }; // Inline sparkline polyline points for a value list. $spark = function (array $vals, float $w = 120, float $h = 36): string { $vals = array_map('floatval', $vals); $n = count($vals); if ($n === 0) { return ''; } $max = max(1.0, max($vals)); $pts = []; foreach ($vals as $i => $v) { $x = $n <= 1 ? $w / 2 : ($i / ($n - 1)) * $w; $y = $h - (max(0.0, $v) / $max) * $h; $pts[] = round($x, 1) . ',' . round($y, 1); } return implode(' ', $pts); }; @endphp

{{ __('Business Health Score') }}

{{ $ov['health']['score'] }} /100

{{ $ov['health']['status'] }}

{{ ($ov['health']['trend'] >= 0 ? '+' : '') . $ov['health']['trend'] }} {{ __('vs previous period') }}

{{ __('Business Status') }}

@foreach ($ov['statusStrip'] as $badge)

{{ $badge['label'] }}

{{ $badge['status'] }}

@if (! empty($badge['sub']))

{{ $badge['sub'] }}

@endif
@endforeach
@php $pt = $ov['profitThreshold']; @endphp

{{ __('Profit Threshold Progress') }}

{{ __('Where the business sits on the profit journey') }}

{{ __('Break-even') }}
{{ $pt['break_even'] }}
{{ __('GP Hurdle') }}
{{ $pt['hurdle'] }}
{{ __('Actual GP') }}
{{ $pt['actual_gp'] }}

{{ __('Distance to Break-even') }}

{{ $pt['to_break_even'] }}

{{ $pt['above_break_even'] ? __('Above break-even') : __('Below break-even') }}

{{ __('Distance to GP Hurdle') }}

{{ $pt['to_hurdle'] }}

{{ __(':pct% of the way there', ['pct' => $pt['hurdle_pct']]) }}

{{ __('Excess GP') }}

{{ $pt['excess_gp'] }}

{{ __('When hurdle is reached') }}

@php $cm = $ov['commission']; @endphp

{{ __('Commission Status') }}

{{ $cm['active'] ? __('Active') : __('Not Active') }}
{{ __('GP Hurdle') }}{{ $cm['gp_hurdle'] }}
{{ __('Actual GP') }}{{ $cm['actual_gp'] }}
@unless ($cm['active'])

{{ __('Need :amt more GP', ['amt' => $cm['remaining']]) }}

{{ __('to activate commission') }}

@endunless
{{ __('Commission Pool') }}{{ $cm['pool'] }}
{{ __('Sales Pool') }}{{ $cm['sales_pool'] }}
{{ __('Production Pool') }}{{ $cm['production_pool'] }}
@foreach ($ov['kpis'] as $kpi)

{{ $kpi['label'] }}

{{ $kpi['value'] }}

@if ($kpi['target'] !== null)
{{ __('Target') }}: {{ $kpi['target'] }} {{ $kpi['mtd_vs_target'] ?? 0 }}%
@elseif (! empty($kpi['sub']))

{{ $kpi['sub'] }}

@endif
@foreach (['mom' => __('MoM'), 'yoy' => __('YoY'), 'sixm' => __('6M')] as $k => $lbl) @php [$txt, $cls, $arrow] = $delta($kpi[$k] ?? null, $kpi['up_good']); @endphp

{{ $txt }}

{{ $lbl }}

@endforeach
@endforeach
@php $tr = $ov['trend']; @endphp

{{ __('Business Performance Trend') }}

@foreach (['revenue' => __('Revenue'), 'profit' => __('Profit'), 'operations' => __('Operations')] as $v => $lbl) @endforeach
@php $tmax = max(1, (float) $tr['max']); $gW = 520; $gH = 210; $gpl = 8; $gpr = 8; $gpb = 24; $gpt = 10; $gpw = $gW - $gpl - $gpr; $gph = $gH - $gpt - $gpb; $gn = count($tr['labels']); $gx = fn ($i) => $gn <= 1 ? $gpl + $gpw / 2 : $gpl + ($i / ($gn - 1)) * $gpw; $gy = fn ($v) => $gpt + $gph - (max(0.0, (float) $v) / $tmax) * $gph; $stepg = (int) max(1, ceil($gn / 8)); @endphp
@if ($tr['target'] !== null) @php $tp = []; foreach (($tr['target']['values'] ?? []) as $i => $v) { $tp[] = round($gx($i), 1) . ',' . round($gy($v), 1); } @endphp @endif @foreach ($tr['datasets'] as $d) @php $dp = []; foreach ($d['values'] as $i => $v) { $dp[] = round($gx($i), 1) . ',' . round($gy($v), 1); } @endphp @endforeach @foreach ($tr['labels'] as $i => $lbl) @if ($i % $stepg === 0) {{ $lbl }} @endif @endforeach
@foreach ($tr['datasets'] as $d) {{ $d['label'] }} @endforeach @if ($tr['target'] !== null) {{ $tr['target']['label'] }} @endif

{{ __('Target Achievement') }}

@foreach ($ov['targetAchievement'] as $b)
{{ $b['label'] }} {{ $b['actual'] }} / {{ $b['target'] }} {{ $b['pct'] !== null ? $b['pct'] . '%' : '—' }}
@endforeach

{{ __('End of Month Forecast') }}

{{ $ov['forecast']['projecting'] ? __('Projected from current run rate') : __('Period complete, actuals') }}

@foreach ($ov['forecast']['items'] as $f)

{{ $f['label'] }}

{{ $f['value'] }}

@if ($f['vs_target'] !== null)

{{ $f['vs_target'] }}% {{ __('of target') }}

@elseif (! empty($f['note']))

{{ $f['note'] }}

@endif @if (! empty($f['target']))

{{ __('Target') }}: {{ $f['target'] }}

@endif
@endforeach

{{ __('Key Business Insights') }}

@forelse ($ov['insights'] as $ins)
{{ $ins['text'] }}
@empty

{{ __('Insights appear as data accumulates.') }}

@endforelse

{{ __('Risks & Alerts') }}

@forelse ($ov['risks'] as $risk)
{{ $risk['label'] }} {{ $risk['severity'] }}
@empty
{{ __('No active risks.') }}
@endforelse
@php $dq = $ov['dataQuality']; $dqColor = $dq['score'] >= 90 ? 'emerald' : ($dq['score'] >= 70 ? 'amber' : 'rose'); @endphp

{{ __('Data Quality') }}

{{ $dq['score'] }}%

{{ $dq['status'] }}

{{ trans_choice('{0}No issues|{1}:n issue found|[2,*]:n issues found', $dq['issue_count'], ['n' => $dq['issue_count']]) }}

@if ($dq['trend'] !== 0)

{{ $dq['trend'] > 0 ? __(':n fewer vs last period', ['n' => abs($dq['trend'])]) : __(':n more vs last period', ['n' => abs($dq['trend'])]) }}

@endif
@if (! empty($dq['issues']))
    @foreach ($dq['issues'] as $iss)
  • {{ $iss['label'] }}{{ $iss['count'] }}
  • @endforeach
@endif

{{ __('Top Performing Customers') }}

{{ __('By gross profit') }}

@forelse ($ov['topCustomers'] as $c) @empty @endforelse
{{ __('Customer') }} {{ __('Revenue') }} {{ __('GP') }} {{ __('Margin') }} {{ __('Jobs') }}
{{ $c['name'] }} {{ $c['revenue'] }} {{ $c['gp'] }} {{ number_format($c['margin'], 1) }}% {{ $c['jobs'] }}
{{ __('No jobs in this period.') }}

{{ __('Most Profitable Categories') }}

{{ __('By gross profit') }}

@forelse ($ov['topCategories'] as $c) @empty @endforelse
{{ __('Category') }} {{ __('Revenue') }} {{ __('GP') }} {{ __('Margin') }}
{{ $c['name'] }} {{ $c['revenue'] }} {{ $c['gp'] }} {{ number_format($c['margin'], 1) }}%
{{ __('No jobs in this period.') }}

{{ __('Business Health Heatmap') }}

{{ __('Monthly Business Health Score') }}

@foreach ($ov['heatmap'] as $cell) @endforeach @foreach ($ov['heatmap'] as $cell) @endforeach @foreach ($ov['heatmap'] as $cell) @endforeach
{{ __('Metric') }}{{ $cell['label'] }}
{{ __('Score') }} {{ $cell['score'] }}
{{ __('Change') }} {{ $cell['change'] === null ? '—' : (($cell['change'] >= 0 ? '+' : '') . $cell['change']) }}
@php $groups = collect($executive['groups'])->keyBy('key'); $tileChip = [ 'indigo' => 'bg-indigo-50 text-indigo-600', 'sky' => 'bg-sky-50 text-sky-600', 'violet' => 'bg-violet-50 text-violet-600', 'emerald' => 'bg-emerald-50 text-emerald-600', 'amber' => 'bg-amber-50 text-amber-600', 'rose' => 'bg-rose-50 text-rose-600', 'slate' => 'bg-slate-100 text-slate-400', ]; $statusDot = [ 'on' => 'bg-emerald-500', 'at_risk' => 'bg-amber-500', 'behind' => 'bg-rose-500', 'none' => 'bg-slate-300', 'pending' => 'bg-slate-300', ]; $toneBadge = [ 'emerald' => 'bg-emerald-50 text-emerald-700 ring-emerald-600/20', 'amber' => 'bg-amber-50 text-amber-700 ring-amber-600/20', 'rose' => 'bg-rose-50 text-rose-700 ring-rose-600/20', 'slate' => 'bg-slate-100 text-slate-600 ring-slate-500/20', ]; $groupMeta = [ 'sales' => ['icon' => 'chart-bar', 'chip' => 'bg-indigo-50 text-indigo-600'], 'production' => ['icon' => 'briefcase', 'chip' => 'bg-violet-50 text-violet-600'], 'finance' => ['icon' => 'currency-dollar', 'chip' => 'bg-emerald-50 text-emerald-600'], ]; @endphp {{-- Executive health/commission/hurdle now live in the Overview command center above; the Sales/Production/Finance group sections follow. --}} {{-- =================================================================== FINANCE TAB, Finance Intelligence Center (approved mockup). Every headline figure read from ManagementFinanceService; the breakdown panels from FinanceIntelligenceService; targets from TargetProgress, all via the $finance payload (BuildsFinanceIntelligence). ==================================================================== --}} @php $fn = $finance; // Defined locally: the shared $heatBg/$chip palettes live in the Sales // block, which renders after this tab in source order. $finHeatBg = ['emerald' => 'bg-emerald-500 text-white', 'sky' => 'bg-sky-400 text-white', 'amber' => 'bg-amber-300 text-amber-900', 'rose' => 'bg-rose-500 text-white', 'slate' => 'bg-slate-100 text-slate-400']; @endphp

{{ __('Finance Health Score') }}

{{ $fn['health']['score'] }} /100

{{ $fn['health']['status'] }}

{{ ($fn['health']['trend'] >= 0 ? '+' : '') . $fn['health']['trend'] }} {{ __('vs previous period') }}

{{ __('Financial Status') }}

@foreach ($fn['statusStrip'] as $badge)

{{ $badge['label'] }}

{{ $badge['status'] }}

@if (! empty($badge['sub']))

{{ $badge['sub'] }}

@endif
@endforeach
@foreach ($fn['kpis'] as $kpi)

{{ $kpi['label'] }}

{{ $kpi['value'] }}

@if ($kpi['target'] !== null)
{{ __('Target') }}: {{ $kpi['target'] }} {{ $kpi['mtd_vs_target'] ?? 0 }}%
@elseif (! empty($kpi['sub']))

{{ $kpi['sub'] }}

@endif
@foreach (['mom' => __('MoM'), 'yoy' => __('YoY'), 'sixm' => __('6M')] as $k => $lbl) @php [$txt, $cls, $arrow] = $delta($kpi[$k] ?? null, $kpi['up_good']); @endphp

{{ $txt }}

{{ $lbl }}

@endforeach
@endforeach

{{ __('Fund Distribution') }}

{{ __('Where your money is right now, in :base.', ['base' => $treasury['distribution']['baseCode']]) }}

@if (! empty($treasury['distribution']['segments']))
@foreach ($treasury['distribution']['segments'] as $seg)
{{ $seg['label'] }} {{ $seg['pct'] }}% {{ $treasury['distribution']['baseCode'] }} {{ number_format($seg['value'], 2) }}
@endforeach
@else

{{ __('No balances to chart yet.') }}

@endif

{{ __('Cash Flow') }}

{{ __('Money in vs money out, in :base.', ['base' => $treasury['base']]) }}

@foreach ($treasury['grains'] as $key => $label) @endforeach
{{ __('Inflow') }}

{{ $treasury['base'] }} {{ number_format($treasury['cashflowTotals']['in'], 2) }}

{{ __('Outflow') }}

{{ $treasury['base'] }} {{ number_format($treasury['cashflowTotals']['out'], 2) }}

{{ __('Asset Value by Category') }}

{{ __('Current book value in :base.', ['base' => $assets['category']['base']]) }}

@if ($assets['category']['total'] > 0)
@foreach ($assets['category']['rows'] as $row)
{{ $row['label'] }} {{ $assets['category']['base'] }} {{ number_format($row['amount'], 2) }}
@endforeach
@else

{{ __('Add assets with a value to see the breakdown.') }}

@endif

{{ __('Assets by Status') }}

{{ __('Across the register') }}

@foreach ($assets['status'] as $bar)
{{ $bar['label'] }} {{ $bar['count'] }}
@endforeach
@php $capToneChip = [ 'emerald' => 'bg-emerald-50 text-emerald-600', 'amber' => 'bg-amber-50 text-amber-600', 'rose' => 'bg-rose-50 text-rose-600', 'slate' => 'bg-slate-100 text-slate-500', 'indigo' => 'bg-indigo-50 text-indigo-600', 'sky' => 'bg-sky-50 text-sky-600', ]; $capKfmt = fn ($v) => $v >= 1000 ? rtrim(rtrim(number_format($v / 1000, 1), '0'), '.') . 'K' : number_format($v, 0); $capBarMax = max($capital['monthly']->max('amount') ?: 0, 1); @endphp

{{ __('Equity by Contributor') }}

{{ __('By ownership %') }}

@if ($capital['contributors']->isNotEmpty() && $capital['equity'] > 0)
@foreach ($capital['contributors'] as $row)
{{ $row['label'] }} {{ $row['pct'] }}% · {{ $capital['base'] }} {{ number_format($row['amount'], 2) }}
@endforeach

{{ __('Funded Assets') }}

{{ $capital['base'] }} {{ number_format($capital['assetFunded'], 2) }}

{{ __('Assets purchased') }}

{{ __('Funded Expenses') }}

{{ $capital['base'] }} {{ number_format($capital['expenseFunded'], 2) }}

{{ __('Operating expenses') }}

@else

{{ __('No equity contributions yet.') }}

@endif

{{ __('Top Contributors') }}

{{ __('By amount invested') }}

@if ($capital['contributors']->isNotEmpty())
@foreach ($capital['contributors']->take(5) as $idx => $row)
{{ $idx + 1 }}
{{ $row['label'] }} {{ $capital['base'] }} {{ number_format($row['amount'], 2) }}
{{ $row['pct'] }}%
@endforeach
@else

{{ __('No contributors yet.') }}

@endif

{{ __('Invested Over Time') }}

{{ __('Capital contributions trend') }}

{{ __('Last 12 Months') }}
@if ($capital['monthly']->isNotEmpty())
{{ $capKfmt($capBarMax) }} {{ $capKfmt($capBarMax * 0.66) }} {{ $capKfmt($capBarMax * 0.33) }} 0
@for ($g = 0; $g < 4; $g++)
@endfor
@foreach ($capital['monthly'] as $bar)
@endforeach
@foreach ($capital['monthly'] as $bar) {{ \Illuminate\Support\Str::of($bar['label'])->before(' ') }} @endforeach

{{ __('Total Invested') }}

{{ $capital['base'] }} {{ number_format($capital['totalInvested'], 2) }}

@if ($capital['growthPct'] !== null)
{{ number_format(abs($capital['growthPct']), 1) }}% {{ __('vs previous 12 months') }}
@endif
@else

{{ __('No contributions recorded yet.') }}

@endif

{{ __('Funding Type Breakdown') }}

{{ __('How funds are being used') }}

@if ($capital['assetFunded'] + $capital['expenseFunded'] > 0)
@php $capFundedTotal = max($capital['assetFunded'] + $capital['expenseFunded'], 0.01); @endphp
{{ __('Expenses') }} {{ $capital['base'] }} {{ number_format($capital['expenseFunded'], 2) }} ({{ round($capital['expenseFunded'] / $capFundedTotal * 100) }}%)
{{ __('Assets') }} {{ $capital['base'] }} {{ number_format($capital['assetFunded'], 2) }} ({{ round($capital['assetFunded'] / $capFundedTotal * 100) }}%)
@else

{{ __('Nothing funded yet.') }}

@endif

{{ __('Recent Insights') }}

{{ __('Auto-generated from your capital numbers') }}

@if (! empty($capital['insightCards']))
@foreach ($capital['insightCards'] as $insight)

{{ $insight['title'] }}

{{ $insight['body'] }}

@endforeach
@else

{{ __('Insights appear once you record contributions.') }}

@endif

{{ __('Profit Journey') }}

{{ __('How revenue flows through the business') }} · {{ $fn['journey']['base'] }}

@php $wf = $fn['journey']; $wmin = min(0.0, (float) $wf['min']); $wmax = max(0.01, (float) $wf['max']); $wrange = max($wmax - $wmin, 0.01); $wW = 640; $wH = 260; $wpadB = 40; $wpadT = 24; $wplotH = $wH - $wpadB - $wpadT; $wn = count($wf['bars']); $wslot = $wW / max($wn, 1); $wbw = $wslot * 0.5; $wyOf = fn ($v) => $wpadT + $wplotH - (($v - $wmin) / $wrange) * $wplotH; $wzero = round($wyOf(0), 1); @endphp
@foreach ($wf['bars'] as $i => $b) @php $lo = min((float) $b['base'], (float) $b['top']); $hi = max((float) $b['base'], (float) $b['top']); $y = round($wyOf($hi), 1); $h = max(round($wyOf($lo) - $wyOf($hi), 1), 2); $x = round($i * $wslot + ($wslot - $wbw) / 2, 1); $cxc = round($i * $wslot + $wslot / 2, 1); $fill = $b['type'] === 'decrease' ? '#f43f5e' : ($i === 0 ? '#124a61' : '#10b981'); @endphp {{ $b['amount'] }} {{ \Illuminate\Support\Str::limit($b['label'], 12) }} @endforeach
{{ __('Revenue') }} {{ __('Costs') }} {{ __('Profit') }}
@php $rd = $fn['readiness']; @endphp

{{ __('Break-even & Commission Readiness') }}

{{ __('Break-even') }}
{{ $rd['break_even'] }}
{{ __('GP Hurdle') }}
{{ $rd['hurdle'] }}
{{ __('Actual GP') }}
{{ $rd['actual_gp'] }}

{{ __('Distance to Break-even') }}

{{ $rd['above_break_even'] ? __('Achieved') : $rd['to_break_even'] }}

{{ __('Distance to GP Hurdle') }}

{{ $rd['hurdle_reached'] ? __('Reached') : $rd['to_hurdle'] }}

{{ __('Margin of Safety') }}

{{ number_format($rd['margin_of_safety_pct'], 1) }}%

{{ __('Commission Readiness') }}

{{ $rd['readiness_pct'] }}%

{{ $rd['status'] }}
@php $cm = $fn['commission']; @endphp

{{ __('Commission Overview') }}

{{ $cm['active'] ? __('Active') : __('Not Active') }}
{{ __('GP Hurdle') }}{{ $cm['gp_hurdle'] }}
{{ __('Actual GP') }}{{ $cm['actual_gp'] }}
{{ __('Excess GP') }}{{ $cm['excess_gp'] }}
{{ __('Pool Rate') }}{{ $cm['pool_rate'] }}
{{ __('Commission Pool') }}{{ $cm['pool'] }}
{{ __('Sales Pool') }}{{ $cm['sales_pool'] }}
{{ __('Production Pool') }}{{ $cm['production_pool'] }}
@php $tr = $fn['trend']; @endphp

{{ __('Financial Trend Center') }}

@foreach (['revenue' => __('Revenue'), 'profit' => __('Profit'), 'cashflow' => __('Cash Flow')] as $v => $lbl) @endforeach
@php $tmax = max(1, (float) $tr['max']); $gW = 1040; $gH = 240; $gpl = 8; $gpr = 8; $gpb = 24; $gpt = 10; $gpw = $gW - $gpl - $gpr; $gph = $gH - $gpt - $gpb; $gn = count($tr['labels']); $gx = fn ($i) => $gn <= 1 ? $gpl + $gpw / 2 : $gpl + ($i / ($gn - 1)) * $gpw; $gy = fn ($v) => $gpt + $gph - (max(0.0, (float) $v) / $tmax) * $gph; $stepg = (int) max(1, ceil($gn / 12)); @endphp
@if ($tr['target'] !== null) @php $tp = []; foreach (($tr['target']['values'] ?? []) as $i => $v) { $tp[] = round($gx($i), 1) . ',' . round($gy($v), 1); } @endphp @endif @foreach ($tr['datasets'] as $d) @php $dp = []; foreach ($d['values'] as $i => $v) { $dp[] = round($gx($i), 1) . ',' . round($gy($v), 1); } @endphp @endforeach @foreach ($tr['labels'] as $i => $lbl) @if ($i % $stepg === 0) {{ $lbl }} @endif @endforeach
@foreach ($tr['datasets'] as $d) {{ $d['label'] }} @endforeach @if ($tr['target'] !== null) {{ $tr['target']['label'] }} @endif
@php $ie = $incomeVsExpense; @endphp

{{ __('Income vs Expense') }}

{{ __(':label · payments received vs expenses incurred, in :base.', ['label' => $ie['label'], 'base' => $ie['base']]) }}

{{ __('Income') }}

{{ $ie['base'] }} {{ number_format($ie['totalIncome'], 2) }}

{{ __('Expense') }}

{{ $ie['base'] }} {{ number_format($ie['totalExpense'], 2) }}

{{ __('Net') }}

{{ $ie['base'] }} {{ number_format($ie['totalNet'], 2) }}

@php $iemax = max(1.0, (float) $ie['max']); $iW = 1040; $iH = 260; $ipl = 8; $ipr = 8; $ipb = 26; $ipt = 10; $ipw = $iW - $ipl - $ipr; $iph = $iH - $ipt - $ipb; $inb = count($ie['labels']); $islot = $inb > 0 ? $ipw / $inb : $ipw; $ibw = min(18, $islot * 0.30); $iBase = $ipt + $iph; $iStep = (int) max(1, ceil($inb / 16)); @endphp
@php $netPts = []; @endphp @foreach ($ie['labels'] as $i => $lbl) @php $cx = $ipl + $i * $islot + $islot / 2; $incH = ($ie['income'][$i] / $iemax) * $iph; $expH = ($ie['expense'][$i] / $iemax) * $iph; $netY = $iBase - (max(0.0, (float) $ie['net'][$i]) / $iemax) * $iph; $netPts[] = round($cx, 1) . ',' . round($netY, 1); @endphp @if ($i % $iStep === 0) {{ $lbl }} @endif @endforeach
{{ __('Income') }} {{ __('Expense') }} {{ __('Net') }}

{{ __('Target Achievement') }}

@foreach ($fn['targetAchievement'] as $b)
{{ $b['label'] }} {{ $b['actual'] }} / {{ $b['target'] }} {{ $b['pct'] !== null ? $b['pct'] . '%' : '—' }}
@endforeach

{{ __('End of Month Forecast') }}

{{ $fn['forecast']['projecting'] ? __('Projected from current run rate') : __('Period complete, actuals') }}

@foreach ($fn['forecast']['items'] as $f)

{{ $f['label'] }}

{{ $f['value'] }}

@if ($f['vs_target'] !== null)

{{ $f['vs_target'] }}% {{ __('of target') }}

@elseif (! empty($f['note']))

{{ $f['note'] }}

@endif
@endforeach
@php $rc = $fn['receivables']; $acc = 0; $stops = []; foreach ($rc['buckets'] as $s) { if ($s['pct'] <= 0) { continue; } $from = $acc; $acc += $s['pct']; $stops[] = "{$s['hex']} {$from}% {$acc}%"; } $rcGradient = implode(', ', $stops) ?: '#e2e8f0 0 100%'; @endphp

{{ __('Receivables & Collections') }}

{{ $rc['total_label'] }} {{ __('Outstanding') }}
@foreach ($rc['buckets'] as $s)
{{ $s['label'] }} {{ $s['value_label'] }} ({{ $s['pct'] }}%)
@endforeach

{{ __('Collection Rate') }}

{{ number_format($rc['collection_pct'], 1) }}%

{{ __('Avg Collection') }}

{{ $rc['avg_days'] }} {{ __('days') }}

{{ __('Overdue') }}

{{ $rc['overdue_label'] }}

@php $cf = $fn['cashFlow']; @endphp

{{ __('Cash Flow Center') }}

{{ __('Cash in vs cash out') }} · {{ $cf['base'] }}

@php $cmax = max(1.0, (float) $cf['max']); $cW = 520; $cH = 180; $cpl = 8; $cpr = 8; $cpb = 22; $cpt = 8; $cpw = $cW - $cpl - $cpr; $cph = $cH - $cpt - $cpb; $cn = count($cf['bars']); $cslot = $cn > 0 ? $cpw / $cn : $cpw; $cbw = $cslot * 0.28; $cBase = $cpt + $cph; $cStepLbl = (int) max(1, ceil($cn / 12)); @endphp
@php $netPts = []; @endphp @foreach ($cf['bars'] as $i => $b) @php $cx = $cpl + $i * $cslot + $cslot / 2; $inH = ($b['in'] / $cmax) * $cph; $outH = ($b['out'] / $cmax) * $cph; $netY = $cBase - (max(0.0, (float) $b['net']) / $cmax) * $cph; $netPts[] = round($cx, 1) . ',' . round($netY, 1); @endphp @if ($i % $cStepLbl === 0) {{ $b['label'] }} @endif @endforeach
{{ __('Cash In') }} {{ __('Cash Out') }} {{ __('Net Cash Flow') }}

{{ __('Operating Cash Flow') }}

{{ $cf['operating'] }}

{{ __('Net Cash Flow') }}

{{ $cf['net'] }}

{{ __('Forecast Position') }}

{{ $cf['forecast'] }}

{{ __('Top Customers') }}

{{ __('By total invoiced in :year', ['year' => $year]) }}

{{ __('View all') }}
@if ($topCustomers->isEmpty())

{{ __('No invoiced customers for this year.') }}

@else
@foreach ($topCustomers as $i => $c)
{{ $i + 1 }}

{{ $c['name'] }}

{{ $c['count'] }} {{ \Illuminate\Support\Str::plural('invoice', $c['count']) }}

${{ number_format($c['invoiced'], 2) }}

${{ number_format($c['paid'], 2) }} {{ __('paid') }}

@endforeach
@endif

{{ __('Customer Financial Analysis') }}

{{ __('Top customers by gross profit') }}

@forelse ($fn['topCustomers'] as $c) @empty @endforelse
{{ __('Customer') }} {{ __('Revenue') }} {{ __('GP') }} {{ __('Margin') }}
{{ $c['name'] }} {{ $c['revenue'] }} {{ $c['gp'] }} {{ number_format($c['margin'], 1) }}%
{{ __('No jobs in this period.') }}
@php $cs = $fn['costStructure']; $acc = 0; $stops = []; foreach ($cs['segments'] as $s) { if ($s['pct'] <= 0) { continue; } $from = $acc; $acc += $s['pct']; $stops[] = "{$s['hex']} {$from}% {$acc}%"; } $csGradient = implode(', ', $stops) ?: '#e2e8f0 0 100%'; @endphp

{{ __('Cost Structure Analysis') }}

{{ __('COGS + Overheads + Other Opex') }}

@if ($cs['hasData'])
{{ $cs['total_label'] }} {{ __('Total Cost') }}
@foreach ($cs['segments'] as $s)
{{ $s['label'] }} {{ $s['value_label'] }} ({{ $s['pct'] }}%)
@endforeach
@else

{{ __('No costs recorded in this period.') }}

@endif

{{ __('Key Financial Insights') }}

@forelse ($fn['insights'] as $ins)
{{ $ins['text'] }}
@empty

{{ __('Insights appear as data accumulates.') }}

@endforelse

{{ __('Financial Risks & Alerts') }}

@forelse ($fn['risks'] as $risk)
{{ $risk['label'] }} {{ $risk['severity'] }}
@empty
{{ __('No active financial risks.') }}
@endforelse

{{ __('Financial Heatmap') }}

{{ __('Monthly performance overview') }}

@foreach ($fn['heatmap']['labels'] as $lbl) @endforeach @foreach ($fn['heatmap']['rows'] as $row) @foreach ($row['cells'] as $cell) @endforeach @endforeach
{{ __('Metric') }}{{ $lbl }}
{{ $row['label'] }} {{ $cell['label'] }}
{{-- =================================================================== SALES TAB, Sales Intelligence Center. Every figure read from SalesFunnelService + SalesIntelligenceService + TargetProgress via the $sales payload (BuildsSalesIntelligence). ==================================================================== --}} @php $sl = $sales; $chip = ['indigo' => 'bg-indigo-50 text-indigo-600', 'sky' => 'bg-sky-50 text-sky-600', 'emerald' => 'bg-emerald-50 text-emerald-600', 'amber' => 'bg-amber-50 text-amber-600', 'violet' => 'bg-violet-50 text-violet-600', 'slate' => 'bg-slate-100 text-slate-500']; $heatBg = ['emerald' => 'bg-emerald-500 text-white', 'sky' => 'bg-sky-400 text-white', 'amber' => 'bg-amber-300 text-amber-900', 'slate' => 'bg-slate-100 text-slate-400']; @endphp

{{ __('Sales Health Score') }}

{{ $sl['health']['score'] }} / 100

{{ $sl['health']['status'] }}

@php [$ht, $hc, $ha] = $delta($sl['health']['trend'] === 0 ? null : (float) $sl['health']['trend'], true); @endphp

{{ $sl['health']['trend'] === 0 ? __('No change') : ($sl['health']['trend'] > 0 ? '+' . $sl['health']['trend'] : $sl['health']['trend']) }} {{ __('vs prev period') }}

{{ __('Sales Status') }}

@foreach ($sl['statusStrip'] as $st)

{{ $st['label'] }}

{{ $st['status'] }}

@endforeach

{{ __('Sales Funnel') }}

@foreach ($sl['funnel']['stages'] as $stage)
{{ $stage['label'] }} {{ $stage['count'] }} · {{ $stage['value_label'] }}
@endforeach

{{ __('Conversion Rates') }}

@foreach ($sl['funnel']['conversions'] as $conv)
{{ $conv['label'] }} {{ number_format($conv['pct'], 1) }}%
@endforeach
@foreach ($sl['kpis'] as $kpi)

{{ $kpi['label'] }}

{{ $kpi['value'] }}

@if ($kpi['target'] !== null)
{{ __('Target') }}: {{ $kpi['target'] }} {{ $kpi['mtd_vs_target'] ?? 0 }}%
@endif
@foreach (['mom' => __('MoM'), 'yoy' => __('YoY'), 'sixm' => __('6M')] as $k => $lbl) @php [$txt, $cls, $arrow] = $delta($kpi[$k] ?? null, true); @endphp

{{ $txt }}

{{ $lbl }}

@endforeach
@endforeach

{{ __('Sales Conversion Center') }}

@foreach ($sl['conversion'] as $row) @endforeach
{{ __('Conversion') }} {{ __('Actual') }} {{ __('Target') }} {{ __('Variance') }} {{ __('Status') }}
{{ $row['label'] }} {{ $row['actual'] }} {{ $row['target'] }} {{ $row['variance'] }}
@php $st = $sl['trend']; @endphp

{{ __('Sales Performance Trend') }}

@foreach (['revenue' => __('Revenue'), 'pipeline' => __('Pipeline'), 'conversion' => __('Conversions')] as $v => $lbl) @endforeach
@php $smax = max(1, (float) $st['max']); $sW = 520; $sH = 200; $spl = 8; $spr = 8; $spb = 24; $spt = 10; $spw = $sW - $spl - $spr; $sph = $sH - $spt - $spb; $sn = count($st['labels']); $sx = fn ($i) => $sn <= 1 ? $spl + $spw / 2 : $spl + ($i / ($sn - 1)) * $spw; $sy = fn ($v) => $spt + $sph - (max(0.0, (float) $v) / $smax) * $sph; $steps = (int) max(1, ceil($sn / 8)); @endphp
@foreach ($st['datasets'] as $d) @php $dp = []; foreach ($d['values'] as $i => $v) { $dp[] = round($sx($i), 1) . ',' . round($sy($v), 1); } @endphp @endforeach @foreach ($st['labels'] as $i => $lbl) @if ($i % $steps === 0) {{ $lbl }} @endif @endforeach
@foreach ($st['datasets'] as $d) {{ $d['label'] }} @endforeach

{{ __('Sales Target Achievement') }}

@foreach ($sl['targetAchievement'] as $b)
{{ $b['label'] }} {{ $b['actual'] }} / {{ $b['target'] }} {{ $b['pct'] !== null ? $b['pct'] . '%' : '—' }}
@endforeach

{{ __('Pipeline Health') }}

@foreach ($sl['pipeline'] as $p)

{{ $p['label'] }}

{{ $p['count'] }}

{{ $p['value'] }}

@endforeach

{{ __('Sales Velocity') }}

{{ __('Average days, selected period') }}

@foreach ($sl['velocity']['rows'] as $r)
{{ $r['label'] }} {{ number_format($r['days'], 1) }} {{ __('days') }}
@endforeach
{{ __('Total Sales Cycle') }} {{ number_format($sl['velocity']['total'], 1) }} {{ __('days') }}

{{ __('Pipeline Aging') }}

{{ __('Open quotes by age') }}

@foreach ($sl['aging'] as $b)
{{ $b['label'] }} {{ $b['count'] }} · {{ $b['pct'] }}%
@endforeach

{{ __('Quote Expiry Risk') }}

{{ $sl['expiry']['within_3']['count'] }} {{ __('quotes expiring in 3 days') }} {{ $sl['expiry']['within_3']['value'] }} {{ __('at risk value') }}
{{ __('Within 7 days') }} {{ $sl['expiry']['within_7']['count'] }} · {{ $sl['expiry']['within_7']['value'] }}
{{ __('View expiring quotes') }} →

{{ __('Average Deal Value') }}

@foreach ($sl['dealValue'] as $d)

{{ $d['label'] }}

{{ $d['value'] }}

@php [$mt, $mc] = $delta($d['mom'] ?? null, true); [$yt, $yc] = $delta($d['yoy'] ?? null, true); @endphp {{ $mt }} {{ __('MoM') }}
@endforeach

{{ __('End of Month Forecast') }}

{{ $sl['forecast']['projecting'] ? __('Projected from current run rate') : __('Period complete, actuals') }}

@foreach ($sl['forecast']['items'] as $f)

{{ $f['label'] }}

{{ $f['value'] }}

@if ($f['vs_target'] !== null)

{{ $f['vs_target'] }}% {{ __('of target') }}

@endif
@endforeach

{{ __('Top Performing Customers') }}

{{ __('By gross profit') }}

@forelse ($sl['topCustomers'] as $c) @empty @endforelse
{{ __('Customer') }} {{ __('Revenue') }} {{ __('Jobs') }} {{ __('GP') }}
{{ $c['name'] }} {{ $c['revenue'] }} {{ $c['jobs'] }} {{ $c['gp'] }}
{{ __('No jobs in this period.') }}

{{ __('Customer Retention') }}

@php $rt = $sl['retention']; $acc = 0; $stops = []; foreach ($rt['donut'] as $s) { if ($s['pct'] <= 0) { continue; } $from = $acc; $acc += $s['pct']; $stops[] = "{$s['hex']} {$from}% {$acc}%"; } $gradient = implode(', ', $stops) ?: '#e2e8f0 0 100%'; @endphp
{{ $rt['returning_pct'] }}% {{ __('Returning') }}
{{ __('Returning') }}{{ $rt['returning'] }} ({{ $rt['returning_pct'] }}%)
{{ __('New') }}{{ $rt['new'] }} ({{ $rt['new_pct'] }}%)
{{ __('Repeat Revenue') }}{{ $rt['repeat_revenue_pct'] }}%
{{ __('Avg Customer Value') }}{{ $rt['avg_value_label'] }}

{{ __('Most Profitable Sales Categories') }}

{{ __('By gross profit') }}

@forelse ($sl['categories'] as $c) @empty @endforelse
{{ __('Category') }} {{ __('Revenue') }} {{ __('GP') }} {{ __('Margin') }}
{{ $c['name'] }} {{ $c['revenue'] }} {{ $c['gp'] }} {{ number_format($c['margin'], 1) }}%
{{ __('No jobs in this period.') }}

{{ __('Lost Opportunity Analysis') }}

{{ __('Quotes that did not convert') }}

@if ($sl['lost']['count'] > 0) @php $acc = 0; $stops = []; foreach ($sl['lost']['segments'] as $s) { if ($s['pct'] <= 0) { continue; } $from = $acc; $acc += $s['pct']; $stops[] = "{$s['hex']} {$from}% {$acc}%"; } $gradient = implode(', ', $stops) ?: '#e2e8f0 0 100%'; @endphp
{{ $sl['lost']['count'] }} {{ __('Lost') }}
{{ __('Value Lost') }}{{ $sl['lost']['value'] }}
@foreach ($sl['lost']['segments'] as $s)
{{ $s['label'] }} {{ $s['count'] }} ({{ $s['pct'] }}%)
@endforeach

{{ __('Reasons derived from quote status; manual loss reasons can be added later.') }}

@else

{{ __('No lost quotes in this period.') }}

@endif

{{ __('Salesperson Performance') }}

@forelse ($sl['salespeople'] as $p) @empty @endforelse
{{ __('Salesperson') }} {{ __('Quote Value') }} {{ __('Jobs Won') }} {{ __('Revenue') }} {{ __('Conversion') }} {{ __('Target') }}
{{ $p['name'] }} {{ $p['quote_value'] }} {{ $p['jobs_won'] }} {{ $p['revenue'] }} {{ $p['conversion'] }} {{ $p['achievement'] !== null ? $p['achievement'] . '%' : '—' }}
{{ __('No sales activity in this period.') }}

{{ __('Key Sales Insights') }}

@forelse ($sl['insights'] as $ins)
{{ $ins['text'] }}
@empty

{{ __('Insights appear as data accumulates.') }}

@endforelse

{{ __('Sales Risks & Alerts') }}

@forelse ($sl['risks'] as $risk)
{{ $risk['label'] }} {{ $risk['severity'] }}
@empty
{{ __('No active sales risks.') }}
@endforelse

{{ __('Sales Performance Heatmap') }}

{{ __('Monthly, colour intensity reflects relative performance') }}

@foreach ($sl['heatmap']['labels'] as $lbl) @endforeach @foreach ($sl['heatmap']['rows'] as $row) @foreach ($row['cells'] as $cell) @endforeach @endforeach
{{ __('Metric') }}{{ $lbl }}
{{ $row['label'] }} {{ $cell['label'] }}
{{-- =================================================================== PRODUCTION TAB, Production Intelligence Center. Every figure read from ProductionMetricsService + ProductionIntelligenceService + TargetProgress via the $production payload (BuildsProductionIntelligence). The operations command center. ==================================================================== --}} @php $pr = $production; $sevText = ['critical' => 'text-rose-600', 'high' => 'text-orange-600', 'medium' => 'text-amber-600', 'low' => 'text-slate-500']; @endphp

{{ __('Production Health Score') }}

{{ $pr['health']['score'] }} / 100

{{ $pr['health']['status'] }}

@php [$pht, $phc, $pha] = $delta($pr['health']['trend'] === 0 ? null : (float) $pr['health']['trend'], true); @endphp

{{ $pr['health']['trend'] === 0 ? __('No change') : ($pr['health']['trend'] > 0 ? '+' . $pr['health']['trend'] : $pr['health']['trend']) }} {{ __('vs previous period') }}

{{ __('Production Status') }}

@foreach ($pr['statusStrip'] as $st)

{{ $st['label'] }}

{{ $st['status'] }}

@endforeach

{{ __('Production Workflow') }}

{{ $pr['periodLabel'] }}

@foreach ($pr['workflow']['stages'] as $stage)

{{ $stage['label'] }}

{{ $stage['count'] }}

{{ $stage['value'] }}

@if ($stage['conversion'] !== null)
@endif @endforeach
@foreach ($pr['kpis'] as $kpi)

{{ $kpi['label'] }}

{{ $kpi['value'] }}

@if ($kpi['target'] !== null)
{{ __('Target') }}: {{ $kpi['target'] }} {{ $kpi['mtd_vs_target'] ?? 0 }}%
@if ($kpi['ytd_vs_target'] !== null)

{{ __('YTD vs Target') }}: {{ $kpi['ytd_vs_target'] }}%

@endif @endif
@foreach (['mom' => __('MoM'), 'yoy' => __('YoY'), 'sixm' => __('6M')] as $k => $lbl) @php [$txt, $cls, $arrow] = $delta($kpi[$k] ?? null, $kpi['up_good']); @endphp

{{ $txt }}

{{ $lbl }}

@endforeach
@endforeach

{{ __('Production Efficiency Center') }}

@foreach ($pr['efficiency'] as $row) @endforeach
{{ __('Metric') }} {{ __('Actual') }} {{ __('Target') }} {{ __('Variance') }} {{ __('Status') }}
{{ $row['label'] }} {{ $row['actual'] }} {{ $row['target'] }} {{ $row['variance'] }}
@php $pt = $pr['trend']; @endphp

{{ __('Production Performance Trend') }}

@foreach (['throughput' => __('Throughput'), 'efficiency' => __('Efficiency'), 'delivery' => __('Delivery')] as $v => $lbl) @endforeach
@php $pmax = max(1, (float) $pt['max']); $pW = 520; $pH = 200; $ppl = 8; $ppr = 8; $ppb = 24; $ppt2 = 10; $ppw = $pW - $ppl - $ppr; $pph = $pH - $ppt2 - $ppb; $pnn = count($pt['labels']); $pxx = fn ($i) => $pnn <= 1 ? $ppl + $ppw / 2 : $ppl + ($i / ($pnn - 1)) * $ppw; $pyy = fn ($v) => $ppt2 + $pph - (max(0.0, (float) $v) / $pmax) * $pph; $pstep = (int) max(1, ceil($pnn / 8)); @endphp
@foreach ($pt['datasets'] as $d) @php $dp = []; foreach ($d['values'] as $i => $v) { $dp[] = round($pxx($i), 1) . ',' . round($pyy($v), 1); } @endphp @endforeach @foreach ($pt['labels'] as $i => $lbl) @if ($i % $pstep === 0) {{ $lbl }} @endif @endforeach
@foreach ($pt['datasets'] as $d) {{ $d['label'] }} @endforeach

{{ __('Target Achievement') }}

@foreach ($pr['targetAchievement'] as $b)
{{ $b['label'] }} {{ $b['actual'] }} / {{ $b['target'] }} {{ $b['pct'] !== null ? $b['pct'] . '%' : '—' }}
@endforeach
@php $cap = $pr['capacity']; @endphp

{{ __('Workload & Capacity Center') }}

{{ $cap['workload'] }}

{{ __('Active Jobs') }}

{{ $cap['active_jobs'] }}

{{ __('Hours Logged') }}

{{ $cap['hours_logged'] }}

{{ __('Available Capacity') }}

{{ $cap['available'] }}

{{ __('Team Workload') }}

{{ $cap['operators'] }} {{ __('operators') }}

{{ __('Capacity Utilisation') }} {{ number_format($cap['utilisation_pct'], 1) }}% {{ __('of') }} {{ $cap['capacity'] }}

{{ __('Production Forecast') }}

{{ $pr['forecast']['projecting'] ? __('Projected from current run rate') : __('Period complete, actuals') }}

@foreach ($pr['forecast']['items'] as $f)

{{ $f['label'] }}

{{ $f['value'] }}

@if ($f['vs_target'] !== null)

{{ $f['vs_target'] }}% {{ __('of target') }}

@elseif (! empty($f['note']))

{{ $f['note'] }}

@endif
@endforeach

{{ __('Job Status Distribution') }}

@if (! empty($pr['jobStatus']['segments'])) @php $acc = 0; $stops = []; foreach ($pr['jobStatus']['segments'] as $s) { if ($s['pct'] <= 0) { continue; } $from = $acc; $acc += $s['pct']; $stops[] = "{$s['hex']} {$from}% {$acc}%"; } $gradient = implode(', ', $stops) ?: '#e2e8f0 0 100%'; @endphp
{{ $pr['jobStatus']['total'] }} {{ __('Total Jobs') }}
@foreach ($pr['jobStatus']['segments'] as $s)
{{ $s['label'] }} {{ $s['count'] }} ({{ $s['pct'] }}%)
@endforeach
@else

{{ __('No jobs yet.') }}

@endif

{{ __('Production Category Analysis') }}

{{ __('By production hours') }}

@forelse ($pr['categories'] as $c) @empty @endforelse
{{ __('Category') }} {{ __('Jobs') }} {{ __('Hours') }} {{ __('Revenue') }} {{ __('Turnaround') }}
{{ $c['name'] }} {{ $c['jobs'] }} {{ $c['hours'] }} {{ $c['revenue'] }} {{ $c['avg_turnaround'] }}
{{ __('No jobs in this period.') }}
@php $rw = $pr['rework']; @endphp

{{ __('Rework Analysis') }}

{{ __('Rework Jobs') }}

{{ $rw['rework_jobs'] }}

{{ __('Rework Rate') }}

{{ $rw['rework_pct'] }}

{{ __('Hours Lost') }}

{{ $rw['hours_lost'] }}

{{ __('Est. Cost of Rework') }}

{{ $rw['cost'] }}

{{ __('Target') }}: {{ $rw['threshold'] }} @php [$rwt, $rwc] = $delta($rw['trend'] === 0 ? null : (float) $rw['trend'], false); @endphp {{ $rwt }} {{ __('vs prev') }}
@php $ta = $pr['turnaround']; @endphp

{{ __('Turnaround Analysis') }}

{{ $ta['avg_days'] }}

{{ __('Average turnaround days') }}

{{ __('Fastest Category') }} {{ $ta['fastest'] ? $ta['fastest']['name'] . ' · ' . $ta['fastest']['days'] . 'd' : '—' }}
{{ __('Slowest Category') }} {{ $ta['slowest'] ? $ta['slowest']['name'] . ' · ' . $ta['slowest']['days'] . 'd' : '—' }}

{{ __('Overdue Jobs') }}

@if ($pr['overdue']['count'] > 0) {{ $pr['overdue']['count'] }} {{ __('overdue') }} @endif
@forelse ($pr['overdue']['rows'] as $j) @empty @endforelse
{{ __('Job') }} {{ __('Customer') }} {{ __('Overdue') }} {{ __('Value') }} {{ __('Priority') }}
{{ $j['job_number'] }} {{ $j['customer'] }} {{ $j['days_overdue'] }}d {{ $j['value'] }} {{ $j['priority'] }}
{{ __('No overdue jobs. ') }}🎉

{{ __('Team Performance') }}

{{ __('By production operator') }}

@forelse ($pr['team'] as $p) @empty @endforelse
{{ __('Operator') }} {{ __('Done') }} {{ __('Hours') }} {{ __('On-Time') }} {{ __('Rework') }} {{ __('Util') }}
{{ $p['name'] }} {{ $p['jobs_completed'] }} {{ number_format($p['hours_logged'], 1) }} {{ number_format($p['on_time_pct'], 0) }}% {{ number_format($p['rework_pct'], 0) }}% {{ number_format($p['utilisation_pct'], 0) }}%
{{ __('No production hours logged in this period.') }}

{{ __('Key Production Insights') }}

@forelse ($pr['insights'] as $ins)
{{ $ins['text'] }}
@empty

{{ __('Insights appear as data accumulates.') }}

@endforelse

{{ __('Production Risks & Alerts') }}

@forelse ($pr['risks'] as $risk)
{{ $risk['label'] }} {{ $risk['severity'] }}
@empty
{{ __('No active production risks.') }}
@endforelse

{{ __('Production Performance Heatmap') }}

{{ __('Monthly, colour intensity reflects relative performance') }}

@foreach ($pr['heatmap']['labels'] as $lbl) @endforeach @foreach ($pr['heatmap']['rows'] as $row) @foreach ($row['cells'] as $cell) @endforeach @endforeach
{{ __('Metric') }}{{ $lbl }}
{{ $row['label'] }} {{ $cell['label'] }}