@extends('layouts.app') @section('title', 'الفواتير') @section('content')
BILLS

الفواتير

إدارة جميع الفواتير

@if (session('success'))
✅ {{ session('success') }}
@endif @if (session('error'))
❌ {{ session('error') }}
@endif @if ($errors->any())
❌ {{ $errors->first() }}
@endif

إجمالي الفواتير الشهرية

{{ number_format($totalMonthly, 2) }} USD

📊

العدد الإجمالي

{{ $bills instanceof \Illuminate\Pagination\LengthAwarePaginator ? $bills->total() : $bills->count() }}

📋

مستحقة خلال يومين

{{ $dueBills->count() }}

🔔

📋 قائمة الفواتير الدورية

@forelse ($bills as $bill) @empty @endforelse
العنوان النوع المبلغ الدورية الاستحقاق القادم الحالة إجراءات
{{ $bill->title }} @if (($bill->type ?? 'recurring') === 'variable') متغيرة @else متكررة @endif {{ number_format($bill->amount, 2) }} {{ $bill->currency }} @if ($bill->frequency) {{ ['monthly'=>'شهري','weekly'=>'أسبوعي','daily'=>'يومي'][$bill->frequency] ?? $bill->frequency }} @else @endif {{ $bill->next_due_date ? \Carbon\Carbon::parse($bill->next_due_date)->format('Y-m-d') : '—' }} @php $approval = $bill->approval_status ?? 'approved'; @endphp @if ($approval === 'pending_approval') ⏳ بانتظار الموافقة @elseif ($approval === 'rejected') 🚫 مرفوض @elseif (($bill->type ?? 'recurring') === 'variable' && in_array($bill->id, $paidBillIds)) ✅ تم الدفع @elseif (!$bill->is_active) موقوف @elseif (($bill->type ?? 'recurring') === 'recurring' && $bill->next_due_date && \Carbon\Carbon::parse($bill->next_due_date)->isFuture() && in_array($bill->id, $paidBillIds)) ✅ تم الدفع @else نشط @endif @php $isActive = $bill->is_active && ($bill->approval_status ?? 'approved') === 'approved'; $isDue = $bill->next_due_date && \Carbon\Carbon::parse($bill->next_due_date)->lte(now()); $isVariable = ($bill->type ?? 'recurring') === 'variable'; $hasBeenPaid = in_array($bill->id, $paidBillIds); $canPay = $isActive && ($isVariable ? true : (!$hasBeenPaid || $isDue)); $isPaid = $isActive && !$isVariable && $hasBeenPaid && !$isDue; @endphp
@if ($canPay) @endif @if ($approval !== 'rejected')
@csrf
@endif @if ($approval === 'rejected') @endif
📭

لا توجد فواتير

@if (method_exists($bills, 'links'))
{{ $bills->links() }}
@endif
@if ($customCategories->count() > 0)
🏷️

إدارة التصنيفات المضافة

التصنيفات اللي أضفتها بنفسك. تقدر تخفيها لو ضفتها بالغلط.

@foreach ($customCategories as $cat)
{{ $cat }}
@csrf
@endforeach
@endif @endsection