bamen commited on
Commit
4e83d32
·
verified ·
1 Parent(s): c548462

c'est bien mais j'ai testé en inscrivant un eleve mais dans l'espace administrateur , je n'ai pas vu l'ajout de l'eleve et toutes les modifications liées aux finances. Corrige cela . et plus le lien whatsapp est vers le numero +221765286257 - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +138 -32
index.html CHANGED
@@ -1214,56 +1214,162 @@ Cours d'Excellence les Grands Esprits`
1214
  );
1215
 
1216
  whatsappPayment.href = `https://wa.me/221${tuteurPhone}?text=${whatsappMessage}`;
1217
- // Fonctions pour l'espace privé
1218
- async function loadDashboardData() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1219
  try {
1220
  document.getElementById('loading-indicator').classList.remove('hidden');
1221
- const response = await api.get('/dashboard', {
1222
- headers: {
1223
- 'Use-Auto-Provider': 'true'
1224
- }
1225
- });
1226
 
1227
- // Mettre à jour les statistiques
1228
- document.querySelector('#admin-dashboard .bg-white:nth-child(1) h3').textContent = response.data.stats.students;
1229
- document.querySelector('#admin-dashboard .bg-white:nth-child(2) h3').textContent = response.data.stats.teachers;
1230
- document.querySelector('#admin-dashboard .bg-white:nth-child(3) h3').textContent = response.data.stats.balance + ' FCFA';
1231
-
1232
- // Mettre à jour l'activité récente
1233
- const activityList = document.querySelector('#admin-dashboard .space-y-4');
1234
- activityList.innerHTML = '';
1235
-
1236
- response.data.recentActivity.forEach(activity => {
1237
- activityList.innerHTML += `
1238
- <div class="flex items-start">
1239
- <div class="bg-blue-100 text-blue-800 p-2 rounded-full mr-3">
1240
- <i class="fas ${activity.icon}"></i>
1241
- </div>
1242
- <div>
1243
- <p class="font-medium">${activity.title}</p>
1244
- <p class="text-sm text-gray-500">${activity.description}</p>
1245
- <p class="text-xs text-gray-400 mt-1">${activity.time}</p>
1246
- </div>
1247
  </div>
1248
- `;
1249
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1250
 
1251
  } catch (error) {
1252
- console.error('Erreur lors du chargement des données:', error);
1253
  } finally {
1254
  document.getElementById('loading-indicator').classList.add('hidden');
1255
  }
1256
  }
1257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1258
  // Charger les données au démarrage
1259
  document.addEventListener('DOMContentLoaded', () => {
1260
  if (document.getElementById('admin-dashboard') && !document.getElementById('admin-dashboard').classList.contains('hidden')) {
1261
- loadDashboardData();
1262
  }
1263
  });
1264
 
1265
  // Rafraîchir les données lors du clic sur le tableau de bord
1266
- document.querySelector('#admin-sidebar a:first-child').addEventListener('click', loadDashboardData);
1267
  </script>
1268
  <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 <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=bamen/cege" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1269
  </html>
 
1214
  );
1215
 
1216
  whatsappPayment.href = `https://wa.me/221${tuteurPhone}?text=${whatsappMessage}`;
