@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $items = $data['items']; $trend = $data['trend']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 1, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; $directionTone = ['success' => 'delta-up', 'danger' => 'delta-down', 'warning' => 'delta-down', 'neutral' => 'delta-flat']; $maxScale = 100; // shares are % $barTrackW = 220; // 12-month line chart. $chartW = 480; $chartH = 160; $padX = 30; $padY = 22; $allValues = []; foreach ($trend['series'] as $s) { foreach ($s['data'] as $v) { if ($v !== null) $allValues[] = $v; } } $minV = !empty($allValues) ? min($allValues) : 0; $maxV = !empty($allValues) ? max($allValues) : 1; if ($minV === $maxV) { $maxV = $minV + 1; } $stepX = count($trend['labels']) > 1 ? ($chartW - 2 * $padX) / (count($trend['labels']) - 1) : 0; $polylines = []; foreach ($trend['series'] as $s) { $pts = []; foreach ($s['data'] as $i => $v) { if ($v === null) continue; $x = $padX + $i * $stepX; $y = $chartH - $padY - (($v - $minV) / ($maxV - $minV)) * ($chartH - 2 * $padY); $pts[] = "{$x},{$y}"; } $polylines[] = ['color' => $s['color'], 'label' => $s['label'], 'points' => implode(' ', $pts)]; } @endphp @section('content')
|
{{ $i['label'] }}
Cible : {{ number_format($i['budget'], 0, ',', ' ') }} %
|
|
{{ number_format($i['actual'], 1, ',', ' ') }} %
@if ($i['delta_pct'] !== null)
{{ ($i['delta_pct'] > 0 ? '+' : '') . number_format($i['delta_pct'], 1, ',', ' ') }} %
@endif
|
Aucune donnée de mix.
@endifPas de données mensuelles.
@endif @endsection