هام: تنسيق ملف CSV
@@ -91,7 +98,7 @@
اسم الطالب, العمر, اسم ولي الأمر, هاتف ولي الأمر 1, هاتف ولي الأمر 2, هاتف الطالب, الصف, اسم المدرسة, العنوان, المحفوظات, الملاحظات, تاريخ التسجيل
-
إذا كانت الحقول الاختيارية (هاتف ولي الأمر 2، هاتف الطالب، الملاحظات، تاريخ التسجيل) فارغة، اتركها كذلك. تاريخ التسجيل سيُعيّن تلقائياً لليوم الحالي إذا تُرِك فارغاً. **النقاط تبدأ من صفر ولا تُدرج في الملف CSV.**
+
إذا كانت الحقول الاختيارية (هاتف ولي الأمر 2، هاتف الطالب، الملاحظات، تاريخ التسجيل) فارغة، اتركها كذلك. تاريخ التسجيل سيُعيّن تلقائياً لليوم الحالي إذا تُرِك فارغاً. **النقاط تبدأ من صفر ولا تُدرج في ملف CSV.**
تنزيل قالب CSV
@@ -144,7 +151,7 @@
المحفوظات |
تاريخ التسجيل |
ملاحظات |
-
النقاط | {# ADDED: Points header for table #}
+
النقاط |
@@ -176,11 +183,11 @@
{{ student['memorizing'] }} |
{{ student['registration_date'] }} |
{{ student['notes'] or 'لا يوجد' }} |
- {{ student['points'] }} | {# ADDED: Display points #}
+ {{ student['points'] }} |
{% else %}
- | لم تتم إضافة أي طالب بعد. | {# Adjusted colspan #}
+ لم تتم إضافة أي طالب بعد. |
{% endfor %}
@@ -201,22 +208,24 @@
const addStudentForm = document.getElementById('add-student-form');
const submitAddButton = document.getElementById('submit-add-button');
+ // NEW: CSV Import section and toggle button
+ const csvImportSection = document.getElementById('csv-import-section');
+ const toggleCsvImportButton = document.getElementById('toggle-csv-import-button');
+
const searchInput = document.getElementById('search-input');
const studentsTableBody = document.getElementById('students-table-body');
const noStudentsRow = document.getElementById('no-students-row');
const noSearchResultsDiv = document.getElementById('no-search-results');
- // Store original student data and row elements for efficient filtering and restoration
const allStudentData = [];
studentsTableBody.querySelectorAll('tr').forEach(row => {
if (row.id === 'no-students-row') {
- return; // Skip the "no students" row from data processing
+ return;
}
allStudentData.push({
element: row,
student_name: row.children[2] ? row.children[2].textContent : '',
parent_name: row.children[4] ? row.children[4].textContent : '',
- // Store original HTML of potentially highlighted cells to restore them later
originalStudentNameHTML: row.children[2] ? row.children[2].innerHTML : '',
originalParentNameHTML: row.children[4] ? row.children[4].innerHTML : ''
});
@@ -325,8 +334,25 @@
addManuallyButton.addEventListener('click', () => {
addStudentSection.classList.toggle('hidden');
+ // Hide CSV import section if manual add is shown
+ csvImportSection.classList.add('hidden');
+ toggleCsvImportButton.textContent = 'استيراد من CSV'; // Reset button text
});
+ // NEW: Toggle CSV Import section visibility
+ toggleCsvImportButton.addEventListener('click', () => {
+ csvImportSection.classList.toggle('hidden');
+ // Hide manual add section if CSV import is shown
+ addStudentSection.classList.add('hidden');
+ // Update button text based on visibility
+ if (csvImportSection.classList.contains('hidden')) {
+ toggleCsvImportButton.textContent = 'استيراد من CSV';
+ } else {
+ toggleCsvImportButton.textContent = 'إخفاء استيراد CSV';
+ }
+ });
+
+
importForm.addEventListener('submit', () => {
submitImportButton.disabled = true;
submitImportButton.textContent = 'جاري الرفع...';