@extends('layouts.app') @php $locale = app()->getLocale(); $isRtl = $locale === 'ar'; $currency = \App\Models\Setting::currencyLabel($locale); @endphp @section('title', $isRtl ? 'المصروفات' : 'Expenses') @section('content')

{{ $isRtl ? 'المصروفات' : 'Expenses' }}

{{ $isRtl ? 'تسجيل وإدارة المصروفات' : 'Record and manage expenses' }}

{{ $isRtl ? 'إجمالي هذا الشهر' : 'This Month' }}

{{ number_format((float)($stats['total_this_month'] ?? 0), 2) }} {{ $currency }}

{{ $isRtl ? 'إجمالي الشهر الماضي' : 'Last Month' }}

{{ number_format((float)($stats['total_last_month'] ?? 0), 2) }} {{ $currency }}

{{ $isRtl ? 'عدد المصروفات' : 'Expenses Count' }}

{{ $expenses->total() }}

{{ $isRtl ? 'إعادة ضبط' : 'Reset' }}
@forelse($expenses as $expense) @empty @endforelse
{{ $isRtl ? 'التاريخ' : 'Date' }} {{ $isRtl ? 'العنوان' : 'Title' }} {{ $isRtl ? 'التصنيف' : 'Category' }} {{ $isRtl ? 'المبلغ' : 'Amount' }} {{ $isRtl ? 'الطريقة' : 'Method' }} {{ $isRtl ? 'إجراءات' : 'Actions' }}
{{ $expense->expense_date?->format('Y-m-d') ?? '—' }} {{ $expense->title }} @if($expense->description)

{{ $expense->description }}

@endif
{{ $isRtl && ($expense->category->name_ar ?? null) ? $expense->category->name_ar : ($expense->category->name ?? '—') }} {{ number_format((float)$expense->amount, 2) }} {{ $currency }} {{ $expense->payment_method }}
@csrf @method('DELETE')

{{ $isRtl ? 'لا توجد مصروفات' : 'No expenses found' }}

@if($expenses->hasPages())
{{ $expenses->withQueryString()->links() }}
@endif
@if(isset($stats['by_category']) && is_iterable($stats['by_category']))

{{ $isRtl ? 'حسب التصنيف (هذا الشهر)' : 'By Category (This Month)' }}

@foreach($stats['by_category'] as $c)

{{ $c['name'] ?? '—' }}

{{ number_format((float)($c['total'] ?? 0), 2) }} {{ $currency }}

@endforeach
@endif
@endsection