- version : 0.8

- description : adding record and points pages and adding a navbar .
هذا الالتزام موجود في:
2025-06-11 19:03:59 +03:00
الأصل c5d5c1408c
التزام 731e45f75c
4 ملفات معدلة مع 123 إضافات و34 حذوفات

15
app.py
عرض الملف

@@ -191,7 +191,8 @@ def import_csv():
student_data['parent_name'],
student_data['parent_phone_1'],
student_data['parent_phone_2'] or None,
student_data['student_phone'] or None,
student_data['student_phone']
or None,
student_data['grade'],
student_data['school_name'],
student_data['address'],
@@ -228,12 +229,22 @@ def import_csv():
return redirect(url_for('index'))
# New route to download the CSV template
# Route to download the CSV template
@app.route('/download_csv_template')
def download_csv_template():
# The directory where the template.csv is located (your templates folder)
# The second argument is the filename to be sent
return send_from_directory(app.template_folder, 'template.csv', as_attachment=True)
# Route for the "تسجيل حضور أو حفظ" page
@app.route('/record')
def record():
return render_template('record.html')
# Route for the "النقاط" page
@app.route('/points')
def points():
return render_template('points.html')
if __name__ == '__main__':
app.run(debug=True)

عرض الملف

@@ -3,9 +3,26 @@
{% block title %}الصفحة الرئيسية{% endblock %} {# Specific title for this page #}
{% block content %}
<header class="text-center mb-8">
<h1 class="text-3xl sm:text-4xl font-bold text-gray-900">نظام إدارة الطلاب</h1>
<p class="text-gray-600 mt-2">أدخل بيانات الطلاب يدوياً أو قم باستيراد ملف CSV.</p>
<header class="text-center"> {# Removed mb-8 from header, now handled by h1 and nav #}
<h1 class="text-3xl sm:text-4xl font-bold text-gray-900 mb-6">نظام إدارة الطلاب</h1> {# Added mb-6 for spacing below title #}
{# Navigation Bar - More Eye-Attractive Styling #}
<nav class="mb-8"> {# Kept mb-8 for space below nav #}
<ul class="flex justify-center space-x-4 space-x-reverse bg-white p-2 rounded-full shadow-lg inline-flex"> {# Added padding, background, rounded corners, shadow, and inline-flex for better alignment #}
<li>
{# Active link styling #}
<a href="{{ url_for('index') }}" class="text-white bg-blue-600 hover:bg-blue-700 font-semibold px-6 py-3 rounded-full transition-all duration-300 ease-in-out shadow-md">الصفحة الرئيسية</a>
</li>
<li>
{# Inactive link styling #}
<a href="{{ url_for('record') }}" class="text-gray-700 hover:text-blue-700 hover:bg-blue-50 font-medium px-6 py-3 rounded-full transition-all duration-300 ease-in-out hover:shadow-sm transform hover:scale-105">تسجيل حضور أو حفظ</a>
</li>
<li>
{# Inactive link styling #}
<a href="{{ url_for('points') }}" class="text-gray-700 hover:text-blue-700 hover:bg-blue-50 font-medium px-6 py-3 rounded-full transition-all duration-300 ease-in-out hover:shadow-sm transform hover:scale-105">النقاط</a>
</li>
</ul>
</nav>
</header>
<div id="add-student-section" class="bg-white p-8 rounded-xl shadow-lg mb-8 hidden">
@@ -62,40 +79,39 @@
</div>
<div class="bg-white p-6 rounded-xl shadow-lg mb-8">
<h2 class="text-2xl font-semibold mb-4 text-gray-800 border-b pb-4">استيراد من ملف CSV</h2>
<div class="bg-yellow-50 border border-yellow-200 text-yellow-800 text-sm p-4 rounded-lg mt-4">
<p class="font-bold">هام: تنسيق ملف CSV</p>
<p>يجب أن يكون الملف بصيغة CSV ومرمّزاً بترميز UTF-8.</p>
<p>يجب **ألا يحتوي** الملف على صف للعناوين، ويجب أن تكون الأعمدة بالترتيب الدقيق التالي:</p>
<p class="mt-2" style="direction: ltr; text-align: right;">
<code class="text-xs font-mono">اسم الطالب, العمر, اسم ولي الأمر, هاتف ولي الأمر 1, هاتف ولي الأمر 2, هاتف الطالب, الصف, اسم المدرسة, العنوان, المحفوظات</code>
</p>
<p>إذا كانت الحقول الاختيارية (هاتف ولي الأمر 2، هاتف الطالب) فارغة، اتركها كذلك.</p>
{# Added link to download CSV template #}
<p class="mt-3">
<a href="{{ url_for('download_csv_template') }}" class="text-blue-600 hover:underline font-semibold" download>
تنزيل قالب CSV
</a>
</p>
</div>
<div class="mt-6 text-left">
<form id="import-form" action="{{ url_for('import_csv') }}" method="POST" enctype="multipart/form-data">
<input type="file" name="file" id="csv-file-input" class="hidden" required accept=".csv">
<h2 class="text-2xl font-semibold mb-4 text-gray-800 border-b pb-4">استيراد من ملف CSV</h2>
<div class="bg-yellow-50 border border-yellow-200 text-yellow-800 text-sm p-4 rounded-lg mt-4">
<p class="font-bold">هام: تنسيق ملف CSV</p>
<p>يجب أن يكون الملف بصيغة CSV ومرمّزاً بترميز UTF-8.</p>
<p>يجب **ألا يحتوي** الملف على صف للعناوين، ويجب أن تكون الأعمدة بالترتيب الدقيق التالي:</p>
<p class="mt-2" style="direction: ltr; text-align: right;">
<code class="text-xs font-mono">اسم الطالب, العمر, اسم ولي الأمر, هاتف ولي الأمر 1, هاتف ولي الأمر 2, هاتف الطالب, الصف, اسم المدرسة, العنوان, المحفوظات</code>
</p>
<p>إذا كانت الحقول الاختيارية (هاتف ولي الأمر 2، هاتف الطالب) فارغة، اتركها كذلك.</p>
{# Added link to download CSV template #}
<p class="mt-3">
<a href="{{ url_for('download_csv_template') }}" class="text-blue-600 hover:underline font-semibold" download>
تنزيل قالب CSV
</a>
</p>
</div>
<div class="mt-6 text-left">
<form id="import-form" action="{{ url_for('import_csv') }}" method="POST" enctype="multipart/form-data">
<input type="file" name="file" id="csv-file-input" class="hidden" required accept=".csv">
<button type="button" id="choose-file-button" class="px-6 py-2 bg-green-600 text-white font-semibold rounded-lg shadow-md hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-all">
اختر ملف
</button>
<button type="button" id="choose-file-button" class="px-6 py-2 bg-green-600 text-white font-semibold rounded-lg shadow-md hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-all">
اختر ملف
</button>
<span id="file-name-display" class="hidden ml-4 text-gray-700"></span>
<span id="file-name-display" class="hidden ml-4 text-gray-700"></span>
<button type="submit" id="submit-import-button" class="hidden px-6 py-2 bg-blue-600 text-white font-semibold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-all">
تأكيد ورفع الملف
</button>
</form>
</div>
<button type="submit" id="submit-import-button" class="hidden px-6 py-2 bg-blue-600 text-white font-semibold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-all">
تأكيد ورفع الملف
</button>
</form>
</div>
</div>
<div class="bg-white p-6 rounded-xl shadow-lg">
<div class="flex justify-between items-center mb-4 pb-4 border-b">
<h2 class="text-2xl font-semibold text-gray-800">الطلاب المسجلون</h2>

31
templates/points.html Normal file
عرض الملف

@@ -0,0 +1,31 @@
{% extends 'template.html' %}
{% block title %}النقاط{% endblock %}
{% block content %}
<header class="text-center"> {# Removed mb-8 from header, now handled by h1 and nav #}
<h1 class="text-3xl sm:text-4xl font-bold text-gray-900 mb-6">نظام نقاط الطلاب</h1> {# Added mb-6 for spacing below title #}
{# Navigation Bar - More Eye-Attractive Styling #}
<nav class="mb-8"> {# Kept mb-8 for space below nav #}
<ul class="flex justify-center space-x-4 space-x-reverse bg-white p-2 rounded-full shadow-lg inline-flex"> {# Added padding, background, rounded corners, shadow, and inline-flex for better alignment #}
<li>
{# Inactive link styling #}
<a href="{{ url_for('index') }}" class="text-gray-700 hover:text-blue-700 hover:bg-blue-50 font-medium px-6 py-3 rounded-full transition-all duration-300 ease-in-out hover:shadow-sm transform hover:scale-105">الصفحة الرئيسية</a>
</li>
<li>
{# Inactive link styling #}
<a href="{{ url_for('record') }}" class="text-gray-700 hover:text-blue-700 hover:bg-blue-50 font-medium px-6 py-3 rounded-full transition-all duration-300 ease-in-out hover:shadow-sm transform hover:scale-105">تسجيل حضور أو حفظ</a>
</li>
<li>
{# Active link styling #}
<a href="{{ url_for('points') }}" class="text-white bg-blue-600 hover:bg-blue-700 font-semibold px-6 py-3 rounded-full transition-all duration-300 ease-in-out shadow-md">النقاط</a>
</li>
</ul>
</nav>
</header>
<div class="bg-white p-8 rounded-xl shadow-lg mb-8">
<p class="text-gray-600 text-center">هذه صفحة لعرض وإدارة نقاط الطلاب.</p>
{# Content for student points/rewards will go here #}
</div>
{% endblock %}

31
templates/record.html Normal file
عرض الملف

@@ -0,0 +1,31 @@
{% extends 'template.html' %}
{% block title %}تسجيل حضور أو حفظ{% endblock %}
{% block content %}
<header class="text-center"> {# Removed mb-8 from header, now handled by h1 and nav #}
<h1 class="text-3xl sm:text-4xl font-bold text-gray-900 mb-6">تسجيل حضور الطلاب وحفظ المحفوظات</h1> {# Added mb-6 for spacing below title #}
{# Navigation Bar - More Eye-Attractive Styling #}
<nav class="mb-8"> {# Kept mb-8 for space below nav #}
<ul class="flex justify-center space-x-4 space-x-reverse bg-white p-2 rounded-full shadow-lg inline-flex"> {# Added padding, background, rounded corners, shadow, and inline-flex for better alignment #}
<li>
{# Inactive link styling #}
<a href="{{ url_for('index') }}" class="text-gray-700 hover:text-blue-700 hover:bg-blue-50 font-medium px-6 py-3 rounded-full transition-all duration-300 ease-in-out hover:shadow-sm transform hover:scale-105">الصفحة الرئيسية</a>
</li>
<li>
{# Active link styling #}
<a href="{{ url_for('record') }}" class="text-white bg-blue-600 hover:bg-blue-700 font-semibold px-6 py-3 rounded-full transition-all duration-300 ease-in-out shadow-md">تسجيل حضور أو حفظ</a>
</li>
<li>
{# Inactive link styling #}
<a href="{{ url_for('points') }}" class="text-gray-700 hover:text-blue-700 hover:bg-blue-50 font-medium px-6 py-3 rounded-full transition-all duration-300 ease-in-out hover:shadow-sm transform hover:scale-105">النقاط</a>
</li>
</ul>
</nav>
</header>
<div class="bg-white p-8 rounded-xl shadow-lg mb-8">
<p class="text-gray-600 text-center">هذه صفحة لتسجيل حضور الطلاب وتحديث تقدمهم في حفظ المحفوظات.</p>
{# Content for attendance/memorization recording will go here #}
</div>
{% endblock %}