@extends('layouts.app') @php $locale = app()->getLocale(); $isAr = $locale === 'ar'; @endphp @section('title', ($success ? __('payment.success_title') : __('payment.failed_title')) . ' | ' . $siteName) @section('content')
@if($success) {{-- ── Invoice / Receipt ──────────────────────── --}}
{{-- Header --}}
@if(!empty($siteLogo)) @else {{ $siteName ?? 'Diet Watchers' }} @endif
{{ __('Paid') }} / {{ $isAr ? 'Paid' : 'مدفوع' }}
{{-- Title --}}

{{ __('Invoice') }} / {{ $isAr ? 'Invoice' : 'فاتورة' }}

{{ __('Thank you for your order!') }} / {{ $isAr ? 'Thank you for your order!' : 'شكراً لطلبك!' }}

{{-- Order Info Grid --}}

{{ __('Order Number') }} / {{ $isAr ? 'Order No.' : 'رقم الطلب' }}

{{ $payment->order_number }}

{{ __('Date') }} / {{ $isAr ? 'Date' : 'التاريخ' }}

{{ $payment->updated_at->format('d/m/Y - H:i') }}

{{ __('Customer') }} / {{ $isAr ? 'Customer' : 'العميل' }}

{{ $payment->customer_name }}

{{ __('Phone') }} / {{ $isAr ? 'Phone' : 'الهاتف' }}

{{ $payment->customer_phone }}

@if($payment->customer_email)

{{ __('Email') }} / {{ $isAr ? 'Email' : 'البريد' }}

{{ $payment->customer_email }}

@endif
{{-- Subscription Details --}}

{{ __('Subscription Details') }} / {{ $isAr ? 'Subscription Details' : 'تفاصيل الاشتراك' }}

@if($payment->start_date)
{{ __('Start Date') }} / {{ $isAr ? 'Start Date' : 'تاريخ البداية' }} {{ $payment->start_date }}
@endif @if($payment->duration)
{{ __('Duration') }} / {{ $isAr ? 'Duration' : 'المدة' }} {{ __(ucfirst($payment->duration)) }}
@endif
{{ __('Delivery') }} / {{ $isAr ? 'Delivery' : 'التوصيل' }} {{ $payment->delivery_type === 'home' ? __('Home Delivery') : __('Pickup from Kitchen') }}
@if($payment->delivery_type === 'home' && $payment->city)
{{ __('Address') }} / {{ $isAr ? 'Address' : 'العنوان' }} {{ __(ucfirst($payment->city)) }}{{ $payment->street ? ', ' . $payment->street : '' }}{{ $payment->building ? ', ' . $payment->building : '' }}
@endif
{{-- Items Table --}} @if(!empty($payment->cart_items))

{{ __('Items') }} / {{ $isAr ? 'Items' : 'العناصر' }}

@foreach($payment->cart_items as $item) @endforeach
{{ __('Item') }} {{ __('Qty') }} {{ __('Price') }} {{ __('Total') }}
@php $img = $item['image'] ?? ''; @endphp

{{ $item['name'] ?? '' }}

@if(!empty($item['options']['mealType']))

{{ __(ucfirst($item['options']['mealType'])) }} @if(!empty($item['options']['calories'])) - {{ $item['options']['calories'] }} {{ __('Kcal') }} @endif

@endif
{{ $item['quantity'] ?? 1 }} {{ number_format($item['price'] ?? 0, 2) }} {{ number_format(($item['price'] ?? 0) * ($item['quantity'] ?? 1), 2) }}
@endif {{-- Totals --}}
{{ __('Subtotal') }} / {{ $isAr ? 'Subtotal' : 'المجموع الفرعي' }} SAR {{ number_format($payment->subtotal / 100, 2) }}
@if($payment->delivery_fee > 0)
{{ __('Delivery fees') }} / {{ $isAr ? 'Delivery' : 'التوصيل' }} SAR {{ number_format($payment->delivery_fee / 100, 2) }}
@else
{{ __('Delivery fees') }} / {{ $isAr ? 'Delivery' : 'التوصيل' }} {{ __('Free') }} / {{ $isAr ? 'Free' : 'مجاني' }}
@endif @if($payment->discount_amount > 0)
{{ __('Discount') }} / {{ $isAr ? 'Discount' : 'الخصم' }} @if($payment->coupon)({{ $payment->coupon }})@endif - SAR {{ number_format($payment->discount_amount / 100, 2) }}
@endif
{{ __('VAT') }} (15%) / {{ $isAr ? 'VAT' : 'ضريبة القيمة المضافة' }} SAR {{ number_format($payment->vat_amount / 100, 2) }}
{{ __('Total') }} / {{ $isAr ? 'Total' : 'الإجمالي' }} SAR {{ number_format($payment->amount_in_sar, 2) }}
{{-- Payment Method --}} @if($payment->card_type || $payment->payment_method)
{{ __('Paid with') }} / {{ $isAr ? 'Paid with' : 'الدفع عبر' }}: {{ $payment->payment_method ? $payment->payment_method->label() : '' }} @if($payment->card_type) ({{ ucfirst($payment->card_type) }}) @endif @if($payment->masked_pan) {{ $payment->masked_pan }} @endif
@endif {{-- Footer --}}
{{-- Actions (outside invoice for print) --}}
{{ __('payment.back_to_home') }}
@else {{-- ── Failed State ──────────────────────────── --}}

{{ __('payment.failed_heading') }}

{{ $errorMessage ?? __('payment.failed_message') }}

@endif
@endsection @push('styles') @endpush