@extends('backend.partials.master') @section('title') {{ ___('admin.customer_details_23312f') }} @endsection @section('maincontent')
@if($customer)

{{ $customer->name }}

{!! $customer->tierBadge() !!} {!! $customer->statusBadge() !!}

  • {{ $customer->phone ?: '—' }}
  • {{ $customer->email ?: '—' }}
  • {{ $customer->address ?: '—' }}

{{ ___('admin.edit_530164') }}

{{ ___('admin.profile_ff4fc0') }}

{{ ___('admin.customer_id_1186e5') }}{{ ___('admin.cus_e2ab25') }}{{ str_pad($customer->id, 4, '0', STR_PAD_LEFT) }}
{{ ___('admin.name_709a23') }}{{ $customer->name }}
{{ ___('admin.email_84add5') }}{{ $customer->email ?: '—' }}
{{ ___('admin.phone_77064d') }}{{ $customer->phone ?: '—' }}
{{ ___('admin.address_d70f93') }}{{ $customer->address ?: '—' }}
{{ ___('admin.tier_5bd44e') }}{!! $customer->tierBadge() !!}
{{ ___('admin.status_bae7d5') }}{!! $customer->statusBadge() !!}
{{ ___('admin.notes_704400') }}{{ $customer->notes ?: '—' }}
{{ ___('admin.joined_43a1c6') }}{{ $customer->created_at?->translatedFormat('d M Y') }}
{{-- Side services used to live only in their own modules, so a customer's profile showed no sign that they had bought insurance or a medical trip — and nothing added up what those sales earned. --}} @php $services = collect() ->concat($customer->insurances->map(fn ($r) => [ 'module' => ___('menus.travel_insurance'), 'detail' => trim($r->provider . ' · ' . $r->plan_name, ' ·'), 'fee' => $r->service_fee, 'status' => $r->status, ])) ->concat($customer->studentServices->map(fn ($r) => [ 'module' => ___('menus.student_consultancy'), 'detail' => trim($r->university . ' · ' . $r->country, ' ·') ?: $r->service_type, 'fee' => $r->service_fee, 'status' => $r->status, ])) ->concat($customer->medicalTours->map(fn ($r) => [ 'module' => ___('menus.medical_tourism'), 'detail' => trim($r->hospital . ' · ' . $r->destination, ' ·'), 'fee' => $r->service_fee, 'status' => $r->status, ])) ->concat($customer->corporateTravels->map(fn ($r) => [ 'module' => ___('menus.corporate_travel'), 'detail' => trim($r->company_name . ' · ' . $r->service_type, ' ·'), 'fee' => $r->service_fee, 'status' => $r->status, ])); @endphp @if($services->count())

{{ ___('menus.services') }}

{{ ___('label.service_revenue') }}: {{ currency_symbol() }}{{ number_format($services->sum('fee')) }}
@foreach($services as $service) @endforeach
{{ ___('menus.services') }} {{ ___('label.details') }} {{ ___('label.service_fee') }} {{ ___('label.status') }}
{{ $service['module'] }} {{ $service['detail'] ?: '—' }} {{ $service['fee'] !== null ? currency_symbol() . number_format($service['fee']) : '—' }} {{ admin_label(ucfirst($service['status'])) }}
@endif {{-- Wallet: money the agency is holding for this customer. Every line is either a top-up/adjustment made here, or a receipt/refund that already posted itself — so this and account 2300 always agree. --}}

{{ ___('admin.wallet_b60862') }}

{{ ___('admin.balance_90eef6') }}

{{ currency_symbol() }}{{ number_format($walletBalance ?? 0, 2) }}

@if(hasPermission('customer_update'))
@csrf
@endif

{{ ___('admin.wallet_statement_1925d6') }}

@forelse($walletTransactions ?? [] as $t) @empty @endforelse
{{ ___('admin.reference_db1c78') }}{{ ___('admin.date_eb9a4b') }}{{ ___('admin.description_55f8eb') }}{{ ___('admin.type_3deb74') }}{{ ___('admin.amount_43dc85') }}{{ ___('admin.balance_90eef6') }}
{{ $t->reference }} {{ $t->txn_date?->translatedFormat('d M Y') }} {{ $t->description }} {{ admin_label(ucfirst($t->type)) }} {{ $t->type === 'credit' ? '+' : '-' }}{{ currency_symbol() }}{{ number_format($t->amount, 2) }} {{ currency_symbol() }}{{ number_format($t->balance_after, 2) }}
{{ ___('admin.no_wallet_activity_yet_d8d197') }}
@else
{{ ___('admin.no_customer_found_081607') }}
@endif
@endsection