🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:customers.php
<?php $page = 'customers'; $page_title = 'Customers'; require_once '../includes/header.php'; $customers = $db->query("SELECT u.*, (SELECT COUNT(*) FROM orders WHERE user_id = u.id) as order_count, (SELECT COALESCE(SUM(total), 0) FROM orders WHERE user_id = u.id AND payment_status = 'completed') as total_spent FROM users u ORDER BY u.created_at DESC")->fetchAll(); ?> <div class="data-table-wrapper"> <h3 style="margin-bottom: 20px; font-size: 1.2rem;">All Customers (<?= count($customers) ?>)</h3> <div class="table-responsive"> <table class="admin-table"> <thead> <tr> <th>Customer</th> <th>Email</th> <th>Phone</th> <th>Orders</th> <th>Total Spent</th> <th>Joined</th> <th>Status</th> </tr> </thead> <tbody> <?php foreach ($customers as $c): ?> <tr> <td> <div style="display: flex; gap: 10px; align-items: center;"> <div style="width: 40px; height: 40px; background: var(--gradient-rose); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600;"> <?= strtoupper(substr($c['first_name'], 0, 1) . substr($c['last_name'], 0, 1)) ?> </div> <div> <strong><?= htmlspecialchars($c['first_name'] . ' ' . $c['last_name']) ?></strong> </div> </div> </td> <td><?= htmlspecialchars($c['email']) ?></td> <td><?= htmlspecialchars($c['phone'] ?? 'N/A') ?></td> <td><span class="badge" style="background: var(--soft-pink); color: var(--primary-rose-gold); padding: 4px 10px; border-radius: 10px;"><?= $c['order_count'] ?></span></td> <td><strong><?= format_currency($c['total_spent']) ?></strong></td> <td><?= date('M d, Y', strtotime($c['created_at'])) ?></td> <td> <span class="status-badge status-<?= $c['status'] ? 'active' : 'inactive' ?>"> <?= $c['status'] ? 'Active' : 'Inactive' ?> </span> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <?php require_once '../includes/footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder