@extends('layouts.app') @section('content')

{{ app()->getLocale() == 'ar' ? 'تفاصيل عقد التأجير' : 'Rental Contract Details' }} - {{ $rental->contract_number }}

{{ app()->getLocale() == 'ar' ? 'عودة' : 'Back' }} {{ app()->getLocale() == 'ar' ? 'تحميل PDF' : 'Download PDF' }} @if($rental->status == 'open') {{ app()->getLocale() == 'ar' ? 'إغلاق العقد' : 'Close Contract' }} @endif

{{ app()->getLocale() == 'ar' ? 'معلومات العقد' : 'Contract Info' }}

{{ strtoupper($rental->status) }}
{{ $rental->start_date->format('Y-m-d H:i') }}
{{ $rental->end_date->format('Y-m-d H:i') }}
{{ $rental->car->title }}
{{ $rental->car->plate_number }}
{{ $rental->customer->name }}
{{ $rental->customer->phone }}
{{ number_format($rental->start_odometer) }} KM
{{ $rental->end_odometer ? number_format($rental->end_odometer) . ' KM' : '-' }}

{{ app()->getLocale() == 'ar' ? 'التفاصيل المالية' : 'Financial Details' }}

{{ app()->getLocale() == 'ar' ? 'المدفوع' : 'Paid' }} {{ number_format($rental->paid_amount, 2) }} SAR
{{ app()->getLocale() == 'ar' ? 'المتبقي' : 'Remaining' }} {{ number_format($rental->remaining_amount, 2) }} SAR
{{ app()->getLocale() == 'ar' ? 'السعر اليومي' : 'Daily Price' }} {{ number_format($rental->daily_price, 2) }} SAR
{{ app()->getLocale() == 'ar' ? 'مبلغ التأمين' : 'Insurance' }} {{ number_format($rental->insurance_amount, 2) }} SAR
{{ app()->getLocale() == 'ar' ? 'الخصم' : 'Discount' }} - {{ number_format($rental->discount, 2) }} SAR
@if($rental->selectedAddOns->count() > 0)

🚀 {{ app()->getLocale() == 'ar' ? 'الخدمات الإضافية المختارة' : 'Selected Add-ons' }}

@foreach($rental->selectedAddOns as $addOn)
{{ $addOn->name }} {{ $addOn->price_type == 'daily' ? 'يومي' : 'ثابت' }} × {{ $addOn->pivot->quantity }}
+ {{ number_format($addOn->pivot->total_price, 2) }} SAR
@endforeach
@endif
{{ app()->getLocale() == 'ar' ? 'الضريبة' : 'Tax' }} {{ number_format($rental->tax, 2) }} SAR
@if($rental->extra_km_charges > 0)
{{ app()->getLocale() == 'ar' ? 'رسوم كيلومترات إضافية' : 'Extra KM Charges' }} + {{ number_format($rental->extra_km_charges, 2) }} SAR
@endif
{{ app()->getLocale() == 'ar' ? 'الإجمالي النهائي' : 'Final Total' }} {{ number_format($rental->total_amount, 2) }} SAR

{{ app()->getLocale() == 'ar' ? 'إجراءات سريعة' : 'Quick Actions' }}

@if($rental->paper_contract)

{{ app()->getLocale() == 'ar' ? 'العقد الورقي المرفق' : 'Attached Paper Contract' }}

{{ app()->getLocale() == 'ar' ? 'عرض العقد المرفق' : 'View Attachment' }}
@endif @if($rental->additional_terms && count($rental->additional_terms) > 0)

{{ app()->getLocale() == 'ar' ? 'شروط إضافية خاصة' : 'Special Conditions' }}

@foreach($rental->additional_terms as $index => $term)
{{ $index + 1 }} {{ $term }}
@endforeach
@endif

{{ app()->getLocale() == 'ar' ? 'سندات القبض' : 'Receipts' }}

{{ $rental->receipts->count() }} {{ app()->getLocale() == 'ar' ? 'سند' : 'Receipts' }}
@forelse($rental->receipts->sortByDesc('created_at') as $receipt)
{{ $receipt->receipt_number }} {{ number_format($receipt->amount, 2) }}
{{ $receipt->payment_method }} | {{ $receipt->receipt_date->format('Y-m-d') }} {{ $receipt->status }}
@empty
{{ app()->getLocale() == 'ar' ? 'لا توجد سندات قبض مسجلة' : 'No receipts found' }}
@endforelse

{{ app()->getLocale() == 'ar' ? 'سجل المدفوعات' : 'Payment History' }}

@foreach($rental->payments as $payment)
{{ number_format($payment->amount, 2) }} {{ strtoupper($payment->method) }}
{{ $payment->type }} | {{ $payment->created_at->format('Y-m-d') }}
@endforeach
@if($overdueDays > 0)
{{ app()->getLocale() == 'ar' ? 'تنبيه تأخير' : 'Overdue Alert' }}

{{ app()->getLocale() == 'ar' ? "هذا العقد متأخر بمقدار $overdueDays يوم." : "This contract is overdue by $overdueDays days." }}

@endif
@endsection