alredfani commited on
Commit
b68c264
·
verified ·
1 Parent(s): fce9015

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +799 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Helmy
3
- emoji: 🌍
4
- colorFrom: yellow
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: helmy
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,799 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ar" dir="rtl">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>نظام إدارة المدرسة</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <style>
9
+ :root {
10
+ --primary-color: #3498db;
11
+ --secondary-color: #2980b9;
12
+ --success-color: #2ecc71;
13
+ --danger-color: #e74c3c;
14
+ --light-color: #ecf0f1;
15
+ --dark-color: #2c3e50;
16
+ --warning-color: #f39c12;
17
+ }
18
+
19
+ * {
20
+ margin: 0;
21
+ padding: 0;
22
+ box-sizing: border-box;
23
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
24
+ }
25
+
26
+ body {
27
+ background-color: #f5f5f5;
28
+ color: #333;
29
+ }
30
+
31
+ .container {
32
+ max-width: 1200px;
33
+ margin: 0 auto;
34
+ padding: 20px;
35
+ }
36
+
37
+ /* Header Styles */
38
+ header {
39
+ background-color: var(--primary-color);
40
+ color: white;
41
+ padding: 20px 0;
42
+ text-align: center;
43
+ border-radius: 0 0 10px 10px;
44
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
45
+ margin-bottom: 30px;
46
+ }
47
+
48
+ header h1 {
49
+ font-size: 2.2rem;
50
+ margin-bottom: 10px;
51
+ }
52
+
53
+ /* Login Form Styles */
54
+ .login-container {
55
+ max-width: 500px;
56
+ margin: 50px auto;
57
+ padding: 30px;
58
+ background-color: white;
59
+ border-radius: 10px;
60
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
61
+ text-align: center;
62
+ }
63
+
64
+ .login-container h2 {
65
+ margin-bottom: 20px;
66
+ color: var(--dark-color);
67
+ }
68
+
69
+ .form-group {
70
+ margin-bottom: 20px;
71
+ text-align: right;
72
+ }
73
+
74
+ .form-group label {
75
+ display: block;
76
+ margin-bottom: 8px;
77
+ font-weight: bold;
78
+ }
79
+
80
+ .form-group input {
81
+ width: 100%;
82
+ padding: 12px;
83
+ border: 1px solid #ddd;
84
+ border-radius: 5px;
85
+ font-size: 16px;
86
+ transition: border-color 0.3s;
87
+ }
88
+
89
+ .form-group input:focus {
90
+ border-color: var(--primary-color);
91
+ outline: none;
92
+ }
93
+
94
+ .btn {
95
+ display: inline-block;
96
+ padding: 12px 24px;
97
+ background-color: var(--primary-color);
98
+ color: white;
99
+ border: none;
100
+ border-radius: 5px;
101
+ cursor: pointer;
102
+ font-size: 16px;
103
+ transition: background-color 0.3s;
104
+ margin: 5px;
105
+ }
106
+
107
+ .btn:hover {
108
+ background-color: var(--secondary-color);
109
+ }
110
+
111
+ .btn-success {
112
+ background-color: var(--success-color);
113
+ }
114
+
115
+ .btn-success:hover {
116
+ background-color: #27ae60;
117
+ }
118
+
119
+ .btn-danger {
120
+ background-color: var(--danger-color);
121
+ }
122
+
123
+ .btn-danger:hover {
124
+ background-color: #c0392b;
125
+ }
126
+
127
+ .btn-warning {
128
+ background-color: var(--warning-color);
129
+ }
130
+
131
+ .btn-warning:hover {
132
+ background-color: #d35400;
133
+ }
134
+
135
+ /* Dashboard Styles */
136
+ .dashboard {
137
+ display: none;
138
+ }
139
+
140
+ .dashboard-header {
141
+ display: flex;
142
+ justify-content: space-between;
143
+ align-items: center;
144
+ margin-bottom: 30px;
145
+ }
146
+
147
+ .welcome-message {
148
+ font-size: 1.5rem;
149
+ color: var(--dark-color);
150
+ }
151
+
152
+ .logout-btn {
153
+ background-color: var(--danger-color);
154
+ }
155
+
156
+ .dashboard-nav {
157
+ display: flex;
158
+ justify-content: center;
159
+ margin-bottom: 30px;
160
+ background-color: white;
161
+ border-radius: 10px;
162
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
163
+ padding: 10px;
164
+ }
165
+
166
+ .nav-link {
167
+ padding: 10px 20px;
168
+ text-decoration: none;
169
+ color: var(--dark-color);
170
+ font-weight: bold;
171
+ border-radius: 5px;
172
+ transition: background-color 0.3s;
173
+ margin: 0 5px;
174
+ }
175
+
176
+ .nav-link:hover, .nav-link.active {
177
+ background-color: var(--primary-color);
178
+ color: white;
179
+ }
180
+
181
+ /* Content Sections */
182
+ .content-section {
183
+ display: none;
184
+ background-color: white;
185
+ padding: 30px;
186
+ border-radius: 10px;
187
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
188
+ margin-bottom: 30px;
189
+ }
190
+
191
+ .content-section.active {
192
+ display: block;
193
+ }
194
+
195
+ .section-title {
196
+ margin-bottom: 20px;
197
+ color: var(--dark-color);
198
+ padding-bottom: 10px;
199
+ border-bottom: 2px solid var(--light-color);
200
+ }
201
+
202
+ /* Teacher Management */
203
+ .teacher-form {
204
+ max-width: 600px;
205
+ margin: 0 auto;
206
+ }
207
+
208
+ /* Results Section */
209
+ .results-form {
210
+ max-width: 800px;
211
+ margin: 0 auto;
212
+ }
213
+
214
+ .subject-group {
215
+ display: flex;
216
+ align-items: center;
217
+ margin-bottom: 15px;
218
+ }
219
+
220
+ .subject-group input[type="text"] {
221
+ flex: 1;
222
+ margin-right: 10px;
223
+ }
224
+
225
+ .subject-group input[type="number"] {
226
+ width: 100px;
227
+ }
228
+
229
+ .add-subject-btn {
230
+ margin-bottom: 20px;
231
+ }
232
+
233
+ /* Search Results */
234
+ .search-results {
235
+ margin-top: 20px;
236
+ }
237
+
238
+ .result-card {
239
+ background-color: var(--light-color);
240
+ padding: 15px;
241
+ border-radius: 5px;
242
+ margin-bottom: 15px;
243
+ }
244
+
245
+ .result-card h3 {
246
+ margin-bottom: 10px;
247
+ color: var(--dark-color);
248
+ }
249
+
250
+ .result-card p {
251
+ margin-bottom: 5px;
252
+ }
253
+
254
+ /* Responsive Design */
255
+ @media (max-width: 768px) {
256
+ .dashboard-nav {
257
+ flex-direction: column;
258
+ }
259
+
260
+ .nav-link {
261
+ margin: 5px 0;
262
+ text-align: center;
263
+ }
264
+
265
+ .form-group {
266
+ margin-bottom: 15px;
267
+ }
268
+ }
269
+
270
+ /* Utility Classes */
271
+ .text-center {
272
+ text-align: center;
273
+ }
274
+
275
+ .mb-3 {
276
+ margin-bottom: 1rem;
277
+ }
278
+
279
+ .alert {
280
+ padding: 15px;
281
+ margin-bottom: 20px;
282
+ border-radius: 5px;
283
+ }
284
+
285
+ .alert-success {
286
+ background-color: #d4edda;
287
+ color: #155724;
288
+ border: 1px solid #c3e6cb;
289
+ }
290
+
291
+ .alert-danger {
292
+ background-color: #f8d7da;
293
+ color: #721c24;
294
+ border: 1px solid #f5c6cb;
295
+ }
296
+ </style>
297
+ </head>
298
+ <body>
299
+ <header>
300
+ <div class="container">
301
+ <h1><i class="fas fa-school"></i> نظام إدارة المدرسة</h1>
302
+ </div>
303
+ </header>
304
+
305
+ <div class="container">
306
+ <!-- Login Section -->
307
+ <div id="login-section">
308
+ <div class="login-container">
309
+ <h2><i class="fas fa-sign-in-alt"></i> تسجيل الدخول</h2>
310
+ <form id="login-form">
311
+ <div class="form-group">
312
+ <label for="username"><i class="fas fa-user"></i> اسم المستخدم</label>
313
+ <input type="text" id="username" required>
314
+ </div>
315
+ <div class="form-group">
316
+ <label for="password"><i class="fas fa-lock"></i> كلمة المرور</label>
317
+ <input type="password" id="password" required>
318
+ </div>
319
+ <button type="submit" class="btn btn-success">تسجيل الدخول</button>
320
+ </form>
321
+ </div>
322
+ </div>
323
+
324
+ <!-- Dashboard Section -->
325
+ <div id="dashboard" class="dashboard">
326
+ <div class="dashboard-header">
327
+ <div class="welcome-message">مرحباً, <span id="logged-in-username"></span></div>
328
+ <button id="logout-btn" class="btn logout-btn"><i class="fas fa-sign-out-alt"></i> تسجيل الخروج</button>
329
+ </div>
330
+
331
+ <div class="dashboard-nav">
332
+ <a href="#" class="nav-link active" data-section="teacher-management"><i class="fas fa-chalkboard-teacher"></i> إدارة المعلمين</a>
333
+ <a href="#" class="nav-link" data-section="results-entry"><i class="fas fa-book"></i> إدخال النتائج</a>
334
+ <a href="#" class="nav-link" data-section="results-search"><i class="fas fa-search"></i> البحث عن النتائج</a>
335
+ </div>
336
+
337
+ <!-- Teacher Management Section -->
338
+ <div id="teacher-management" class="content-section active">
339
+ <h2 class="section-title"><i class="fas fa-chalkboard-teacher"></i> إدارة المعلمين</h2>
340
+ <div id="teacher-form-container" class="teacher-form">
341
+ <h3><i class="fas fa-user-plus"></i> إضافة معلم جديد</h3>
342
+ <form id="add-teacher-form">
343
+ <div class="form-group">
344
+ <label for="teacher-username">اسم المستخدم</label>
345
+ <input type="text" id="teacher-username" required>
346
+ </div>
347
+ <div class="form-group">
348
+ <label for="teacher-password">كلمة المرور</label>
349
+ <input type="password" id="teacher-password" required>
350
+ </div>
351
+ <button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> إضافة معلم</button>
352
+ </form>
353
+ <div id="teacher-list" class="mt-4">
354
+ <h3><i class="fas fa-list"></i> قائمة المعلمين</h3>
355
+ <div id="teachers-container"></div>
356
+ </div>
357
+ </div>
358
+ </div>
359
+
360
+ <!-- Results Entry Section -->
361
+ <div id="results-entry" class="content-section">
362
+ <h2 class="section-title"><i class="fas fa-book"></i> إدخال نتائج الطلاب</h2>
363
+ <div class="results-form">
364
+ <form id="result-form">
365
+ <div class="form-group">
366
+ <label for="student-name">اسم الطالب</label>
367
+ <input type="text" id="student-name" required>
368
+ </div>
369
+ <div class="form-group">
370
+ <label for="student-id">رقم الطالب</label>
371
+ <input type="number" id="student-id" required>
372
+ </div>
373
+ <div class="form-group">
374
+ <label for="student-grade">الصف الدراسي</label>
375
+ <select id="student-grade" class="form-control" required>
376
+ <option value="">اختر الصف</option>
377
+ <option value="الصف الأول">الصف الأول</option>
378
+ <option value="الصف الثاني">الصف الثاني</option>
379
+ <option value="الصف الثالث">الصف الثالث</option>
380
+ <option value="الصف الرابع">الصف الرابع</option>
381
+ <option value="الصف الخامس">الصف الخامس</option>
382
+ <option value="الصف السادس">الصف السادس</option>
383
+ </select>
384
+ </div>
385
+ <div class="form-group">
386
+ <label for="academic-year">العام الدراسي</label>
387
+ <input type="text" id="academic-year" required>
388
+ </div>
389
+ <div class="form-group">
390
+ <label for="semester">الفصل الدراسي</label>
391
+ <select id="semester" required>
392
+ <option value="الأول">الأول</option>
393
+ <option value="الثاني">الثاني</option>
394
+ </select>
395
+ </div>
396
+
397
+ <h4 class="mb-3"><i class="fas fa-subscript"></i> المواد الدراسية</h4>
398
+ <div id="subjects-container">
399
+ <div class="subject-group">
400
+ <input type="text" class="subject-name" placeholder="اسم المادة" required>
401
+ <input type="number" class="subject-grade" placeholder="الدرجة" min="0" max="100" required>
402
+ <button type="button" class="btn btn-danger remove-subject"><i class="fas fa-trash"></i></button>
403
+ </div>
404
+ </div>
405
+ <button type="button" id="add-subject-btn" class="btn btn-warning add-subject-btn"><i class="fas fa-plus"></i> إضافة مادة أخرى</button>
406
+
407
+ <button type="submit" class="btn btn-success"><i class="fas fa-save"></i> حفظ النتائج</button>
408
+ </form>
409
+ </div>
410
+ </div>
411
+
412
+ <!-- Results Search Section -->
413
+ <div id="results-search" class="content-section">
414
+ <h2 class="section-title"><i class="fas fa-search"></i> البحث عن نتائج الطلاب</h2>
415
+ <div class="results-form">
416
+ <form id="search-form">
417
+ <div class="form-group">
418
+ <label for="search-term">ابحث عن طريق:</label>
419
+ <div>
420
+ <input type="radio" name="search-type" id="search-by-name" value="name" checked>
421
+ <label for="search-by-name">اسم الطالب</label>
422
+ &nbsp;&nbsp;
423
+ <input type="radio" name="search-type" id="search-by-id" value="id">
424
+ <label for="search-by-id">رقم الطالب</label>
425
+ </div>
426
+ </div>
427
+ <div class="form-group">
428
+ <label for="search-term">كلمة البحث</label>
429
+ <input type="text" id="search-term" required>
430
+ </div>
431
+ <button type="submit" class="btn btn-primary"><i class="fas fa-search"></i> بحث</button>
432
+ </form>
433
+
434
+ <div id="search-results" class="search-results">
435
+ <!-- Results will appear here -->
436
+ </div>
437
+ </div>
438
+ </div>
439
+ </div>
440
+ </div>
441
+
442
+ <script>
443
+ document.addEventListener('DOMContentLoaded', function() {
444
+ // Admin credentials
445
+ const admin = {
446
+ username: 'alredfani',
447
+ password: '73345'
448
+ };
449
+
450
+ // Teachers data
451
+ let teachers = JSON.parse(localStorage.getItem('teachers')) || [];
452
+
453
+ // Results data
454
+ let results = JSON.parse(localStorage.getItem('results')) || [];
455
+
456
+ // DOM Elements
457
+ const loginSection = document.getElementById('login-section');
458
+ const dashboard = document.getElementById('dashboard');
459
+ const loginForm = document.getElementById('login-form');
460
+ const logoutBtn = document.getElementById('logout-btn');
461
+ const loggedInUsername = document.getElementById('logged-in-username');
462
+ const navLinks = document.querySelectorAll('.nav-link');
463
+ const contentSections = document.querySelectorAll('.content-section');
464
+
465
+ // Teacher management elements
466
+ const addTeacherForm = document.getElementById('add-teacher-form');
467
+ const teachersContainer = document.getElementById('teachers-container');
468
+
469
+ // Results entry elements
470
+ const resultForm = document.getElementById('result-form');
471
+ const subjectsContainer = document.getElementById('subjects-container');
472
+ const addSubjectBtn = document.getElementById('add-subject-btn');
473
+
474
+ // Results search elements
475
+ const searchForm = document.getElementById('search-form');
476
+ const searchResults = document.getElementById('search-results');
477
+
478
+ // Current user
479
+ let currentUser = null;
480
+
481
+ // Show/hide sections
482
+ function showSection(sectionId) {
483
+ contentSections.forEach(section => {
484
+ section.classList.remove('active');
485
+ });
486
+
487
+ document.getElementById(sectionId).classList.add('active');
488
+
489
+ navLinks.forEach(link => {
490
+ link.classList.remove('active');
491
+ if (link.dataset.section === sectionId) {
492
+ link.classList.add('active');
493
+ }
494
+ });
495
+ }
496
+
497
+ // Login function
498
+ function login(username, password) {
499
+ if (username === admin.username && password === admin.password) {
500
+ currentUser = { username: admin.username, isAdmin: true };
501
+ localStorage.setItem('currentUser', JSON.stringify(currentUser));
502
+ return true;
503
+ }
504
+
505
+ const teacher = teachers.find(t => t.username === username && t.password === password);
506
+ if (teacher) {
507
+ currentUser = { username: teacher.username, isAdmin: false };
508
+ localStorage.setItem('currentUser', JSON.stringify(currentUser));
509
+ return true;
510
+ }
511
+
512
+ return false;
513
+ }
514
+
515
+ // Check if user is already logged in
516
+ function checkLoggedIn() {
517
+ const user = JSON.parse(localStorage.getItem('currentUser'));
518
+ if (user) {
519
+ currentUser = user;
520
+ loginSection.style.display = 'none';
521
+ dashboard.style.display = 'block';
522
+ loggedInUsername.textContent = currentUser.username;
523
+
524
+ // Hide teacher management for non-admin users
525
+ if (!currentUser.isAdmin) {
526
+ document.getElementById('teacher-management').style.display = 'none';
527
+ document.querySelector('a[data-section="teacher-management"]').style.display = 'none';
528
+ }
529
+ }
530
+ }
531
+
532
+ // Logout function
533
+ function logout() {
534
+ localStorage.removeItem('currentUser');
535
+ currentUser = null;
536
+ loginSection.style.display = 'block';
537
+ dashboard.style.display = 'none';
538
+ loginForm.reset();
539
+ }
540
+
541
+ // Add teacher function
542
+ function addTeacher(username, password) {
543
+ const teacher = { username, password };
544
+ teachers.push(teacher);
545
+ localStorage.setItem('teachers', JSON.stringify(teachers));
546
+ renderTeachers();
547
+ }
548
+
549
+ // Remove teacher function
550
+ function removeTeacher(username) {
551
+ teachers = teachers.filter(t => t.username !== username);
552
+ localStorage.setItem('teachers', JSON.stringify(teachers));
553
+ renderTeachers();
554
+ }
555
+
556
+ // Render teachers list
557
+ function renderTeachers() {
558
+ teachersContainer.innerHTML = '';
559
+
560
+ if (teachers.length === 0) {
561
+ teachersContainer.innerHTML = '<p>لا يوجد معلمون مسجلون بعد.</p>';
562
+ return;
563
+ }
564
+
565
+ const ul = document.createElement('ul');
566
+ teachers.forEach(teacher => {
567
+ const li = document.createElement('li');
568
+ li.innerHTML = `
569
+ <div class="teacher-item">
570
+ <span>${teacher.username}</span>
571
+ <button class="btn btn-danger btn-sm remove-teacher" data-username="${teacher.username}">
572
+ <i class="fas fa-trash"></i> حذف
573
+ </button>
574
+ </div>
575
+ `;
576
+ ul.appendChild(li);
577
+ });
578
+
579
+ teachersContainer.appendChild(ul);
580
+
581
+ // Add event listeners to remove buttons
582
+ document.querySelectorAll('.remove-teacher').forEach(btn => {
583
+ btn.addEventListener('click', function() {
584
+ removeTeacher(this.dataset.username);
585
+ });
586
+ });
587
+ }
588
+
589
+ // Add result function
590
+ function addResult(result) {
591
+ results.push(result);
592
+ localStorage.setItem('results', JSON.stringify(results));
593
+ }
594
+
595
+ // Search results function
596
+ function searchResults(type, term) {
597
+ term = term.toLowerCase();
598
+
599
+ if (type === 'name') {
600
+ return results.filter(r =>
601
+ r.studentName.toLowerCase().includes(term)
602
+ );
603
+ } else {
604
+ return results.filter(r =>
605
+ r.studentId.toString().includes(term)
606
+ );
607
+ }
608
+ }
609
+
610
+ // Render search results
611
+ function renderSearchResults(foundResults) {
612
+ searchResults.innerHTML = '';
613
+
614
+ if (foundResults.length === 0) {
615
+ searchResults.innerHTML = '<p class="alert alert-danger">لم يتم العثور على نتائج تطابق بحثك.</p>';
616
+ return;
617
+ }
618
+
619
+ foundResults.forEach(result => {
620
+ const total = result.subjects.reduce((sum, subject) => sum + subject.grade, 0);
621
+ const average = total / result.subjects.length;
622
+
623
+ const card = document.createElement('div');
624
+ card.className = 'result-card';
625
+ card.innerHTML = `
626
+ <h3>${result.studentName} (${result.studentId})</h3>
627
+ <p><strong>الصف:</strong> ${result.grade}</p>
628
+ <p><strong>العام الدراسي:</strong> ${result.academicYear}</p>
629
+ <p><strong>الفصل الدراسي:</strong> ${result.semester}</p>
630
+ <hr>
631
+ <h4>المواد والدرجات:</h4>
632
+ <ul>
633
+ ${result.subjects.map(subject => `
634
+ <li>${subject.name}: ${subject.grade}</li>
635
+ `).join('')}
636
+ </ul>
637
+ <p><strong>المجموع:</strong> ${total}</p>
638
+ <p><strong>النسبة المئوية:</strong> ${average.toFixed(2)}%</p>
639
+ `;
640
+
641
+ searchResults.appendChild(card);
642
+ });
643
+ }
644
+
645
+ // Event Listeners
646
+ loginForm.addEventListener('submit', function(e) {
647
+ e.preventDefault();
648
+
649
+ const username = document.getElementById('username').value;
650
+ const password = document.getElementById('password').value;
651
+
652
+ if (login(username, password)) {
653
+ loginSection.style.display = 'none';
654
+ dashboard.style.display = 'block';
655
+ loggedInUsername.textContent = currentUser.username;
656
+
657
+ // Hide teacher management for non-admin users
658
+ if (!currentUser.isAdmin) {
659
+ document.getElementById('teacher-management').style.display = 'none';
660
+ document.querySelector('a[data-section="teacher-management"]').style.display = 'none';
661
+ }
662
+
663
+ renderTeachers();
664
+ } else {
665
+ alert('اسم المستخدم أو كلمة المرور غير صحيحة');
666
+ }
667
+ });
668
+
669
+ logoutBtn.addEventListener('click', logout);
670
+
671
+ navLinks.forEach(link => {
672
+ link.addEventListener('click', function(e) {
673
+ e.preventDefault();
674
+ showSection(this.dataset.section);
675
+ });
676
+ });
677
+
678
+ addTeacherForm.addEventListener('submit', function(e) {
679
+ e.preventDefault();
680
+
681
+ const username = document.getElementById('teacher-username').value;
682
+ const password = document.getElementById('teacher-password').value;
683
+
684
+ // Check if teacher already exists
685
+ if (teachers.some(t => t.username === username)) {
686
+ alert('اسم المستخدم موجود بالفعل');
687
+ return;
688
+ }
689
+
690
+ addTeacher(username, password);
691
+ addTeacherForm.reset();
692
+ });
693
+
694
+ // Add subject field
695
+ addSubjectBtn.addEventListener('click', function() {
696
+ const subjectGroup = document.createElement('div');
697
+ subjectGroup.className = 'subject-group';
698
+ subjectGroup.innerHTML = `
699
+ <input type="text" class="subject-name" placeholder="اسم المادة" required>
700
+ <input type="number" class="subject-grade" placeholder="الدرجة" min="0" max="100" required>
701
+ <button type="button" class="btn btn-danger remove-subject"><i class="fas fa-trash"></i></button>
702
+ `;
703
+
704
+ subjectsContainer.appendChild(subjectGroup);
705
+
706
+ // Add event listener to remove button
707
+ const removeBtn = subjectGroup.querySelector('.remove-subject');
708
+ removeBtn.addEventListener('click', function() {
709
+ if (subjectsContainer.children.length > 1) {
710
+ subjectGroup.remove();
711
+ } else {
712
+ alert('يجب أن يكون هناك مادة واحدة على الأقل');
713
+ }
714
+ });
715
+ });
716
+
717
+ // Add event listeners to existing remove buttons
718
+ document.querySelectorAll('.remove-subject').forEach(btn => {
719
+ btn.addEventListener('click', function() {
720
+ if (subjectsContainer.children.length > 1) {
721
+ this.parentElement.remove();
722
+ } else {
723
+ alert('يجب أن يكون هناك مادة واحدة على الأقل');
724
+ }
725
+ });
726
+ });
727
+
728
+ resultForm.addEventListener('submit', function(e) {
729
+ e.preventDefault();
730
+
731
+ const studentName = document.getElementById('student-name').value;
732
+ const studentId = document.getElementById('student-id').value;
733
+ const grade = document.getElementById('student-grade').value;
734
+ const academicYear = document.getElementById('academic-year').value;
735
+ const semester = document.getElementById('semester').value;
736
+
737
+ const subjectInputs = document.querySelectorAll('.subject-group');
738
+ const subjects = [];
739
+
740
+ subjectInputs.forEach(group => {
741
+ const name = group.querySelector('.subject-name').value;
742
+ const grade = parseInt(group.querySelector('.subject-grade').value);
743
+
744
+ subjects.push({
745
+ name,
746
+ grade
747
+ });
748
+ });
749
+
750
+ const result = {
751
+ studentName,
752
+ studentId,
753
+ grade,
754
+ academicYear,
755
+ semester,
756
+ subjects,
757
+ teacher: currentUser.username,
758
+ timestamp: new Date().toISOString()
759
+ };
760
+
761
+ addResult(result);
762
+
763
+ alert('تم حفظ النتائج بنجاح');
764
+ resultForm.reset();
765
+
766
+ // Reset subjects to one field
767
+ subjectsContainer.innerHTML = `
768
+ <div class="subject-group">
769
+ <input type="text" class="subject-name" placeholder="اسم المادة" required>
770
+ <input type="number" class="subject-grade" placeholder="الدرجة" min="0" max="100" required>
771
+ <button type="button" class="btn btn-danger remove-subject"><i class="fas fa-trash"></i></button>
772
+ </div>
773
+ `;
774
+
775
+ // Add event listener to new remove button
776
+ document.querySelector('.remove-subject').addEventListener('click', function() {
777
+ alert('يجب أن يكون هناك مادة واحدة على الأقل');
778
+ });
779
+ });
780
+
781
+ searchForm.addEventListener('submit', function(e) {
782
+ e.preventDefault();
783
+
784
+ const searchType = document.querySelector('input[name="search-type"]:checked').value;
785
+ const searchTerm = document.getElementById('search-term').value;
786
+
787
+ const foundResults = searchResults(searchType, searchTerm);
788
+ renderSearchResults(foundResults);
789
+ });
790
+
791
+ // Initialize the app
792
+ checkLoggedIn();
793
+ if (currentUser) {
794
+ renderTeachers();
795
+ }
796
+ });
797
+ </script>
798
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body>
799
+ </html>