@extends('layouts.app') @section('title', __('Compare results')) @section('page-title', __('Compare results')) @section('page-subtitle', $analysis->typeLabel()) @php use App\Services\AnalysisComparisonService; // Mode-specific labels for the tabs. $modeLabels = [ AnalysisComparisonService::MODE_PERIOD => __('Period-over-period'), AnalysisComparisonService::MODE_ANNUAL => __('Year-over-year'), AnalysisComparisonService::MODE_MULTI_YEAR => __('Multi-year trend'), AnalysisComparisonService::MODE_BUDGET => __('Budget vs Actual'), AnalysisComparisonService::MODE_SECTOR => __('Sector benchmark'), ]; $modeBlurbs = [ AnalysisComparisonService::MODE_PERIOD => __('Compare against month/quarter/semester/year-ago.'), AnalysisComparisonService::MODE_ANNUAL => __('Strict year-over-year against the closest year-ago delivery.'), AnalysisComparisonService::MODE_MULTI_YEAR => __('Trend line across multiple year-spaced analyses.'), AnalysisComparisonService::MODE_BUDGET => __('Tag one analysis as the budget, the other as the actual.'), AnalysisComparisonService::MODE_SECTOR => __('Benchmark this analysis against typical industry ranges.'), ]; $periodChips = [ 'month' => __('1 month ago'), 'quarter' => __('3 months ago'), 'semester' => __('6 months ago'), 'year' => __('1 year ago'), ]; // Numeric formatter shared with the pair table. $fmtVal = function ($v, $unit = '') { if ($v === null || $v === '' || ! is_scalar($v)) return '—'; if (is_numeric($v)) { $n = (float) $v; $abs = abs($n); $formatted = $abs >= 1000 ? number_format($n, 0, '.', ' ') : (floor($n) == $n ? number_format($n, 0) : number_format($n, 2)); return trim($formatted.' '.$unit); } return (string) $v; }; $changePhrase = function ($row) { if ($row['direction'] === 'missing') return __('Not comparable'); if ($row['direction'] === 'flat') return __('About the same'); $verb = $row['direction'] === 'improved' ? __('Better') : __('Worse'); if (isset($row['pct']) && $row['pct'] !== null) { $abs = abs((float) $row['pct']); return $verb.' '.__('by :n%', ['n' => number_format($abs, $abs >= 10 ? 0 : 1)]); } return $verb; }; $compareWithId = $right && $left ? ($right->id === $analysis->id ? $left->id : $right->id) : null; @endphp @push('head') @endpush @section('content')
{{ $modeBlurbs[$mode] ?? '' }}
{{-- ── Flash banners (success / error / warnings) ───────────────────── --}} @if(session('status')){{ __('Examples: “Why did profitability drop in Q3?” · “Explain the working capital evolution.” · “What are the major financial risks?”') }}
“{{ $qaAnswer['question'] }}”