-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayment.ejs
More file actions
104 lines (99 loc) · 3.44 KB
/
payment.ejs
File metadata and controls
104 lines (99 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!--
Cheng Tsz Hung (25017438D)
Awwab Hamam (22103907D)
-->
<%- include('partials/page-start', { pageTitle: 'User Management' }) %>
<div class="d-flex justify-content-between align-items-center mb-4 flex-wrap gap-2">
<div>
<h1 class="h4 mb-1">User Account Management</h1>
<p class="text-muted mb-0">View and manage all registered vendor accounts.</p>
</div>
<a href="/admin/events" class="btn btn-outline-primary">Back to Events</a>
</div>
<% if (!users.length) { %>
<div class="alert alert-info">No users have registered yet.</div>
<% } else { %>
<div class="row g-4 mb-4">
<div class="col-md-4">
<div class="card shadow-sm border-primary-subtle">
<div class="card-body text-center">
<div class="metric-value text-primary"><%= users.length %></div>
<div class="metric-label">Total Users</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card shadow-sm border-success-subtle">
<div class="card-body text-center">
<div class="metric-value text-success">
<%= users.filter((u) => u.role === 'user').length %>
</div>
<div class="metric-label">Vendors</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card shadow-sm border-info-subtle">
<div class="card-body text-center">
<div class="metric-value text-info">
<%= users.filter((u) => u.bookingCount > 0).length %>
</div>
<div class="metric-label">Active Bookers</div>
</div>
</div>
</div>
</div>
<div class="table-responsive shadow-sm bg-white rounded-4">
<table class="table table-striped align-middle mb-0">
<thead class="table-light">
<tr>
<th scope="col">Profile</th>
<th scope="col">User ID</th>
<th scope="col">Display Name</th>
<th scope="col">Email</th>
<th scope="col">Role</th>
<th scope="col">Bookings</th>
<th scope="col">Total Spent</th>
<th scope="col">Joined</th>
</tr>
</thead>
<tbody>
<% users.forEach((user) => { %>
<tr>
<td>
<% if (user.profileImage) { %>
<img
src="<%= user.profileImage.startsWith('/') ? user.profileImage : '/' + user.profileImage %>"
alt="<%= user.nickname %>"
class="rounded-circle"
style="width: 40px; height: 40px; object-fit: cover"
/>
<% } else { %>
<div
class="rounded-circle d-inline-flex align-items-center justify-content-center bg-primary text-white"
style="width: 40px; height: 40px; font-size: 0.875rem"
>
<%= user.nickname ? user.nickname.charAt(0).toUpperCase() : user.userId.charAt(0).toUpperCase() %>
</div>
<% } %>
</td>
<td><code><%= user.userId %></code></td>
<td><strong><%= user.nickname %></strong></td>
<td><%= user.email %></td>
<td>
<span class="badge bg-<%= user.role === 'admin' ? 'danger' : 'primary' %>">
<%= user.role === 'admin' ? 'Administrator' : 'Vendor' %>
</span>
</td>
<td>
<span class="badge bg-light text-dark"><%= user.bookingCount || 0 %></span>
</td>
<td>HK$<%= (user.totalSpent || 0).toLocaleString() %></td>
<td class="small text-muted"><%= new Date(user.createdAt).toLocaleDateString() %></td>
</tr>
<% }) %>
</tbody>
</table>
</div>
<% } %>
<%- include('partials/page-end') %>