@props([ 'customer' => null, 'showCreditLimit' => true, 'showOrderHistory' => true, ])

{{ __('Customer Details') }}: {{ $customer?->name }}

@if($customer)

{{ __('Basic Information') }}

{{ __('Name') }}: {{ $customer->name }}
{{ __('Phone') }}: {{ $customer->mobile_number ?? 'N/A' }}
{{ __('Email') }}: {{ $customer->email ?? 'N/A' }}
{{ __('Province') }}: {{ $customer->province ?? 'N/A' }}
{{ __('Type') }}: {{ ucfirst($customer->customer_type) }}
@if($showCreditLimit)

{{ __('Credit Information') }}

{{ __('Credit Limit') }}: {{ number_format($customer->credit_limit, 2) }}
{{ __('Outstanding Amount') }}: {{ number_format($customer->outstanding_amount, 2) }}
{{ __('Available Credit') }}: {{ number_format($customer->credit_limit - $customer->outstanding_amount, 2) }}
@if($customer->credit_limit - $customer->outstanding_amount < 0)
⚠️ {{ __('Credit limit exceeded') }}
@endif
@endif
@if($customer->address)

{{ __('Address') }}

{{ $customer->address }}

@endif @if($showOrderHistory && $customer->orders && $customer->orders->count() > 0)

{{ __('Recent Orders') }}

@foreach($customer->orders as $order) @endforeach
{{ __('Order #') }} {{ __('Date') }} {{ __('Amount') }} {{ __('Status') }} {{ __('Paid') }}
{{ $order->order_number }} {{ $order->order_date?->format('Y-m-d') }} {{ number_format($order->total_amount, 2) }} {{ $order->status }} @if($order->is_paid) @else @endif
@else
{{ __('No recent orders found') }}
@endif
@endif