This repository was archived by the owner on Sep 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
249 lines (220 loc) · 11.1 KB
/
Copy pathadmin.html
File metadata and controls
249 lines (220 loc) · 11.1 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Par3 Challenge Admin Dashboard</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100">
<div class="min-h-screen">
<!-- Header -->
<header class="bg-green-800 text-white p-4">
<div class="container mx-auto flex justify-between items-center">
<h1 class="text-2xl font-bold">Par3 Challenge Admin</h1>
<div class="flex items-center space-x-4">
<span>Welcome, Admin</span>
<button onclick="logout()" class="bg-green-600 px-4 py-2 rounded hover:bg-green-700">Logout</button>
</div>
</div>
</header>
<!-- Navigation -->
<nav class="bg-green-700 text-white p-2">
<div class="container mx-auto">
<ul class="flex space-x-6">
<li><a href="#dashboard" onclick="showSection('dashboard')" class="hover:underline">Dashboard</a>
</li>
<li><a href="#claims" onclick="showSection('claims')" class="hover:underline">Claims</a></li>
<li><a href="#settings" onclick="showSection('settings')" class="hover:underline">Settings</a></li>
</ul>
</div>
</nav>
<!-- Dashboard Section -->
<div id="dashboard" class="section p-6">
<div class="container mx-auto">
<h2 class="text-3xl font-bold mb-6">Dashboard</h2>
<!-- Stats Grid -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-semibold text-gray-700">Total Claims</h3>
<p class="text-3xl font-bold text-green-600" id="totalClaims">0</p>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-semibold text-gray-700">Pending Verification</h3>
<p class="text-3xl font-bold text-yellow-600" id="pendingClaims">0</p>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-semibold text-gray-700">Verified Claims</h3>
<p class="text-3xl font-bold text-blue-600" id="verifiedClaims">0</p>
</div>
</div>
<!-- Recent Claims Alert -->
<div class="bg-yellow-100 border-l-4 border-yellow-500 p-4 mb-6">
<h3 class="text-lg font-semibold text-yellow-800">Recent Claims Requiring Attention</h3>
<p class="text-yellow-700">No new claims at this time.</p>
</div>
</div>
</div>
<!-- Claims Section -->
<div id="claims" class="section p-6" style="display: none;">
<div class="container mx-auto">
<h2 class="text-3xl font-bold mb-6">Claims Management</h2>
<div class="bg-white rounded-lg shadow overflow-hidden">
<table class="min-w-full">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Player</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Claim Type
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Outfit</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Time</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Actions</th>
</tr>
</thead>
<tbody id="claimsTable" class="bg-white divide-y divide-gray-200">
<tr>
<td colspan="6" class="px-6 py-4 text-center text-gray-500">No claims yet. Claims will
appear here when players submit birdie or hole-in-one achievements.</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Settings Section -->
<div id="settings" class="section p-6" style="display: none;">
<div class="container mx-auto">
<h2 class="text-3xl font-bold mb-6">Settings</h2>
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-semibold mb-4">Email Configuration</h3>
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Notification Email</label>
<input type="email" value="devbooth1@yahoo.com"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500">
</div>
<button class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700">Save Settings</button>
</div>
</div>
</div>
</div>
<script>
// Sample claims data
let claims = [];
function showSection(sectionId) {
// Hide all sections
document.querySelectorAll('.section').forEach(section => {
section.style.display = 'none';
});
// Show selected section
document.getElementById(sectionId).style.display = 'block';
if (sectionId === 'claims') {
updateClaimsTable();
}
}
function updateClaimsTable() {
const tableBody = document.getElementById('claimsTable');
if (claims.length === 0) {
tableBody.innerHTML = `
<tr>
<td colspan="6" class="px-6 py-4 text-center text-gray-500">No claims yet. Claims will appear here when players submit birdie or hole-in-one achievements.</td>
</tr>
`;
return;
}
tableBody.innerHTML = claims.map(claim => `
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">${claim.playerName}</div>
<div class="text-sm text-gray-500">${claim.email}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${claim.type === 'hole-in-one' ? 'bg-purple-100 text-purple-800' : 'bg-blue-100 text-blue-800'}">
${claim.type}
</span>
</td>
<td class="px-6 py-4 text-sm text-gray-900">${claim.outfit}</td>
<td class="px-6 py-4 text-sm text-gray-500">${claim.time}</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${claim.status === 'verified' ? 'bg-green-100 text-green-800' : 'bg-yellow-100 text-yellow-800'}">
${claim.status}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
${claim.status === 'pending' ?
`<button onclick="verifyClaim('${claim.id}')" class="text-green-600 hover:text-green-900 mr-3">Verify</button>
<button onclick="rejectClaim('${claim.id}')" class="text-red-600 hover:text-red-900">Reject</button>` :
'<span class="text-gray-400">No actions</span>'
}
</td>
</tr>
`).join('');
}
function verifyClaim(claimId) {
const claim = claims.find(c => c.id === claimId);
if (claim) {
claim.status = 'verified';
updateClaimsTable();
updateStats();
// Send email notification
fetch('/api/send-email', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'verification',
claim: claim
})
});
alert('Claim verified and email sent!');
}
}
function rejectClaim(claimId) {
const claimIndex = claims.findIndex(c => c.id === claimId);
if (claimIndex > -1) {
claims.splice(claimIndex, 1);
updateClaimsTable();
updateStats();
alert('Claim rejected and removed.');
}
}
function updateStats() {
document.getElementById('totalClaims').textContent = claims.length;
document.getElementById('pendingClaims').textContent = claims.filter(c => c.status === 'pending').length;
document.getElementById('verifiedClaims').textContent = claims.filter(c => c.status === 'verified').length;
}
function logout() {
window.location.href = '/login.html';
}
// Listen for new claims from the main app
function pollForClaims() {
fetch('/api/claims')
.then(response => response.json())
.then(data => {
if (data.length > claims.length) {
claims = data;
updateClaimsTable();
updateStats();
// Show notification for new claims
const newClaims = data.length - claims.length;
if (newClaims > 0) {
const notification = document.createElement('div');
notification.className = 'fixed top-4 right-4 bg-green-500 text-white p-4 rounded-lg shadow-lg z-50';
notification.innerHTML = `New claim${newClaims > 1 ? 's' : ''} received! (${newClaims})`;
document.body.appendChild(notification);
setTimeout(() => {
notification.remove();
}, 5000);
}
}
})
.catch(error => console.log('Polling error:', error));
}
// Poll for new claims every 5 seconds
setInterval(pollForClaims, 5000);
// Initialize
updateStats();
</script>
</body>
</html>