@php use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Str; use App\Models\Order; use App\Models\OrderDetails; use App\Models\Product; $customer = Auth::guard('customer')->user(); $customerId = $customer->id; // Statistics $totalOrders = Order::where('customer_id', $customerId)->count(); $pendingOrders = Order::where('customer_id', $customerId) ->whereNotIn('order_status', ['6', '11']) ->count(); $completedOrders = Order::where('customer_id', $customerId) ->where('order_status', '6') ->count(); // Recent Orders (last 5) $recentOrders = Order::where('customer_id', $customerId) ->with(['status', 'payment', 'orderdetails.product']) ->latest() ->limit(5) ->get(); // Recommended Products $recommendedProducts = Product::where('status', 1) ->where('approval_status', 'approved') ->where('stock', '>', 0) ->with('image') ->inRandomOrder() ->limit(4) ->get(); // Total Order Amount $totalOrderAmount = Order::where('customer_id', $customerId)->sum('amount'); // Profile Image - Use direct image path $profileImage = $customer->image ? asset($customer->image) : asset('public/uploads/default/no-image.png'); // Pending Orders Count for Badge $pendingOrdersCount = Order::where('customer_id', $customerId) ->whereNotIn('order_status', ['6', '11']) ->count(); // Site Name & Logo $siteName = \App\Models\GeneralSetting::first(); $siteInitial = strtoupper(substr($siteName->name ?? 'G', 0, 1)); $siteDisplayName = Str::limit($siteName->name ?? 'GadgetShop', 8); $generalsetting = $siteName; // For sidebar compatibility $darkLogo = $siteName->dark_logo ?? null; @endphp Customer Panel | {{ $siteName->name ?? 'Gadget Style' }}

স্বাগতম, {{ $customer->name }}! 👋

Profile

মোট অর্ডার

{{ $totalOrders }} টি

চলমান অর্ডার

{{ $pendingOrders }} টি

কমপ্লিট অর্ডার

{{ $completedOrders }} টি

মোট টাকা

৳{{ number_format($totalOrderAmount, 0) }}

📦 সাম্প্রতিক অর্ডারসমূহ

সবগুলো দেখুন
@forelse($recentOrders as $order) @php $firstProduct = $order->orderdetails->first(); $productName = $firstProduct && $firstProduct->product ? Str::limit($firstProduct->product->name, 30) : 'N/A'; $payment = $order->payment; $paymentStatus = $payment ? strtolower($payment->payment_status) : 'pending'; $isPaid = $paymentStatus === 'paid' || $paymentStatus === 'success'; $statusClass = ''; $statusText = ''; if($order->order_status == '6') { $statusClass = 'bg-green-50 text-green-600'; $statusText = 'Delivered'; } elseif($order->order_status == '11') { $statusClass = 'bg-red-50 text-red-600'; $statusText = 'Cancelled'; } elseif(in_array($order->order_status, ['3', '4', '5'])) { $statusClass = 'bg-orange-50 text-orange-600'; $statusText = 'Shipped'; } else { $statusClass = 'bg-blue-50 text-blue-600'; $statusText = 'Processing'; } @endphp @empty @endforelse
অর্ডার আইডি তারিখ পণ্যের নাম মোট টাকা পেমেন্ট স্ট্যাটাস অ্যাকশন
#{{ $order->invoice_id ?? $order->id }} {{ $order->created_at->format('d M, Y') }} {{ $productName }} ৳{{ number_format($order->amount, 0) }} @if($isPaid) Paid @else Unpaid @endif {{ $statusText }}
কোনো অর্ডার পাওয়া যায়নি
@if($recommendedProducts->count() > 0)

🔥 আপনার জন্য সেরা (Recommended)

@foreach($recommendedProducts as $product) @php $discount = 0; if($product->old_price && $product->new_price && $product->old_price > $product->new_price) { $discount = round((($product->old_price - $product->new_price) / $product->old_price) * 100); } @endphp
{{ $product->name }} @if($discount > 0) {{ $discount }}% OFF @elseif($product->feature_product) New @endif @if($product->stock <= 0) স্টকে নেই @endif

{{ $product->name }}

@if($product->old_price && $product->old_price > $product->new_price) ৳{{ number_format($product->old_price, 0) }} @endif ৳{{ number_format($product->new_price ?? 0, 0) }}
@if($product->stock > 0) @else
স্টকে নেই
@endif
@endforeach
@endif