1217
+ // Stockage local pour les données
1218
+ let students = JSON.parse(localStorage.getItem('students')) || [];
1219
+ let finances = JSON.parse(localStorage.getItem('finances')) || { balance: 0, transactions: [] };
1220
+
1221
+ // Fonction pour sauvegarder les élèves
1222
+ function saveStudent(student) {
1223
+ students.push(student);
1224
+ localStorage.setItem('students', JSON.stringify(students));
1225
+
1226
+ // Ajouter la transaction financière
1227
+ const transaction = {
1228
+ date: new Date().toISOString(),
1229
+ amount: student.fees.total,
1230
+ type: 'inscription',
1231
+ student: student.fullName,
1232
+ class: student.class
1233
+ };
1234
+ finances.transactions.push(transaction);
1235
+ finances.balance += student.fees.total;
1236
+ localStorage.setItem('finances', JSON.stringify(finances));
1237
+
1238
+ return student;
1239
+ }
1240
+
1241
+ // Fonction pour charger les élèves
1242
+ async function loadStudents() {
1243
  try {
1244
  document.getElementById('loading-indicator').classList.remove('hidden');
 
 
 
 
 
1245
 
1246
+ const mainContent = document.querySelector('#admin-dashboard .flex-1');
1247
+ mainContent.innerHTML = `
1248
+ <h2 class="text-2xl font-bold mb-6 text-blue-800">Gestion des Élèves</h2>
1249
+ <div class="mb-6 flex justify-between items-center">
1250
+ <div class="relative w-64">
1251
+ <input type="text" id="student-search" placeholder="Rechercher un élève..."
1252
+ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
1253
+ <i class="fas fa-search absolute right-3 top-3 text-gray-400"></i>
 
 
 
 
 
 
 
 
 
 
 
 
1254
  </div>
1255
+ <button onclick="showAddStudentModal()" class="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700">
1256
+ <i class="fas fa-plus mr-2"></i>Ajouter un élève
1257
+ </button>
1258
+ </div>
1259
+ <div class="bg-white rounded-lg shadow overflow-hidden">
1260
+ <table class="min-w-full divide-y divide-gray-200">
1261
+ <thead class="bg-gray-50">
1262
+ <tr>
1263
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nom</th>
1264
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Classe</th>
1265
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Tuteur</th>
1266
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Paiement</th>
1267
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
1268
+ </tr>
1269
+ </thead>
1270
+ <tbody id="students-list" class="bg-white divide-y divide-gray-200">
1271
+ ${students.map(student => `
1272
+ <tr>
1273
+ <td class="px-6 py-4 whitespace-nowrap">${student.fullName}</td>
1274
+ <td class="px-6 py-4 whitespace-nowrap">${student.class}</td>
1275
+ <td class="px-6 py-4 whitespace-nowrap">${student.guardianPhone}</td>
1276
+ <td class="px-6 py-4 whitespace-nowrap">
1277
+ <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full
1278
+ ${student.fees.paid ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'}">
1279
+ ${student.fees.paid ? 'Payé' : 'Non payé'}
1280
+ </span>
1281
+ </td>
1282
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
1283
+ <button onclick="editStudent(${student.id})" class="text-blue-600 hover:text-blue-900 mr-3">
1284
+ <i class="fas fa-edit"></i>
1285
+ </button>
1286
+ <button onclick="deleteStudent(${student.id})" class="text-red-600 hover:text-red-900">
1287
+ <i class="fas fa-trash"></i>
1288
+ </button>
1289
+ </td>
1290
+ </tr>
1291
+ `).join('')}
1292
+ </tbody>
1293
+ </table>
1294
+ </div>
1295
+ `;
1296
+
1297
+ // Mettre à jour les statistiques
1298
+ updateDashboardStats();
1299
 
1300
  } catch (error) {
1301
+ console.error('Erreur lors du chargement des élèves:', error);
1302
  } finally {
1303
  document.getElementById('loading-indicator').classList.add('hidden');
1304
  }
1305
  }
1306
 
1307
+ // Fonction pour mettre à jour les statistiques
1308
+ function updateDashboardStats() {
1309
+ document.querySelector('#admin-dashboard .bg-white:nth-child(1) h3').textContent = students.length;
1310
+ document.querySelector('#admin-dashboard .bg-white:nth-child(3) h3').textContent = finances.balance + ' FCFA';
1311
+ }
1312
+
1313
+ // Fonction pour enregistrer un nouvel élève depuis le formulaire d'inscription
1314
+ function registerNewStudent() {
1315
+ const student = {
1316
+ id: Date.now(),
1317
+ fullName: `${document.getElementById('eleve-prenom').value} ${document.getElementById('eleve-nom').value}`,
1318
+ birthDate: document.getElementById('eleve-ddn').value,
1319
+ class: document.getElementById('niveau').options[document.getElementById('niveau').selectedIndex].text,
1320
+ option: document.querySelector('input[name="option"]:checked').value,
1321
+ guardianName: `${document.getElementById('tuteur-prenom').value} ${document.getElementById('tuteur-nom').value}`,
1322
+ guardianPhone: document.getElementById('tuteur-phone').value,
1323
+ medicalHistory: document.getElementById('antecedents').value || 'Aucun',
1324
+ registrationDate: new Date().toISOString(),
1325
+ fees: {
1326
+ base: document.querySelector('input[name="paiement-mode"]:checked').value === '1' ?
1327
+ parseInt(document.getElementById('montant-total').textContent.replace('Total: ', '').replace(' FCFA', '')) - 10000 :
1328
+ parseInt(document.getElementById('montant-total').textContent.replace('Total: ', '').replace(' FCFA', '')) - 10000,
1329
+ registration: 10000,
1330
+ total: parseInt(document.getElementById('montant-total').textContent.replace('Total: ', '').replace(' FCFA', '')),
1331
+ paid: false
1332
+ }
1333
+ };
1334
+
1335
+ saveStudent(student);
1336
+ alert('Élève enregistré avec succès!');
1337
+ }
1338
+
1339
+ // Mettre à jour le lien WhatsApp
1340
+ const whatsappPayment = document.getElementById('whatsapp-payment');
1341
+ whatsappPayment.href = `https://wa.me/221765286257?text=${encodeURIComponent(
1342
+ `Bonjour,
1343
+
1344
+ Je confirme l'inscription via le site web.
1345
+ Montant à payer: ${document.getElementById('montant-total').textContent.replace('Total: ', '')}
1346
+
1347
+ Pour finaliser, veuillez effectuer le paiement via:
1348
+ - Orange Money: 76 528 62 57
1349
+ - Wave: 76 528 62 57
1350
+ - Espèces au secrétariat
1351
+
1352
+ Merci.
1353
+ Cours d'Excellence les Grands Esprits`
1354
+ )}`;
1355
+
1356
+ // Modifier le bouton "Suivant" pour enregistrer l'élève
1357
+ nextBtn.addEventListener('click', (e) => {
1358
+ e.preventDefault();
1359
+ registerNewStudent();
1360
+ registrationForm.classList.add('hidden');
1361
+ recapSection.classList.remove('hidden');
1362
+ });
1363
+
1364
  // Charger les données au démarrage
1365
  document.addEventListener('DOMContentLoaded', () => {
1366
  if (document.getElementById('admin-dashboard') && !document.getElementById('admin-dashboard').classList.contains('hidden')) {
1367
+ loadStudents();
1368
  }
1369
  });
1370
 
1371
  // Rafraîchir les données lors du clic sur le tableau de bord
1372
+ document.querySelector('#admin-sidebar a:first-child').addEventListener('click', loadStudents);
1373
  </script>
1374
  <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 <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=bamen/cege" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1375
  </html>