@extends('layouts.app') @section('title', __('app.invoices')) @section('content') @php $isRtl = app()->getLocale() === 'ar'; $currency = \App\Models\Setting::currencyLabel(app()->getLocale()); @endphp

{{ $isRtl ? 'الفواتير' : 'Invoices' }}

{{ $isRtl ? 'إدارة الفواتير والمستحقات' : 'Manage invoices and receivables' }}

{{ $stats['total'] }}

{{ $isRtl ? 'إجمالي الفواتير' : 'Total' }}

{{ $stats['paid'] }}

{{ $isRtl ? 'مدفوعة' : 'Paid' }}

{{ $stats['unpaid'] }}

{{ $isRtl ? 'غير مدفوعة' : 'Unpaid' }}

{{ $stats['overdue'] }}

{{ $isRtl ? 'متأخرة' : 'Overdue' }}

{{ number_format((float) $stats['total_amount'], 2) }}

{{ $isRtl ? 'الإجمالي' : 'Amount' }}

{{ $currency }}

{{ number_format((float) $stats['total_paid'], 2) }}

{{ $isRtl ? 'المحصل' : 'Collected' }}

{{ $currency }}

{{ number_format((float) $stats['total_due'], 2) }}

{{ $isRtl ? 'المستحق' : 'Due' }}

{{ $currency }}

@forelse($invoices as $invoice) @empty @endforelse
{{ $isRtl ? 'رقم الفاتورة' : 'Invoice #' }} {{ $isRtl ? 'العميل' : 'Customer' }} {{ $isRtl ? 'النوع' : 'Type' }} {{ $isRtl ? 'التاريخ' : 'Date' }} {{ $isRtl ? 'الإجمالي' : 'Total' }} {{ $isRtl ? 'المدفوع' : 'Paid' }} {{ $isRtl ? 'الحالة' : 'Status' }} {{ $isRtl ? 'الإجراءات' : 'Actions' }}
{{ $invoice->invoice_number }} @if($invoice->member)
{{ mb_substr($invoice->member->first_name, 0, 1) }}

{{ $invoice->member->full_name }}

{{ $invoice->member->phone }}

@elseif($invoice->customer_name)

{{ $invoice->customer_name }}

@else {{ $isRtl ? 'عميل نقدي' : 'Walk-in' }} @endif
@php $typeColors = [ 'sale' => 'bg-blue-100 text-blue-700', 'subscription' => 'bg-violet-100 text-violet-700', 'service' => 'bg-cyan-100 text-cyan-700', ]; $typeLabels = [ 'sale' => $isRtl ? 'مبيعات' : 'Sale', 'subscription' => $isRtl ? 'اشتراك' : 'Subscription', 'service' => $isRtl ? 'خدمة' : 'Service', ]; @endphp {{ $typeLabels[$invoice->type] ?? $invoice->type }} {{ $invoice->invoice_date->format('Y/m/d') }} {{ number_format($invoice->total) }} {{ number_format($invoice->paid_amount) }} @php $statusColors = [ 'paid' => 'bg-emerald-100 text-emerald-700', 'partial' => 'bg-amber-100 text-amber-700', 'unpaid' => 'bg-slate-100 text-slate-700', 'overdue' => 'bg-rose-100 text-rose-700', ]; $statusLabels = [ 'paid' => $isRtl ? 'مدفوعة' : 'Paid', 'partial' => $isRtl ? 'جزئي' : 'Partial', 'unpaid' => $isRtl ? 'غير مدفوعة' : 'Unpaid', 'overdue' => $isRtl ? 'متأخرة' : 'Overdue', ]; $status = $invoice->payment_status; if ($invoice->due_date && $invoice->due_date->isPast() && $invoice->remaining_amount > 0) { $status = 'overdue'; } @endphp {{ $statusLabels[$status] ?? $status }}
@if($invoice->remaining_amount > 0) @endif

{{ $isRtl ? 'لا توجد فواتير' : 'No invoices found' }}

@if($invoices->hasPages())
{{ $invoices->links() }}
@endif

{{ $isRtl ? 'إضافة دفعة' : 'Add Payment' }}

@csrf

{{ $isRtl ? 'المبلغ المتبقي:' : 'Remaining:' }}

@push('scripts') @endpush @endsection