@extends('layouts.app') @section('title', 'Dépenses — ' . $activeHostel?->name) @section('content')
{{-- Header --}} {{-- Flash messages --}} @if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@foreach ($errors->all() as $error)
⚠️ {{ $error }}
@endforeach
@endif {{-- Stats --}}
Total dépenses
{{ $stats['total_count'] }}
Enregistrées au total
Montant total (TND)
{{ number_format($stats['total_amount'], 3, ',', ' ') }}
Toutes périodes confondues
Ce mois-ci (TND)
{{ number_format($stats['this_month'], 3, ',', ' ') }}
{{ now()->locale('fr')->isoFormat('MMMM YYYY') }}
Catégorie dominante
@php $topCat = collect($stats['by_category'])->sortDesc()->keys()->first(); $topCatLabel = $topCat ? ($categories[$topCat] ?? $topCat) : '—'; @endphp {{ $topCatLabel }}
{{ $topCat && isset($stats['by_category'][$topCat]) ? number_format($stats['by_category'][$topCat], 3, ',', ' ') . ' TND' : 'Aucune donnée' }}
{{-- Filters --}}
@if (request()->hasAny(['search', 'category', 'from', 'to'])) Reset @endif
{{-- Table --}}
@if ($expenses->count() === 0)
💸

Aucune dépense pour le moment

Commencez par enregistrer votre première dépense.

➕ Créer une dépense
@else @foreach ($expenses as $exp) @endforeach
Date Catégorie Libellé Payé par Montant Créé par Actions
{{ $exp->expense_date->format('d/m/Y') }} {{ $exp->expense_date->locale('fr')->isoFormat('dddd') }} {{ $exp->category_emoji }} {{ $exp->category_label }} {{ $exp->label }} @if ($exp->note)
{{ Str::limit($exp->note, 60) }}
@endif
{{ $exp->payer_name }} {{ number_format((float) $exp->amount, 3, ',', ' ') }} {{ $exp->currency }} {{ $exp->creator_label ?? '—' }}
✏️
{{ $expenses->links() }}
@endif
{{-- Formulaire caché pour la suppression --}} @endsection