@extends('layouts.app') @section('title', __('Review analysis')) @php $type = $types[$analysis->analysis_type] ?? null; $isAr = app()->getLocale() === 'ar'; // KPI rows stripped of any chart_hint legacy fields. $kpiRows = []; foreach (((array) $analysis->kpis) as $kpi) { if (! is_array($kpi)) continue; $kpiRows[] = [ 'label' => (string) ($kpi['label'] ?? ''), 'value' => (string) ($kpi['value'] ?? ''), 'unit' => (string) ($kpi['unit'] ?? ''), 'comment' => (string) ($kpi['comment'] ?? ''), 'trend' => (string) ($kpi['trend'] ?? ''), 'source_ref' => (string) ($kpi['source_ref'] ?? ''), ]; } // Charts arrive as [{title,type,categories,series,source_ref}] from the // analyzer or from a previous admin save. Series rows are either // {label,value,is_total?} or {label,values:[…]}. $chartRows = []; foreach (((array) $analysis->chart_config) as $c) { if (! is_array($c)) continue; $series = []; foreach ((array) ($c['series'] ?? []) as $s) { if (! is_array($s)) continue; if (isset($s['values']) && is_array($s['values'])) { $series[] = [ 'label' => (string) ($s['label'] ?? ''), 'values' => array_map(fn ($v) => (float) $v, $s['values']), 'is_total' => false, 'mode' => 'multi', ]; } else { $series[] = [ 'label' => (string) ($s['label'] ?? ''), 'value' => isset($s['value']) ? (float) $s['value'] : 0, 'is_total' => ! empty($s['is_total']), 'mode' => 'single', ]; } } $chartRows[] = [ 'title' => (string) ($c['title'] ?? ''), 'type' => (string) ($c['type'] ?? 'bar'), 'categories' => array_map(fn ($x) => (string) $x, (array) ($c['categories'] ?? [])), 'series' => $series, 'source_ref' => (string) ($c['source_ref'] ?? ''), ]; } @endphp @push('head') @endpush @section('content')
{{ $submission->original_name }} · {{ optional($submission->uploader)->name ?? '—' }}