File size: 10,040 Bytes
6d51792
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BrainyBots | Student Management</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        .neon-card {
            background: rgba(15, 23, 42, 0.7);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(94, 234, 212, 0.2);
            transition: all 0.3s ease;
        }
        .neon-card:hover {
            border-color: rgba(94, 234, 212, 0.5);
            box-shadow: 0 0 15px rgba(94, 234, 212, 0.3);
        }
        .glow-text {
            text-shadow: 0 0 8px rgba(94, 234, 212, 0.6);
        }
    </style>
</head>
<body class="bg-slate-900 text-gray-100 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <div class="flex justify-between items-center mb-8">
            <h1 class="text-3xl font-bold text-teal-400 glow-text">BrainyBots Student Database</h1>
            <button id="addStudentBtn" class="bg-teal-600 hover:bg-teal-500 text-white px-4 py-2 rounded-lg flex items-center">
                <i data-feather="user-plus" class="mr-2"></i> Add Student
            </button>
        </div>

        <!-- Search and Filters -->
        <div class="neon-card rounded-xl p-6 mb-8">
            <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                <div>
                    <label class="block text-sm font-medium mb-1 text-teal-300">Search</label>
                    <input type="text" placeholder="Student ID or Name" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-4 py-2 focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
                </div>
                <div>
                    <label class="block text-sm font-medium mb-1 text-teal-300">Program</label>
                    <select class="w-full bg-slate-800 border border-slate-700 rounded-lg px-4 py-2 focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
                        <option>All Programs</option>
                        <option>Quantum Computing</option>
                        <option>Neural Networks</option>
                        <option>Robotics</option>
                        <option>Biotech</option>
                    </select>
                </div>
                <div>
                    <label class="block text-sm font-medium mb-1 text-teal-300">Status</label>
                    <select class="w-full bg-slate-800 border border-slate-700 rounded-lg px-4 py-2 focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
                        <option>All Students</option>
                        <option>Active</option>
                        <option>Graduated</option>
                        <option>On Leave</option>
                    </select>
                </div>
            </div>
        </div>

        <!-- Student Table -->
        <div class="neon-card rounded-xl p-6 overflow-x-auto">
            <table class="w-full">
                <thead>
                    <tr class="border-b border-slate-700">
                        <th class="text-left py-3 px-4 text-teal-400">Student ID</th>
                        <th class="text-left py-3 px-4 text-teal-400">Full Name</th>
                        <th class="text-left py-3 px-4 text-teal-400">Program</th>
                        <th class="text-left py-3 px-4 text-teal-400">Enrollment Date</th>
                        <th class="text-left py-3 px-4 text-teal-400">Status</th>
                        <th class="text-right py-3 px-4 text-teal-400">Actions</th>
                    </tr>
                </thead>
                <tbody id="studentTableBody">
                    <!-- Student data will be loaded here -->
                </tbody>
            </table>
        </div>
    </div>

    <!-- Add Student Modal -->
    <div id="studentModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
        <div class="bg-slate-800 rounded-xl p-6 w-full max-w-md">
            <div class="flex justify-between items-center mb-4">
                <h3 class="text-xl font-bold text-teal-400">Add New Student</h3>
                <button id="closeModalBtn" class="text-gray-400 hover:text-white">
                    <i data-feather="x"></i>
                </button>
            </div>
            <form id="studentForm" class="space-y-4">
                <div>
                    <label class="block text-sm font-medium mb-1 text-teal-300">Full Name</label>
                    <input type="text" required class="w-full bg-slate-700 border border-slate-600 rounded-lg px-4 py-2 focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
                </div>
                <div>
                    <label class="block text-sm font-medium mb-1 text-teal-300">Student ID</label>
                    <input type="text" required class="w-full bg-slate-700 border border-slate-600 rounded-lg px-4 py-2 focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
                </div>
                <div>
                    <label class="block text-sm font-medium mb-1 text-teal-300">Program</label>
                    <select required class="w-full bg-slate-700 border border-slate-600 rounded-lg px-4 py-2 focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
                        <option value="">Select Program</option>
                        <option>Quantum Computing</option>
                        <option>Neural Networks</option>
                        <option>Robotics</option>
                        <option>Biotech</option>
                    </select>
                </div>
                <div>
                    <label class="block text-sm font-medium mb-1 text-teal-300">Enrollment Date</label>
                    <input type="date" required class="w-full bg-slate-700 border border-slate-600 rounded-lg px-4 py-2 focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
                </div>
                <div class="pt-4">
                    <button type="submit" class="w-full bg-teal-600 hover:bg-teal-500 text-white py-2 rounded-lg flex items-center justify-center">
                        <i data-feather="save" class="mr-2"></i> Save Student
                    </button>
                </div>
            </form>
        </div>
    </div>

    <script>
        feather.replace();
        
        // Modal functionality
        const modal = document.getElementById('studentModal');
        const addBtn = document.getElementById('addStudentBtn');
        const closeBtn = document.getElementById('closeModalBtn');

        addBtn.addEventListener('click', () => modal.classList.remove('hidden'));
        closeBtn.addEventListener('click', () => modal.classList.add('hidden'));
        
        // Sample data - in a real app this would come from an API
        const sampleStudents = [
            { id: 'QC-2023-001', name: 'Alex Turing', program: 'Quantum Computing', date: '2023-09-15', status: 'Active' },
            { id: 'NN-2023-042', name: 'Jamie Lovelace', program: 'Neural Networks', date: '2023-08-22', status: 'Active' },
            { id: 'RB-2023-017', name: 'Taylor Hopper', program: 'Robotics', date: '2023-07-30', status: 'On Leave' },
            { id: 'BT-2023-089', name: 'Riley Curie', program: 'Biotech', date: '2023-09-05', status: 'Active' }
        ];

        // Render student table
        function renderStudents() {
            const tableBody = document.getElementById('studentTableBody');
            tableBody.innerHTML = '';
            
            sampleStudents.forEach(student => {
                const row = document.createElement('tr');
                row.className = 'border-b border-slate-700 hover:bg-slate-800';
                row.innerHTML = `
                    <td class="py-3 px-4">${student.id}</td>
                    <td class="py-3 px-4">${student.name}</td>
                    <td class="py-3 px-4">${student.program}</td>
                    <td class="py-3 px-4">${student.date}</td>
                    <td class="py-3 px-4"><span class="px-2 py-1 rounded-full text-xs ${getStatusClass(student.status)}">${student.status}</span></td>
                    <td class="py-3 px-4 text-right">
                        <button class="text-teal-400 hover:text-teal-300 mr-3" onclick="viewStudent('${student.id}')">
                            <i data-feather="eye"></i>
                        </button>
                        <button class="text-blue-400 hover:text-blue-300 mr-3">
                            <i data-feather="edit"></i>
                        </button>
                        <button class="text-red-400 hover:text-red-300" onclick="deleteStudent('${student.id}')">
                            <i data-feather="trash-2"></i>
                        </button>
                    </td>
                `;
                tableBody.appendChild(row);
            });
            feather.replace();
        }

        function getStatusClass(status) {
            switch(status) {
                case 'Active': return 'bg-green-900 text-green-300';
                case 'Graduated': return 'bg-purple-900 text-purple-300';
                case 'On Leave': return 'bg-amber-900 text-amber-300';
                default: return 'bg-gray-900 text-gray-300';
            }
        }

        function viewStudent(id) {
            alert(`Viewing student with ID: ${id}`);
        }

        function deleteStudent(id) {
            if(confirm(`Are you sure you want to delete student ${id}?`)) {
                alert(`Student ${id} deleted successfully!`);
                // In a real app, you would call an API here
                renderStudents();
            }
        }

        // Initialize the page
        document.addEventListener('DOMContentLoaded', renderStudents);
    </script>
</body>
</html>