-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
494 lines (444 loc) · 22.2 KB
/
Copy pathindex.html
File metadata and controls
494 lines (444 loc) · 22.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>ACRA Sign-In Sheet</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--green: #3a6b4a; --green-light: #e8f0ea; --green-mid: #b8d1bc;
--amber: #c9783a; --cream: #faf8f4; --ink: #1e2820;
--muted: #6b7b6e; --border: #ccd9ce; --row-alt: #f2f6f3;
--red: #c0392b; --red-light: #fde8e8; --red-mid: #f5c6c6;
}
body { font-family: -apple-system, 'Helvetica Neue', sans-serif; background: var(--cream); color: var(--ink); min-height: 100vh; padding-bottom: 60px; }
header { background: var(--green); color: white; padding: 16px 16px 0; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.header-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
header h1 { font-size: 20px; font-weight: 700; }
header p { font-size: 12px; opacity: .8; margin-top: 2px; }
.date-badge { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 600; cursor: pointer; color: white; white-space: nowrap; }
.tabs { display: flex; gap: 4px; padding-left: 4px; }
.tab { padding: 8px 14px; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.55); cursor: pointer; border-bottom: 3px solid transparent; transition: color .15s; -webkit-tap-highlight-color: transparent; }
.tab.active { color: white; border-bottom-color: white; }
.stats { display: flex; background: var(--green-light); border-bottom: 1px solid var(--border); }
.stat { flex: 1; text-align: center; padding: 8px 4px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-num { font-size: 20px; font-weight: 700; color: var(--green); line-height: 1; }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-top: 2px; }
.controls { display: flex; gap: 6px; padding: 10px 12px; background: white; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.btn { display: flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; transition: opacity .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { opacity: .7; }
.btn-primary { background: var(--green); color: white; }
.btn-secondary { background: var(--green-light); color: var(--green); border: 1px solid var(--green-mid); }
.btn-danger { background: var(--red-light); color: var(--red); border: 1px solid var(--red-mid); }
.btn-amber { background: #fef3e8; color: var(--amber); border: 1px solid #f5d9bb; }
.add-row-form { display: none; background: white; border-top: 2px solid var(--green); padding: 12px 14px; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.add-row-form.open { display: flex; }
.form-field { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 120px; }
.form-field label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.form-field input { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 15px; font-family: inherit; outline: none; background: var(--cream); color: var(--ink); }
.form-field input:focus { border-color: var(--green); background: white; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 560px; border-collapse: collapse; }
thead th { background: var(--green); color: white; padding: 8px 10px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; white-space: nowrap; }
thead th:first-child { width: 50px; text-align: center; }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr.in { background: #e6f4ea !important; }
tbody tr.out { background: #fef0e6 !important; }
tbody td { padding: 9px 10px; font-size: 14px; vertical-align: middle; }
tbody td.check-cell { text-align: center; font-size: 22px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; min-width: 50px; }
.name-cell { font-weight: 500; }
.time-cell { font-size: 12px; white-space: nowrap; }
.time-in { color: var(--green); font-weight: 600; }
.time-out { color: var(--red); font-weight: 600; }
.time-dash { color: var(--muted); }
.note-input { width: 100%; border: none; background: transparent; font-size: 12px; color: var(--muted); font-family: inherit; outline: none; padding: 2px 0; }
.note-input:focus { border-bottom: 1px solid var(--green-mid); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .emoji { font-size: 36px; display: block; margin-bottom: 10px; }
.footer-note { text-align: center; padding: 14px; font-size: 11px; color: var(--muted); line-height: 1.6; }
/* Legend */
.legend { display: flex; gap: 12px; padding: 8px 14px; background: white; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
/* History */
#historyPane { display: none; }
#historyPane.active { display: block; }
#todayPane.hidden { display: none; }
.history-day { border-bottom: 1px solid var(--border); background: white; }
.history-day-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; gap: 8px; }
.history-day-header:active { background: var(--green-light); }
.history-day-title { font-weight: 700; font-size: 14px; }
.history-day-meta { font-size: 12px; color: var(--muted); }
.history-day-badge { background: var(--green); color: white; border-radius: 20px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.history-day-body { display: none; padding: 0 14px 12px; }
.history-day-body.open { display: block; }
.history-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.history-table th { background: var(--green-light); color: var(--green); padding: 5px 8px; text-align: left; font-size: 11px; text-transform: uppercase; }
.history-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.history-table tr.present { background: #f0faf2; }
.history-table tr.absent td { color: #bbb; }
.history-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
/* Modals */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: 16px; padding: 22px; width: 90%; max-width: 340px; box-shadow: 0 8px 40px rgba(0,0,0,.25); }
.modal h2 { font-size: 17px; margin-bottom: 12px; color: var(--ink); font-weight: 700; }
.modal p { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.modal input[type="date"] { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 16px; font-family: inherit; margin-bottom: 14px; }
.modal-btns { display: flex; gap: 8px; }
.modal-btns .btn { flex: 1; justify-content: center; }
@media print {
header { position: static; background: white !important; color: black !important; }
.tabs, .controls, .add-row-form, .footer-note, .legend, td:last-child, th:last-child { display: none !important; }
.stats { background: white; } .stat-num { color: black; }
table { min-width: unset; } body { background: white; }
#historyPane { display: none !important; }
}
</style>
</head>
<body>
<header>
<div class="header-top">
<div><h1>ACRA Sign-In</h1><p>Summer Program · 9:00 AM – 1:00 PM</p></div>
<button class="date-badge" onclick="openDateModal()" id="dateDisplay">Loading…</button>
</div>
<div class="tabs">
<div class="tab active" id="tabToday" onclick="switchTab('today')">Today</div>
<div class="tab" id="tabHistory" onclick="switchTab('history')">History</div>
</div>
</header>
<div id="todayPane">
<div class="stats">
<div class="stat"><div class="stat-num" id="statTotal">0</div><div class="stat-label">Enrolled</div></div>
<div class="stat"><div class="stat-num" id="statIn">0</div><div class="stat-label">In</div></div>
<div class="stat"><div class="stat-num" id="statOut">0</div><div class="stat-label">Out</div></div>
<div class="stat"><div class="stat-num" id="statAbsent">0</div><div class="stat-label">Absent</div></div>
</div>
<div class="legend">
<div class="legend-item">⬜ Not here</div>
<div class="legend-item">✅ Checked in</div>
<div class="legend-item">🔴 Checked out</div>
<div class="legend-item">(tap again to clear)</div>
</div>
<div class="controls">
<button class="btn btn-primary" onclick="toggleAddForm()">+ Add</button>
<button class="btn btn-secondary" onclick="checkInAll()">✅ All In</button>
<button class="btn btn-amber" onclick="openCloseDay()">📁 Save & Close Day</button>
<button class="btn btn-secondary" onclick="window.print()">⎙ Print</button>
<button class="btn btn-danger" onclick="clearRoster()">🗑 Roster</button>
</div>
<div class="add-row-form" id="addForm">
<div class="form-field">
<label>First Name</label>
<input type="text" id="newFirst" placeholder="Jordan" autocomplete="off">
</div>
<div class="form-field">
<label>Last Name</label>
<input type="text" id="newLast" placeholder="Smith" autocomplete="off">
</div>
<div class="form-field" style="flex:0;min-width:80px">
<label>Age/Gr</label>
<input type="text" id="newAge" placeholder="8" autocomplete="off">
</div>
<button class="btn btn-primary" onclick="addParticipant()" style="align-self:flex-end">Add</button>
<button class="btn btn-secondary" onclick="toggleAddForm()" style="align-self:flex-end">Cancel</button>
</div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th style="text-align:center">Status</th>
<th>Name</th>
<th>Age</th>
<th>Time In</th>
<th>Time Out</th>
<th>Notes</th>
<th></th>
</tr>
</thead>
<tbody id="rosterBody"></tbody>
</table>
<div class="empty" id="emptyState" style="display:none">
<span class="emoji">📋</span>
<p>No participants yet.<br>Tap <strong>+ Add</strong> to build your roster.</p>
</div>
</div>
<div class="footer-note">Tap once = Check In · Tap twice = Check Out · Tap three times = Clear<br>Tap <strong>Save & Close Day</strong> at end of session to log attendance</div>
</div>
<div id="historyPane">
<div class="controls">
<button class="btn btn-secondary" onclick="exportCSV()">⬇ Export CSV</button>
<button class="btn btn-danger" onclick="clearHistory()">🗑 Clear History</button>
</div>
<div id="historyList"></div>
</div>
<!-- Date Modal -->
<div class="modal-overlay" id="dateModal">
<div class="modal">
<h2>Set Session Date</h2>
<input type="date" id="dateInput">
<div class="modal-btns">
<button class="btn btn-secondary" onclick="closeDateModal()">Cancel</button>
<button class="btn btn-primary" onclick="saveDate()">Set Date</button>
</div>
</div>
</div>
<!-- Close Day Modal -->
<div class="modal-overlay" id="closeDayModal">
<div class="modal">
<h2>📁 Save & Close Day</h2>
<p id="closeDaySummary"></p>
<div class="modal-btns">
<button class="btn btn-secondary" onclick="document.getElementById('closeDayModal').classList.remove('open')">Cancel</button>
<button class="btn btn-primary" onclick="confirmCloseDay()">Save to History</button>
</div>
</div>
</div>
<script>
let roster = [];
let history = [];
let sessionDate = new Date().toISOString().slice(0,10);
// Status cycle: 0=absent, 1=in, 2=out
const STATUS = { ABSENT: 0, IN: 1, OUT: 2 };
function load() {
try {
const r = localStorage.getItem('acra_roster'); if (r) roster = JSON.parse(r);
const h = localStorage.getItem('acra_history'); if (h) history = JSON.parse(h);
const d = localStorage.getItem('acra_date'); if (d) sessionDate = d;
} catch(e) {}
// Migrate old format (checkedIn boolean → status number)
roster.forEach(p => {
if (p.status === undefined) {
if (p.checkedIn) { p.status = STATUS.IN; }
else { p.status = STATUS.ABSENT; p.timeIn = null; p.timeOut = null; }
delete p.checkedIn;
}
});
renderDate(); render(); renderHistory();
}
function save() {
try {
localStorage.setItem('acra_roster', JSON.stringify(roster));
localStorage.setItem('acra_history', JSON.stringify(history));
localStorage.setItem('acra_date', sessionDate);
} catch(e) {}
}
function switchTab(tab) {
document.getElementById('tabToday').classList.toggle('active', tab === 'today');
document.getElementById('tabHistory').classList.toggle('active', tab === 'history');
document.getElementById('todayPane').classList.toggle('hidden', tab !== 'today');
document.getElementById('historyPane').classList.toggle('active', tab === 'history');
}
function fmtDate(iso) {
const d = new Date(iso + 'T12:00:00');
return d.toLocaleDateString('en-US', {weekday:'short', month:'short', day:'numeric'});
}
function fmtDateLong(iso) {
const d = new Date(iso + 'T12:00:00');
return d.toLocaleDateString('en-US', {weekday:'long', month:'long', day:'numeric'});
}
function fmtTime() {
return new Date().toLocaleTimeString('en-US', {hour:'numeric', minute:'2-digit'});
}
function nextWeekday(iso) {
const d = new Date(iso + 'T12:00:00');
do { d.setDate(d.getDate() + 1); } while (d.getDay() === 0 || d.getDay() === 6);
return d.toISOString().slice(0,10);
}
function renderDate() {
document.getElementById('dateDisplay').textContent = fmtDate(sessionDate);
}
function openDateModal() {
document.getElementById('dateInput').value = sessionDate;
document.getElementById('dateModal').classList.add('open');
}
function closeDateModal() { document.getElementById('dateModal').classList.remove('open'); }
function saveDate() {
const v = document.getElementById('dateInput').value;
if (v) { sessionDate = v; save(); renderDate(); }
closeDateModal();
}
function addParticipant() {
const first = document.getElementById('newFirst').value.trim();
const last = document.getElementById('newLast').value.trim();
const age = document.getElementById('newAge').value.trim();
if (!first && !last) return;
roster.push({ id: Date.now(), first, last, age, status: STATUS.ABSENT, timeIn: null, timeOut: null, note: '' });
roster.sort((a,b) => (a.last+a.first).localeCompare(b.last+b.first));
save(); render();
document.getElementById('newFirst').value = '';
document.getElementById('newLast').value = '';
document.getElementById('newAge').value = '';
document.getElementById('newFirst').focus();
}
function cycleStatus(id) {
const p = roster.find(r => r.id === id);
if (!p) return;
if (p.status === STATUS.ABSENT) {
p.status = STATUS.IN; p.timeIn = fmtTime(); p.timeOut = null;
} else if (p.status === STATUS.IN) {
p.status = STATUS.OUT; p.timeOut = fmtTime();
} else {
p.status = STATUS.ABSENT; p.timeIn = null; p.timeOut = null;
}
save(); render();
}
function updateNote(id, val) {
const p = roster.find(r => r.id === id);
if (p) { p.note = val; save(); }
}
function removeParticipant(id) {
if (!confirm('Remove this participant?')) return;
roster = roster.filter(r => r.id !== id);
save(); render();
}
function checkInAll() {
const t = fmtTime();
roster.forEach(p => { if (p.status === STATUS.ABSENT) { p.status = STATUS.IN; p.timeIn = t; } });
save(); render();
}
function clearRoster() {
if (!confirm('Delete the entire roster? History is kept separately.')) return;
roster = []; save(); render();
}
function statusEmoji(s) {
if (s === STATUS.IN) return '✅';
if (s === STATUS.OUT) return '🔴';
return '⬜';
}
function render() {
const body = document.getElementById('rosterBody');
const empty = document.getElementById('emptyState');
const total = roster.length;
const inCount = roster.filter(p => p.status === STATUS.IN).length;
const outCount= roster.filter(p => p.status === STATUS.OUT).length;
const absent = roster.filter(p => p.status === STATUS.ABSENT).length;
document.getElementById('statTotal').textContent = total;
document.getElementById('statIn').textContent = inCount;
document.getElementById('statOut').textContent = outCount;
document.getElementById('statAbsent').textContent = absent;
if (total === 0) { body.innerHTML = ''; empty.style.display = 'block'; return; }
empty.style.display = 'none';
body.innerHTML = roster.map(p => {
const rowClass = p.status === STATUS.IN ? 'in' : p.status === STATUS.OUT ? 'out' : '';
return `<tr class="${rowClass}">
<td class="check-cell" onclick="cycleStatus(${p.id})">${statusEmoji(p.status)}</td>
<td class="name-cell">${p.last ? escHtml(p.last) + ', ' + escHtml(p.first) : escHtml(p.first)}</td>
<td style="font-size:12px;color:var(--muted)">${p.age || '—'}</td>
<td class="time-cell ${p.timeIn ? 'time-in' : 'time-dash'}">${p.timeIn || '—'}</td>
<td class="time-cell ${p.timeOut ? 'time-out' : 'time-dash'}">${p.timeOut || '—'}</td>
<td><input class="note-input" placeholder="note…" value="${escHtml(p.note)}" onchange="updateNote(${p.id}, this.value)"></td>
<td><button onclick="removeParticipant(${p.id})" style="background:none;border:none;color:var(--red);font-size:15px;cursor:pointer;padding:2px 6px">✕</button></td>
</tr>`;
}).join('');
}
function openCloseDay() {
const inCount = roster.filter(p => p.status === STATUS.IN || p.status === STATUS.OUT).length;
document.getElementById('closeDaySummary').textContent =
`Save attendance for ${fmtDateLong(sessionDate)}? ${inCount} of ${roster.length} participants were present. Check-ins will reset for tomorrow.`;
document.getElementById('closeDayModal').classList.add('open');
}
function confirmCloseDay() {
const entry = {
date: sessionDate,
entries: roster.map(p => ({
name: p.last ? p.last + ', ' + p.first : p.first,
age: p.age,
status: p.status,
timeIn: p.timeIn,
timeOut: p.timeOut,
note: p.note
}))
};
const idx = history.findIndex(h => h.date === sessionDate);
if (idx >= 0) history[idx] = entry; else history.unshift(entry);
roster.forEach(p => { p.status = STATUS.ABSENT; p.timeIn = null; p.timeOut = null; p.note = ''; });
sessionDate = nextWeekday(sessionDate);
save(); render(); renderDate(); renderHistory();
document.getElementById('closeDayModal').classList.remove('open');
document.getElementById('dateDisplay').textContent = '✅ Saved!';
setTimeout(renderDate, 1800);
}
function renderHistory() {
const list = document.getElementById('historyList');
if (!list) return;
if (history.length === 0) {
list.innerHTML = '<div class="history-empty">📅 No sessions saved yet.<br><br>Use <strong>Save & Close Day</strong> at end of each session.</div>';
return;
}
list.innerHTML = history.map((day, idx) => {
const present = day.entries.filter(e => e.status === STATUS.IN || e.status === STATUS.OUT).length;
const total = day.entries.length;
const rows = day.entries.map(e => {
const isPresent = e.status === STATUS.IN || e.status === STATUS.OUT;
const statusLabel = e.status === STATUS.IN ? '✅ In' : e.status === STATUS.OUT ? '🔴 Out' : '⬜ Absent';
return `<tr class="${isPresent ? 'present' : 'absent'}">
<td>${escHtml(e.name)}</td>
<td>${statusLabel}</td>
<td>${e.timeIn || '—'}</td>
<td>${e.timeOut || '—'}</td>
<td>${escHtml(e.note||'')}</td>
</tr>`;
}).join('');
return `<div class="history-day">
<div class="history-day-header" onclick="toggleDay(${idx})">
<div>
<div class="history-day-title">${fmtDateLong(day.date)}</div>
<div class="history-day-meta">${present} present · ${total-present} absent</div>
</div>
<span class="history-day-badge">${present}/${total}</span>
</div>
<div class="history-day-body" id="hday-${idx}">
<table class="history-table">
<thead><tr><th>Name</th><th>Status</th><th>Time In</th><th>Time Out</th><th>Notes</th></tr></thead>
<tbody>${rows}</tbody>
</table>
<div style="margin-top:10px;display:flex;gap:8px">
<button class="btn btn-danger" style="font-size:12px;padding:5px 10px" onclick="deleteDay('${day.date}')">✕ Delete</button>
</div>
</div>
</div>`;
}).join('');
}
function toggleDay(idx) {
document.getElementById('hday-' + idx).classList.toggle('open');
}
function deleteDay(date) {
if (!confirm('Delete this day from history?')) return;
history = history.filter(h => h.date !== date);
save(); renderHistory();
}
function clearHistory() {
if (!confirm('Clear ALL history? Cannot be undone.')) return;
history = []; save(); renderHistory();
}
function exportCSV() {
const rows = [['Date','Name','Age','Status','Time In','Time Out','Notes']];
history.forEach(day => {
day.entries.forEach(e => {
const statusLabel = e.status === STATUS.IN ? 'In' : e.status === STATUS.OUT ? 'Out' : 'Absent';
rows.push([day.date, e.name, e.age||'', statusLabel, e.timeIn||'', e.timeOut||'', e.note||'']);
});
});
const csv = rows.map(r => r.map(v => '"' + String(v).replace(/"/g,'""') + '"').join(',')).join('\n');
const a = document.createElement('a');
a.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv);
a.download = 'acra-attendance.csv'; a.click();
}
function escHtml(s) {
return (s||'').replace(/&/g,'&').replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>');
}
function toggleAddForm() {
document.getElementById('addForm').classList.toggle('open');
if (document.getElementById('addForm').classList.contains('open'))
setTimeout(() => document.getElementById('newFirst').focus(), 50);
}
document.addEventListener('keydown', e => {
if (e.key === 'Enter' && document.getElementById('addForm').classList.contains('open')) addParticipant();
});
load();
</script>
</body>
</html>