@vite(['resources/css/app.css', 'resources/js/app.js']) @php $meta = $order->metadata ?? []; $originalPrice = (float) ($meta['original_price'] ?? $order->amount); $discountAmount = (float) ($meta['discount'] ?? 0); $couponCode = $meta['coupon_code'] ?? null; $baseCurrency = $meta['base_currency'] ?? $order->currency; $exchangeRate = $meta['exchange_rate'] ?? null; $currencyModel = \App\Models\Currency::where('code', $order->currency)->first(); $sym = $currencyModel?->symbol ?: '$'; $companyName = $siteSettings['company_name'] ?? ($siteSettings['site_name'] ?? config('app.name')); $companyAddr = $siteSettings['company_address'] ?? ''; $companyEmail = $siteSettings['company_email'] ?? ($siteSettings['contact_email'] ?? ''); $companyPhone = $siteSettings['company_phone'] ?? ($siteSettings['contact_phone'] ?? ''); $hasLogo = !empty($siteSettings['site_logo']) && file_exists(storage_path('app/public/' . $siteSettings['site_logo'])); $statusLabel = match($order->status) { 'completed' => __('Paid'), 'pending', 'pending_verification' => __('Unpaid'), 'failed' => __('Failed'), 'refunded' => __('Refunded'), 'cancelled' => __('Cancelled'), default => ucfirst($order->status), }; $statusColor = match($order->status) { 'completed' => 'text-emerald-700 bg-emerald-50 border-emerald-200', 'pending', 'pending_verification' => 'text-amber-700 bg-amber-50 border-amber-200', 'failed' => 'text-red-700 bg-red-50 border-red-200', 'refunded' => 'text-blue-700 bg-blue-50 border-blue-200', default => 'text-gray-700 bg-gray-50 border-gray-200', }; @endphp {{-- Toolbar --}}
@if(auth()->user()?->hasRole(['Super Admin', 'Admin']))
@if(session('success'))

{{ session('success') }}

@endif
@csrf @method('PATCH')
@endif
{{-- Scrollable invoice area --}}
{{-- HEADER --}}
@if($hasLogo) {{ $companyName }} @else

{{ $companyName }}

@endif @if($companyAddr)

{{ $companyAddr }}

@endif @if($companyEmail)

{{ $companyEmail }}

@endif @if($companyPhone)

{{ $companyPhone }}

@endif

{{ __('Invoice') }}

#{{ $order->order_number }}

{{ $statusLabel }}
{{-- META --}}

{{ __('Bill To') }}

{{ $order->user->name }}

{{ $order->user->email }}

{{ __('Issue Date') }}

{{ $order->created_at->format('M d, Y') }}

{{ __('Payment Method') }}

{{ $order->payment_method ?: __('Online Payment') }}

@if($order->gateway_transaction_id)

{{ $order->gateway_transaction_id }}

@endif
{{-- LINE ITEMS --}}
{{ __('Description') }} {{ __('Qty') }} {{ __('Unit Price') }} {{ __('Amount') }}

{{ $order->plan?->name ?? __('Plan') }} {{ __('Subscription') }}

@if($order->plan?->billing_cycle)

{{ ucfirst($order->plan->billing_cycle) }} billing

@endif
1 {{ $sym }}{{ number_format($originalPrice, 2) }} {{ $sym }}{{ number_format($originalPrice, 2) }}
{{-- TOTALS --}}
{{ __('Subtotal') }} {{ $sym }}{{ number_format($originalPrice, 2) }}
@if($discountAmount > 0)
{{ __('Discount') }} @if($couponCode)({{ $couponCode }})@endif -{{ $sym }}{{ number_format($discountAmount, 2) }}
@endif @if($exchangeRate && $baseCurrency !== $order->currency)
{{ __('Currency conversion') }} {{ $baseCurrency }} → {{ $order->currency }}
@endif
{{ __('Total Due') }} {{ $sym }}{{ number_format($order->amount, 2) }}
@if($order->currency)
{{ $order->currency }}
@endif
{{-- FOOTER --}}

{{ __('Thank you for your business.') }}

@if($companyEmail)

{{ __('Questions? Contact') }} {{ $companyEmail }}

@endif
@if($hasLogo) @else

{{ $companyName }}

@endif