-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearner-style.html
More file actions
694 lines (692 loc) · 30 KB
/
learner-style.html
File metadata and controls
694 lines (692 loc) · 30 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
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Learner Profile & Analytics</title>
<style>
:root {
--primary-bg: #181c25;
--primary-blue: #90caf9;
--primary-blue-light: #42a5f5;
--primary-white: #232834;
--accent-red: #ff5252;
--accent-red-dark: #b71c1c;
--nav-link-hover: #26324a;
--card-shadow: 0 2px 8px #0007;
--text-color: #f1f1f1;
--label-color: #64b5f6;
--table-header-bg: #232c3b;
--table-header-color: #90caf9;
--error-color: #ff5252;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: var(--primary-bg);
min-height: 100vh;
color: var(--text-color);
}
nav {
background: var(--primary-white);
color: var(--primary-blue);
padding: 1em 2em;
margin: 0;
display: flex;
align-items: center;
font-size: 1.1em;
box-shadow: 0 2px 4px #000a;
}
nav a {
color: var(--primary-blue);
margin-right: 2em;
text-decoration: none;
font-weight: bold;
letter-spacing: 0.03em;
transition: color 0.2s;
}
nav a:hover {
color: var(--nav-link-hover);
}
.top-actions {
display: flex;
gap: 0.8em;
justify-content: flex-end;
align-items: center;
background: var(--primary-bg);
padding: 1.5em 2em 0.5em 2em;
border-bottom: 1px solid #232c3b;
}
.top-actions button,
.top-actions .logout-btn {
padding: 0.6em 1.2em;
font-size: 1em;
border: none;
border-radius: 5px;
background: var(--primary-blue);
color: #181c25;
cursor: pointer;
text-decoration: none;
font-weight: bold;
transition: background 0.2s;
box-shadow: 0 1px 3px #0007;
}
.top-actions button:hover,
.top-actions .logout-btn:hover {
background: var(--primary-blue-light);
color: #fff;
}
.top-actions .logout-btn {
background: var(--accent-red);
color: #fff;
}
.top-actions .logout-btn:hover {
background: var(--accent-red-dark);
}
h1 {
color: var(--primary-blue);
margin-left: 2em;
margin-bottom: 1em;
margin-top: 1em;
font-size: 2em;
letter-spacing: 0.01em;
}
.grid-container {
display: grid;
grid-template-columns: 250px 1.2fr 1.2fr;
gap: 2em;
margin: 0 2em 2em 2em;
align-items: start;
}
.radio-list,
.profile-card,
.analytics-card {
background: var(--primary-white);
border-radius: 8px;
box-shadow: var(--card-shadow);
color: var(--text-color);
}
.radio-list {
padding: 1.2em 1em;
height: fit-content;
}
.radio-list .label {
display: block;
margin-bottom: 0.6em;
font-weight: bold;
font-size: 1.08em;
color: var(--label-color);
}
.radio-list label {
display: block;
margin-bottom: 0.5em;
font-weight: normal;
cursor: pointer;
}
.profile-card {
max-width: 520px;
width: 100%;
padding: 1.5em;
position: relative;
}
.analytics-card {
padding: 1.5em;
min-width: 300px;
}
.analytics-filter {
margin-bottom: 1em;
}
.support-radio-group {
margin: 1em 0 1.5em 0;
padding: 1em;
background: #202637;
border-radius: 6px;
border: 1px solid #2a314a;
}
.support-radio-group label {
display: block;
margin-bottom: 0.45em;
font-weight: normal;
}
.support-radio-group .label {
margin-bottom: 0.7em;
font-weight: bold;
display: block;
color: var(--label-color);
}
.support-radio-group input[type="text"] {
display: block;
margin-top: 0.4em;
width: 98%;
padding: 0.3em 0.6em;
border-radius: 4px;
border: 1px solid #444;
font-size: 1em;
background: #181c25;
color: var(--text-color);
}
.assessment-options, .below-options {
margin: 1em 0 1.5em 0;
padding: 1em;
background: #222c21;
border-radius: 6px;
border: 1px solid #314c32;
}
.assessment-options .label, .below-options .label {
margin-bottom: 0.7em;
font-weight: bold;
display: block;
color: var(--label-color);
}
.assessment-options label, .below-options label {
display: block;
margin-bottom: 0.45em;
font-weight: normal;
}
.assessment-options input[type="checkbox"], .below-options input[type="checkbox"] {
margin-right: 0.5em;
}
@media (max-width: 1200px) {
.grid-container { grid-template-columns: 1fr; }
.profile-card, .analytics-card { max-width: 100%; }
.radio-list { width: 100%; }
.top-actions { flex-direction: column; align-items: flex-end; }
h1, .grid-container { margin-left: 1em; margin-right: 1em; }
}
.label { font-weight: bold; color: var(--label-color); }
.marks-table { width: 100%; margin-bottom: 1em; border-collapse: collapse; }
.marks-table th, .marks-table td { border: 1px solid #333; padding: 0.5em; text-align: center; }
.marks-table th { background: var(--table-header-bg); color: var(--table-header-color); }
.grade-group, .style-group { margin: 1em 0; }
.style-group label { margin-right: 1em; }
.error { color: var(--error-color); font-size: 0.95em; }
.info-list { margin: 0 0 1em 0; }
.info-list li { margin-bottom: 0.3em; }
.selected-style { font-weight: bold; color: var(--primary-blue-light); }
select, option {
background: #181c25;
color: var(--text-color);
border: 1px solid #444;
border-radius: 4px;
padding: 0.2em 0.5em;
}
input[type="checkbox"], input[type="radio"] {
accent-color: var(--primary-blue-light);
}
</style>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<nav>
<a href="dashboard.html">Dashboard</a>
<a href="learner-style.html">Learner Profile</a>
<a href="learnerdecisiontree.html">Decision Tree</a>
</nav>
<div class="top-actions">
<button onclick="saveProfile(getSelectedLearnerIndex())">Save Profile</button>
<button onclick="printProfile()">Print</button>
<button onclick="exportProfile()">Export (JSON)</button>
<button onclick="exportProfileCSV()">Export (CSV)</button>
<a href="logout.html" class="logout-btn">Log Out</a>
</div>
<h1>Learner Profile & Analytics</h1>
<div class="grid-container">
<div id="learnerRadioGroup" class="radio-list"></div>
<div id="profile"></div>
<div class="analytics-card">
<div class="analytics-filter">
<label for="analyticsType"><b>Analytics Type:</b></label>
<select id="analyticsType">
<option value="average">Average Marks per Learner</option>
<option value="styles">Learning Styles Distribution</option>
<option value="gender">Gender Distribution</option>
</select>
</div>
<canvas id="analyticsChart" height="320"></canvas>
</div>
</div>
<script>
// --- Learners dataset ---
const learners = [
{ name: "Lerato Mahlangu", gender: "Female", languages: ["isiZulu", "English"], class: "Grade 9C", assessments: { classTest: 72, presentation: 85, project: 78, test1: 65, test2: 54, exam: 90 } },
{ name: "Sipho Nkosi", gender: "Male", languages: ["isiZulu", "English"], class: "Grade 9C", assessments: { classTest: 88, presentation: 79, project: 60, test1: 91, test2: 77, exam: 40 } },
{ name: "Megan Petersen", gender: "Female", languages: ["Afrikaans", "English"], class: "Grade 9C", assessments: { classTest: 62, presentation: 74, project: 67, test1: 60, test2: 69, exam: 79 } },
{ name: "Riyaad Davids", gender: "Male", languages: ["Afrikaans", "English"], class: "Grade 9C", assessments: { classTest: 77, presentation: 73, project: 75, test1: 79, test2: 80, exam: 83 } },
{ name: "Ayesha Patel", gender: "Female", languages: ["English"], class: "Grade 9C", assessments: { classTest: 91, presentation: 90, project: 88, test1: 89, test2: 93, exam: 94 } },
{ name: "Thabo Mokoena", gender: "Male", languages: ["Sesotho", "English"], class: "Grade 9C", assessments: { classTest: 55, presentation: 63, project: 57, test1: 51, test2: 60, exam: 65 } },
{ name: "Jade Smith", gender: "Female", languages: ["English", "Afrikaans"], class: "Grade 9C", assessments: { classTest: 83, presentation: 86, project: 92, test1: 87, test2: 85, exam: 88 } },
{ name: "Nomvula Khumalo", gender: "Female", languages: ["isiZulu"], class: "Grade 9C", assessments: { classTest: 81, presentation: 89, project: 84, test1: 79, test2: 86, exam: 92 } },
{ name: "Anneline Fortuin", gender: "Female", languages: ["Afrikaans", "English"], class: "Grade 9C", assessments: { classTest: 47, presentation: 53, project: 49, test1: 45, test2: 58, exam: 61 } },
{ name: "Priya Naidoo", gender: "Female", languages: ["English"], class: "Grade 9C", assessments: { classTest: 76, presentation: 80, project: 83, test1: 71, test2: 74, exam: 81 } },
{ name: "Cameron van der Merwe", gender: "Male", languages: ["Afrikaans", "English"], class: "Grade 9C", assessments: { classTest: 68, presentation: 50, project: 92, test1: 70, test2: 49, exam: 81 } },
{ name: "Tshepo Dube", gender: "Male", languages: ["isiZulu", "English"], class: "Grade 9C", assessments: { classTest: 58, presentation: 60, project: 62, test1: 57, test2: 59, exam: 63 } },
{ name: "Naledi Phiri", gender: "Female", languages: ["Xhosa", "English"], class: "Grade 9C", assessments: { classTest: 85, presentation: 88, project: 86, test1: 82, test2: 87, exam: 91 } },
{ name: "Kaylin Daniels", gender: "Female", languages: ["Afrikaans", "English"], class: "Grade 9C", assessments: { classTest: 74, presentation: 77, project: 72, test1: 46, test2: 79, exam: 70 } },
{ name: "Simphiwe Molefe", gender: "Male", languages: ["isiZulu"], class: "Grade 9C", assessments: { classTest: 61, presentation: 51, project: 67, test1: 63, test2: 69, exam: 41 } },
{ name: "Xolani Mabuza", gender: "Male", languages: ["isiZulu", "English"], class: "Grade 9C", assessments: { classTest: 53, presentation: 57, project: 60, test1: 55, test2: 89, exam: 64 } },
{ name: "Chantelle Botha", gender: "Female", languages: ["Afrikaans", "English"], class: "Grade 9C", assessments: { classTest: 86, presentation: 90, project: 91, test1: 88, test2: 92, exam: 96 } },
{ name: "Yusuf Ismail", gender: "Male", languages: ["English"], class: "Grade 9C", assessments: { classTest: 75, presentation: 78, project: 74, test1: 77, test2: 80, exam: 82 } },
{ name: "Karabo Motsoeneng", gender: "Male", languages: ["Sesotho", "English"], class: "Grade 9C", assessments: { classTest: 68, presentation: 70, project: 55, test1: 66, test2: 73, exam: 74 } },
{ name: "Johan du Plessis", gender: "Male", languages: ["Afrikaans", "English"], class: "Grade 9C", assessments: { classTest: 59, presentation: 61, project: 60, test1: 58, test2: 66, exam: 67 } }
];
function getLearnerStorageKey(idx) {
return "learnerProfile_" + idx;
}
function saveProfile(idx) {
const support = [];
document.querySelectorAll('.support-checkbox').forEach(cb => {
if (cb.checked) support.push(cb.value);
});
const supportOther = document.getElementById('supportOtherBox')?.value || "";
const gradeLevel = document.getElementById('gradeLevel').value;
const styles = [];
document.querySelectorAll('.style-checkbox').forEach(cb => {
if (cb.checked) styles.push(cb.value);
});
const assessment = [];
document.querySelectorAll('.assessment-checkbox').forEach(cb => {
if (cb.checked) assessment.push(cb.value);
});
const below = [];
document.querySelectorAll('.below-checkbox').forEach(cb => {
if (cb.checked) below.push(cb.value);
});
const data = { support, supportOther, gradeLevel, styles, assessment, below };
localStorage.setItem(getLearnerStorageKey(idx), JSON.stringify(data));
}
function loadProfile(idx) {
const raw = localStorage.getItem(getLearnerStorageKey(idx));
return raw ? JSON.parse(raw) : {};
}
function getAverage(a) {
return Math.round(
(a.classTest + a.presentation + a.project + a.test1 + a.test2 + a.exam) / 6
);
}
function getSystemStyle(avg) {
if (avg >= 80) return "Visual";
if (avg >= 60) return "Auditory";
return "Kinesthetic";
}
function populateLearnerRadios() {
const group = document.getElementById('learnerRadioGroup');
group.innerHTML = '<span class="label">Select Learner:</span>';
learners.forEach((learner, i) => {
group.innerHTML += `
<label>
<input type="radio" name="learnerRadio" value="${i}" ${i===0?"checked":""}>
${learner.name}
</label>
`;
});
}
function getSelectedLearnerIndex() {
const radios = document.getElementsByName('learnerRadio');
for (let i = 0; i < radios.length; i++) {
if (radios[i].checked) return radios[i].value;
}
return 0;
}
function handleSupportCheckboxLimit(e) {
const checkboxes = document.querySelectorAll('.support-checkbox');
const checked = Array.from(checkboxes).filter(cb => cb.checked);
if (checked.length > 2) {
e.target.checked = false;
document.getElementById('supportError').textContent = "You can select at most two support needs.";
} else {
document.getElementById('supportError').textContent = "";
}
const otherChecked = document.getElementById('supportOtherCheck').checked;
document.getElementById('supportOtherBox').style.display = otherChecked ? 'block' : 'none';
saveProfile(getSelectedLearnerIndex());
}
function handleSupportOtherInput(e) {
saveProfile(getSelectedLearnerIndex());
}
function handleStyleCheckboxLimit(e) {
const styleCheckboxes = document.querySelectorAll('.style-checkbox');
const checked = Array.from(styleCheckboxes).filter(cb => cb.checked);
if (checked.length > 2) {
e.target.checked = false;
document.getElementById('styleError').textContent = "You can select at most two learning styles.";
} else {
document.getElementById('styleError').textContent = "";
}
saveProfile(getSelectedLearnerIndex());
}
function handleAssessmentCheckboxLimit(e) {
const assessmentCheckboxes = document.querySelectorAll('.assessment-checkbox');
const checked = Array.from(assessmentCheckboxes).filter(cb => cb.checked);
if (checked.length > 2) {
e.target.checked = false;
document.getElementById('assessmentError').textContent = "You can select at most two assessment options.";
} else {
document.getElementById('assessmentError').textContent = "";
}
saveProfile(getSelectedLearnerIndex());
}
function handleBelowCheckboxLimit(e) {
const belowCheckboxes = document.querySelectorAll('.below-checkbox');
const checked = Array.from(belowCheckboxes).filter(cb => cb.checked);
if (checked.length > 2) {
e.target.checked = false;
document.getElementById('belowError').textContent = "You can select at most two support options.";
} else {
document.getElementById('belowError').textContent = "";
}
saveProfile(getSelectedLearnerIndex());
}
function handleAssessmentDisplay() {
const perf = document.getElementById('gradeLevel').value;
const assessmentDiv = document.getElementById('assessmentOptions');
const belowDiv = document.getElementById('belowOptions');
if (perf === "At Grade Level" || perf === "Above Grade Level") {
assessmentDiv.style.display = 'block';
belowDiv.style.display = 'none';
document.querySelectorAll('.below-checkbox').forEach(cb => cb.checked = false);
document.getElementById('belowError').textContent = "";
} else if (perf === "Below Grade Level") {
assessmentDiv.style.display = 'none';
belowDiv.style.display = 'block';
document.querySelectorAll('.assessment-checkbox').forEach(cb => cb.checked = false);
document.getElementById('assessmentError').textContent = "";
} else {
assessmentDiv.style.display = 'none';
belowDiv.style.display = 'none';
document.querySelectorAll('.below-checkbox').forEach(cb => cb.checked = false);
document.querySelectorAll('.assessment-checkbox').forEach(cb => cb.checked = false);
document.getElementById('belowError').textContent = "";
document.getElementById('assessmentError').textContent = "";
}
saveProfile(getSelectedLearnerIndex());
}
function handleGradeLevelChange(e) {
handleAssessmentDisplay();
saveProfile(getSelectedLearnerIndex());
}
function handleRestoreProfile(idx) {
const data = loadProfile(idx);
if (data.support) {
document.querySelectorAll('.support-checkbox').forEach(cb => {
cb.checked = data.support.includes(cb.value);
});
}
if (data.supportOther !== undefined && document.getElementById('supportOtherBox')) {
document.getElementById('supportOtherBox').value = data.supportOther;
document.getElementById('supportOtherBox').style.display = document.getElementById('supportOtherCheck').checked ? 'block' : 'none';
}
if (data.gradeLevel && document.getElementById('gradeLevel')) {
document.getElementById('gradeLevel').value = data.gradeLevel;
handleAssessmentDisplay();
}
if (data.styles) {
document.querySelectorAll('.style-checkbox').forEach(cb => {
cb.checked = data.styles.includes(cb.value);
});
}
if (data.assessment) {
document.querySelectorAll('.assessment-checkbox').forEach(cb => {
cb.checked = data.assessment.includes(cb.value);
});
}
if (data.below) {
document.querySelectorAll('.below-checkbox').forEach(cb => {
cb.checked = data.below.includes(cb.value);
});
}
}
function printProfile() {
const profile = document.querySelector('.profile-card');
const printWindow = window.open('', '', 'width=800,height=600');
printWindow.document.write(`
<html>
<head>
<title>Print Profile</title>
<style>
body { font-family: Arial, sans-serif; margin: 2rem; background: #fff; }
.profile-card { box-shadow: 0 2px 8px #0001; border-radius: 8px; padding: 1.5em; }
.marks-table { width: 100%; border-collapse: collapse; }
.marks-table th, .marks-table td { border: 1px solid #ccc; padding: 0.5em; text-align: center; }
</style>
</head>
<body>${profile.outerHTML}</body>
</html>
`);
printWindow.document.close();
printWindow.focus();
printWindow.print();
}
function exportProfile() {
const idx = getSelectedLearnerIndex();
const learner = learners[idx];
const data = loadProfile(idx);
const exportObj = {
name: learner.name,
gender: learner.gender,
languages: learner.languages,
class: learner.class,
assessments: learner.assessments,
...data
};
const blob = new Blob([JSON.stringify(exportObj, null, 2)], {type: "application/json"});
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = `${learner.name.replace(/\s+/g,"_")}_profile.json`;
link.click();
}
function exportProfileCSV() {
const idx = getSelectedLearnerIndex();
const learner = learners[idx];
const data = loadProfile(idx);
const fields = [
["Name", learner.name],
["Gender", learner.gender],
["Languages", (learner.languages||[]).join(", ")],
["Class", learner.class],
["Class Test", learner.assessments.classTest],
["Presentation", learner.assessments.presentation],
["Project", learner.assessments.project],
["Test 1", learner.assessments.test1],
["Test 2", learner.assessments.test2],
["Exam", learner.assessments.exam]
];
if (data.support && data.support.length > 0)
fields.push(["Support Needs", data.support.join(", ")]);
if (data.support && data.support.includes("Other") && data.supportOther)
fields.push(["Support Needs (Other)", data.supportOther]);
if (data.gradeLevel) fields.push(["Performance", data.gradeLevel]);
if ((data.gradeLevel === "Above Grade Level" || data.gradeLevel === "At Grade Level") && data.assessment && data.assessment.length > 0)
fields.push(["Assessment Options", data.assessment.join(", ")]);
if (data.gradeLevel === "Below Grade Level" && data.below && data.below.length > 0)
fields.push(["Support Options (Below Grade Level)", data.below.join(", ")]);
if (data.styles && data.styles.length > 0)
fields.push(["Learning Styles", data.styles.join(", ")]);
const csvRows = fields.map(([k,v]) => `"${k.replace(/"/g,'""')}","${String(v).replace(/"/g,'""')}"`);
const csvString = csvRows.join("\r\n");
const blob = new Blob([csvString], {type: "text/csv"});
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = (learner.name.replace(/\s+/g,"_") || "profile") + "_profile.csv";
link.click();
}
function renderProfile() {
const idx = getSelectedLearnerIndex();
const learner = learners[idx];
if (!learner) return;
const a = learner.assessments;
const avg = getAverage(a);
const systemStyle = getSystemStyle(avg);
document.getElementById('profile').innerHTML = `
<div class="profile-card">
<h2>${learner.name}</h2>
<ul class="info-list">
<li><span class="label">Gender:</span> ${learner.gender}</li>
<li><span class="label">Languages:</span> ${learner.languages.join(', ')}</li>
<li><span class="label">Class:</span> ${learner.class}</li>
</ul>
<table class="marks-table">
<thead>
<tr>
<th>Class Test</th><th>Presentation</th><th>Project</th>
<th>Test 1</th><th>Test 2</th><th>Exam</th><th>Average</th>
</tr>
</thead>
<tbody>
<tr>
<td>${a.classTest}</td><td>${a.presentation}</td><td>${a.project}</td>
<td>${a.test1}</td><td>${a.test2}</td><td>${a.exam}</td><td><b>${avg}</b></td>
</tr>
</tbody>
</table>
<div><span class="label">System Suggests:</span> <span class="selected-style">${systemStyle} learner</span></div>
<div class="support-radio-group">
<span class="label">Support Needs (Select up to 2):</span>
<label><input type="checkbox" class="support-checkbox" value="ELL"> ELL (English Language Learner)</label>
<label><input type="checkbox" class="support-checkbox" value="IEP504"> IEP or 504 Plan</label>
<label><input type="checkbox" class="support-checkbox" value="Executive"> Struggles with executive function</label>
<label><input type="checkbox" class="support-checkbox" value="Assistive"> Needs assistive technology (e.g., TTS, dictation)</label>
<label>
<input type="checkbox" class="support-checkbox" value="Other" id="supportOtherCheck"> Other (Specify)
<input type="text" id="supportOtherBox" style="display:none; margin-left:1.5em;" placeholder="Please specify" />
</label>
<div id="supportError" class="error"></div>
</div>
<hr>
<div class="grade-group">
<label class="label" for="gradeLevel">Performance:</label>
<select id="gradeLevel">
<option value="">Select...</option>
<option value="Above Grade Level">Above Grade Level</option>
<option value="At Grade Level">At Grade Level</option>
<option value="Below Grade Level">Below Grade Level</option>
</select>
</div>
<div id="assessmentOptions" class="assessment-options" style="display:none;">
<span class="label">Assessment Options (Select up to 2):</span>
<label><input type="checkbox" class="assessment-checkbox" value="Project-based assessment"> Project-based assessment</label>
<label><input type="checkbox" class="assessment-checkbox" value="Oral presentation"> Oral presentation</label>
<label><input type="checkbox" class="assessment-checkbox" value="Choice board or menu assessment"> Choice board or menu assessment</label>
<label><input type="checkbox" class="assessment-checkbox" value="Peer teaching or mentoring"> Peer teaching or mentoring</label>
<label><input type="checkbox" class="assessment-checkbox" value="Self-reflection/journalling"> Self-reflection/journalling</label>
<div id="assessmentError" class="error"></div>
</div>
<div id="belowOptions" class="below-options" style="display:none;">
<span class="label">Support Options (Select up to 2):</span>
<label><input type="checkbox" class="below-checkbox" value="Scaffolded checklist or rubric"> Scaffolded checklist or rubric</label>
<label><input type="checkbox" class="below-checkbox" value="Exit slips or daily formative checks"> Exit slips or daily formative checks</label>
<label><input type="checkbox" class="below-checkbox" value="Think alouds or guided practice"> Think alouds or guided practice</label>
<label><input type="checkbox" class="below-checkbox" value="Visual supports (Graphic organizers, diagrams)"> Visual supports (Graphic organizers, diagrams)</label>
<label><input type="checkbox" class="below-checkbox" value="Physical/hands on tasks"> Physical/hands on tasks</label>
<label><input type="checkbox" class="below-checkbox" value="Extra time or modified instructions"> Extra time or modified instructions</label>
<div id="belowError" class="error"></div>
</div>
<div class="style-group">
<div class="label">Teacher: Select up to 2 learning styles</div>
<label><input type="checkbox" class="style-checkbox" value="Auditory"> Auditory</label>
<label><input type="checkbox" class="style-checkbox" value="Kinesthetic"> Kinesthetic</label>
<label><input type="checkbox" class="style-checkbox" value="Visual"> Visual</label>
<label><input type="checkbox" class="style-checkbox" value="Reading/Writing"> Reading/Writing</label>
<div id="styleError" class="error"></div>
</div>
</div>
`;
document.querySelectorAll('.style-checkbox').forEach(cb =>
cb.onchange = handleStyleCheckboxLimit
);
document.querySelectorAll('.support-checkbox').forEach(cb =>
cb.onchange = handleSupportCheckboxLimit
);
document.getElementById('supportOtherBox').oninput = handleSupportOtherInput;
document.querySelectorAll('.assessment-checkbox').forEach(cb =>
cb.onchange = handleAssessmentCheckboxLimit
);
document.querySelectorAll('.below-checkbox').forEach(cb =>
cb.onchange = handleBelowCheckboxLimit
);
const gradeLevel = document.getElementById('gradeLevel');
gradeLevel.onchange = handleGradeLevelChange;
handleRestoreProfile(idx);
}
let chart;
function updateAnalyticsChart() {
const type = document.getElementById('analyticsType').value;
const ctx = document.getElementById('analyticsChart').getContext('2d');
if (chart) chart.destroy();
if (type === "average") {
const labels = learners.map(l => l.name);
const data = learners.map(l => getAverage(l.assessments));
chart = new Chart(ctx, {
type: 'bar',
data: {
labels,
datasets: [{
label: 'Average Mark',
data,
backgroundColor: 'rgba(54, 162, 235, 0.6)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}]
},
options: {
plugins: { legend: { display: false } },
scales: {
y: { beginAtZero: true, max: 100, title: { display: true, text: 'Average (%)' } }
}
}
});
} else if (type === "styles") {
const styleCounts = { Visual: 0, Auditory: 0, Kinesthetic: 0 };
learners.forEach(l => {
const avg = getAverage(l.assessments);
styleCounts[getSystemStyle(avg)]++;
});
chart = new Chart(ctx, {
type: 'pie',
data: {
labels: Object.keys(styleCounts),
datasets: [{
data: Object.values(styleCounts),
backgroundColor: [
'rgba(76, 175, 80, 0.7)',
'rgba(255, 235, 59, 0.7)',
'rgba(255, 152, 0, 0.7)'
]
}]
},
options: {
plugins: { legend: { display: true } }
}
});
} else if (type === "gender") {
const genderCounts = { Female: 0, Male: 0 };
learners.forEach(l => genderCounts[l.gender]++);
chart = new Chart(ctx, {
type: 'pie',
data: {
labels: Object.keys(genderCounts),
datasets: [{
data: Object.values(genderCounts),
backgroundColor: [
'rgba(244, 143, 177, 0.7)',
'rgba(66, 165, 245, 0.7)'
]
}]
},
options: {
plugins: { legend: { display: true } }
}
});
}
}
document.addEventListener('DOMContentLoaded', function() {
populateLearnerRadios();
renderProfile();
updateAnalyticsChart();
document.getElementById('learnerRadioGroup').onchange = function() {
renderProfile();
};
document.getElementById('analyticsType').onchange = updateAnalyticsChart;
});
</script>
</body>
</html>