saidbakli commited on
Commit
29dc09f
·
verified ·
1 Parent(s): 360064c

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +1837 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ma Classe
3
- emoji: 🐨
4
- colorFrom: indigo
5
- colorTo: gray
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: ma-classe
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: red
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,1837 @@
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
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css">
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
10
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
12
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
13
+ <style>
14
+ @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');
15
+
16
+ body {
17
+ font-family: 'Tajawal', sans-serif;
18
+ transition: background-color 0.3s, color 0.3s;
19
+ }
20
+
21
+ .rtl {
22
+ direction: rtl;
23
+ }
24
+
25
+ .subject-icon {
26
+ transition: transform 0.3s;
27
+ }
28
+
29
+ .subject-icon:hover {
30
+ transform: scale(1.1);
31
+ }
32
+
33
+ .dark-mode {
34
+ background-color: #1a202c;
35
+ color: #f7fafc;
36
+ }
37
+
38
+ .dark-mode .box {
39
+ background-color: #2d3748;
40
+ color: #f7fafc;
41
+ }
42
+
43
+ .dark-mode .table {
44
+ background-color: #2d3748;
45
+ color: #f7fafc;
46
+ }
47
+
48
+ .dark-mode .table th, .dark-mode .table td {
49
+ color: #f7fafc;
50
+ border-color: #4a5568;
51
+ }
52
+
53
+ .dark-mode input, .dark-mode select {
54
+ background-color: #4a5568;
55
+ color: #f7fafc;
56
+ border-color: #4a5568;
57
+ }
58
+
59
+ .dark-mode .button.is-primary {
60
+ background-color: #4299e1;
61
+ }
62
+
63
+ .dark-mode .button.is-danger {
64
+ background-color: #f56565;
65
+ }
66
+
67
+ .dark-mode .notification {
68
+ background-color: #2d3748;
69
+ color: #f7fafc;
70
+ }
71
+
72
+ .gallery-item {
73
+ transition: transform 0.3s;
74
+ }
75
+
76
+ .gallery-item:hover {
77
+ transform: scale(1.05);
78
+ }
79
+
80
+ .highlight {
81
+ animation: highlight 2s;
82
+ }
83
+
84
+ @keyframes highlight {
85
+ 0% { background-color: yellow; }
86
+ 100% { background-color: transparent; }
87
+ }
88
+ </style>
89
+ </head>
90
+ <body class="rtl">
91
+ <!-- Login Section -->
92
+ <section id="login-section" class="hero is-fullheight">
93
+ <div class="hero-body">
94
+ <div class="container">
95
+ <div class="columns is-centered">
96
+ <div class="column is-5-tablet is-4-desktop is-3-widescreen">
97
+ <div class="box p-6 has-text-centered">
98
+ <img src="https://img.icons8.com/color/96/000000/school.png" alt="School Logo" class="mb-4">
99
+ <h1 class="title is-3 mb-6">نظام إدارة الفصل الدراسي</h1>
100
+ <h2 class="subtitle is-5 mb-6">مدرسة الشهيد حموم سعيد - بجاية</h2>
101
+
102
+ <div class="field">
103
+ <label class="label">اسم المستخدم</label>
104
+ <div class="control has-icons-left">
105
+ <input id="username" class="input" type="text" placeholder="اسم المستخدم" required>
106
+ <span class="icon is-small is-left">
107
+ <i class="fas fa-user"></i>
108
+ </span>
109
+ </div>
110
+ </div>
111
+
112
+ <div class="field">
113
+ <label class="label">كلمة المرور</label>
114
+ <div class="control has-icons-left">
115
+ <input id="password" class="input" type="password" placeholder="كلمة المرور" required>
116
+ <span class="icon is-small is-left">
117
+ <i class="fas fa-lock"></i>
118
+ </span>
119
+ </div>
120
+ </div>
121
+
122
+ <div class="field mt-5">
123
+ <button id="login-btn" class="button is-primary is-fullwidth">
124
+ <span class="icon">
125
+ <i class="fas fa-sign-in-alt"></i>
126
+ </span>
127
+ <span>تسجيل الدخول</span>
128
+ </button>
129
+ </div>
130
+
131
+ <div id="login-error" class="notification is-danger is-light is-hidden">
132
+ اسم المستخدم أو كلمة المرور غير صحيحة!
133
+ </div>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </section>
140
+
141
+ <!-- Main App (Hidden Initially) -->
142
+ <div id="app" class="is-hidden">
143
+ <!-- Navigation Bar -->
144
+ <nav class="navbar is-primary" role="navigation" aria-label="main navigation">
145
+ <div class="navbar-brand">
146
+ <a class="navbar-item" href="#">
147
+ <i class="fas fa-school mr-2"></i>
148
+ <span>فصلي الأول</span>
149
+ </a>
150
+
151
+ <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasic">
152
+ <span aria-hidden="true"></span>
153
+ <span aria-hidden="true"></span>
154
+ <span aria-hidden="true"></span>
155
+ </a>
156
+ </div>
157
+
158
+ <div id="navbarBasic" class="navbar-menu">
159
+ <div class="navbar-start">
160
+ <a id="home-link" class="navbar-item">
161
+ <i class="fas fa-home mr-2"></i>
162
+ الصفحة الرئيسية
163
+ </a>
164
+
165
+ <a id="grades-link" class="navbar-item">
166
+ <i class="fas fa-table mr-2"></i>
167
+ إدارة الدرجات
168
+ </a>
169
+
170
+ <a id="gallery-link" class="navbar-item">
171
+ <i class="fas fa-images mr-2"></i>
172
+ معرض الأعمال
173
+ </a>
174
+ </div>
175
+
176
+ <div class="navbar-end">
177
+ <div class="navbar-item">
178
+ <div class="buttons">
179
+ <button id="dark-mode-toggle" class="button is-light">
180
+ <span class="icon">
181
+ <i class="fas fa-moon"></i>
182
+ </span>
183
+ <span>الوضع الليلي</span>
184
+ </button>
185
+
186
+ <button id="logout-btn" class="button is-light">
187
+ <span class="icon">
188
+ <i class="fas fa-sign-out-alt"></i>
189
+ </span>
190
+ <span>تسجيل الخروج</span>
191
+ </button>
192
+ </div>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ </nav>
197
+
198
+ <!-- Notification Bell -->
199
+ <div class="notification-bell fixed top-4 right-4 z-50">
200
+ <div class="dropdown is-right is-hoverable">
201
+ <div class="dropdown-trigger">
202
+ <button id="notification-btn" class="button is-primary is-rounded" aria-haspopup="true" aria-controls="notification-menu">
203
+ <span class="icon">
204
+ <i class="fas fa-bell"></i>
205
+ </span>
206
+ <span id="notification-count" class="tag is-danger is-small is-rounded">0</span>
207
+ </button>
208
+ </div>
209
+ <div class="dropdown-menu" id="notification-menu" role="menu">
210
+ <div class="dropdown-content">
211
+ <div class="dropdown-item">
212
+ <p>الإشعارات</p>
213
+ </div>
214
+ <hr class="dropdown-divider">
215
+ <div id="notification-items" class="dropdown-item">
216
+ <p class="has-text-grey">لا توجد إشعارات جديدة</p>
217
+ </div>
218
+ </div>
219
+ </div>
220
+ </div>
221
+ </div>
222
+
223
+ <!-- Main Content -->
224
+ <div class="container mt-5">
225
+ <!-- Home Page -->
226
+ <section id="home-page" class="section">
227
+ <h1 class="title has-text-centered mb-6">مرحباً بك في نظام إدارة الفصل</h1>
228
+ <h2 class="subtitle has-text-centered mb-6">اختر المادة التي تريد إدارتها</h2>
229
+
230
+ <div class="columns is-multiline is-centered">
231
+ <!-- Arabic -->
232
+ <div class="column is-2-desktop is-4-tablet">
233
+ <div class="box has-text-centered subject-icon" data-subject="arabic">
234
+ <span class="icon is-large mb-3">
235
+ <i class="fas fa-language fa-3x"></i>
236
+ </span>
237
+ <h3 class="title is-5">اللغة العربية</h3>
238
+ </div>
239
+ </div>
240
+
241
+ <!-- Math -->
242
+ <div class="column is-2-desktop is-4-tablet">
243
+ <div class="box has-text-centered subject-icon" data-subject="math">
244
+ <span class="icon is-large mb-3">
245
+ <i class="fas fa-square-root-alt fa-3x"></i>
246
+ </span>
247
+ <h3 class="title is-5">الرياضيات</h3>
248
+ </div>
249
+ </div>
250
+
251
+ <!-- Islamic -->
252
+ <div class="column is-2-desktop is-4-tablet">
253
+ <div class="box has-text-centered subject-icon" data-subject="islamic">
254
+ <span class="icon is-large mb-3">
255
+ <i class="fas fa-mosque fa-3x"></i>
256
+ </span>
257
+ <h3 class="title is-5">التربية الإسلامية</h3>
258
+ </div>
259
+ </div>
260
+
261
+ <!-- Art -->
262
+ <div class="column is-2-desktop is-4-tablet">
263
+ <div class="box has-text-centered subject-icon" data-subject="art">
264
+ <span class="icon is-large mb-3">
265
+ <i class="fas fa-palette fa-3x"></i>
266
+ </span>
267
+ <h3 class="title is-5">التربية الفنية</h3>
268
+ </div>
269
+ </div>
270
+
271
+ <!-- Music -->
272
+ <div class="column is-2-desktop is-4-tablet">
273
+ <div class="box has-text-centered subject-icon" data-subject="music">
274
+ <span class="icon is-large mb-3">
275
+ <i class="fas fa-music fa-3x"></i>
276
+ </span>
277
+ <h3 class="title is-5">التربية الموسيقية</h3>
278
+ </div>
279
+ </div>
280
+ </div>
281
+
282
+ <div class="has-text-centered mt-6">
283
+ <button id="view-grades-btn" class="button is-primary is-medium">
284
+ <span class="icon">
285
+ <i class="fas fa-table"></i>
286
+ </span>
287
+ <span>عرض كافة الدرجات</span>
288
+ </button>
289
+ </div>
290
+ </section>
291
+
292
+ <!-- Subject Pages (Hidden Initially) -->
293
+ <section id="subject-pages" class="section is-hidden">
294
+ <div class="level">
295
+ <div class="level-left">
296
+ <button id="back-to-home" class="button is-light">
297
+ <span class="icon">
298
+ <i class="fas fa-arrow-right"></i>
299
+ </span>
300
+ <span>العودة إلى الرئيسية</span>
301
+ </button>
302
+ </div>
303
+ <div class="level-right">
304
+ <h1 id="subject-title" class="title"></h1>
305
+ </div>
306
+ </div>
307
+
308
+ <div class="tabs is-centered">
309
+ <ul>
310
+ <li class="is-active" data-tab="grades"><a>الدرجات</a></li>
311
+ <li data-tab="stats"><a>الإحصائيات</a></li>
312
+ <li data-tab="activities"><a>الأنشطة</a></li>
313
+ </ul>
314
+ </div>
315
+
316
+ <!-- Grades Tab -->
317
+ <div id="grades-tab" class="tab-content">
318
+ <div class="box">
319
+ <div class="table-container">
320
+ <table class="table is-fullwidth is-striped">
321
+ <thead>
322
+ <tr>
323
+ <th>الرقم</th>
324
+ <th>اسم التلميذ</th>
325
+ <th>الاختبار 1</th>
326
+ <th>الاختبار 2</th>
327
+ <th>الاختبار 3</th>
328
+ <th>المعدل</th>
329
+ <th>الملاحظات</th>
330
+ </tr>
331
+ </thead>
332
+ <tbody id="subject-grades-table">
333
+ <!-- Will be populated by JavaScript -->
334
+ </tbody>
335
+ </table>
336
+ </div>
337
+
338
+ <div class="buttons is-centered mt-5">
339
+ <button class="button is-primary save-grades">
340
+ <span class="icon">
341
+ <i class="fas fa-save"></i>
342
+ </span>
343
+ <span>حفظ التغييرات</span>
344
+ </button>
345
+ <button class="button is-info export-pdf">
346
+ <span class="icon">
347
+ <i class="fas fa-file-pdf"></i>
348
+ </span>
349
+ <span>تصدير PDF</span>
350
+ </button>
351
+ <button class="button is-success export-excel">
352
+ <span class="icon">
353
+ <i class="fas fa-file-excel"></i>
354
+ </span>
355
+ <span>تصدير Excel</span>
356
+ </button>
357
+ </div>
358
+ </div>
359
+ </div>
360
+
361
+ <!-- Stats Tab -->
362
+ <div id="stats-tab" class="tab-content is-hidden">
363
+ <div class="columns">
364
+ <div class="column">
365
+ <div class="box">
366
+ <h2 class="title is-5 has-text-centered">توزيع الدرجات</h2>
367
+ <canvas id="grades-chart"></canvas>
368
+ </div>
369
+ </div>
370
+ <div class="column">
371
+ <div class="box">
372
+ <h2 class="title is-5 has-text-centered">المعدلات حسب الجنس</h2>
373
+ <canvas id="gender-chart"></canvas>
374
+ </div>
375
+ </div>
376
+ </div>
377
+
378
+ <div class="box mt-4">
379
+ <h2 class="title is-5 has-text-centered">أعلى 5 وأقل 5 درجات</h2>
380
+ <div class="columns">
381
+ <div class="column">
382
+ <div class="notification is-info">
383
+ <h3 class="title is-6">أعلى 5 درجات</h3>
384
+ <ol id="top-students" class="ml-4">
385
+ <!-- Will be populated by JavaScript -->
386
+ </ol>
387
+ </div>
388
+ </div>
389
+ <div class="column">
390
+ <div class="notification is-warning">
391
+ <h3 class="title is-6">أقل 5 درجات</h3>
392
+ <ol id="bottom-students" class="ml-4">
393
+ <!-- Will be populated by JavaScript -->
394
+ </ol>
395
+ </div>
396
+ </div>
397
+ </div>
398
+ </div>
399
+ </div>
400
+
401
+ <!-- Activities Tab -->
402
+ <div id="activities-tab" class="tab-content is-hidden">
403
+ <div class="box">
404
+ <h2 class="title is-5 has-text-centered">أنشطة المادة</h2>
405
+ <div class="columns is-multiline" id="subject-activities">
406
+ <!-- Will be populated by JavaScript -->
407
+ </div>
408
+
409
+ <div class="field mt-5">
410
+ <label class="label">إضافة نشاط جديد</label>
411
+ <div class="control">
412
+ <input id="new-activity-title" class="input" type="text" placeholder="عنوان النشاط">
413
+ </div>
414
+ <div class="control mt-3">
415
+ <textarea id="new-activity-desc" class="textarea" placeholder="وصف النشاط"></textarea>
416
+ </div>
417
+ <div class="control mt-3">
418
+ <input id="new-activity-image" class="input" type="file" accept="image/*">
419
+ </div>
420
+ <button id="add-activity-btn" class="button is-primary mt-3">
421
+ <span class="icon">
422
+ <i class="fas fa-plus"></i>
423
+ </span>
424
+ <span>إضافة النشاط</span>
425
+ </button>
426
+ </div>
427
+ </div>
428
+ </div>
429
+ </section>
430
+
431
+ <!-- All Grades Page -->
432
+ <section id="grades-page" class="section is-hidden">
433
+ <div class="level">
434
+ <div class="level-left">
435
+ <button id="back-to-home-from-grades" class="button is-light">
436
+ <span class="icon">
437
+ <i class="fas fa-arrow-right"></i>
438
+ </span>
439
+ <span>العودة إلى الرئيسية</span>
440
+ </button>
441
+ </div>
442
+ <div class="level-right">
443
+ <h1 class="title">كافة الدرجات</h1>
444
+ </div>
445
+ </div>
446
+
447
+ <div class="tabs is-centered">
448
+ <ul>
449
+ <li class="is-active" data-tab="all-grades"><a>كافة الدرجات</a></li>
450
+ <li data-tab="overall-stats"><a>إحصائيات عامة</a></li>
451
+ <li data-tab="missing-grades"><a>الدرجات الناقصة</a></li>
452
+ </ul>
453
+ </div>
454
+
455
+ <!-- All Grades Tab -->
456
+ <div id="all-grades-tab" class="tab-content">
457
+ <div class="box">
458
+ <div class="table-container">
459
+ <table class="table is-fullwidth is-striped">
460
+ <thead>
461
+ <tr>
462
+ <th>الرقم</th>
463
+ <th>اسم التلميذ</th>
464
+ <th>العربية</th>
465
+ <th>الرياضيات</th>
466
+ <th>الإسلامية</th>
467
+ <th>الفنية</th>
468
+ <th>الموسيقية</th>
469
+ <th>المعدل العام</th>
470
+ </tr>
471
+ </thead>
472
+ <tbody id="all-grades-table">
473
+ <!-- Will be populated by JavaScript -->
474
+ </tbody>
475
+ </table>
476
+ </div>
477
+
478
+ <div class="buttons is-centered mt-5">
479
+ <button class="button is-primary save-all-grades">
480
+ <span class="icon">
481
+ <i class="fas fa-save"></i>
482
+ </span>
483
+ <span>حفظ التغييرات</span>
484
+ </button>
485
+ <button class="button is-info export-all-pdf">
486
+ <span class="icon">
487
+ <i class="fas fa-file-pdf"></i>
488
+ </span>
489
+ <span>تصدير PDF</span>
490
+ </button>
491
+ <button class="button is-success export-all-excel">
492
+ <span class="icon">
493
+ <i class="fas fa-file-excel"></i>
494
+ </span>
495
+ <span>تصدير Excel</span>
496
+ </button>
497
+ </div>
498
+ </div>
499
+ </div>
500
+
501
+ <!-- Overall Stats Tab -->
502
+ <div id="overall-stats-tab" class="tab-content is-hidden">
503
+ <div class="columns">
504
+ <div class="column">
505
+ <div class="box">
506
+ <h2 class="title is-5 has-text-centered">المعدلات حسب المواد</h2>
507
+ <canvas id="subjects-chart"></canvas>
508
+ </div>
509
+ </div>
510
+ <div class="column">
511
+ <div class="box">
512
+ <h2 class="title is-5 has-text-centered">أفضل 5 تلاميذ</h2>
513
+ <canvas id="top-students-chart"></canvas>
514
+ </div>
515
+ </div>
516
+ </div>
517
+
518
+ <div class="box mt-4">
519
+ <h2 class="title is-5 has-text-centered">التصنيف العام</h2>
520
+ <div class="table-container">
521
+ <table class="table is-fullwidth is-striped">
522
+ <thead>
523
+ <tr>
524
+ <th>الترتيب</th>
525
+ <th>اسم التلميذ</th>
526
+ <th>المعدل العام</th>
527
+ <th>التقدير</th>
528
+ </tr>
529
+ </thead>
530
+ <tbody id="ranking-table">
531
+ <!-- Will be populated by JavaScript -->
532
+ </tbody>
533
+ </table>
534
+ </div>
535
+ </div>
536
+ </div>
537
+
538
+ <!-- Missing Grades Tab -->
539
+ <div id="missing-grades-tab" class="tab-content is-hidden">
540
+ <div class="box">
541
+ <h2 class="title is-5 has-text-centered">الدرجات الناقصة</h2>
542
+ <div class="table-container">
543
+ <table class="table is-fullwidth is-striped">
544
+ <thead>
545
+ <tr>
546
+ <th>اسم التلميذ</th>
547
+ <th>المادة</th>
548
+ <th>الاختبار الناقص</th>
549
+ <th>حالة التنبيه</th>
550
+ </tr>
551
+ </thead>
552
+ <tbody id="missing-grades-table">
553
+ <!-- Will be populated by JavaScript -->
554
+ </tbody>
555
+ </table>
556
+ </div>
557
+
558
+ <div class="buttons is-centered mt-5">
559
+ <button id="send-reminders" class="button is-warning">
560
+ <span class="icon">
561
+ <i class="fas fa-bell"></i>
562
+ </span>
563
+ <span>إرسال تنبيهات</span>
564
+ </button>
565
+ </div>
566
+ </div>
567
+ </div>
568
+ </section>
569
+
570
+ <!-- Gallery Page -->
571
+ <section id="gallery-page" class="section is-hidden">
572
+ <div class="level">
573
+ <div class="level-left">
574
+ <button id="back-to-home-from-gallery" class="button is-light">
575
+ <span class="icon">
576
+ <i class="fas fa-arrow-right"></i>
577
+ </span>
578
+ <span>العودة إلى الرئيسية</span>
579
+ </button>
580
+ </div>
581
+ <div class="level-right">
582
+ <h1 class="title">معرض الأعمال الفنية</h1>
583
+ </div>
584
+ </div>
585
+
586
+ <div class="tabs is-centered">
587
+ <ul>
588
+ <li class="is-active" data-tab="all-activities"><a>جميع الأنشطة</a></li>
589
+ <li data-tab="arabic-activities"><a>اللغة العربية</a></li>
590
+ <li data-tab="math-activities"><a>الرياضيات</a></li>
591
+ <li data-tab="islamic-activities"><a>الإسلامية</a></li>
592
+ <li data-tab="art-activities"><a>الفنية</a></li>
593
+ <li data-tab="music-activities"><a>الموسيقية</a></li>
594
+ </ul>
595
+ </div>
596
+
597
+ <!-- All Activities Tab -->
598
+ <div id="all-activities-tab" class="tab-content">
599
+ <div class="box">
600
+ <div class="columns is-multiline" id="all-activities-gallery">
601
+ <!-- Will be populated by JavaScript -->
602
+ </div>
603
+ </div>
604
+ </div>
605
+
606
+ <!-- Subject Activities Tabs -->
607
+ <div id="arabic-activities-tab" class="tab-content is-hidden">
608
+ <div class="box">
609
+ <div class="columns is-multiline" id="arabic-activities-gallery">
610
+ <!-- Will be populated by JavaScript -->
611
+ </div>
612
+ </div>
613
+ </div>
614
+
615
+ <div id="math-activities-tab" class="tab-content is-hidden">
616
+ <div class="box">
617
+ <div class="columns is-multiline" id="math-activities-gallery">
618
+ <!-- Will be populated by JavaScript -->
619
+ </div>
620
+ </div>
621
+ </div>
622
+
623
+ <div id="islamic-activities-tab" class="tab-content is-hidden">
624
+ <div class="box">
625
+ <div class="columns is-multiline" id="islamic-activities-gallery">
626
+ <!-- Will be populated by JavaScript -->
627
+ </div>
628
+ </div>
629
+ </div>
630
+
631
+ <div id="art-activities-tab" class="tab-content is-hidden">
632
+ <div class="box">
633
+ <div class="columns is-multiline" id="art-activities-gallery">
634
+ <!-- Will be populated by JavaScript -->
635
+ </div>
636
+ </div>
637
+ </div>
638
+
639
+ <div id="music-activities-tab" class="tab-content is-hidden">
640
+ <div class="box">
641
+ <div class="columns is-multiline" id="music-activities-gallery">
642
+ <!-- Will be populated by JavaScript -->
643
+ </div>
644
+ </div>
645
+ </div>
646
+
647
+ <div class="box mt-4">
648
+ <h2 class="title is-5">إضافة عمل فني جديد</h2>
649
+ <div class="field">
650
+ <label class="label">العنوان</label>
651
+ <div class="control">
652
+ <input id="new-artwork-title" class="input" type="text" placeholder="عنوان العمل">
653
+ </div>
654
+ </div>
655
+
656
+ <div class="field">
657
+ <label class="label">المادة</label>
658
+ <div class="control">
659
+ <div class="select">
660
+ <select id="new-artwork-subject">
661
+ <option value="arabic">اللغة العربية</option>
662
+ <option value="math">الرياضيات</option>
663
+ <option value="islamic">التربية الإسلامية</option>
664
+ <option value="art">التربية الفنية</option>
665
+ <option value="music">التربية الموسيقية</option>
666
+ </select>
667
+ </div>
668
+ </div>
669
+ </div>
670
+
671
+ <div class="field">
672
+ <label class="label">الصورة</label>
673
+ <div class="control">
674
+ <input id="new-artwork-image" class="input" type="file" accept="image/*">
675
+ </div>
676
+ </div>
677
+
678
+ <div class="field">
679
+ <label class="label">الوصف</label>
680
+ <div class="control">
681
+ <textarea id="new-artwork-desc" class="textarea" placeholder="وصف العمل"></textarea>
682
+ </div>
683
+ </div>
684
+
685
+ <div class="field">
686
+ <div class="control">
687
+ <button id="add-artwork-btn" class="button is-primary">
688
+ <span class="icon">
689
+ <i class="fas fa-plus"></i>
690
+ </span>
691
+ <span>إضافة العمل</span>
692
+ </button>
693
+ </div>
694
+ </div>
695
+ </div>
696
+ </section>
697
+ </div>
698
+
699
+ <!-- Footer -->
700
+ <footer class="footer mt-6">
701
+ <div class="content has-text-centered">
702
+ <p>
703
+ <strong>نظام إدارة الفصل الدراسي</strong> - مدرسة الشهيد حموم سعيد - بجاية
704
+ </p>
705
+ <p>
706
+ السنة الدراسية 2023/2024 - الصف الأول ابتدائي
707
+ </p>
708
+ </div>
709
+ </footer>
710
+ </div>
711
+
712
+ <script>
713
+ // Initialize the application when the DOM is loaded
714
+ document.addEventListener('DOMContentLoaded', function() {
715
+ // Check for dark mode preference
716
+ if (localStorage.getItem('darkMode') === 'enabled') {
717
+ document.body.classList.add('dark-mode');
718
+ document.getElementById('dark-mode-toggle').innerHTML = `
719
+ <span class="icon">
720
+ <i class="fas fa-sun"></i>
721
+ </span>
722
+ <span>الوضع النهاري</span>
723
+ `;
724
+ }
725
+
726
+ // Initialize sample data if not exists
727
+ if (!localStorage.getItem('classData')) {
728
+ initializeSampleData();
729
+ }
730
+
731
+ // Load notifications
732
+ updateNotificationCount();
733
+
734
+ // Login functionality
735
+ document.getElementById('login-btn').addEventListener('click', function() {
736
+ const username = document.getElementById('username').value;
737
+ const password = document.getElementById('password').value;
738
+
739
+ if (username === "ma classe" && password === "1412") {
740
+ document.getElementById('login-section').classList.add('is-hidden');
741
+ document.getElementById('app').classList.remove('is-hidden');
742
+ } else {
743
+ document.getElementById('login-error').classList.remove('is-hidden');
744
+ }
745
+ });
746
+
747
+ // Dark mode toggle
748
+ document.getElementById('dark-mode-toggle').addEventListener('click', function() {
749
+ document.body.classList.toggle('dark-mode');
750
+
751
+ if (document.body.classList.contains('dark-mode')) {
752
+ localStorage.setItem('darkMode', 'enabled');
753
+ this.innerHTML = `
754
+ <span class="icon">
755
+ <i class="fas fa-sun"></i>
756
+ </span>
757
+ <span>الوضع النهاري</span>
758
+ `;
759
+ } else {
760
+ localStorage.setItem('darkMode', 'disabled');
761
+ this.innerHTML = `
762
+ <span class="icon">
763
+ <i class="fas fa-moon"></i>
764
+ </span>
765
+ <span>الوضع الليلي</span>
766
+ `;
767
+ }
768
+ });
769
+
770
+ // Logout functionality
771
+ document.getElementById('logout-btn').addEventListener('click', function() {
772
+ document.getElementById('app').classList.add('is-hidden');
773
+ document.getElementById('login-section').classList.remove('is-hidden');
774
+ document.getElementById('username').value = '';
775
+ document.getElementById('password').value = '';
776
+ document.getElementById('login-error').classList.add('is-hidden');
777
+ });
778
+
779
+ // Navigation functionality
780
+ document.getElementById('home-link').addEventListener('click', function() {
781
+ showPage('home-page');
782
+ });
783
+
784
+ document.getElementById('grades-link').addEventListener('click', function() {
785
+ showPage('grades-page');
786
+ renderAllGradesTable();
787
+ renderOverallStats();
788
+ renderMissingGrades();
789
+ });
790
+
791
+ document.getElementById('gallery-link').addEventListener('click', function() {
792
+ showPage('gallery-page');
793
+ renderGallery('all');
794
+ });
795
+
796
+ document.getElementById('view-grades-btn').addEventListener('click', function() {
797
+ showPage('grades-page');
798
+ renderAllGradesTable();
799
+ renderOverallStats();
800
+ renderMissingGrades();
801
+ });
802
+
803
+ // Subject icons click handlers
804
+ document.querySelectorAll('.subject-icon').forEach(icon => {
805
+ icon.addEventListener('click', function() {
806
+ const subject = this.getAttribute('data-subject');
807
+ showSubjectPage(subject);
808
+ });
809
+ });
810
+
811
+ // Back buttons
812
+ document.getElementById('back-to-home').addEventListener('click', function() {
813
+ showPage('home-page');
814
+ });
815
+
816
+ document.getElementById('back-to-home-from-grades').addEventListener('click', function() {
817
+ showPage('home-page');
818
+ });
819
+
820
+ document.getElementById('back-to-home-from-gallery').addEventListener('click', function() {
821
+ showPage('home-page');
822
+ });
823
+
824
+ // Tab switching for subject pages
825
+ document.querySelectorAll('#subject-pages .tabs li').forEach(tab => {
826
+ tab.addEventListener('click', function() {
827
+ const tabName = this.getAttribute('data-tab');
828
+ switchSubjectTab(tabName);
829
+ });
830
+ });
831
+
832
+ // Tab switching for grades page
833
+ document.querySelectorAll('#grades-page .tabs li').forEach(tab => {
834
+ tab.addEventListener('click', function() {
835
+ const tabName = this.getAttribute('data-tab');
836
+ switchGradesTab(tabName);
837
+ });
838
+ });
839
+
840
+ // Tab switching for gallery page
841
+ document.querySelectorAll('#gallery-page .tabs li').forEach(tab => {
842
+ tab.addEventListener('click', function() {
843
+ const tabName = this.getAttribute('data-tab').replace('-activities', '');
844
+ renderGallery(tabName);
845
+ });
846
+ });
847
+
848
+ // Save grades buttons
849
+ document.querySelectorAll('.save-grades').forEach(btn => {
850
+ btn.addEventListener('click', function() {
851
+ saveSubjectGrades();
852
+ });
853
+ });
854
+
855
+ document.querySelector('.save-all-grades').addEventListener('click', function() {
856
+ saveAllGrades();
857
+ });
858
+
859
+ // Export buttons
860
+ document.querySelectorAll('.export-pdf').forEach(btn => {
861
+ btn.addEventListener('click', function() {
862
+ exportToPDF('subject');
863
+ });
864
+ });
865
+
866
+ document.querySelector('.export-all-pdf').addEventListener('click', function() {
867
+ exportToPDF('all');
868
+ });
869
+
870
+ document.querySelectorAll('.export-excel').forEach(btn => {
871
+ btn.addEventListener('click', function() {
872
+ exportToExcel('subject');
873
+ });
874
+ });
875
+
876
+ document.querySelector('.export-all-excel').addEventListener('click', function() {
877
+ exportToExcel('all');
878
+ });
879
+
880
+ // Add activity button
881
+ document.getElementById('add-activity-btn').addEventListener('click', function() {
882
+ addActivity();
883
+ });
884
+
885
+ // Add artwork button
886
+ document.getElementById('add-artwork-btn').addEventListener('click', function() {
887
+ addArtwork();
888
+ });
889
+
890
+ // Send reminders button
891
+ document.getElementById('send-reminders').addEventListener('click', function() {
892
+ sendReminders();
893
+ });
894
+
895
+ // Initialize navbar burger menu
896
+ const navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
897
+ if (navbarBurgers.length > 0) {
898
+ navbarBurgers.forEach(el => {
899
+ el.addEventListener('click', () => {
900
+ const target = el.dataset.target;
901
+ const $target = document.getElementById(target);
902
+ el.classList.toggle('is-active');
903
+ $target.classList.toggle('is-active');
904
+ });
905
+ });
906
+ }
907
+ });
908
+
909
+ // Function to show a specific page and hide others
910
+ function showPage(pageId) {
911
+ // Hide all pages
912
+ document.getElementById('home-page').classList.add('is-hidden');
913
+ document.getElementById('subject-pages').classList.add('is-hidden');
914
+ document.getElementById('grades-page').classList.add('is-hidden');
915
+ document.getElementById('gallery-page').classList.add('is-hidden');
916
+
917
+ // Show the requested page
918
+ document.getElementById(pageId).classList.remove('is-hidden');
919
+
920
+ // Update active nav item
921
+ document.querySelectorAll('.navbar-item').forEach(item => {
922
+ item.classList.remove('is-active');
923
+ });
924
+
925
+ if (pageId === 'home-page') {
926
+ document.getElementById('home-link').classList.add('is-active');
927
+ } else if (pageId === 'grades-page') {
928
+ document.getElementById('grades-link').classList.add('is-active');
929
+ } else if (pageId === 'gallery-page') {
930
+ document.getElementById('gallery-link').classList.add('is-active');
931
+ }
932
+ }
933
+
934
+ // Function to show a subject page
935
+ function showSubjectPage(subject) {
936
+ showPage('subject-pages');
937
+
938
+ // Set the subject title
939
+ const subjectTitles = {
940
+ 'arabic': 'اللغة العربية',
941
+ 'math': 'الرياضيات',
942
+ 'islamic': 'التربية الإسلامية',
943
+ 'art': 'التربية الفنية',
944
+ 'music': 'التربية الموسيقية'
945
+ };
946
+
947
+ document.getElementById('subject-title').textContent = subjectTitles[subject];
948
+
949
+ // Store current subject in a data attribute
950
+ document.getElementById('subject-pages').setAttribute('data-current-subject', subject);
951
+
952
+ // Render the subject data
953
+ renderSubjectGradesTable(subject);
954
+ renderSubjectStats(subject);
955
+ renderSubjectActivities(subject);
956
+
957
+ // Reset to grades tab
958
+ switchSubjectTab('grades');
959
+ }
960
+
961
+ // Function to switch tabs in subject pages
962
+ function switchSubjectTab(tabName) {
963
+ // Update active tab
964
+ document.querySelectorAll('#subject-pages .tabs li').forEach(tab => {
965
+ tab.classList.remove('is-active');
966
+ if (tab.getAttribute('data-tab') === tabName) {
967
+ tab.classList.add('is-active');
968
+ }
969
+ });
970
+
971
+ // Show the selected tab content
972
+ document.getElementById('grades-tab').classList.add('is-hidden');
973
+ document.getElementById('stats-tab').classList.add('is-hidden');
974
+ document.getElementById('activities-tab').classList.add('is-hidden');
975
+
976
+ document.getElementById(`${tabName}-tab`).classList.remove('is-hidden');
977
+ }
978
+
979
+ // Function to switch tabs in grades page
980
+ function switchGradesTab(tabName) {
981
+ // Update active tab
982
+ document.querySelectorAll('#grades-page .tabs li').forEach(tab => {
983
+ tab.classList.remove('is-active');
984
+ if (tab.getAttribute('data-tab') === tabName) {
985
+ tab.classList.add('is-active');
986
+ }
987
+ });
988
+
989
+ // Show the selected tab content
990
+ document.getElementById('all-grades-tab').classList.add('is-hidden');
991
+ document.getElementById('overall-stats-tab').classList.add('is-hidden');
992
+ document.getElementById('missing-grades-tab').classList.add('is-hidden');
993
+
994
+ document.getElementById(`${tabName}-tab`).classList.remove('is-hidden');
995
+ }
996
+
997
+ // Function to initialize sample data
998
+ function initializeSampleData() {
999
+ const classData = {
1000
+ students: [],
1001
+ grades: {
1002
+ arabic: [],
1003
+ math: [],
1004
+ islamic: [],
1005
+ art: [],
1006
+ music: []
1007
+ },
1008
+ activities: {
1009
+ arabic: [],
1010
+ math: [],
1011
+ islamic: [],
1012
+ art: [],
1013
+ music: []
1014
+ },
1015
+ artworks: []
1016
+ };
1017
+
1018
+ // Generate 36 sample students (Arabic names)
1019
+ const firstNames = ['محمد', 'أحمد', 'علي', 'يوسف', 'إبراهيم', 'مريم', 'فاطمة', 'زينب', 'آمنة', 'خديجة'];
1020
+ const lastNames = ['بن علي', 'بن عمر', 'بن أحمد', 'بن إبراهيم', 'بنت محمد', 'بنت علي', 'بنت أحمد', 'بنت يوسف'];
1021
+
1022
+ for (let i = 1; i <= 36; i++) {
1023
+ const firstName = firstNames[Math.floor(Math.random() * firstNames.length)];
1024
+ const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
1025
+ const gender = Math.random() > 0.5 ? 'male' : 'female';
1026
+
1027
+ classData.students.push({
1028
+ id: i,
1029
+ name: `${firstName} ${lastName}`,
1030
+ gender: gender
1031
+ });
1032
+
1033
+ // Generate random grades for each subject (between 5 and 20)
1034
+ classData.grades.arabic.push({
1035
+ studentId: i,
1036
+ test1: Math.floor(Math.random() * 16) + 5,
1037
+ test2: Math.floor(Math.random() * 16) + 5,
1038
+ test3: null, // Some missing grades
1039
+ notes: ''
1040
+ });
1041
+
1042
+ classData.grades.math.push({
1043
+ studentId: i,
1044
+ test1: Math.floor(Math.random() * 16) + 5,
1045
+ test2: Math.floor(Math.random() * 16) + 5,
1046
+ test3: Math.floor(Math.random() * 16) + 5,
1047
+ notes: ''
1048
+ });
1049
+
1050
+ classData.grades.islamic.push({
1051
+ studentId: i,
1052
+ test1: Math.floor(Math.random() * 16) + 5,
1053
+ test2: null, // Some missing grades
1054
+ test3: Math.floor(Math.random() * 16) + 5,
1055
+ notes: ''
1056
+ });
1057
+
1058
+ classData.grades.art.push({
1059
+ studentId: i,
1060
+ test1: Math.floor(Math.random() * 16) + 5,
1061
+ test2: Math.floor(Math.random() * 16) + 5,
1062
+ test3: Math.floor(Math.random() * 16) + 5,
1063
+ notes: ''
1064
+ });
1065
+
1066
+ classData.grades.music.push({
1067
+ studentId: i,
1068
+ test1: null, // Some missing grades
1069
+ test2: Math.floor(Math.random() * 16) + 5,
1070
+ test3: null, // Some missing grades
1071
+ notes: ''
1072
+ });
1073
+ }
1074
+
1075
+ // Add some sample activities
1076
+ classData.activities.arabic.push({
1077
+ id: 1,
1078
+ title: 'قراءة قصة',
1079
+ description: 'قراءة قصة قصيرة ومناقشتها في الصف',
1080
+ date: '2023-10-15'
1081
+ });
1082
+
1083
+ classData.activities.math.push({
1084
+ id: 1,
1085
+ title: 'تمارين الجمع',
1086
+ description: 'حل تمارين الجمع باستخدام العدادات',
1087
+ date: '2023-10-20'
1088
+ });
1089
+
1090
+ classData.activities.islamic.push({
1091
+ id: 1,
1092
+ title: 'حفظ سورة الفاتحة',
1093
+ description: 'حفظ سورة الفاتحة وتلاوتها',
1094
+ date: '2023-10-10'
1095
+ });
1096
+
1097
+ classData.activities.art.push({
1098
+ id: 1,
1099
+ title: 'رسم لوحة الخريف',
1100
+ description: 'رسم لوحة تعبر عن فصل الخريف',
1101
+ date: '2023-11-05'
1102
+ });
1103
+
1104
+ classData.activities.music.push({
1105
+ id: 1,
1106
+ title: 'أنشودة الألوان',
1107
+ description: 'تعلم أنشودة الألوان مع الحركات',
1108
+ date: '2023-11-10'
1109
+ });
1110
+
1111
+ // Add some sample artworks
1112
+ classData.artworks.push({
1113
+ id: 1,
1114
+ title: 'لوحة الخريف',
1115
+ subject: 'art',
1116
+ description: 'رسمها التلميذ محمد بن علي',
1117
+ image: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMDAgMjAwIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iI2ZmYzI3MyIvPjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjMwIiBmaWxsPSIjZmY5ZTBlIi8+PGNpcmNsZSBjeD0iMTUwIiBjeT0iNTAiIHI9IjMwIiBmaWxsPSIjZmY3ZjBlIi8+PHBhdGggZD0iTTEwMCAxNTAgTDE1MCAxMDAgTDIwMCAxNTAiIHN0cm9rZT0iIzc5NTU0OCIgc3Ryb2tlLXdpZHRoPSIyIiBmaWxsPSJub25lIi8+PC9zdmc+',
1118
+ date: '2023-11-05'
1119
+ });
1120
+
1121
+ classData.artworks.push({
1122
+ id: 2,
1123
+ title: 'قصيدة الحروف',
1124
+ subject: 'arabic',
1125
+ description: 'كتابة قصيدة الحروف بخط جميل',
1126
+ image: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMDAgMjAwIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iI2ZmZTBiYiIvPjx0ZXh0IHg9IjEwMCIgeT0iMTAwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMjQiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZpbGw9IiM3OTU1NDgiPuS4reS7luS4i+S5jOS4reS7luS4i+S5jDwvdGV4dD48L3N2Zz4=',
1127
+ date: '2023-10-15'
1128
+ });
1129
+
1130
+ // Save to localStorage
1131
+ localStorage.setItem('classData', JSON.stringify(classData));
1132
+ }
1133
+
1134
+ // Function to get class data
1135
+ function getClassData() {
1136
+ return JSON.parse(localStorage.getItem('classData'));
1137
+ }
1138
+
1139
+ // Function to save class data
1140
+ function saveClassData(classData) {
1141
+ localStorage.setItem('classData', JSON.stringify(classData));
1142
+ }
1143
+
1144
+ // Function to render subject grades table
1145
+ function renderSubjectGradesTable(subject) {
1146
+ const classData = getClassData();
1147
+ const tableBody = document.getElementById('subject-grades-table');
1148
+ tableBody.innerHTML = '';
1149
+
1150
+ classData.students.forEach(student => {
1151
+ const studentGrades = classData.grades[subject].find(g => g.studentId === student.id);
1152
+
1153
+ const row = document.createElement('tr');
1154
+ row.innerHTML = `
1155
+ <td>${student.id}</td>
1156
+ <td>${student.name}</td>
1157
+ <td><input class="input grade-input" type="number" min="0" max="20" step="0.5" value="${studentGrades.test1 !== null ? studentGrades.test1 : ''}" data-test="test1" data-student-id="${student.id}"></td>
1158
+ <td><input class="input grade-input" type="number" min="0" max="20" step="0.5" value="${studentGrades.test2 !== null ? studentGrades.test2 : ''}" data-test="test2" data-student-id="${student.id}"></td>
1159
+ <td><input class="input grade-input" type="number" min="0" max="20" step="0.5" value="${studentGrades.test3 !== null ? studentGrades.test3 : ''}" data-test="test3" data-student-id="${student.id}"></td>
1160
+ <td>${calculateAverage(studentGrades)}</td>
1161
+ <td><input class="input" type="text" value="${studentGrades.notes}" data-test="notes" data-student-id="${student.id}"></td>
1162
+ `;
1163
+
1164
+ tableBody.appendChild(row);
1165
+ });
1166
+ }
1167
+
1168
+ // Function to calculate average for a student's grades in a subject
1169
+ function calculateAverage(grades) {
1170
+ const validGrades = [grades.test1, grades.test2, grades.test3].filter(g => g !== null);
1171
+ if (validGrades.length === 0) return 'N/A';
1172
+
1173
+ const sum = validGrades.reduce((a, b) => a + b, 0);
1174
+ const avg = sum / validGrades.length;
1175
+ return avg.toFixed(2);
1176
+ }
1177
+
1178
+ // Function to save subject grades
1179
+ function saveSubjectGrades() {
1180
+ const classData = getClassData();
1181
+ const subject = document.getElementById('subject-pages').getAttribute('data-current-subject');
1182
+
1183
+ document.querySelectorAll(`#subject-grades-table .grade-input`).forEach(input => {
1184
+ const studentId = parseInt(input.getAttribute('data-student-id'));
1185
+ const test = input.getAttribute('data-test');
1186
+ const value = input.value === '' ? null : parseFloat(input.value);
1187
+
1188
+ const studentGrades = classData.grades[subject].find(g => g.studentId === studentId);
1189
+ studentGrades[test] = value;
1190
+ });
1191
+
1192
+ // Also save notes
1193
+ document.querySelectorAll(`#subject-grades-table input[data-test="notes"]`).forEach(input => {
1194
+ const studentId = parseInt(input.getAttribute('data-student-id'));
1195
+ const value = input.value;
1196
+
1197
+ const studentGrades = classData.grades[subject].find(g => g.studentId === studentId);
1198
+ studentGrades.notes = value;
1199
+ });
1200
+
1201
+ saveClassData(classData);
1202
+
1203
+ // Show success message
1204
+ showNotification('تم حفظ الدرجات بنجاح', 'success');
1205
+
1206
+ // Re-render the table to update averages
1207
+ renderSubjectGradesTable(subject);
1208
+ }
1209
+
1210
+ // Function to render all grades table
1211
+ function renderAllGradesTable() {
1212
+ const classData = getClassData();
1213
+ const tableBody = document.getElementById('all-grades-table');
1214
+ tableBody.innerHTML = '';
1215
+
1216
+ classData.students.forEach(student => {
1217
+ const arabicGrades = classData.grades.arabic.find(g => g.studentId === student.id);
1218
+ const mathGrades = classData.grades.math.find(g => g.studentId === student.id);
1219
+ const islamicGrades = classData.grades.islamic.find(g => g.studentId === student.id);
1220
+ const artGrades = classData.grades.art.find(g => g.studentId === student.id);
1221
+ const musicGrades = classData.grades.music.find(g => g.studentId === student.id);
1222
+
1223
+ const arabicAvg = calculateAverage(arabicGrades);
1224
+ const mathAvg = calculateAverage(mathGrades);
1225
+ const islamicAvg = calculateAverage(islamicGrades);
1226
+ const artAvg = calculateAverage(artGrades);
1227
+ const musicAvg = calculateAverage(musicGrades);
1228
+
1229
+ // Calculate overall average
1230
+ const validAverages = [arabicAvg, mathAvg, islamicAvg, artAvg, musicAvg]
1231
+ .filter(avg => avg !== 'N/A')
1232
+ .map(avg => parseFloat(avg));
1233
+
1234
+ const overallAvg = validAverages.length > 0
1235
+ ? (validAverages.reduce((a, b) => a + b, 0) / validAverages.length).toFixed(2)
1236
+ : 'N/A';
1237
+
1238
+ const row = document.createElement('tr');
1239
+ row.innerHTML = `
1240
+ <td>${student.id}</td>
1241
+ <td>${student.name}</td>
1242
+ <td>${arabicAvg}</td>
1243
+ <td>${mathAvg}</td>
1244
+ <td>${islamicAvg}</td>
1245
+ <td>${artAvg}</td>
1246
+ <td>${musicAvg}</td>
1247
+ <td>${overallAvg}</td>
1248
+ `;
1249
+
1250
+ tableBody.appendChild(row);
1251
+ });
1252
+ }
1253
+
1254
+ // Function to save all grades
1255
+ function saveAllGrades() {
1256
+ // This would need to be implemented if we allow editing in the all grades view
1257
+ // For now, we'll just show a message
1258
+ showNotification('يجب تعديل الدرجات من صفحة كل مادة على حدة', 'info');
1259
+ }
1260
+
1261
+ // Function to render subject statistics
1262
+ function renderSubjectStats(subject) {
1263
+ const classData = getClassData();
1264
+ const grades = classData.grades[subject];
1265
+
1266
+ // Calculate averages for each student
1267
+ const averages = grades.map(g => {
1268
+ const validGrades = [g.test1, g.test2, g.test3].filter(grade => grade !== null);
1269
+ if (validGrades.length === 0) return null;
1270
+ return validGrades.reduce((a, b) => a + b, 0) / validGrades.length;
1271
+ }).filter(avg => avg !== null);
1272
+
1273
+ // Create histogram data
1274
+ const histogramData = {
1275
+ '0-5': 0,
1276
+ '5-10': 0,
1277
+ '10-15': 0,
1278
+ '15-20': 0
1279
+ };
1280
+
1281
+ averages.forEach(avg => {
1282
+ if (avg < 5) histogramData['0-5']++;
1283
+ else if (avg < 10) histogramData['5-10']++;
1284
+ else if (avg < 15) histogramData['10-15']++;
1285
+ else histogramData['15-20']++;
1286
+ });
1287
+
1288
+ // Render histogram chart
1289
+ const gradesCtx = document.getElementById('grades-chart').getContext('2d');
1290
+ if (window.gradesChart) window.gradesChart.destroy();
1291
+
1292
+ window.gradesChart = new Chart(gradesCtx, {
1293
+ type: 'bar',
1294
+ data: {
1295
+ labels: ['0-5', '5-10', '10-15', '15-20'],
1296
+ datasets: [{
1297
+ label: 'عدد التلاميذ',
1298
+ data: Object.values(histogramData),
1299
+ backgroundColor: 'rgba(54, 162, 235, 0.7)',
1300
+ borderColor: 'rgba(54, 162, 235, 1)',
1301
+ borderWidth: 1
1302
+ }]
1303
+ },
1304
+ options: {
1305
+ scales: {
1306
+ y: {
1307
+ beginAtZero: true,
1308
+ ticks: {
1309
+ stepSize: 1
1310
+ }
1311
+ }
1312
+ }
1313
+ }
1314
+ });
1315
+
1316
+ // Calculate averages by gender
1317
+ const maleAverages = [];
1318
+ const femaleAverages = [];
1319
+
1320
+ grades.forEach(g => {
1321
+ const student = classData.students.find(s => s.id === g.studentId);
1322
+ const validGrades = [g.test1, g.test2, g.test3].filter(grade => grade !== null);
1323
+ if (validGrades.length === 0) return;
1324
+
1325
+ const avg = validGrades.reduce((a, b) => a + b, 0) / validGrades.length;
1326
+
1327
+ if (student.gender === 'male') maleAverages.push(avg);
1328
+ else femaleAverages.push(avg);
1329
+ });
1330
+
1331
+ const maleAvg = maleAverages.length > 0 ? maleAverages.reduce((a, b) => a + b, 0) / maleAverages.length : 0;
1332
+ const femaleAvg = femaleAverages.length > 0 ? femaleAverages.reduce((a, b) => a + b, 0) / femaleAverages.length : 0;
1333
+
1334
+ // Render gender chart
1335
+ const genderCtx = document.getElementById('gender-chart').getContext('2d');
1336
+ if (window.genderChart) window.genderChart.destroy();
1337
+
1338
+ window.genderChart = new Chart(genderCtx, {
1339
+ type: 'pie',
1340
+ data: {
1341
+ labels: ['ذكور', 'إناث'],
1342
+ datasets: [{
1343
+ data: [maleAvg, femaleAvg],
1344
+ backgroundColor: ['rgba(54, 162, 235, 0.7)', 'rgba(255, 99, 132, 0.7)'],
1345
+ borderColor: ['rgba(54, 162, 235, 1)', 'rgba(255, 99, 132, 1)'],
1346
+ borderWidth: 1
1347
+ }]
1348
+ }
1349
+ });
1350
+
1351
+ // Render top and bottom students
1352
+ const studentsWithAverages = classData.students.map(student => {
1353
+ const grade = grades.find(g => g.studentId === student.id);
1354
+ const validGrades = [grade.test1, grade.test2, grade.test3].filter(g => g !== null);
1355
+ const avg = validGrades.length > 0 ? validGrades.reduce((a, b) => a + b, 0) / validGrades.length : null;
1356
+
1357
+ return {
1358
+ id: student.id,
1359
+ name: student.name,
1360
+ average: avg
1361
+ };
1362
+ }).filter(s => s.average !== null);
1363
+
1364
+ // Sort by average
1365
+ studentsWithAverages.sort((a, b) => b.average - a.average);
1366
+
1367
+ // Top 5 students
1368
+ const topStudentsList = document.getElementById('top-students');
1369
+ topStudentsList.innerHTML = '';
1370
+
1371
+ studentsWithAverages.slice(0, 5).forEach((student, index) => {
1372
+ const li = document.createElement('li');
1373
+ li.textContent = `${index + 1}. ${student.name} - ${student.average.toFixed(2)}`;
1374
+ topStudentsList.appendChild(li);
1375
+ });
1376
+
1377
+ // Bottom 5 students
1378
+ const bottomStudentsList = document.getElementById('bottom-students');
1379
+ bottomStudentsList.innerHTML = '';
1380
+
1381
+ studentsWithAverages.slice(-5).reverse().forEach((student, index) => {
1382
+ const li = document.createElement('li');
1383
+ li.textContent = `${studentsWithAverages.length - index}. ${student.name} - ${student.average.toFixed(2)}`;
1384
+ bottomStudentsList.appendChild(li);
1385
+ });
1386
+ }
1387
+
1388
+ // Function to render overall statistics
1389
+ function renderOverallStats() {
1390
+ const classData = getClassData();
1391
+
1392
+ // Calculate subject averages
1393
+ const subjectAverages = {};
1394
+ const subjects = ['arabic', 'math', 'islamic', 'art', 'music'];
1395
+ const subjectNames = {
1396
+ 'arabic': 'العربية',
1397
+ 'math': 'الرياضيات',
1398
+ 'islamic': 'الإسلامية',
1399
+ 'art': 'الفنية',
1400
+ 'music': 'الموسيقية'
1401
+ };
1402
+
1403
+ subjects.forEach(subject => {
1404
+ const grades = classData.grades[subject];
1405
+ const averages = grades.map(g => {
1406
+ const validGrades = [g.test1, g.test2, g.test3].filter(grade => grade !== null);
1407
+ if (validGrades.length === 0) return null;
1408
+ return validGrades.reduce((a, b) => a + b, 0) / validGrades.length;
1409
+ }).filter(avg => avg !== null);
1410
+
1411
+ subjectAverages[subject] = averages.length > 0
1412
+ ? averages.reduce((a, b) => a + b, 0) / averages.length
1413
+ : 0;
1414
+ });
1415
+
1416
+ // Render subjects chart
1417
+ const subjectsCtx = document.getElementById('subjects-chart').getContext('2d');
1418
+ if (window.subjectsChart) window.subjectsChart.destroy();
1419
+
1420
+ window.subjectsChart = new Chart(subjectsCtx, {
1421
+ type: 'bar',
1422
+ data: {
1423
+ labels: Object.values(subjectNames),
1424
+ datasets: [{
1425
+ label: 'المعدل',
1426
+ data: Object.values(subjectAverages),
1427
+ backgroundColor: [
1428
+ 'rgba(255, 99, 132, 0.7)',
1429
+ 'rgba(54, 162, 235, 0.7)',
1430
+ 'rgba(255, 206, 86, 0.7)',
1431
+ 'rgba(75, 192, 192, 0.7)',
1432
+ 'rgba(153, 102, 255, 0.7)'
1433
+ ],
1434
+ borderColor: [
1435
+ 'rgba(255, 99, 132, 1)',
1436
+ 'rgba(54, 162, 235, 1)',
1437
+ 'rgba(255, 206, 86, 1)',
1438
+ 'rgba(75, 192, 192, 1)',
1439
+ 'rgba(153, 102, 255, 1)'
1440
+ ],
1441
+ borderWidth: 1
1442
+ }]
1443
+ },
1444
+ options: {
1445
+ scales: {
1446
+ y: {
1447
+ beginAtZero: true,
1448
+ max: 20
1449
+ }
1450
+ }
1451
+ }
1452
+ });
1453
+
1454
+ // Calculate top 5 students overall
1455
+ const studentsWithAverages = classData.students.map(student => {
1456
+ let sum = 0;
1457
+ let count = 0;
1458
+
1459
+ subjects.forEach(subject => {
1460
+ const grade = classData.grades[subject].find(g => g.studentId === student.id);
1461
+ const validGrades = [grade.test1, grade.test2, grade.test3].filter(g => g !== null);
1462
+
1463
+ if (validGrades.length > 0) {
1464
+ sum += validGrades.reduce((a, b) => a + b, 0) / validGrades.length;
1465
+ count++;
1466
+ }
1467
+ });
1468
+
1469
+ return {
1470
+ id: student.id,
1471
+ name: student.name,
1472
+ average: count > 0 ? sum / count : null
1473
+ };
1474
+ }).filter(s => s.average !== null);
1475
+
1476
+ // Sort by average
1477
+ studentsWithAverages.sort((a, b) => b.average - a.average);
1478
+
1479
+ // Render top students chart
1480
+ const topStudentsCtx = document.getElementById('top-students-chart').getContext('2d');
1481
+ if (window.topStudentsChart) window.topStudentsChart.destroy();
1482
+
1483
+ window.topStudentsChart = new Chart(topStudentsCtx, {
1484
+ type: 'bar',
1485
+ data: {
1486
+ labels: studentsWithAverages.slice(0, 5).map(s => s.name),
1487
+ datasets: [{
1488
+ label: 'المعدل العام',
1489
+ data: studentsWithAverages.slice(0, 5).map(s => s.average),
1490
+ backgroundColor: 'rgba(75, 192, 192, 0.7)',
1491
+ borderColor: 'rgba(75, 192, 192, 1)',
1492
+ borderWidth: 1
1493
+ }]
1494
+ },
1495
+ options: {
1496
+ scales: {
1497
+ y: {
1498
+ beginAtZero: true,
1499
+ max: 20
1500
+ }
1501
+ }
1502
+ }
1503
+ });
1504
+
1505
+ // Render ranking table
1506
+ const rankingTable = document.getElementById('ranking-table');
1507
+ rankingTable.innerHTML = '';
1508
+
1509
+ studentsWithAverages.forEach((student, index) => {
1510
+ const row = document.createElement('tr');
1511
+
1512
+ // Determine grade based on average
1513
+ let grade;
1514
+ if (student.average >= 16) grade = 'ممتاز';
1515
+ else if (student.average >= 14) grade = 'جيد جداً';
1516
+ else if (student.average >= 12) grade = 'جيد';
1517
+ else if (student.average >= 10) grade = 'مقبول';
1518
+ else grade = 'ضعيف';
1519
+
1520
+ row.innerHTML = `
1521
+ <td>${index + 1}</td>
1522
+ <td>${student.name}</td>
1523
+ <td>${student.average.toFixed(2)}</td>
1524
+ <td>${grade}</td>
1525
+ `;
1526
+
1527
+ rankingTable.appendChild(row);
1528
+ });
1529
+ }
1530
+
1531
+ // Function to render missing grades
1532
+ function renderMissingGrades() {
1533
+ const classData = getClassData();
1534
+ const tableBody = document.getElementById('missing-grades-table');
1535
+ tableBody.innerHTML = '';
1536
+
1537
+ const subjectNames = {
1538
+ 'arabic': 'العربية',
1539
+ 'math': 'الرياضيات',
1540
+ 'islamic': 'الإسلامية',
1541
+ 'art': 'الفنية',
1542
+ 'music': 'الموسيقية'
1543
+ };
1544
+
1545
+ const testNames = {
1546
+ 'test1': 'الاختبار 1',
1547
+ 'test2': 'الاختبار 2',
1548
+ 'test3': 'الاختبار 3'
1549
+ };
1550
+
1551
+ let missingCount = 0;
1552
+
1553
+ classData.students.forEach(student => {
1554
+ ['arabic', 'math', 'islamic', 'art', 'music'].forEach(subject => {
1555
+ const grade = classData.grades[subject].find(g => g.studentId === student.id);
1556
+
1557
+ ['test1', 'test2', 'test3'].forEach(test => {
1558
+ if (grade[test] === null) {
1559
+ missingCount++;
1560
+ const row = document.createElement('tr');
1561
+ row.innerHTML = `
1562
+ <td>${student.name}</td>
1563
+ <td>${subjectNames[subject]}</td>
1564
+ <td>${testNames[test]}</td>
1565
+ <td><span class="tag is-warning">غير مدخل</span></td>
1566
+ `;
1567
+ tableBody.appendChild(row);
1568
+ }
1569
+ });
1570
+ });
1571
+ });
1572
+
1573
+ // Update notification count
1574
+ updateNotificationCount();
1575
+
1576
+ if (missingCount === 0) {
1577
+ const row = document.createElement('tr');
1578
+ row.innerHTML = `
1579
+ <td colspan="4" class="has-text-centered">لا توجد درجات ناقصة</td>
1580
+ `;
1581
+ tableBody.appendChild(row);
1582
+ }
1583
+ }
1584
+
1585
+ // Function to update notification count
1586
+ function updateNotificationCount() {
1587
+ const classData = getClassData();
1588
+ let missingCount = 0;
1589
+
1590
+ classData.students.forEach(student => {
1591
+ ['arabic', 'math', 'islamic', 'art', 'music'].forEach(subject => {
1592
+ const grade = classData.grades[subject].find(g => g.studentId === student.id);
1593
+
1594
+ ['test1', 'test2', 'test3'].forEach(test => {
1595
+ if (grade[test] === null) {
1596
+ missingCount++;
1597
+ }
1598
+ });
1599
+ });
1600
+ });
1601
+
1602
+ const notificationCount = document.getElementById('notification-count');
1603
+ notificationCount.textContent = missingCount;
1604
+
1605
+ if (missingCount > 0) {
1606
+ notificationCount.classList.remove('is-hidden');
1607
+
1608
+ // Update notification items
1609
+ const notificationItems = document.getElementById('notification-items');
1610
+ notificationItems.innerHTML = '';
1611
+
1612
+ const notification = document.createElement('div');
1613
+ notification.className = 'notification is-warning is-light';
1614
+ notification.innerHTML = `
1615
+ <p>يوجد ${missingCount} درجة ناقصة تحتاج إلى إدخال</p>
1616
+ <button class="button is-small mt-2 view-missing-grades">عرض الدرجات الناقصة</button>
1617
+ `;
1618
+
1619
+ notification.querySelector('.view-missing-grades').addEventListener('click', function() {
1620
+ showPage('grades-page');
1621
+ switchGradesTab('missing-grades');
1622
+ renderMissingGrades();
1623
+ });
1624
+
1625
+ notificationItems.appendChild(notification);
1626
+ } else {
1627
+ notificationCount.classList.add('is-hidden');
1628
+ }
1629
+ }
1630
+
1631
+ // Function to send reminders
1632
+ function sendReminders() {
1633
+ showNotification('تم إرسال التنبيهات بنجاح', 'success');
1634
+ }
1635
+
1636
+ // Function to render subject activities
1637
+ function renderSubjectActivities(subject) {
1638
+ const classData = getClassData();
1639
+ const activitiesContainer = document.getElementById('subject-activities');
1640
+ activitiesContainer.innerHTML = '';
1641
+
1642
+ classData.activities[subject].forEach(activity => {
1643
+ const col = document.createElement('div');
1644
+ col.className = 'column is-4';
1645
+
1646
+ col.innerHTML = `
1647
+ <div class="card">
1648
+ <div class="card-content">
1649
+ <p class="title is-5">${activity.title}</p>
1650
+ <p class="subtitle is-6">${activity.description}</p>
1651
+ <p class="has-text-grey">${activity.date}</p>
1652
+ </div>
1653
+ </div>
1654
+ `;
1655
+
1656
+ activitiesContainer.appendChild(col);
1657
+ });
1658
+ }
1659
+
1660
+ // Function to add a new activity
1661
+ function addActivity() {
1662
+ const subject = document.getElementById('subject-pages').getAttribute('data-current-subject');
1663
+ const title = document.getElementById('new-activity-title').value;
1664
+ const description = document.getElementById('new-activity-desc').value;
1665
+ const imageInput = document.getElementById('new-activity-image');
1666
+
1667
+ if (!title || !description) {
1668
+ showNotification('الرجاء إدخال عنوان ووصف للنشاط', 'danger');
1669
+ return;
1670
+ }
1671
+
1672
+ const classData = getClassData();
1673
+ const newId = classData.activities[subject].length > 0
1674
+ ? Math.max(...classData.activities[subject].map(a => a.id)) + 1
1675
+ : 1;
1676
+
1677
+ const newActivity = {
1678
+ id: newId,
1679
+ title: title,
1680
+ description: description,
1681
+ date: new Date().toISOString().split('T')[0]
1682
+ };
1683
+
1684
+ classData.activities[subject].push(newActivity);
1685
+ saveClassData(classData);
1686
+
1687
+ // Clear form
1688
+ document.getElementById('new-activity-title').value = '';
1689
+ document.getElementById('new-activity-desc').value = '';
1690
+ imageInput.value = '';
1691
+
1692
+ // Show success message
1693
+ showNotification('تم إضافة النشاط بنجاح', 'success');
1694
+
1695
+ // Re-render activities
1696
+ renderSubjectActivities(subject);
1697
+ }
1698
+
1699
+ // Function to render gallery
1700
+ function renderGallery(subject) {
1701
+ const classData = getClassData();
1702
+ let galleryContainer;
1703
+
1704
+ if (subject === 'all') {
1705
+ galleryContainer = document.getElementById('all-activities-gallery');
1706
+ } else {
1707
+ galleryContainer = document.getElementById(`${subject}-activities-gallery`);
1708
+ }
1709
+
1710
+ galleryContainer.innerHTML = '';
1711
+
1712
+ let artworksToShow = [];
1713
+
1714
+ if (subject === 'all') {
1715
+ artworksToShow = classData.artworks;
1716
+ } else {
1717
+ artworksToShow = classData.artworks.filter(art => art.subject === subject);
1718
+ }
1719
+
1720
+ if (artworksToShow.length === 0) {
1721
+ const col = document.createElement('div');
1722
+ col.className = 'column is-12';
1723
+ col.innerHTML = `
1724
+ <div class="notification is-light has-text-centered">
1725
+ لا توجد أعمال فنية متاحة
1726
+ </div>
1727
+ `;
1728
+ galleryContainer.appendChild(col);
1729
+ return;
1730
+ }
1731
+
1732
+ artworksToShow.forEach(artwork => {
1733
+ const col = document.createElement('div');
1734
+ col.className = 'column is-4';
1735
+
1736
+ col.innerHTML = `
1737
+ <div class="card gallery-item">
1738
+ <div class="card-image">
1739
+ <figure class="image is-4by3">
1740
+ <img src="${artwork.image}" alt="${artwork.title}">
1741
+ </figure>
1742
+ </div>
1743
+ <div class="card-content">
1744
+ <p class="title is-5">${artwork.title}</p>
1745
+ <p class="subtitle is-6">${artwork.description}</p>
1746
+ <p class="has-text-grey">${artwork.date}</p>
1747
+ </div>
1748
+ </div>
1749
+ `;
1750
+
1751
+ galleryContainer.appendChild(col);
1752
+ });
1753
+ }
1754
+
1755
+ // Function to add a new artwork
1756
+ function addArtwork() {
1757
+ const title = document.getElementById('new-artwork-title').value;
1758
+ const subject = document.getElementById('new-artwork-subject').value;
1759
+ const description = document.getElementById('new-artwork-desc').value;
1760
+ const imageInput = document.getElementById('new-artwork-image');
1761
+
1762
+ if (!title || !description || !imageInput.files[0]) {
1763
+ showNotification('الرجاء إدخال جميع البيانات المطلوبة', 'danger');
1764
+ return;
1765
+ }
1766
+
1767
+ const file = imageInput.files[0];
1768
+ const reader = new FileReader();
1769
+
1770
+ reader.onload = function(e) {
1771
+ const classData = getClassData();
1772
+ const newId = classData.artworks.length > 0
1773
+ ? Math.max(...classData.artworks.map(a => a.id)) + 1
1774
+ : 1;
1775
+
1776
+ const newArtwork = {
1777
+ id: newId,
1778
+ title: title,
1779
+ subject: subject,
1780
+ description: description,
1781
+ image: e.target.result,
1782
+ date: new Date().toISOString().split('T')[0]
1783
+ };
1784
+
1785
+ classData.artworks.push(newArtwork);
1786
+ saveClassData(classData);
1787
+
1788
+ // Clear form
1789
+ document.getElementById('new-artwork-title').value = '';
1790
+ document.getElementById('new-artwork-desc').value = '';
1791
+ imageInput.value = '';
1792
+
1793
+ // Show success message
1794
+ showNotification('تم إضافة العمل الفني بنجاح', 'success');
1795
+
1796
+ // Re-render gallery
1797
+ renderGallery('all');
1798
+ };
1799
+
1800
+ reader.readAsDataURL(file);
1801
+ }
1802
+
1803
+ // Function to export to PDF
1804
+ function exportToPDF(type) {
1805
+ const { jsPDF } = window.jspdf;
1806
+ const doc = new jsPDF();
1807
+
1808
+ if (type === 'subject') {
1809
+ const subject = document.getElementById('subject-pages').getAttribute('data-current-subject');
1810
+ const subjectNames = {
1811
+ 'arabic': 'اللغة العربية',
1812
+ 'math': 'الرياضيات',
1813
+ 'islamic': 'التربية الإسلامية',
1814
+ 'art': 'التربية الفنية',
1815
+ 'music': 'التربية الموسيقية'
1816
+ };
1817
+
1818
+ doc.text(`كشف درجات مادة ${subjectNames[subject]}`, 10, 10);
1819
+
1820
+ const classData = getClassData();
1821
+ let y = 20;
1822
+
1823
+ doc.text('الرقم', 10, y);
1824
+ doc.text('اسم التلميذ', 30, y);
1825
+ doc.text('الاختبار 1', 70, y);
1826
+ doc.text('الاختبار 2', 90, y);
1827
+ doc.text('الاختبار 3', 110, y);
1828
+ doc.text('المعدل', 130, y);
1829
+
1830
+ y += 10;
1831
+
1832
+ classData.students.forEach(student => {
1833
+ const grades = classData.grades[subject].find(g => g.studentId === student.id);
1834
+ const avg = calculateAverage(grades);
1835
+
1836
+ doc.text(student.id.toString(), 10, y
1837
+ </html>