@extends('layouts.admin.app', ['page' => $menuAdmin['customers']['active'] ?? '', 'sub_page' => $menuAdmin['customers']['route']['customers']['sub_active'] ?? null]) @section('title', $customer->name ?? __('labels.customer_details')) @section('header_data') @php $page_title = $customer->name ?? __('labels.customer'); $page_pretitle = __('labels.customer_details'); @endphp @endsection @php $breadcrumbs = [ ['title' => __('labels.home'), 'url' => route('admin.dashboard')], ['title' => __('labels.customers'), 'url' => route('admin.customers.index')], ['title' => $customer->name ?? __('labels.customer'), 'url' => null], ]; @endphp @section('admin-content')
{{-- PROFILE CARD --}}

{{ $customer->name ?? 'N/A' }}

{{ $customer->email ?? 'N/A' }} | {{ $customer->mobile ?? 'N/A' }}
{{ $customer->status ? __('labels.active') : __('labels.inactive') }} @if ($customer->email_verified_at) {{ __('labels.email_verified') }} @else {{ __('labels.email_not_verified') }} @endif @if ($customer->mobile_verified_at) {{ __('labels.mobile_verified') }} @else {{ __('labels.mobile_not_verified') }} @endif
{{ __('labels.registration_date') }}
{{ $customer->created_at->format('d M Y') }}
@if ($customer->referral_code)
{{ __('labels.referral_code') }}: {{ $customer->referral_code }}
@endif
{{-- STAT CARDS ROW --}}
{{ $orderStats['total'] }}
{{ __('labels.total_orders') }}
{{ $orderStats['delivered'] }} ({{ $orderStats['completion_rate'] }}%)
{{ __('labels.completed_orders') }}
{{ getCurrencySymbol() . number_format($orderStats['total_spent'], 2) }}
{{ __('labels.total_spent') }}
{{ getCurrencySymbol() . number_format($customer->wallet?->balance ?? 0, 2) }}
{{ __('labels.wallet_balance') }}
{{ $loyaltyPointsBalance ?? 0 }}
{{ __('labels.loyalty_points') }}
{{-- TABS --}}
{{-- TAB: OVERVIEW --}}
{{-- Personal Information --}}

{{ __('labels.personal_information') }}

{{ __('labels.full_name') }} {{ $customer->name ?? 'N/A' }}
{{ __('labels.email') }} {{ $customer->email ?? 'N/A' }}
{{ __('labels.mobile') }} {{ $customer->mobile ?? 'N/A' }}
{{ __('labels.country') }} {{ $customer->country ?? 'N/A' }}
{{ __('labels.country_code') }} {{ $customer->country_code ?? 'N/A' }}
{{ __('labels.referral_code') }} {{ $customer->referral_code ?? 'N/A' }}
{{ __('labels.friends_code') }} {{ $customer->friends_code ?? 'N/A' }}
{{ __('labels.reward_points') }} {{ getCurrencySymbol() . $customer->reward_points ?? 0 }}
{{-- Verification Details --}}

{{ __('labels.verification_details') }}

{{ __('labels.email_verified') }} @if ($customer->email_verified_at) {{ $customer->email_verified_at->format('d M Y H:i') }} @else {{ __('labels.not_verified') }} @endif
{{ __('labels.mobile_verified') }} @if ($customer->mobile_verified_at) {{ $customer->mobile_verified_at->format('d M Y H:i') }} @else {{ __('labels.not_verified') }} @endif
{{ __('labels.login_type') }} {{ ucfirst($customer->logged_in_type?->value ?? 'N/A') }}
{{-- Order Breakdown + Map --}}
{{-- Primary Address Map --}}

{{ __('labels.primary_address') }}

{{-- Order Breakdown --}}

{{ __('labels.order_breakdown') }}

@php $total = max($orderStats['total'], 1); $breakdowns = [ [ 'label' => __('labels.delivered'), 'count' => $orderStats['delivered'], 'class' => 'bg-success', ], [ 'label' => __('labels.pending'), 'count' => $orderStats['pending'], 'class' => 'bg-warning', ], [ 'label' => __('labels.in_progress'), 'count' => $orderStats['in_progress'], 'class' => 'bg-info', ], [ 'label' => __('labels.cancelled'), 'count' => $orderStats['cancelled'], 'class' => 'bg-danger', ], ]; @endphp @foreach ($breakdowns as $item)
{{ $item['label'] }} {{ $item['count'] }}
@endforeach
{{-- TAB: ORDERS --}}
{{-- TAB: WALLET --}}
{{ getCurrencySymbol() . number_format($customer->wallet?->balance ?? 0, 2) }}
{{ __('labels.current_balance') }}
{{ $loyaltyPointsBalance ?? 0 }}
{{ __('labels.loyalty_points') }}
{{-- Wallet Transactions DataTable --}}

{{ __('labels.recent_transactions') }}

{{-- TAB: ADDRESSES --}}
@if ($addresses->count() > 0)
@foreach ($addresses as $address)
@php $typeIcon = match ( strtolower($address->address_type ?? '') ) { 'home' => 'ti-home', 'office', 'work' => 'ti-building', default => 'ti-map-pin', }; @endphp {{ ucfirst($address->address_type ?? 'Other') }}
{{ $address->address_line1 ?? '' }}
@if ($address->address_line2)
{{ $address->address_line2 }}
@endif
{{ collect([$address->city, $address->state, $address->zipcode])->filter()->implode(', ') }}
@if ($address->landmark)
{{ $address->landmark }}
@endif @if ($address->mobile)
{{ $address->mobile }}
@endif
@endforeach
@else

{{ __('labels.no_addresses_found') }}

@endif
{{-- TAB: NOTIFICATIONS --}}
{{-- TAB: LOYALTY POINTS --}}

{{ __('labels.loyalty_points') ?? 'Loyalty Points' }}

{{ __('labels.points_balance') ?? 'Points Balance' }}: {{ $loyaltyPointsBalance ?? 0 }}
{{-- ADJUST LOYALTY POINTS MODAL --}} @endsection @push('styles') @endpush @push('scripts') @php $primaryAddress = $addresses->first(); $hasLocation = $primaryAddress && $primaryAddress->latitude && $primaryAddress->longitude; @endphp @endpush