-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
256 lines (226 loc) · 10.6 KB
/
admin.html
File metadata and controls
256 lines (226 loc) · 10.6 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>rtro.GIO — Admin</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link
href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Courier+Prime:wght@400;700&family=Inter:wght@400;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="css/styles.css">
<style>
.brand-pin {
font-family: 'Inter', sans-serif;
font-weight: 900;
font-size: 2.5rem;
letter-spacing: -0.02em;
color: var(--white);
display: flex;
align-items: baseline;
gap: 0.15rem;
}
.brand-pin .by {
font-weight: 400;
font-size: 1.4rem;
color: #777;
margin: 0 0.4rem;
}
.brand-pin .gio {
font-family: 'Inter', sans-serif;
font-weight: 900;
font-size: 3rem;
letter-spacing: 0.05em;
color: var(--white);
}
</style>
<!-- Vercel Speed Insights -->
<script> window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); }; </script>
<script defer src="/_vercel/speed-insights/script.js"></script>
</head>
<body class="admin-body">
<!-- ═══════════════════════════════ PIN SCREEN ═══════════════════════════════ -->
<div id="pinScreen" class="pin-screen">
<a href="index.html" style="text-decoration:none;display:block;">
<div class="brand-pin" style="margin-bottom: 2rem;">
rtro.<span class="gio">GIO</span>
</div>
</a>
<div style="text-align:center;">
<div class="pin-label">Admin Access</div>
<input class="pin-input" id="pinInput" type="password" maxlength="8" placeholder="····"
onkeydown="pinKeydown(event)" autofocus>
</div>
<button class="pin-btn" onclick="checkPin()">Enter →</button>
<div class="pin-error" id="pinError"></div>
<a href="index.html"
style="color:#444;font-size:.6rem;letter-spacing:.2em;text-transform:uppercase;text-decoration:none;margin-top:1rem;">←
Back to Store</a>
</div>
<!-- ═══════════════════════════════ ADMIN MAIN ═══════════════════════════════ -->
<div id="adminMain" class="hidden">
<!-- HEADER -->
<div class="admin-header">
<a href="index.html" style="text-decoration:none; color:inherit; display:flex; align-items:center; gap:1.5rem;">
<div
style="font-family:'Inter', sans-serif; font-weight:900; font-size:1.2rem; text-transform:none; display:flex; align-items:baseline; gap:0.1rem;">
rtro.<span style="font-size:1.5rem;">GIO</span>
</div>
<span
style="font-family:'Inter', sans-serif; font-weight:700; font-size:1rem; letter-spacing:.05em; text-transform:uppercase; color:var(--gray); border-left:1px solid var(--line); padding-left:1.5rem;">
Dashboard</span>
</a>
<div style="display:flex;gap:1rem;align-items:center;">
<a href="index.html"
style="font-size:.6rem;letter-spacing:.2em;text-transform:uppercase;color:var(--gray);text-decoration:none;">←
Store</a>
<button class="admin-logout" onclick="logout()">Log Out</button>
</div>
</div>
<!-- CONTENT -->
<div class="admin-content">
<!-- ── STATS ── -->
<div class="admin-stats">
<div class="admin-stat">
<div class="admin-stat-num" id="statTotal">—</div>
<div class="admin-stat-label">Total Orders</div>
</div>
<div class="admin-stat">
<div class="admin-stat-num" id="statPending">—</div>
<div class="admin-stat-label">Active Orders</div>
</div>
<div class="admin-stat">
<div class="admin-stat-num" id="statDelivered">—</div>
<div class="admin-stat-label">Delivered</div>
</div>
<div class="admin-stat">
<div class="admin-stat-num" id="statRevenue">—</div>
<div class="admin-stat-label">Total Revenue</div>
</div>
</div>
<!-- ── ORDERS ── -->
<div class="admin-section">
<div class="admin-section-title">Orders</div>
<div class="admin-section-sub">Live — updates automatically from Firebase</div>
<!-- Filter row -->
<div style="display:flex;gap:.5rem;flex-wrap:wrap;margin-bottom:1rem;">
<button class="action-btn" onclick="filterOrdersByStatus(null)">All</button>
<button class="action-btn" onclick="filterOrdersByStatus('placed')">Received</button>
<button class="action-btn" onclick="filterOrdersByStatus('processing')">Processing</button>
<button class="action-btn" onclick="filterOrdersByStatus('ready')">Ready</button>
<button class="action-btn" onclick="filterOrdersByStatus('ontheway')">On the Way</button>
<button class="action-btn" onclick="filterOrdersByStatus('delivered')">Delivered</button>
</div>
<!-- Empty state -->
<div id="ordersEmpty" class="orders-empty hidden">
No orders yet. Orders from customers will appear here in real-time.
</div>
<!-- Table -->
<div id="ordersTableWrap" class="orders-table-wrap hidden">
<table class="orders-table">
<thead>
<tr>
<th>Order ID</th>
<th>Customer</th>
<th>Item</th>
<th>Total</th>
<th>Payment</th>
<th>Status</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="ordersBody"></tbody>
</table>
</div>
<!-- Loading state -->
<div id="ordersLoading" class="loading-row">
<div class="spinner"></div> Loading orders…
</div>
</div>
<!-- ── INVENTORY EDITOR ── -->
<div class="admin-section">
<div class="admin-section-title">Inventory & Stock</div>
<div class="admin-section-sub">
Manage your current stock levels and total capacity.
</div>
<div class="inv-editor">
<div class="inv-editor-header" style="grid-template-columns: 1.5fr 1fr 1fr 140px auto;">
<span>Product Name</span>
<span>Price (£)</span>
<span>Current Stock</span>
<span>Total Capacity</span>
<span></span>
</div>
<div class="inv-editor-row" id="adminInvRow" style="grid-template-columns: 1.5fr 1fr 1fr 140px auto;">
<!-- Rendered via JS -->
</div>
</div>
<div style="margin-top:1.5rem; display:flex; gap:1rem; flex-wrap:wrap;">
<button class="action-btn" onclick="restockAllToMax()"
style="background:var(--green); border-color:var(--green); color:white;">⚡ Restock All to Max</button>
<button class="action-btn" onclick="initAdmin()">↻ Refresh Data</button>
</div>
</div>
<!-- ── ADMIN USER MANUAL ── -->
<div class="admin-section">
<div class="admin-section-title">Admin User Manual</div>
<div class="admin-section-sub">Simple steps to manage your store</div>
<div
style="border:1px solid var(--line); padding:1.5rem; font-size:.78rem; line-height:1.8; letter-spacing:.04em; background: rgba(255,255,255,0.02);">
<h4
style="margin-top:0; color:var(--white); text-transform:uppercase; font-size:.7rem; letter-spacing:.15em;">
1. Handling New Orders</h4>
<p>When a new order arrives, it appears at the top of the <strong>Orders</strong> list. Check the "Payment"
column to see if it was Cash, Bank, or Crypto. If a proof was attached, click <strong>📎 View Proof</strong>
to see the screenshot.</p>
<h4
style="color:var(--white); text-transform:uppercase; font-size:.7rem; letter-spacing:.15em; margin-top:1.5rem;">
2. Updating Status (Advance →)</h4>
<p>Click the <strong>Advance →</strong> button to move an order forward (e.g., from <em>Received</em> to
<em>Processing</em>). This updates the customer's tracking page <strong>instantly</strong>. An update email
is also sent to them automatically.
</p>
<h4
style="color:var(--white); text-transform:uppercase; font-size:.7rem; letter-spacing:.15em; margin-top:1.5rem;">
3. Messaging Customers</h4>
<p>Use the <strong>WhatsApp</strong> button to quickly open a chat with the customer. Use the
<strong>Email</strong> button if you want to re-send the current status details to their inbox.
</p>
<h4
style="color:var(--white); text-transform:uppercase; font-size:.7rem; letter-spacing:.15em; margin-top:1.5rem;">
4. Restocking Inventory</h4>
<p>When you have new glasses available, use the <strong>Inventory</strong> section. You can manually change
the number of items left, or click <strong>⚡ Restock All to Max</strong> to quickly reset your stock to its
full capacity.</p>
</div>
</div>
</div>
<!-- /admin-content -->
</div>
<!-- /adminMain -->
<!-- TOAST -->
<div class="admin-toast" id="adminToast"></div>
<!-- ═══════════════════════════════ SCRIPTS ═══════════════════════════════ -->
<!--
<script src="https://www.gstatic.com/firebasejs/9.22.2/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.22.2/firebase-database-compat.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@emailjs/browser@4/dist/email.min.js"></script>
-->
<script src="js/config.js"></script>
<script src="js/firebase.js"></script>
<script src="js/notifications.js"></script>
<script src="js/admin.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
// Set max stock label
const ml = document.getElementById('maxStockLabel');
if (ml) ml.textContent = CONFIG.maxStock;
// Hide orders loading once first data arrives (handled by listenToAllOrders)
// Initially show loading
const loadEl = document.getElementById('ordersLoading');
setTimeout(() => { if (loadEl) loadEl.classList.add('hidden'); }, 5000);
});
</script>
</body>
</html>