@php $colors = [ 'revenu' => ['bg' => 'bg-positive-fill', 'row' => 'bg-positive-surface/40'], 'depense' => ['bg' => 'bg-negative-fill', 'row' => 'bg-negative-surface/40'], 'epargne' => ['bg' => 'bg-info-fill', 'row' => 'bg-info-surface/40'], ]; // Ordered to alternate light/dark shades so adjacent donut slices stay distinguishable // even without relying on the border stroke (WCAG 1.4.11 graphical-object contrast). $chartPalettes = [ 'revenu' => ['#15803d', '#4ade80', '#166534', '#86efac', '#16a34a', '#22c55e'], 'depense' => ['#991b1b', '#fb923c', '#c2410c', '#fdba74', '#dc2626', '#f97316'], 'epargne' => ['#1e40af', '#93c5fd', '#1d4ed8', '#bfdbfe', '#2563eb', '#60a5fa'], ]; // Mobile category dots cycle through a same-hue tonal ramp so adjacent rows // stay distinguishable (WCAG 1.4.11), independent of the desktop chart palette. $mobileDotRamp = ['#8c491a', '#b2622d', '#d67f48', '#f6a06b']; $depenseRows = $sections['depense']['rows']->sortByDesc('tracked')->values(); @endphp
{{-- Mobile: hero "reste à dépenser" card + tiles + spending-by-category list --}}

Bonjour {{ Str::of(auth()->user()->name)->before(' ') }}

{{ Str::of(auth()->user()->name)->explode(' ')->map(fn ($p) => mb_substr($p, 0, 1))->take(2)->implode('') }}
Reste à dépenser · {{ \Illuminate\Support\Carbon::create($year, (int) ($period === 'year' ? now()->month : $period))->translatedFormat('F') }} {{ number_format($sections['depense']['totals']['reste'], 2, ',', ' ') }} € @php $depTotals = $sections['depense']['totals']; $spentPct = $depTotals['budget'] > 0 ? min(100, round($depTotals['tracked'] / $depTotals['budget'] * 100)) : 0; @endphp {{ number_format($depTotals['tracked'], 2, ',', ' ') }} € dépensés sur {{ number_format($depTotals['budget'], 2, ',', ' ') }} € prévus
Revenus {{ number_format($sections['revenu']['totals']['tracked'], 2, ',', ' ') }} €
Épargne {{ number_format($sections['epargne']['totals']['tracked'], 2, ',', ' ') }} €

Dépenses par catégorie

@if ($depenseRows->isEmpty())

Aucune catégorie de dépenses.

@else
@foreach ($depenseRows as $i => $row)
{{ $row['category']->name }}
{{ number_format($row['tracked'], 0, ',', ' ') }} €
@endforeach
@endif
{{-- Desktop / tablet: full analysis tables + donut charts --}} @once @push('scripts') @endpush @endonce