-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
546 lines (507 loc) · 16.7 KB
/
index.html
File metadata and controls
546 lines (507 loc) · 16.7 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>W.A.T.A.W.A.T. Prototype</title>
<link href="https://fonts.googleapis.com/css2?family=Inter&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background: linear-gradient(to bottom right, #f0f4ff, #dbeafe);
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
padding: 20px;
color: #2d3436;
}
h1, h2 {
color: #023e8a;
}
h2 {
text-align: left;
}
.header {
display: flex;
align-items: center;
gap: 15px;
margin-bottom: 30px;
background: #ffffff;
padding: 20px 25px;
border-radius: 10px;
border-bottom: 4px solid #2563eb;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}
.header img {
height: 70px;
}
.header .text {
line-height: 1.2;
}
.header .text div:nth-child(1) {
font-size: 13px;
}
.header .text div:nth-child(2) {
font-weight: bold;
}
.header .text div:nth-child(3) {
font-size: 13px;
}
.header.logged-in {
box-shadow: 0 0 15px rgba(37, 99, 235, 0.2); /* soft blue glow */
border-bottom: 4px solid #38bdf8; /* brighter blue border */
background-color: #f0f9ff; /* slight tint */
position: relative;
}
.header.logged-in::after {
content: "ADMIN MODE";
position: absolute;
top: -10px;
right: 15px;
background: #2563eb;
color: white;
padding: 3px 8px;
font-size: 11px;
font-weight: bold;
border-radius: 4px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
animation: slideFadeIn 0.8s ease-out forwards;
}
@keyframes slideFadeIn {
0% {
opacity: 0;
transform: translateY(-10px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
.container {
margin: auto;
padding: 0 20px;
}
.login-wrapper {
display: flex;
justify-content: center;
align-items: center;
padding-top: 30px;
padding-bottom: 40px;
}
.login-box {
background: rgba(255, 255, 255, 0.8);
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 320px;
backdrop-filter: blur(8px);
}
.login-box h2 {
text-align: center;
margin-top: 0;
margin-bottom: 25px;
}
.login-box input {
width: 90%;
padding: 8px;
margin: 10px auto;
display: block;
}
.login-box button {
width: 60%;
margin-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
}
.hidden { display: none; }
.section {
background: #fff;
padding: 20px;
margin-bottom: 20px;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.section input[type="text"],
.section input[type="password"] {
width: 100%;
box-sizing: border-box;
margin-bottom: 10px;
}
.status {
font-weight: bold;
padding: 10px;
margin-top: 10px;
border-radius: 5px;
}
.success { color: green; }
.error { color: red; }
.log-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
.log-table th, .log-table td {
border: 1px solid #ccc;
padding: 8px;
text-align: left;
}
.log-table th {
background-color: #0077b6;
color: #fff;
}
button {
padding: 10px 14px;
background: #2563eb;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background 0.3s ease;
}
button:hover {
background: #1e40af;
}
input, select {
padding: 8px 10px;
margin-top: 6px;
width: 100%;
border: 1px solid #ccc;
border-radius: 6px;
transition: border 0.3s ease, box-shadow 0.3s ease;
}
input:focus {
border-color: #2563eb;
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
outline: none;
}
label {
display: block;
margin-top: 10px;
}
#toast {
visibility: hidden;
min-width: 250px;
background-color: #dc3545;
color: white;
text-align: center;
border-radius: 4px;
padding: 16px;
position: fixed;
z-index: 1;
left: 50%;
bottom: 30px;
transform: translateX(-50%);
}
#toast.show {
visibility: visible;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
@keyframes fadein {
from { bottom: 0; opacity: 0; }
to { bottom: 30px; opacity: 1; }
}
@keyframes fadeout {
from { bottom: 30px; opacity: 1; }
to { bottom: 0; opacity: 0; }
}
.logout-btn {
background: #d9534f;
}
.subtitle {
text-align: center;
margin-top: -10px;
margin-bottom: 20px;
font-style: italic;
}
.dashboard {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.stat-card {
background-color: #f9fafb;
border: 1px solid #d1d5db;
border-left: 6px solid #64748b;
border-radius: 8px;
padding: 20px 25px;
box-shadow: 0 2px 4px rgba(0,0,0,0.04);
transition: box-shadow 0.2s ease;
}
.stat-card:hover {
box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.stat-card .label {
font-size: 14px;
color: #4b5563;
margin-bottom: 8px;
}
.stat-card .value {
font-size: 24px;
font-weight: bold;
color: #111827;
}
/* Color indicators */
.stat-card.primary { border-left-color: #2563eb; }
.stat-card.warning { border-left-color: #eab308; }
.stat-card.muted { border-left-color: #6b7280; }
.stat-card.neutral { border-left-color: #0f172a; }
@keyframes gradientBG {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.main-content-layout {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.left-column {
flex: 1 1 320px;
min-width: 300px;
display: flex;
flex-direction: column;
gap: 20px;
}
.right-column {
flex: 2 1 600px;
min-width: 400px;
}
</style>
</head>
<body onkeydown="handleKey(event)">
<div class="container">
<div class="header">
<img src="https://i.imgur.com/n94eiEY.png" alt="NAMRIA Logo">
<div class="text">
<div>REPUBLIC OF THE PHILIPPINES</div>
<div>NATIONAL MAPPING AND RESOURCE INFORMATION AUTHORITY</div>
<div>Department of Environment and Natural Resources</div>
</div>
</div>
<h1 id="mainTitle" style="text-align:center">W.A.T.A.W.A.T. Prototype</h1>
<div id="mainSubtitle" class="subtitle">(Wireless Attendance Tracking Application for Weekly Assembly and Timekeeping)<br>NAMRIA RFID-Based Flag Ceremony Attendance System</div>
<!-- Login Page -->
<div id="adminLogin" class="login-wrapper">
<div class="login-box">
<h2>Admin Login</h2>
<input id="adminUser" type="text" placeholder="Username" />
<input id="adminPass" type="password" placeholder="Password" />
<button onclick="loginAdmin()">Login</button>
</div>
</div>
<!-- Main Panel -->
<div id="mainPanel" class="hidden">
<div style="text-align: right; margin-bottom: 10px;">
<button class="logout-btn" onclick="logoutAdmin()">Logout</button>
</div>
<div class="dashboard">
<div class="stat-card neutral">
<div class="label">Total Records</div>
<div class="value" id="countTotal">0</div>
</div>
<div class="stat-card primary">
<div class="label">Flag Raising</div>
<div class="value" id="countFlagRaising">0</div>
</div>
<div class="stat-card warning">
<div class="label">Flag Retreat</div>
<div class="value" id="countFlagRetreat">0</div>
</div>
<div class="stat-card muted">
<div class="label">Manual Entries</div>
<div class="value" id="countManual">0</div>
</div>
</div>
<div class="main-content-layout">
<div class="left-column">
<div class="section">
<h2>RFID Tap-In</h2>
<label for="rfid">Enter RFID Code:</label>
<input type="text" id="rfid" placeholder="e.g., 1001" />
<button onclick="simulateTap()">Tap In</button>
<div id="status" class="status"></div>
</div>
<div class="section">
<h2>Manual Override</h2>
<label for="manualId">Employee ID:</label>
<input type="text" id="manualId" />
<label for="manualName">Name:</label>
<input type="text" id="manualName" />
<button onclick="addManualEntry()">Add Record</button>
</div>
</div>
<div class="right-column">
<div class="section">
<h2>Admin Tools</h2>
<button onclick="toggleLogs()">Show/Hide Attendance Logs</button>
<button onclick="toggleEmployees()">Show/Hide Registered Employees</button>
<button onclick="exportCSV()">Export CSV</button>
</div>
<table id="logTable" class="log-table hidden">
<thead><tr><th>Timestamp</th><th>Employee ID</th><th>Employee Name</th><th>Ceremony</th></tr></thead>
<tbody id="logBody"></tbody>
</table>
<table id="employeeTable" class="log-table hidden">
<thead><tr><th>RFID Code</th><th>Employee Name</th></tr></thead>
<tbody id="employeeBody"></tbody>
</table>
</div>
</div>
</div>
<div id="toast"></div>
</div>
<script>
const originalHeaderHTML = `
<div>REPUBLIC OF THE PHILIPPINES</div>
<div>NATIONAL MAPPING AND RESOURCE INFORMATION AUTHORITY</div>
<div>Department of Environment and Natural Resources</div>
`;
const dummyEmployees = {
'1001': 'Juan Dela Cruz', '1002': 'Maria Santos', '1003': 'Jose Rizal',
'1004': 'Ana Villanueva', '1005': 'Carlos Reyes', '1006': 'Luis Manzano',
'1007': 'Melanie Cruz', '1008': 'Brian Torres', '1009': 'Isabel Mendoza', '1010': 'Ramon Garcia'
};
const logs = [];
function showToast(message, success = false) {
const toast = document.getElementById("toast");
toast.textContent = message;
toast.style.backgroundColor = success ? '#28a745' : '#dc3545';
// Reset animation
toast.classList.remove("show");
void toast.offsetWidth; // Reflow to force restart animation
toast.classList.add("show");
// Auto-hide after animation ends
setTimeout(() => {
toast.classList.remove("show");
}, 3000); // Match total duration: 2.5s delay + 0.5s fadeout
}
function loginAdmin() {
const usernameInput = document.getElementById('adminUser').value;
const passwordInput = document.getElementById('adminPass').value;
if (usernameInput === 'admin' && passwordInput === 'admin123') {
document.getElementById('adminLogin').classList.add('hidden');
document.getElementById('mainPanel').classList.remove('hidden');
document.getElementById('logTable').classList.remove('hidden');
updateDashboard();
// Update header text after login
const headerText = document.querySelector('.header .text');
if (headerText) {
headerText.innerHTML = `
<div style="font-size: 22px; font-weight: 700;">W.A.T.A.W.A.T. Prototype</div>
<div>Wireless Attendance Tracking Application for Weekly Assembly and Timekeeping</div>
<div>National Mapping and Resource Information Authority</div>
`;
}
document.querySelector('.header').classList.add('logged-in');
// Hide the main title and subtitle
document.getElementById('mainTitle').style.display = 'none';
document.getElementById('mainSubtitle').style.display = 'none';
showToast('✅ Login successful', true);
} else {
showToast('❌ Invalid username or password');
}
}
function logoutAdmin() {
document.getElementById('mainPanel').classList.add('hidden');
// Restore header to original version
const headerText = document.querySelector('.header .text');
if (headerText) {
headerText.innerHTML = originalHeaderHTML;
}
document.querySelector('.header').classList.remove('logged-in');
// Show the main title and subtitle again
document.getElementById('mainTitle').style.display = 'block';
document.getElementById('mainSubtitle').style.display = 'block';
document.getElementById('adminLogin').classList.remove('hidden');
}
function getCeremonyType() {
return 'Flag Raising';
}
function simulateTap() {
const rfid = document.getElementById('rfid').value.trim();
const name = dummyEmployees[rfid];
const now = new Date();
const today = now.toLocaleDateString();
const time = now.toLocaleString();
const ceremony = getCeremonyType();
const status = document.getElementById('status');
if (!name) {
status.innerText = 'Unrecognized RFID Code';
status.className = 'status error';
showToast('Unrecognized RFID Code');
return;
}
const duplicate = logs.find(log => log.employeeId === rfid && log.date === today && log.ceremony === ceremony);
if (duplicate) {
status.innerText = 'Duplicate entry';
status.className = 'status error';
showToast('Duplicate entry');
return;
}
logs.push({ time, employeeId: rfid, employeeName: name, ceremony, date: today });
updateLogs();
updateDashboard();
status.innerText = `Success: ${name} - ${ceremony}`;
status.className = 'status success';
showToast(`Success: ${name}`, true);
document.getElementById('rfid').value = '';
}
function handleKey(e) {
const active = document.activeElement;
if (e.key === 'Enter') {
if (!document.getElementById('mainPanel').classList.contains('hidden')) {
if (active.id === 'rfid') simulateTap();
if (active.id === 'manualName') addManualEntry();
} else {
loginAdmin();
}
}
}
function updateLogs() {
const tbody = document.getElementById('logBody');
tbody.innerHTML = logs.map(log => `<tr><td>${log.time}</td><td>${log.employeeId}</td><td>${log.employeeName}</td><td>${log.ceremony}</td></tr>`).join('');
}
function exportCSV() {
const csv = 'Timestamp,Employee ID,Employee Name,Ceremony\n' + logs.map(l => `"${l.time}",${l.employeeId},${l.employeeName},${l.ceremony}`).join('\n');
const blob = new Blob([csv], { type: 'text/csv' });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'WATAWAT_Attendance_' + new Date().toISOString().slice(0,10) + '.csv';
a.click();
}
function toggleLogs() {
document.getElementById('logTable').classList.toggle('hidden');
}
function toggleEmployees() {
const table = document.getElementById('employeeTable');
const tbody = document.getElementById('employeeBody');
table.classList.toggle('hidden');
tbody.innerHTML = Object.entries(dummyEmployees).map(([id, name]) => `<tr><td>${id}</td><td>${name}</td></tr>`).join('');
}
function resetManualEntryForm() {
document.getElementById('manualId').value = '';
document.getElementById('manualName').value = '';
}
function addManualEntry() {
const id = document.getElementById('manualId').value.trim();
const name = document.getElementById('manualName').value.trim();
if (!id || !name) return alert('Please fill out both fields.');
const now = new Date();
logs.push({ time: now.toLocaleString(), employeeId: id, employeeName: name, ceremony: 'Manual Entry', date: now.toLocaleDateString() });
updateLogs();
updateDashboard();
alert('Manual entry added successfully.');
resetManualEntryForm();
}
function updateDashboard() {
document.getElementById('countTotal').innerText = logs.length;
document.getElementById('countFlagRaising').innerText = logs.filter(l => l.ceremony === 'Flag Raising').length;
document.getElementById('countFlagRetreat').innerText = logs.filter(l => l.ceremony === 'Flag Retreat').length;
document.getElementById('countManual').innerText = logs.filter(l => l.ceremony === 'Manual Entry').length;
}
</script>
</body>
</html>