@extends('layouts.app') @php $locale = app()->getLocale(); $isRtl = $locale === 'ar'; $currency = \App\Models\Setting::currencyLabel($locale); $typeLabels = [ 'sale' => $isRtl ? 'مبيعات' : 'Sale', 'subscription' => $isRtl ? 'اشتراك' : 'Subscription', 'service' => $isRtl ? 'خدمة' : 'Service', 'purchase' => $isRtl ? 'مشتريات' : 'Purchase', ]; $statusLabels = [ 'draft' => $isRtl ? 'مسودة' : 'Draft', 'sent' => $isRtl ? 'مرسلة' : 'Sent', 'paid' => $isRtl ? 'مدفوعة' : 'Paid', 'partial' => $isRtl ? 'جزئية' : 'Partial', 'overdue' => $isRtl ? 'متأخرة' : 'Overdue', 'cancelled' => $isRtl ? 'ملغاة' : 'Cancelled', ]; $paymentStatusLabels = [ 'unpaid' => $isRtl ? 'غير مدفوعة' : 'Unpaid', 'partial' => $isRtl ? 'مدفوعة جزئياً' : 'Partial', 'paid' => $isRtl ? 'مدفوعة' : 'Paid', ]; $statusColors = [ 'draft' => 'bg-slate-100 text-slate-700', 'sent' => 'bg-blue-100 text-blue-700', 'paid' => 'bg-emerald-100 text-emerald-700', 'partial' => 'bg-amber-100 text-amber-700', 'overdue' => 'bg-rose-100 text-rose-700', 'cancelled' => 'bg-slate-100 text-slate-600', ]; $computedStatus = $invoice->status; if ($invoice->due_date && $invoice->due_date->isPast() && (float) $invoice->remaining_amount > 0) { $computedStatus = 'overdue'; } @endphp @section('title', ($isRtl ? 'فاتورة' : 'Invoice') . ' - ' . $invoice->invoice_number) @section('content')
{{ $isRtl ? 'حالة الدفع:' : 'Payment status:' }} {{ $paymentStatusLabels[$invoice->payment_status] ?? $invoice->payment_status }}
{{ $isRtl ? 'العميل' : 'Customer' }}
{{ $invoice->customer_name_display }}
@if($invoice->customer_phone){{ $invoice->customer_phone }}
@endif{{ $isRtl ? 'أنشئت بواسطة' : 'Created by' }}
{{ $invoice->createdBy?->name ?? '—' }}
{{ optional($invoice->created_at)->format('Y-m-d H:i') }}
{{ $isRtl ? 'تاريخ الفاتورة' : 'Invoice date' }}
{{ optional($invoice->invoice_date)->format('Y-m-d') }}
{{ $isRtl ? 'تاريخ الاستحقاق' : 'Due date' }}
{{ $invoice->due_date ? $invoice->due_date->format('Y-m-d') : '—' }}
{{ $isRtl ? 'ملاحظات' : 'Notes' }}
{{ $invoice->notes }}
| {{ $isRtl ? 'الوصف' : 'Description' }} | {{ $isRtl ? 'الكمية' : 'Qty' }} | {{ $isRtl ? 'سعر الوحدة' : 'Unit price' }} | {{ $isRtl ? 'الإجمالي' : 'Total' }} |
|---|---|---|---|
|
{{ $item->description }} @if($item->product){{ $isRtl ? 'منتج:' : 'Product:' }} {{ $isRtl && $item->product->name_ar ? $item->product->name_ar : $item->product->name }} @elseif($item->membershipPlan){{ $isRtl ? 'خطة:' : 'Plan:' }} {{ $isRtl && $item->membershipPlan->name_ar ? $item->membershipPlan->name_ar : $item->membershipPlan->name }} @endif |
{{ (int) $item->quantity }} | {{ number_format((float) $item->unit_price, 2) }} {{ $currency }} | {{ number_format((float) $item->total, 2) }} {{ $currency }} |
| {{ $isRtl ? 'التاريخ' : 'Date' }} | {{ $isRtl ? 'المبلغ' : 'Amount' }} | {{ $isRtl ? 'الطريقة' : 'Method' }} | {{ $isRtl ? 'المرجع' : 'Reference' }} | {{ $isRtl ? 'المستلم' : 'Received by' }} |
|---|---|---|---|---|
| {{ optional($pay->payment_date)->format('Y-m-d') }} | {{ number_format((float) $pay->amount, 2) }} {{ $currency }} | {{ $pay->payment_method }} | {{ $pay->reference ?: '—' }} | {{ $pay->receivedBy?->name ?? '—' }} |
| {{ $isRtl ? 'لا توجد دفعات' : 'No payments yet' }} | ||||