@extends('layouts.app') @section('title', $analysis->typeLabel()) @section('page-title', $analysis->typeLabel()) @section('page-subtitle', $analysis->finished_at?->format('Y-m-d H:i').' — '.($analysis->submission?->original_filename ?? '')) @push('head') @endpush @section('content') @php $kpis = (array) ($analysis->kpis ?? []); $kpiCount = count($kpis); $typeIcons = [ 'cashflow' => 'trending-up', 'balance' => 'chart', 'income' => 'receipt', 'ratios' => 'sparkles', ]; $heroIcon = $typeIcons[$analysis->analysis_type] ?? 'chart'; // Server-rendered SVG charts based on admin's chart_config (with AI fallback). $charts = app(\App\Services\Charting\AnalysisChartBuilder::class)->build($analysis); @endphp @if($errors->any())
@foreach($errors->all() as $e)
{{ $e }}
@endforeach
@endif {{-- ╭─────────────────────────────────────────────────────────────────────╮ │ HERO │ │ Big gradient banner — primary identity of the result. Carries the │ │ type, file, language, KPI count and the "back" affordance. │ │ The radial overlay + soft blur gives it depth without textures. │ ╰─────────────────────────────────────────────────────────────────────╯ --}}
{{ __('All results') }}
{{ $analysis->analysis_type }} {{ $analysis->language }}

{{ $analysis->typeLabel() }}

{{ $analysis->submission?->original_filename ?? '—' }}

{{ $analysis->finished_at?->format('Y-m-d H:i') ?? '—' }} {{ trans_choice('{0} no KPI|{1} :count KPI|[2,*] :count KPIs', $kpiCount, ['count' => $kpiCount]) }} @if($analysis->summary) {{ __('Summary available') }} @endif
{{-- Export cluster — pill group --}}
{{-- ╭─────────────────────────────────────────────────────────────────────╮ │ KPI STRIP │ │ Fluid responsive grid: 2 / 3 / 4 / 5 cols depending on viewport. │ │ Each tile is a soft-shadow card with a colored accent dot keyed off │ │ the KPI index, hover lift, monospaced numerals. │ ╰─────────────────────────────────────────────────────────────────────╯ --}} @if($kpiCount > 0)

{{ __('Key indicators') }}

{{ $kpiCount }}
@php // Neutral monochrome accents — no blue/indigo. Light mode uses slate // tones, dark mode mirrors them with lighter slates. $accentMap = [ ['stripe' => 'bg-slate-400/70', 'dot' => 'bg-slate-500'], ['stripe' => 'bg-slate-500/70', 'dot' => 'bg-slate-600'], ['stripe' => 'bg-slate-300/70', 'dot' => 'bg-slate-400'], ['stripe' => 'bg-slate-600/70', 'dot' => 'bg-slate-700'], ]; @endphp
@foreach($kpis as $key => $kpi) @php $label = is_array($kpi) && isset($kpi['label']) ? $kpi['label'] : $key; $value = is_array($kpi) ? ($kpi['value'] ?? null) : $kpi; $unit = is_array($kpi) ? ($kpi['unit'] ?? '') : ''; $comment = is_array($kpi) ? ($kpi['comment'] ?? '') : ''; $kpiChart= is_array($kpi) && !empty($kpi['chart']) && is_array($kpi['chart']) ? $kpi['chart'] : null; $accent = $accentMap[$loop->index % count($accentMap)]; @endphp
{{ $label }}
{{ is_scalar($value) ? $value : '—' }} @if($unit){{ $unit }}@endif
@if($comment)

{{ $comment }}

@endif @if($kpiChart)
{!! \App\Services\Charting\ChartRenderer::render( (string) ($kpiChart['type'] ?? ''), (array) ($kpiChart['series'] ?? []), [ 'categories' => array_values((array) ($kpiChart['categories'] ?? [])), 'width' => 240, 'height' => 96, ], ) !!}
@endif
@endforeach
@endif {{-- ╭─────────────────────────────────────────────────────────────────────╮ │ BODY GRID │ │ Asymmetric 12-col fluid grid: long-form content on the left, │ │ compact "context" rail on the right (compare + metadata). │ ╰─────────────────────────────────────────────────────────────────────╯ --}}
@if($analysis->summary)

{{ __('Executive summary') }}

{{ __('Headline takeaways from your analyst.') }}

{{ $analysis->summary }}

@endif @if(! empty($charts))

{{ __('Charts') }}

{{ __('Visual snapshot of the headline KPIs') }}
@foreach($charts as $c)

{{ $c['title'] }}

{!! $c['html'] !!}
@endforeach
@endif @if($analysis->explanation_html)

{{ __('Detailed analysis') }}

{{ __('Full breakdown of findings') }}

{!! $analysis->explanation_html !!}
@endif @if(! $analysis->summary && ! $analysis->explanation_html)
{{ __('No narrative content was attached to this analysis.') }}
@endif
{{-- ── Right rail ──────────────────────────────────────────────── --}}
@endsection