@extends('layouts.app') @section('title', 'الفواتير') @section('content')
إدارة جميع الفواتير
إجمالي الفواتير الشهرية
{{ number_format($totalMonthly, 2) }} USD
العدد الإجمالي
{{ $bills instanceof \Illuminate\Pagination\LengthAwarePaginator ? $bills->total() : $bills->count() }}
مستحقة خلال يومين
{{ $dueBills->count() }}
| العنوان | النوع | المبلغ | الدورية | الاستحقاق القادم | الحالة | إجراءات |
|---|---|---|---|---|---|---|
| {{ $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')
@endif
@if ($approval === 'rejected')
@endif
|
📭 لا توجد فواتير | ||||||
التصنيفات اللي أضفتها بنفسك. تقدر تخفيها لو ضفتها بالغلط.