fetchAll( "SELECT * FROM orders WHERE customer_id = :id ORDER BY created_at DESC LIMIT 5", ['id' => $customer['customer_id']] ); // Get order stats $orderStats = db()->fetch( "SELECT COUNT(*) as total_orders, COALESCE(SUM(total), 0) as total_spent FROM orders WHERE customer_id = :id AND payment_status = 'paid'", ['id' => $customer['customer_id']] ); // Get wishlist count $wishlistCount = db()->count('wishlist', 'customer_id = :id', ['id' => $customer['customer_id']]); // Get recent wallet transactions $walletTransactions = db()->fetchAll( "SELECT * FROM wallet_transactions WHERE customer_id = :id ORDER BY created_at DESC LIMIT 5", ['id' => $customer['customer_id']] ); require_once __DIR__ . '/../includes/header.php'; ?> = getFlash('success') ?> Welcome back, = htmlspecialchars($customer['name'] ?? 'Coffee Lover') ?>! Here's an overview of your account activity. = $orderStats['total_orders'] ?? 0 ?> Total Orders = formatCurrency($orderStats['total_spent'] ?? 0) ?> Total Spent = formatCurrency($customer['wallet_balance'] ?? 0) ?> Wallet Balance = number_format($customer['reward_points'] ?? 0) ?> Reward Points Recent Orders View All No orders yet. Start shopping! Order #= htmlspecialchars($order['order_number']) ?> = formatDate($order['created_at']) ?> ยท = count(json_decode($order['items'], true)) ?> items = formatCurrency($order['total']) ?> 'warning', 'confirmed', 'processing' => 'primary', 'shipped' => 'primary', 'delivered' => 'success', 'cancelled', 'refunded' => 'error', default => 'primary' }; ?> = ucfirst($order['order_status']) ?> Recent Wallet Activity View All = htmlspecialchars($tx['description'] ?? ucfirst($tx['type'])) ?> = formatDateTime($tx['created_at']) ?> = $tx['amount'] > 0 ? '+' : '' ?>= formatCurrency($tx['amount']) ?> Balance: = formatCurrency($tx['balance_after']) ?>
Here's an overview of your account activity.
No orders yet. Start shopping!
= formatDate($order['created_at']) ?> ยท = count(json_decode($order['items'], true)) ?> items
= formatDateTime($tx['created_at']) ?>