refactor: html organisation
This commit is contained in:
@@ -1,81 +1,73 @@
|
||||
{% extends "base.html" %}
|
||||
{% from 'components/common/macros.html' import hero_section, filter_section %}
|
||||
{% from 'components/assessment/assessment_card.html' import assessment_card %}
|
||||
|
||||
{% block title %}Évaluations - Gestion Scolaire{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="space-y-8">
|
||||
<!-- Hero Section -->
|
||||
<div class="bg-gradient-to-r from-purple-600 to-blue-600 text-white rounded-xl p-8 shadow-lg">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-4xl font-bold mb-2">Mes Évaluations 📚</h1>
|
||||
<p class="text-xl opacity-90 mb-1">Gérez et organisez toutes vos évaluations</p>
|
||||
<div class="flex items-center space-x-6 text-sm opacity-75 mt-3">
|
||||
<span class="flex items-center">
|
||||
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"/>
|
||||
<path fill-rule="evenodd" d="M4 5a2 2 0 012-2v1a1 1 0 102 0V3a2 2 0 012 2v6a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm2.5 2.5a.5.5 0 000 1h3a.5.5 0 000-1h-3z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
{{ assessments|length }} évaluations
|
||||
</span>
|
||||
<span class="flex items-center">
|
||||
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
Année scolaire 2024-2025
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden md:block">
|
||||
<a href="{{ url_for('assessments.new') }}"
|
||||
class="bg-white/20 hover:bg-white/30 text-white px-6 py-3 rounded-xl transition-all duration-300 font-semibold shadow-lg hover:shadow-xl transform hover:scale-105 flex items-center">
|
||||
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
Nouvelle évaluation
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{# Hero Section avec composant réutilisable #}
|
||||
{% set meta_info = [
|
||||
{
|
||||
'icon': '<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20"><path d="M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"/><path fill-rule="evenodd" d="M4 5a2 2 0 012-2v1a1 1 0 102 0V3a2 2 0 012 2v6a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm2.5 2.5a.5.5 0 000 1h3a.5.5 0 000-1h-3z" clip-rule="evenodd"/></svg>',
|
||||
'text': assessments|length ~ ' évaluations'
|
||||
},
|
||||
{
|
||||
'icon': '<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"/></svg>',
|
||||
'text': 'Année scolaire 2024-2025'
|
||||
}
|
||||
] %}
|
||||
{% set primary_action = {
|
||||
'url': url_for('assessments.new'),
|
||||
'text': 'Nouvelle évaluation',
|
||||
'icon': '<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/></svg>'
|
||||
} %}
|
||||
{{ hero_section(
|
||||
title="Mes Évaluations 📚",
|
||||
subtitle="Gérez et organisez toutes vos évaluations",
|
||||
meta_info=meta_info,
|
||||
primary_action=primary_action,
|
||||
gradient_class="from-purple-600 to-blue-600"
|
||||
) }}
|
||||
|
||||
<!-- Filtres et actions -->
|
||||
<div class="bg-white rounded-lg shadow p-6">
|
||||
<div class="flex flex-col lg:flex-row lg:items-center lg:justify-between space-y-4 lg:space-y-0">
|
||||
<div class="flex flex-col md:flex-row md:items-center space-y-3 md:space-y-0 md:space-x-4">
|
||||
<div class="flex items-center space-x-2">
|
||||
<label class="text-sm font-medium text-gray-700">Trimestre :</label>
|
||||
<select id="trimester-filter" class="border border-gray-300 rounded-md px-3 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
|
||||
<option value="">Tous</option>
|
||||
<option value="1" {% if current_trimester == '1' %}selected{% endif %}>Trimestre 1</option>
|
||||
<option value="2" {% if current_trimester == '2' %}selected{% endif %}>Trimestre 2</option>
|
||||
<option value="3" {% if current_trimester == '3' %}selected{% endif %}>Trimestre 3</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<label class="text-sm font-medium text-gray-700">Classe :</label>
|
||||
<select id="class-filter" class="border border-gray-300 rounded-md px-3 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
|
||||
<option value="">Toutes</option>
|
||||
{% for class_group in classes %}
|
||||
<option value="{{ class_group.id }}" {% if current_class == class_group.id|string %}selected{% endif %}>
|
||||
{{ class_group.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<label class="text-sm font-medium text-gray-700">Tri :</label>
|
||||
<select id="sort-filter" class="border border-gray-300 rounded-md px-3 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
|
||||
<option value="date_desc" {% if current_sort == 'date_desc' %}selected{% endif %}>Plus récent</option>
|
||||
<option value="date_asc" {% if current_sort == 'date_asc' %}selected{% endif %}>Plus ancien</option>
|
||||
<option value="title" {% if current_sort == 'title' %}selected{% endif %}>Titre A-Z</option>
|
||||
<option value="class" {% if current_sort == 'class' %}selected{% endif %}>Classe</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Compteur de résultats -->
|
||||
<div class="text-sm text-gray-500 font-medium">
|
||||
{{ assessments|length }} évaluation(s)
|
||||
</div>
|
||||
{# Filtres avec composant réutilisable #}
|
||||
{% set class_options = [{'value': '', 'label': 'Toutes'}] %}
|
||||
{% for class_group in classes %}
|
||||
{% set _ = class_options.append({'value': class_group.id|string, 'label': class_group.name}) %}
|
||||
{% endfor %}
|
||||
|
||||
{% set filters = [
|
||||
{
|
||||
'id': 'trimester-filter',
|
||||
'label': 'Trimestre',
|
||||
'options': [
|
||||
{'value': '', 'label': 'Tous'},
|
||||
{'value': '1', 'label': 'Trimestre 1'},
|
||||
{'value': '2', 'label': 'Trimestre 2'},
|
||||
{'value': '3', 'label': 'Trimestre 3'}
|
||||
]
|
||||
},
|
||||
{
|
||||
'id': 'class-filter',
|
||||
'label': 'Classe',
|
||||
'options': class_options
|
||||
},
|
||||
{
|
||||
'id': 'sort-filter',
|
||||
'label': 'Tri',
|
||||
'options': [
|
||||
{'value': 'date_desc', 'label': 'Plus récent'},
|
||||
{'value': 'date_asc', 'label': 'Plus ancien'},
|
||||
{'value': 'title', 'label': 'Titre A-Z'},
|
||||
{'value': 'class', 'label': 'Classe'}
|
||||
]
|
||||
}
|
||||
] %}
|
||||
|
||||
{% call filter_section(filters, {'trimester-filter': current_trimester, 'class-filter': current_class, 'sort-filter': current_sort}) %}
|
||||
<div class="flex items-center space-x-4">
|
||||
<div class="text-sm text-gray-500 font-medium">
|
||||
{{ assessments|length }} évaluation(s)
|
||||
</div>
|
||||
<div class="md:hidden">
|
||||
<a href="{{ url_for('assessments.new') }}"
|
||||
@@ -87,144 +79,13 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endcall %}
|
||||
|
||||
{% if assessments %}
|
||||
<!-- Grille d'évaluations modernisée -->
|
||||
<!-- Grille d'évaluations avec composants -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{% for assessment in assessments %}
|
||||
{% set trimester_colors = {
|
||||
1: {'bg': 'from-blue-500 to-blue-600', 'accent': 'blue', 'icon_bg': 'bg-blue-100', 'icon_text': 'text-blue-600'},
|
||||
2: {'bg': 'from-green-500 to-green-600', 'accent': 'green', 'icon_bg': 'bg-green-100', 'icon_text': 'text-green-600'},
|
||||
3: {'bg': 'from-orange-500 to-orange-600', 'accent': 'orange', 'icon_bg': 'bg-orange-100', 'icon_text': 'text-orange-600'}
|
||||
} %}
|
||||
{% set colors = trimester_colors[assessment.trimester] %}
|
||||
|
||||
<div class="bg-white rounded-xl shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105 overflow-hidden">
|
||||
<!-- Header avec gradient thématique -->
|
||||
<div class="bg-gradient-to-r {{ colors.bg }} p-4 text-white">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center space-x-3">
|
||||
<div class="w-10 h-10 bg-white/20 rounded-full flex items-center justify-center">
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"/>
|
||||
<path fill-rule="evenodd" d="M4 5a2 2 0 012-2v1a1 1 0 102 0V3a2 2 0 012 2v6a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm2.5 2.5a.5.5 0 000 1h3a.5.5 0 000-1h-3z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="text-sm font-semibold">Trimestre {{ assessment.trimester }}</div>
|
||||
</div>
|
||||
<div class="text-xs opacity-75">{{ assessment.date.strftime('%d/%m/%Y') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Contenu principal -->
|
||||
<div class="p-6">
|
||||
<h3 class="text-lg font-bold text-gray-900 mb-2 line-clamp-2">{{ assessment.title }}</h3>
|
||||
|
||||
<!-- Informations clés -->
|
||||
<div class="space-y-3 mb-4">
|
||||
<div class="flex items-center text-sm text-gray-600">
|
||||
<svg class="w-4 h-4 mr-2 {{ colors.icon_text }}" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
<span class="font-medium">{{ assessment.class_group.name }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center text-sm text-gray-600">
|
||||
<svg class="w-4 h-4 mr-2 {{ colors.icon_text }}" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M7 3a1 1 0 000 2h6a1 1 0 100-2H7zM4 7a1 1 0 011-1h10a1 1 0 110 2H5a1 1 0 01-1-1zM2 11a2 2 0 012-2h12a2 2 0 012 2v4a2 2 0 01-2 2H4a2 2 0 01-2-2v-4z"/>
|
||||
</svg>
|
||||
<span>{{ assessment.exercises|length }} exercice(s)</span>
|
||||
</div>
|
||||
|
||||
<div class="bg-{{ colors.accent }}-100 text-{{ colors.accent }}-800 text-xs px-2 py-1 rounded-full font-medium">
|
||||
Coeff. {{ assessment.coefficient }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Indicateur de progression des notes -->
|
||||
{% set progress = assessment.grading_progress %}
|
||||
<div class="flex items-center justify-between pt-2 border-t border-gray-100">
|
||||
<!-- Indicateur fusionné cliquable -->
|
||||
{% if progress.status == 'completed' %}
|
||||
<div class="inline-flex items-center px-3 py-2 rounded-lg text-sm font-medium bg-green-100 text-green-800 border border-green-200">
|
||||
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
<span class="font-semibold">Correction 100% </span>
|
||||
</div>
|
||||
{% elif progress.status == 'in_progress' %}
|
||||
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}"
|
||||
class="inline-flex items-center px-3 py-2 rounded-lg text-sm font-medium bg-orange-100 text-orange-800 border border-orange-200 hover:bg-orange-200 transition-colors cursor-pointer">
|
||||
<div class="relative w-4 h-4 mr-2">
|
||||
<svg class="w-4 h-4 transform -rotate-90" viewBox="0 0 16 16">
|
||||
<circle cx="8" cy="8" r="6" stroke="currentColor" stroke-width="2" fill="none" class="text-orange-300"/>
|
||||
<circle cx="8" cy="8" r="6" stroke="currentColor" stroke-width="2" fill="none"
|
||||
class="text-orange-600" stroke-dasharray="37.7"
|
||||
stroke-dashoffset="{{ 37.7 - (37.7 * progress.percentage / 100) }}"/>
|
||||
</svg>
|
||||
</div>
|
||||
<span class="font-semibold">Correction {{ progress.percentage }}% </span>
|
||||
</a>
|
||||
{% elif progress.status == 'not_started' %}
|
||||
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}"
|
||||
class="inline-flex items-center px-3 py-2 rounded-lg text-sm font-medium bg-red-100 text-red-800 border border-red-200 hover:bg-red-200 transition-colors cursor-pointer">
|
||||
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
<span class="font-semibold">Correction 0%</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<div class="inline-flex items-center px-3 py-2 rounded-lg text-sm font-medium bg-gray-100 text-gray-800 border border-gray-200">
|
||||
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
<span class="font-semibold">Non définie</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Info détaillée -->
|
||||
<div class="text-xs text-gray-500 text-right">
|
||||
{{ progress.completed }}/{{ progress.total }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if assessment.description %}
|
||||
<p class="text-sm text-gray-600 mb-4 line-clamp-2">{{ assessment.description }}</p>
|
||||
{% endif %}
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="flex space-x-2">
|
||||
<a href="{{ url_for('assessments.detail', id=assessment.id) }}"
|
||||
class="flex-1 bg-gray-50 hover:bg-gray-100 text-gray-700 hover:text-gray-900 px-3 py-2 rounded-lg text-xs font-medium transition-colors flex items-center justify-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10 12a2 2 0 100-4 2 2 0 000 4z"/>
|
||||
<path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
Détails
|
||||
</a>
|
||||
|
||||
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}"
|
||||
class="flex-1 bg-{{ colors.accent }}-50 hover:bg-{{ colors.accent }}-100 text-{{ colors.accent }}-700 hover:text-{{ colors.accent }}-900 px-3 py-2 rounded-lg text-xs font-medium transition-colors flex items-center justify-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"/>
|
||||
</svg>
|
||||
Noter
|
||||
</a>
|
||||
|
||||
<a href="{{ url_for('assessments.edit', id=assessment.id) }}"
|
||||
class="flex-1 bg-gray-50 hover:bg-gray-100 text-gray-700 hover:text-gray-900 px-3 py-2 rounded-lg text-xs font-medium transition-colors flex items-center justify-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"/>
|
||||
<path fill-rule="evenodd" d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
Modifier
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ assessment_card(assessment) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
@@ -260,39 +121,6 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Gestion des filtres
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const trimesterFilter = document.getElementById('trimester-filter');
|
||||
const classFilter = document.getElementById('class-filter');
|
||||
const sortFilter = document.getElementById('sort-filter');
|
||||
|
||||
function applyFilters() {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (trimesterFilter.value) {
|
||||
params.set('trimester', trimesterFilter.value);
|
||||
}
|
||||
|
||||
if (classFilter.value) {
|
||||
params.set('class', classFilter.value);
|
||||
}
|
||||
|
||||
if (sortFilter.value) {
|
||||
params.set('sort', sortFilter.value);
|
||||
}
|
||||
|
||||
// Rediriger avec les nouveaux paramètres
|
||||
const url = new URL(window.location);
|
||||
url.search = params.toString();
|
||||
window.location.href = url.toString();
|
||||
}
|
||||
|
||||
// Écouter les changements sur tous les filtres
|
||||
[trimesterFilter, classFilter, sortFilter].forEach(filter => {
|
||||
filter.addEventListener('change', applyFilters);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{# JavaScript géré par le système centralisé #}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user