-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
220 lines (191 loc) · 9.89 KB
/
admin.html
File metadata and controls
220 lines (191 loc) · 9.89 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>rto.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&display=swap"
rel="stylesheet">
<!-- 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>
<link rel="stylesheet" href="css/styles.css">
<style>
.brand-pin {
font-family: 'Courier Prime', monospace;
font-weight: 700;
font-size: 2.8rem;
color: var(--white);
letter-spacing: .08em;
text-transform: none;
}
.brand-pin .gio {
font-family: 'Bebas Neue', sans-serif;
font-size: 3.2rem;
letter-spacing: .1em;
}
</style>
</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"><span>rto.</span><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">
<div class="admin-title">
<a href="index.html" style="text-decoration:none;color:inherit;"><span
style="font-family:'Courier Prime',monospace;font-weight:700;font-size:1.4rem;text-transform:none;letter-spacing:.04em;">rto.<span
style="font-family:'Bebas Neue',sans-serif;font-size:1.6rem;letter-spacing:.08em;">GiO</span></span></a>
<span>Admin Dashboard</span>
</div>
<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>