65 lines
2.6 KiB
PHP
65 lines
2.6 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../db/config.php';
|
|
$pdo = db();
|
|
|
|
$query = "SELECT * FROM loyalty_customers ORDER BY points DESC";
|
|
$customers_pagination = paginate_query($pdo, $query);
|
|
$customers = $customers_pagination['data'];
|
|
|
|
include 'includes/header.php';
|
|
?>
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h2 class="fw-bold mb-0">Loyalty Program</h2>
|
|
<button class="btn btn-outline-primary" disabled>
|
|
<i class="bi bi-gear"></i> Settings (Coming Soon)
|
|
</button>
|
|
</div>
|
|
|
|
<div class="card border-0 shadow-sm">
|
|
<div class="card-body p-0">
|
|
<!-- Pagination Controls -->
|
|
<div class="p-3 border-bottom bg-light">
|
|
<?php render_pagination_controls($customers_pagination); ?>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle mb-0">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th class="ps-4">ID</th>
|
|
<th>Name</th>
|
|
<th>Email</th>
|
|
<th>Points Balance</th>
|
|
<th>Joined</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($customers as $customer): ?>
|
|
<tr>
|
|
<td class="ps-4 fw-medium">#<?= $customer['id'] ?></td>
|
|
<td class="fw-bold"><?= htmlspecialchars($customer['name']) ?></td>
|
|
<td><a href="mailto:<?= htmlspecialchars($customer['email']) ?>" class="text-decoration-none"><?= htmlspecialchars($customer['email']) ?></a></td>
|
|
<td>
|
|
<span class="badge bg-warning text-dark border border-warning">
|
|
<i class="bi bi-star-fill small me-1"></i> <?= $customer['points'] ?> pts
|
|
</span>
|
|
</td>
|
|
<td class="text-muted small"><?= date('M d, Y', strtotime($customer['created_at'])) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php if (empty($customers)): ?>
|
|
<tr>
|
|
<td colspan="5" class="text-center py-5 text-muted">No loyalty members yet.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- Bottom Pagination -->
|
|
<div class="p-3 border-top bg-light">
|
|
<?php render_pagination_controls($customers_pagination); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include 'includes/footer.php'; ?>
|