@extends('layouts.app')
@section('title', __('dashboard.expenses_title'))
@section('page_heading', __('dashboard.expenses_title'))
@section('content')
@include('dashboard.finance.partials.topbar')
{{-- KPIs --}}
@foreach([
['fa-solid fa-receipt', '#fef2f2','#dc2626', $expenses->total(), __('dashboard.total_expenses_stat')],
['fa-solid fa-coins', '#fef2f2','#dc2626', number_format($expenses->sum('amount'),2), 'إجمالي المبالغ (ج.م)'],
['fa-solid fa-rotate', '#fff7ed','#ea580c', number_format($expenses->getCollection()->filter(fn($e)=>$e->category?->type==='recurring')->sum('amount'),2),'مصروفات ثابتة (ج.م)'],
['fa-solid fa-bolt', '#fffbeb','#d97706', number_format($expenses->getCollection()->filter(fn($e)=>$e->category?->type==='variable')->sum('amount'),2), 'مصروفات متغيرة (ج.م)'],
] as [$ic,$bg,$cl,$val,$lbl])
@endforeach
{{-- Filters --}}
المصروفات
{{ $expenses->total() }}
@if($expenses->isEmpty())
@include('layouts.partials.index-empty-state', ['icon'=>'fa-solid fa-receipt','title'=>'لا توجد مصروفات','message'=>''])
@else
@foreach(['#','التصنيف',__('dashboard.type_label'),'المبلغ','الملاحظات','التاريخ','إجراءات'] as $h)
| {{ $h }} |
@endforeach
@foreach($expenses as $e)
| {{ $e->id }} |
{{ $e->category?->name ?? '—' }}
|
@if($e->category?->type === 'recurring')
ثابت
@elseif($e->category?->type === 'variable')
متغير
@else
—
@endif
|
{{ number_format($e->amount,2) }}
ج.م
|
{{ $e->notes ?: '—' }} |
{{ $e->created_at->format('Y-m-d') }} |
|
@endforeach
@if($expenses->hasPages())
{{ $expenses->links() }}
@endif
@endif
@endsection