@extends('layouts.app') @section('title', __('My Account')) @php /* * Use the currency selected in Payment Settings throughout * the account dashboard and its financial partials. */ $displayCurrency = currency_code( $currency ?? default_currency() ); $profile = is_array($profile ?? null) ? $profile : []; $stats = is_array($stats ?? null) ? $stats : []; $sellerStatus = $sellerStatus ?? null; $recentOrders = collect($recentOrders ?? []); $recentWalletEntries = collect( $recentWalletEntries ?? [] ); $recentSupportTickets = collect( $recentSupportTickets ?? [] ); $recentNotifications = collect( $recentNotifications ?? [] ); $profilePercentage = max( 0, min( 100, (int) data_get( $profile, 'percentage', 0 ) ) ); $displayName = trim( (string) ( $user->first_name ?: $user->username ?: __('there') ) ); /* * last_seen may be returned as either a Carbon instance * or a plain database string. */ $lastSeen = null; if (filled($user->last_seen)) { try { $lastSeen = \Illuminate\Support\Carbon::parse( $user->last_seen ); } catch (\Throwable) { $lastSeen = null; } } $quickActions = [ [ 'route' => 'account.orders.index', 'icon' => 'fa-shopping-bag', 'label' => __('My Orders'), 'color' => 'primary', ], [ 'route' => 'account.wallet.index', 'icon' => 'fa-wallet', 'label' => __('Wallet'), 'color' => 'success', ], [ 'route' => 'account.downloads.index', 'icon' => 'fa-download', 'label' => __('Downloads'), 'color' => 'info', ], [ 'route' => 'account.wishlist.index', 'icon' => 'fa-heart', 'label' => __('Wishlist'), 'color' => 'danger', ], [ 'route' => 'account.messages.index', 'icon' => 'fa-comments', 'label' => __('Messages'), 'color' => 'warning', ], [ 'route' => 'account.support.index', 'icon' => 'fa-headset', 'label' => __('Support'), 'color' => 'secondary', ], ]; @endphp @section('content')
{{-- Welcome Header --}}

{{ __('Welcome back, :name!', [ 'name' => $displayName, ]) }}

{{ now()->format('l, F j, Y') }} @if($lastSeen) {{ __('Last login: :time', [ 'time' => $lastSeen->diffForHumans(), ]) }} @endif

@if( \Illuminate\Support\Facades\Route::has( 'account.orders.index' ) ) {{ __('My Orders') }} @endif @if( \Illuminate\Support\Facades\Route::has( 'account.wallet.index' ) ) {{ __('Wallet') }} @endif
{{-- Profile Completion Alert --}} @if($profilePercentage < 100) @include('account.partials.profile-completion', [ 'profile' => array_merge( $profile, ['percentage' => $profilePercentage] ), ]) @endif {{-- Stats Grid --}} @include('account.partials.stats-grid', [ 'stats' => $stats, 'currency' => $displayCurrency, 'displayCurrency' => $displayCurrency, ]) {{-- Seller Status Banner --}} @include('account.partials.seller-status', [ 'sellerStatus' => $sellerStatus, 'user' => $user, 'currency' => $displayCurrency, 'displayCurrency' => $displayCurrency, ]) {{-- Quick Actions --}}
@foreach($quickActions as $action) @if( \Illuminate\Support\Facades\Route::has( $action['route'] ) ) @endif @endforeach
{{-- Main Content --}}
{{-- Recent Orders --}}
@include('account.partials.recent-orders', [ 'recentOrders' => $recentOrders, 'currency' => $displayCurrency, 'displayCurrency' => $displayCurrency, ])
{{-- Recent Wallet Activity --}}
@include('account.partials.recent-wallet', [ 'recentWalletEntries' => $recentWalletEntries, 'stats' => $stats, 'currency' => $displayCurrency, 'displayCurrency' => $displayCurrency, ])
{{-- Recent Support Tickets --}}
@include('account.partials.recent-tickets', [ 'recentSupportTickets' => $recentSupportTickets, 'stats' => $stats, ])
{{-- Recent Notifications --}}
@include('account.partials.recent-notifications', [ 'recentNotifications' => $recentNotifications, 'stats' => $stats, ])
@endsection @once @push('styles') @endpush @endonce