-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin-dashboard.html
More file actions
782 lines (739 loc) · 43.2 KB
/
admin-dashboard.html
File metadata and controls
782 lines (739 loc) · 43.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
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
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Admin dashboard for MGIT Feedback System — manage users, enrollments, and view system-wide feedback reports." />
<meta name="keywords" content="feedback, students, teachers, MGIT" />
<meta name="robots" content="noindex, nofollow" />
<meta property="og:title" content="Admin Dashboard — MGIT Feedback System" />
<meta property="og:description" content="Admin dashboard for MGIT Feedback System." />
<meta property="og:url" content="https://mgitfeedback.me/admin-dashboard.html" />
<meta property="og:type" content="website" />
<link rel="canonical" href="https://mgitfeedback.me/admin-dashboard.html" />
<title>Admin Dashboard – Feedback System</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚙️</text></svg>" />
<!-- Preconnect for Google Fonts (reduces FCP) -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<!-- Preload main stylesheet (reduces render-blocking) -->
<link rel="preload" href="css/style.css?v=2" as="style" />
<link rel="stylesheet" href="css/style.css?v=2" />
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="bg-orbs"></div>
<button class="mobile-menu-btn" onclick="document.querySelector('.sidebar').classList.toggle('open');document.querySelector('.sidebar-overlay').classList.toggle('show');" aria-label="Menu">☰</button>
<div class="page-wrapper dashboard-layout">
<div class="sidebar-overlay" onclick="document.querySelector('.sidebar').classList.remove('open');this.classList.remove('show');"></div>
<!-- Sidebar -->
<nav class="sidebar">
<div class="sidebar-header">
<div class="sidebar-logo">sT</div>
<div>
<div class="sidebar-title">Admin Panel</div>
<div class="sidebar-subtitle" id="collegeName">System</div>
</div>
</div>
<div class="sidebar-nav">
<div class="nav-group-label">Overview</div>
<div class="nav-item" id="navDashboard" onclick="switchTab('dashboard')"><span class="nav-icon">📊</span> Dashboard</div>
<div class="nav-item" id="navReviews" onclick="switchTab('reviews')"><span class="nav-icon">⭐</span> Website Reviews</div>
<div class="nav-group-label" style="margin-top:12px;">Management</div>
<div class="nav-item active" id="navUsers" onclick="switchTab('users')"><span class="nav-icon">👥</span> User
Management</div>
<div class="nav-item" id="navSubjects" onclick="switchTab('subjects')"><span class="nav-icon">📚</span>
Subjects & Questionnaires</div>
<div class="nav-item" id="navAssign" onclick="switchTab('assign')"><span class="nav-icon">👥</span> Teacher
Assignment</div>
<div class="nav-item" id="navFeedback" onclick="switchTab('feedback')"><span class="nav-icon">💬</span>
Feedback Oversight</div>
<div class="nav-item" id="navAttendance" onclick="switchTab('attendance')"><span class="nav-icon">📋</span>
Attendance</div>
<div class="nav-item" id="navReports" onclick="switchTab('reports')"><span class="nav-icon">📋</span> Reports
& Analytics</div>
<div class="nav-group-label" style="margin-top:16px;">Settings</div>
<div class="nav-item" id="navSettings" onclick="switchTab('settings')"><span class="nav-icon">⚙️</span> System
Settings</div>
</div>
<div class="sidebar-footer">
<div class="user-avatar">A</div>
<div class="user-info">
<div class="user-name" id="sidebarName">Admin...</div>
<div class="user-role">Administrator</div>
</div>
<button class="btn-logout" onclick="logout()" title="Logout" aria-label="Logout">⇥</button>
</div>
</nav>
<main class="main-content">
<!-- ==================== TAB: USERS ==================== -->
<!-- ==================== TAB: DASHBOARD ==================== -->
<div id="tabDashboard" style="display:none;">
<div class="topbar">
<div>
<div class="page-title">Dashboard</div>
<div class="page-subtitle">Overview of your feedback system at a glance</div>
</div>
</div>
<div class="stats-grid animate-in" style="grid-template-columns:repeat(auto-fill,minmax(180px,1fr));">
<div class="stat-card">
<div class="stat-icon">🎓</div>
<div class="stat-value" id="dashStudents">0</div>
<div class="stat-label">Total Students</div>
</div>
<div class="stat-card">
<div class="stat-icon">👨‍🏫</div>
<div class="stat-value" id="dashTeachers">0</div>
<div class="stat-label">Total Teachers</div>
</div>
<div class="stat-card">
<div class="stat-icon">📚</div>
<div class="stat-value" id="dashSubjects">0</div>
<div class="stat-label">Subjects</div>
</div>
<div class="stat-card">
<div class="stat-icon">💬</div>
<div class="stat-value" id="dashFeedbacks">0</div>
<div class="stat-label">Feedbacks</div>
</div>
<div class="stat-card">
<div class="stat-icon">🔗</div>
<div class="stat-value" id="dashEnrollments">0</div>
<div class="stat-label">Enrollments</div>
</div>
<div class="stat-card">
<div class="stat-icon">🏛</div>
<div class="stat-value" id="dashDepts">0</div>
<div class="stat-label">Departments</div>
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
<div class="section-card">
<div class="section-card-header"><div class="section-card-title">📈 Recent Activity</div></div>
<div class="section-card-body" id="dashRecentActivity" style="max-height:300px;overflow-y:auto;">
<div style="color:var(--text-muted);font-size:13px;">Loading...</div>
</div>
</div>
<div class="section-card">
<div class="section-card-header"><div class="section-card-title">👥 Top Teachers by Students</div></div>
<div class="section-card-body" id="dashTopTeachers" style="max-height:300px;overflow-y:auto;">
<div style="color:var(--text-muted);font-size:13px;">Loading...</div>
</div>
</div>
</div>
<div class="section-card" style="margin-top:20px;">
<div class="section-card-header"><div class="section-card-title">🎓 Students by Department</div></div>
<div class="section-card-body" id="dashDeptBreakdown"></div>
</div>
</div>
<div id="tabUsers">
<div class="topbar">
<div>
<div class="page-title">User Management</div>
<div class="page-subtitle">Create, edit and manage all student and teacher accounts</div>
</div>
<div style="display:flex; gap:10px; flex-wrap:wrap;">
<button class="btn btn-secondary btn-sm" onclick="downloadCSVTemplate()">📥 Download Template</button>
<button class="btn btn-success btn-sm" onclick="openBulkModal()">😁 Bulk Import CSV</button>
<button class="btn btn-primary btn-sm" onclick="openAddUserModal()">+ Add User</button>
<button class="btn btn-sm" onclick="deleteSelectedUsers()" style="background:var(--danger);color:#fff;">🗑 Delete Selected</button>
</div>
</div>
<div class="stats-grid animate-in">
<div class="stat-card">
<div class="stat-icon">🎓</div>
<div class="stat-value" id="countStudents">0</div>
<div class="stat-label">Students</div>
</div>
<div class="stat-card">
<div class="stat-icon">👨‍🏫</div>
<div class="stat-value" id="countTeachers">0</div>
<div class="stat-label">Teachers</div>
</div>
<div class="stat-card">
<div class="stat-icon">💬</div>
<div class="stat-value" id="countResponses">0</div>
<div class="stat-label">Feedback Submissions</div>
</div>
</div>
<div class="tab-bar">
<button class="tab-btn active" onclick="renderUserTable('student',this)">Students</button>
<button class="tab-btn" onclick="renderUserTable('teacher',this)">Teachers</button>
</div>
<div class="section-card">
<div class="section-card-body" style="padding:0;">
<div class="table-wrap" id="userTableWrap"></div>
</div>
</div>
</div>
<!-- ==================== TAB: SUBJECTS ==================== -->
<div id="tabSubjects" style="display:none;">
<div class="topbar">
<div>
<div class="page-title">Subjects & Questionnaires</div>
<div class="page-subtitle">Manage subjects and build subject-specific feedback questionnaires</div>
</div>
<button class="btn btn-primary btn-sm" onclick="openAddSubjectModal()">+ Add Subject</button>
</div>
<div id="subjectsList"></div>
</div>
<!-- ==================== TAB: ASSIGN ==================== -->
<div id="tabAssign" style="display:none;">
<div class="topbar">
<div>
<div class="page-title">Teacher Assignment</div>
<div class="page-subtitle">Pick a teacher, tick the students – save in one click</div>
</div>
<button class="btn btn-primary btn-sm" onclick="saveAssignments()" id="saveAssignBtn"
style="display:none;">💾 Save Assignments</button>
</div>
<!-- Step 1: Pick Teacher -->
<div class="section-card" style="margin-bottom:20px;">
<div class="section-card-header">
<div class="section-card-title">Step 1 – Select a Teacher</div>
</div>
<div class="section-card-body">
<div id="teacherPickGrid"
style="display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px;"></div>
<div id="noTeachersMsg" class="empty-state" style="display:none;">
<div class="empty-icon">Y'👨🏫?👨🏫Y👨🏫</div>
<div class="empty-title">No teachers yet</div>
<div class="empty-desc">Go to User Management and add teachers first.</div>
</div>
</div>
</div>
<!-- Step 2: Pick Subject -->
<div class="section-card" id="subjectPickPanel" style="display:none;margin-bottom:20px;">
<div class="section-card-header">
<div class="section-card-title">Step 2 – Select a Subject for <span id="assignSubjectTeacherName" style="color:var(--accent-light);"></span></div>
</div>
<div class="section-card-body">
<div id="subjectPickGrid"
style="display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:12px;"></div>
<div id="noSubjectsMsg" class="empty-state" style="display:none;">
<div class="empty-icon">📚</div>
<div class="empty-title">No subjects assigned</div>
<div class="empty-desc">This teacher has no subjects. Assign subjects in User Management first.</div>
</div>
</div>
</div>
<!-- Step 3: Tick Students -->
<div class="section-card" id="studentCheckPanel" style="display:none;">
<div class="section-card-header">
<div>
<div class="section-card-title">Step 3 – Select Students for <span id="assignTeacherName"
style="color:var(--accent-light);"></span></div>
<div style="font-size:12px;color:var(--text-muted);margin-top:2px;">Ticked students will be enrolled;
unticked will be un-enrolled.</div>
</div>
<div style="display:flex;gap:8px;">
<button class="btn btn-secondary btn-xs" onclick="tickAll(true)">✔ Select All</button>
<button class="btn btn-secondary btn-xs" onclick="tickAll(false)">o Clear All</button>
<button class="btn btn-xs" onclick="resetAllForTeacher()" style="background:var(--danger);color:#fff;" title="Clear all assignments for this teacher">🔄 Reset All</button>
</div>
</div>
<div style="display:flex;gap:12px;flex-wrap:wrap;padding:12px 20px;border-bottom:1px solid var(--border-light);align-items:center;">
<span style="font-size:12px;font-weight:600;color:var(--text-muted);">Filter:</span>
<input id="assignSearchInput" type="search" autocomplete="one-time-code" placeholder="🔍 Search student name, email, roll no..." oninput="renderStudentChecklist(selectedTeacherId)" style="padding:6px 12px;border-radius:var(--radius-sm);border:1px solid var(--border-light);background:var(--surface);color:var(--text);font-size:12px;width:260px;" />
<select id="filterDept" onchange="renderStudentChecklist(selectedTeacherId)" style="padding:6px 12px;border-radius:var(--radius-sm);border:1px solid var(--border-light);background:var(--surface);color:var(--text);font-size:12px;cursor:pointer;">
<option value="">All Departments</option>
</select>
<select id="filterSection" onchange="renderStudentChecklist(selectedTeacherId)" style="padding:6px 12px;border-radius:var(--radius-sm);border:1px solid var(--border-light);background:var(--surface);color:var(--text);font-size:12px;cursor:pointer;">
<option value="">All Sections</option>
</select>
<span id="filterCount" style="font-size:11px;color:var(--text-muted);margin-left:auto;"></span>
</div>
<div class="section-card-body">
<div id="studentCheckGrid"
style="display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;"></div>
<div id="noStudentsMsg" class="empty-state" style="display:none;">
<div class="empty-icon">👥</div>
<div class="empty-title">No students yet</div>
<div class="empty-desc">Add students in User Management first.</div>
</div>
</div>
</div>
</div>
<!-- ==================== TAB: FEEDBACK ==================== -->
<div id="tabFeedback" style="display:none;">
<div class="topbar">
<div>
<div class="page-title">Feedback Oversight</div>
<div class="page-subtitle">View all submissions with filters</div>
</div>
<div style="display:flex; gap:8px; flex-wrap:wrap;">
<button class="btn btn-secondary btn-sm" onclick="exportResponsesCSV()">📥 Export CSV</button>
<button class="btn btn-sm" onclick="clearSelectedFeedback()" style="background:var(--danger);color:#fff;">🗑 Delete Selected</button>
<button class="btn btn-sm" onclick="clearAllFeedback()" style="background:var(--danger);color:#fff;">🗑 Clear All</button>
</div>
</div>
<div class="section-card" style="margin-bottom:20px;">
<div class="section-card-body">
<div
style="display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:12px; align-items:end; flex-wrap:wrap;">
<div class="form-group" style="margin:0;"><label>Filter by Teacher</label><select id="filterTeacher"
onchange="renderFeedbackTable()">
<option value="">All Teachers</option>
</select></div>
<div class="form-group" style="margin:0;"><label>Filter by Subject</label><select id="filterSubject"
onchange="renderFeedbackTable()">
<option value="">All Subjects</option>
</select></div>
<div class="form-group" style="margin:0;"><label>Filter by Anonymity</label><select id="filterAnon"
onchange="renderFeedbackTable()">
<option value="">All</option>
<option value="1">Anonymous</option>
<option value="0">Identified</option>
</select></div>
<button class="btn btn-secondary" onclick="resetFilters()">Reset</button>
</div>
</div>
</div>
<div class="section-card">
<div class="section-card-body" style="padding:0;">
<div class="table-wrap" id="feedbackTable"></div>
</div>
</div>
</div>
<!-- ==================== TAB: ATTENDANCE ==================== -->
<div id="tabAttendance" style="display:none;">
<div class="topbar">
<div>
<div class="page-title">Attendance Management</div>
<div class="page-subtitle">Upload student attendance by section – only students with ≥75% can submit
feedback</div>
</div>
<button class="btn btn-secondary btn-sm" onclick="downloadAttendanceTemplate()">📥 Download
Template</button>
</div>
<!-- Threshold Info Banner -->
<div
style="background:linear-gradient(135deg,rgba(124,58,237,0.1),rgba(59,130,246,0.05));border:1.5px solid rgba(124,58,237,0.25);border-radius:14px;padding:16px 20px;margin-bottom:20px;display:flex;align-items:center;gap:14px;">
<div
style="width:44px;height:44px;border-radius:12px;background:linear-gradient(135deg,var(--accent),var(--accent-light));display:flex;align-items:center;justify-content:center;font-size:20px;flex-shrink:0;">
🎓</div>
<div>
<div style="font-weight:700;font-size:14px;margin-bottom:3px;">Attendance Gate – Minimum 75% Required
</div>
<div style="font-size:12px;color:var(--text-muted);">Students with attendance below 75% will see a locked
feedback button. Upload section-wise attendance to enable or block feedback access per student.</div>
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px;flex-wrap:wrap;">
<!-- Upload Card -->
<div class="section-card">
<div class="section-card-header">
<div class="section-card-title">📤 Upload Attendance CSV</div>
</div>
<div class="section-card-body">
<div class="form-group" style="margin-bottom:14px;">
<div style="font-size:12px;color:var(--text-muted);padding:8px 12px;background:var(--surface2);border-radius:8px;">Include a <strong>section</strong> column in your CSV to upload all sections at once.</div>
<select id="attSectionSelect" style="display:none;">
<option value="">– All Sections –</option>
</select>
</div>
<!-- Drop zone -->
<div id="attDropZone" onclick="document.getElementById('attCSVInput').click()"
ondragover="event.preventDefault(); this.style.borderColor='var(--accent)'"
ondragleave="this.style.borderColor='var(--border)'" ondrop="handleAttDrop(event)"
style="border:2px dashed var(--border);border-radius:var(--radius-sm);padding:28px 20px;text-align:center;cursor:pointer;transition:var(--transition);margin-bottom:12px;">
<div style="font-size:32px;margin-bottom:6px;">📁</div>
<div style="font-weight:700;font-size:14px;margin-bottom:3px;">Drop CSV here or click to browse</div>
<div style="font-size:11px;color:var(--text-muted);">Required columns: <code>email</code>, <code>section</code>,
<code>attendance_percentage</code>
</div>
<input type="file" id="attCSVInput" accept=".csv" style="display:none"
onchange="handleAttCSVFile(this)" />
</div>
<div id="attParseErr"
style="display:none;padding:10px;background:rgba(239,68,68,0.1);border:1px solid rgba(239,68,68,0.3);border-radius:8px;color:#f87171;font-size:13px;margin-bottom:10px;">
</div>
</div>
</div>
<!-- Preview Card -->
<div class="section-card" id="attPreviewCard" style="display:none;">
<div class="section-card-header">
<div class="section-card-title">📋 Preview</div>
<div style="display:flex;gap:8px;">
<span id="attOkCount" class="badge badge-green" style="font-size:11px;"></span>
<span id="attErrCount" class="badge badge-orange" style="font-size:11px;"></span>
</div>
</div>
<div class="section-card-body" style="padding:0;">
<div id="attPreviewTable" class="table-wrap" style="max-height:280px;overflow-y:auto;"></div>
</div>
<div style="padding:14px 16px;border-top:1px solid var(--border-light);">
<button class="btn btn-primary" onclick="saveAttendanceUpload()">✓ Save Attendance</button>
<button class="btn btn-secondary" onclick="cancelAttPreview()" style="margin-left:8px;">✔
Cancel</button>
</div>
</div>
</div>
<!-- Current Records -->
<div class="section-card">
<div class="section-card-header">
<div class="section-card-title">📊 Current Attendance Records</div>
<div style="display:flex;gap:8px;align-items:center;">
<button class="btn btn-sm" onclick="clearAllAttendance()" style="background:var(--danger);color:#fff;font-size:11px;white-space:nowrap;">🗑 Clear All</button>
<select id="attFilterSection" onchange="renderAttendanceRecords()"
style="padding:5px 10px;border-radius:8px;border:1px solid var(--border-light);background:var(--surface);color:var(--text);font-size:12px;">
<option value="">All Sections</option>
</select>
</div>
</div>
<div class="section-card-body" style="padding:0;">
<div id="attRecordsTable" class="table-wrap"></div>
</div>
</div>
</div>
<!-- ==================== TAB: REPORTS ==================== -->
<div id="tabReports" style="display:none;">
<div class="topbar">
<div>
<div class="page-title">Reports & Analytics</div>
<div class="page-subtitle">Institution-wide performance overview</div>
</div>
<div style="display:flex; gap:8px; flex-wrap:wrap;">
<button class="btn btn-secondary btn-sm" onclick="exportResponsesCSV()">📥 Export CSV</button>
<button class="btn btn-sm" onclick="downloadAdminReport()" style="background:linear-gradient(135deg,var(--accent),var(--accent-light));color:#fff;">📊 Download Report</button>
</div>
</div>
<div class="charts-grid animate-in">
<div class="chart-card" style="grid-column:1/-1;">
<div class="chart-title">🏫 Teacher Performance Overview</div>
<div class="chart-canvas-wrap"><canvas id="instChart"></canvas></div>
</div>
<div class="chart-card">
<div class="chart-title">📊 Department Comparison</div>
<div class="chart-canvas-wrap"><canvas id="deptChart"></canvas></div>
</div>
<div class="chart-card">
<div class="chart-title">🎯 Score Distribution</div>
<div class="chart-canvas-wrap"><canvas id="instDistChart"></canvas></div>
</div>
</div>
<div class="section-card">
<div class="section-card-header">
<div class="section-card-title">Teacher Summary Table</div>
</div>
<div class="section-card-body" style="padding:0;">
<div class="table-wrap" id="reportTable"></div>
</div>
</div>
<!-- Per-teacher individual charts injected by renderReports() -->
<div id="perTeacherCharts" style="display:grid;gap:20px;margin-top:20px;"></div>
</div>
<!-- ==================== TAB: SETTINGS ==================== -->
<!-- ==================== TAB: WEBSITE REVIEWS ==================== -->
<div id="tabReviews" style="display:none;">
<div class="topbar">
<div>
<div class="page-title">Website Reviews</div>
<div class="page-subtitle">Public ratings and feedback about your feedback system</div>
</div>
<button class="btn btn-sm" onclick="clearAllReviews()" style="background:var(--danger);color:#fff;">🗑 Clear All</button>
</div>
<div class="stats-grid animate-in" style="grid-template-columns:repeat(3,1fr);margin-bottom:20px;">
<div class="stat-card">
<div class="stat-icon">⭐</div>
<div class="stat-value" id="reviewAvgRating">0</div>
<div class="stat-label">Average Rating</div>
</div>
<div class="stat-card">
<div class="stat-icon">💬</div>
<div class="stat-value" id="reviewTotalCount">0</div>
<div class="stat-label">Total Reviews</div>
</div>
<div class="stat-card">
<div class="stat-icon">📈</div>
<div class="stat-value" id="review5StarPct">0%</div>
<div class="stat-label">5-Star Rate</div>
</div>
</div>
<div class="section-card">
<div class="section-card-header">
<div class="section-card-title">All Reviews</div>
</div>
<div class="section-card-body" id="reviewsList">
<div style="text-align:center;padding:30px;color:var(--text-muted);">No reviews yet</div>
</div>
</div>
</div>
<div id="tabSettings" style="display:none;">
<div class="topbar">
<div>
<div class="page-title">System Settings</div>
<div class="page-subtitle">Configure institution-wide settings</div>
</div>
</div>
<!-- Communication Section -->
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px;">
<!-- Push Notification Card -->
<div class="section-card">
<div class="section-card-header">
<div class="section-card-title">🔔 Push Notification</div>
</div>
<div class="section-card-body">
<div class="form-group">
<label>Title</label>
<input type="text" id="notifTitle" placeholder="e.g. Exam Schedule Released" />
</div>
<div class="form-group">
<label>Message</label>
<textarea id="notifMessage" rows="3" placeholder="Enter notification content..." style="width:100%;padding:10px;border-radius:var(--radius-sm);border:1px solid var(--border-light);background:var(--surface);color:var(--text);font-size:13px;resize:vertical;"></textarea>
</div>
<div class="form-group">
<label>Category</label>
<select id="notifCategory" style="padding:8px 12px;border-radius:var(--radius-sm);border:1px solid var(--border-light);background:var(--surface);color:var(--text);font-size:13px;width:100%;">
<option value="General">General</option>
<option value="Exam">Exam</option>
<option value="Holiday">Holiday</option>
<option value="Event">Event</option>
<option value="Urgent">Urgent</option>
</select>
</div>
<button class="btn btn-primary btn-sm" onclick="pushNotification()" style="width:100%;">🔔 Send Notification</button>
<div id="notifHistory" style="margin-top:16px;max-height:200px;overflow-y:auto;"></div>
</div>
</div>
<!-- Upload Timetable Card -->
<div class="section-card">
<div class="section-card-header">
<div class="section-card-title">📅 Upload Timetable</div>
</div>
<div class="section-card-body">
<div class="form-group">
<label>Title</label>
<input type="text" id="ttTitle" placeholder="e.g. CSE 2nd Year Timetable" />
</div>
<div class="form-group">
<label>Department (optional)</label>
<input type="text" id="ttDept" placeholder="e.g. CSE" />
</div>
<div class="form-group">
<label>Section (optional)</label>
<input type="text" id="ttSection" placeholder="e.g. CSE-4" />
</div>
<div class="form-group">
<label>Timetable Content</label>
<textarea id="ttContent" rows="6" placeholder="Paste timetable here... Mon: Math 9-10, Physics 10-11 Tue: English 9-10, Chemistry 10-11" style="width:100%;padding:10px;border-radius:var(--radius-sm);border:1px solid var(--border-light);background:var(--surface);color:var(--text);font-size:13px;resize:vertical;font-family:monospace;"></textarea>
</div>
<button class="btn btn-primary btn-sm" onclick="uploadTimetable()" style="width:100%;">📅 Upload Timetable</button>
<div id="ttHistory" style="margin-top:16px;max-height:200px;overflow-y:auto;"></div>
</div>
</div>
</div>
<div class="section-card" style="max-width:560px;">
<div class="section-card-header">
<div class="section-card-title">Institution Settings</div>
</div>
<div class="section-card-body">
<div class="form-group">
<label>College / Institution Name</label>
<input type="text" id="settCollegeName" placeholder="e.g. XYZ College of Engineering" />
</div>
<div class="form-group">
<label>College Email Domain</label>
<div class="input-icon-wrap">
<span class="input-icon" style="left:auto; right:12px; transform:translateY(-50%);">@</span>
<input type="text" id="settDomain" placeholder="Enter domain (e.g. mgit.ac.in)" />
</div>
<div style="font-size:11px; color:var(--text-muted); margin-top:4px;">Only emails ending with this
domain will be allowed to log in.</div>
</div>
<!-- Threshold Card -->
<div style="
border-radius:14px;
background:linear-gradient(135deg,rgba(124,58,237,0.08),rgba(139,92,246,0.04));
border:1.5px solid rgba(124,58,237,0.25);
padding:18px 20px;
margin-bottom:20px;
">
<div style="display:flex; align-items:center; gap:14px; margin-bottom:14px;">
<div style="
width:42px; height:42px; border-radius:12px; flex-shrink:0;
background:linear-gradient(135deg,var(--accent),var(--accent-light));
display:flex; align-items:center; justify-content:center;
font-size:18px; box-shadow:0 4px 12px rgba(124,58,237,0.35);
">📈</div>
<div>
<div style="font-weight:700; font-size:14px; color:var(--text); margin-bottom:2px;">Minimum
Performance Threshold</div>
<div style="font-size:11px; color:var(--text-muted);">Teachers scoring below this are flagged for
review</div>
</div>
</div>
<div style="display:flex; align-items:center; gap:16px; flex-wrap:wrap;">
<div style="flex:1; min-width:200px;">
<input type="range" id="settThresholdRange" min="1" max="5" step="0.1" value="3.5"
oninput="document.getElementById('settThreshold').value=this.value; document.getElementById('threshPreview').textContent=parseFloat(this.value).toFixed(1)+'/5';"
style="width:100%; accent-color:var(--accent); cursor:pointer;" />
<div
style="display:flex; justify-content:space-between; font-size:10px; color:var(--text-muted); margin-top:3px;">
<span>1.0 (Very Low)</span><span>3.0 (Moderate)</span><span>5.0 (Excellent)</span>
</div>
</div>
<div style="text-align:center;">
<div id="threshPreview"
style="font-size:26px; font-weight:900; color:var(--accent-light); line-height:1;">3.5/5</div>
<div style="font-size:10px; color:var(--text-muted); margin-top:2px;">Threshold</div>
</div>
</div>
<input type="hidden" id="settThreshold" value="3.5" />
<!-- Colour legend -->
<div style="display:flex; gap:12px; margin-top:14px; flex-wrap:wrap;">
<div style="display:flex; align-items:center; gap:6px; font-size:11px; color:var(--text-muted);">
<div style="width:10px;height:10px;border-radius:50%;background:var(--success);"></div> Above
threshold = Target Met
</div>
<div style="display:flex; align-items:center; gap:6px; font-size:11px; color:var(--text-muted);">
<div style="width:10px;height:10px;border-radius:50%;background:#ef4444;"></div> Below threshold =
Needs Improvement
</div>
</div>
</div>
<button class="btn btn-primary" onclick="saveSettingsForm()">💾 Save Settings</button>
</div>
</div>
</div>
</main>
</div>
<!-- ==================== MODALS ==================== -->
<!-- Add / Edit User Modal -->
<div class="modal-overlay hidden" id="userModal">
<div class="modal" style="max-width:460px;">
<div class="modal-title" id="userModalTitle">➕ Add User</div>
<input type="hidden" id="editUserId" />
<div class="form-group"><label>Full Name</label><input type="text" id="uName" placeholder="e.g. John Doe" /></div>
<div class="form-group"><label>College Email</label><input type="email" id="uEmail"
placeholder="Enter email address" /></div>
<div class="form-group"><label>Password</label><input type="password" id="uPassword" placeholder="Set password" />
</div>
<div class="form-group"><label>Role</label>
<select id="uRole" onchange="toggleSubjectField()">
<option value="student">Student</option>
<option value="teacher">Teacher</option>
</select>
</div>
<div class="form-group"><label>Department</label><input type="text" id="uDept"
placeholder="e.g. CSE, EEE, Mech" /></div>
<div class="form-group"><label>Section</label><input type="text" id="uSection"
placeholder="e.g. CSE1, CSE-A, EEE2" /></div>
<div class="form-group" id="rollNoFieldWrap"><label>Roll No (Students only)</label><input type="text" id="uRollNo"
placeholder="e.g. 21CS101" /></div>
<div class="form-group" id="subjectFieldWrap">
<label>Subjects (for Teachers) — select multiple</label>
<div id="uSubjectCheckboxes" style="max-height:150px;overflow-y:auto;border:1px solid var(--border-light);border-radius:8px;padding:8px;background:var(--surface);"></div>
</div>
<div id="userModalErr" style="font-size:12px; color:var(--danger); margin-bottom:8px;"></div>
<div class="modal-actions">
<button class="btn btn-secondary" onclick="closeModal('userModal')">Cancel</button>
<button class="btn btn-primary" onclick="submitUserModal()">Save</button>
</div>
</div>
</div>
<!-- Add Subject Modal -->
<div class="modal-overlay hidden" id="subjectModal">
<div class="modal" style="max-width:420px;">
<div class="modal-title">➕ Add Subject</div>
<div class="form-group"><label>Subject Name</label><input type="text" id="subName" placeholder="e.g. Biology" />
</div>
<div class="form-group"><label>Department</label><input type="text" id="subDept"
placeholder="e.g. Life Sciences" /></div>
<div class="modal-actions">
<button class="btn btn-secondary" onclick="closeModal('subjectModal')">Cancel</button>
<button class="btn btn-primary" onclick="submitSubjectModal()">Add Subject</button>
</div>
</div>
</div>
<!-- Questionnaire Editor Modal -->
<div class="modal-overlay hidden" id="qModal">
<div class="modal" style="max-width:680px; max-height:85vh; overflow-y:auto;">
<div class="modal-title" id="qModalTitle">✏️ Edit Questionnaire</div>
<input type="hidden" id="qSubjectId" />
<div id="qEditorContainer"></div>
<div style="margin-top:12px;">
<button class="btn btn-secondary btn-sm" onclick="addQSection()">+ Add Section</button>
</div>
<div class="modal-actions">
<button class="btn btn-secondary" onclick="closeModal('qModal')">Cancel</button>
<button class="btn btn-primary" onclick="saveQEditorChanges()">💾 Save Questionnaire</button>
</div>
</div>
</div>
<!-- Bulk Import Modal -->
<div class="modal-overlay hidden" id="bulkModal">
<div class="modal" style="max-width:720px; max-height:90vh; overflow-y:auto;">
<div class="modal-title">📁 Bulk Import Students / Teachers</div>
<!-- Step 1: Upload -->
<div id="bulkStep1">
<div
style="padding:20px; border:2px dashed var(--border); border-radius:var(--radius); text-align:center; margin-bottom:18px; cursor:pointer; transition:var(--transition);"
id="dropZone" onclick="document.getElementById('csvFileInput').click()"
ondragover="event.preventDefault(); this.style.borderColor='var(--accent)'"
ondragleave="this.style.borderColor='var(--border)'" ondrop="handleDrop(event)">
<div style="font-size:36px; margin-bottom:8px;">📁</div>
<div style="font-weight:700; font-size:15px; margin-bottom:4px;">Drop CSV file here or click to browse</div>
<div style="font-size:12px; color:var(--text-muted);">Required columns:
<code>name, email, password, role, department</code> · Optional: <code>subject_name</code> (for
teachers)
</div>
<input type="file" id="csvFileInput" accept=".csv" style="display:none" onchange="handleCSVFile(this)" />
</div>
<div
style="padding:14px; background:rgba(124,58,237,0.07); border:1px solid rgba(124,58,237,0.2); border-radius:8px; font-size:13px; margin-bottom:16px;">
<strong style="color:var(--accent-light);">💡 Tips:</strong>
<ul style="margin:8px 0 0 18px; color:var(--text-muted); line-height:1.8;">
<li>Click <strong style="color:var(--text);">📥 Download Template</strong> to get a pre-filled CSV you can
edit in Excel/Google Sheets.</li>
<li>Rows with duplicate emails will be <strong style="color:var(--warning);">skipped</strong> automatically.
</li>
<li>For teachers, put the subject name exactly as it appears in the system (e.g. <code>Mathematics</code>).
</li>
<li>Roles must be exactly: <code>student</code> or <code>teacher</code>.</li>
</ul>
</div>
<div id="bulkParseErr"
style="display:none; padding:10px 14px; background:rgba(239,68,68,0.1); border:1px solid rgba(239,68,68,0.3); border-radius:8px; color:#f87171; font-size:13px; margin-bottom:12px;">
</div>
</div>
<!-- Step 2: Preview -->
<div id="bulkStep2" style="display:none;">
<div
style="display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; flex-wrap:wrap; gap:8px;">
<div>
<div style="font-weight:700; font-size:14px;">Preview – <span id="bulkPreviewCount">0</span> rows found
</div>
<div style="font-size:12px; color:var(--text-muted);">Review before importing. Red rows will be skipped
(duplicate email).</div>
</div>
<button class="btn btn-secondary btn-sm" onclick="resetBulkModal()">? Upload Different File</button>
</div>
<div class="table-wrap" id="bulkPreviewTable" style="max-height:320px; overflow-y:auto;"></div>
<div style="margin-top:14px; display:flex; gap:10px; align-items:center; flex-wrap:wrap;">
<span id="bulkValidCount" class="badge badge-green" style="font-size:12px;"></span>
<span id="bulkSkipCount" class="badge badge-orange" style="font-size:12px;"></span>
</div>
</div>
<div class="modal-actions">
<button class="btn btn-secondary" onclick="closeModal('bulkModal')">Cancel</button>
<button class="btn btn-primary" id="bulkImportBtn" style="display:none;" onclick="executeBulkImport()">✔
Import Valid Rows</button>
</div>
</div>
</div>
<!-- Toast -->
<div class="toast-container" id="toastContainer"></div>
<script src="js/demo-isolator.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.14.1/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.14.1/firebase-firestore-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.14.1/firebase-auth-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.14.1/firebase-functions-compat.js"></script>
<script src="js/firebase-config.js"></script>
<script src="js/data.js"></script>
<script src="js/auth.js"></script>
<script src="js/charts.js"></script>
<script src="js/firebase-sync.js"></script>
<script src="js/admin-dashboard.js" defer></script>
</body>
</html>