Files
notytex/templates/index.html

308 lines
23 KiB
HTML

{% extends "base.html" %}
{% from 'components/common/macros.html' import page_layout, content_section, alert, stat_card, action_card %}
{% block title %}Accueil - Gestion Scolaire{% endblock %}
{% block content %}
<div class="space-y-8">
{% call page_layout("Bonjour ! 👋", "Prêt à gérer vos évaluations aujourd'hui ?") %}
<!-- Notifications contextuelles avec composant unifié -->
{% if total_assessments == 0 %}
{{ alert('info', 'Bienvenue dans Notytex ! 🎉', 'Commencez par créer votre première évaluation. <a href="' + url_for('assessments.new') + '" class="underline hover:no-underline font-medium">Créer maintenant</a>', false) }}
{% elif recent_assessments and recent_assessments|length >= 3 %}
{{ alert('success', 'Système bien utilisé ! 📈', 'Vous avez ' + total_assessments|string + ' évaluations créées. Pensez à exporter vos données régulièrement.', false) }}
{% endif %}
<!-- Hero Section déjà gérée par page_layout -->
<!-- Statistiques enrichies et cliquables -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<a href="{{ url_for('classes') }}" class="block bg-white rounded-lg shadow hover:shadow-lg transition-all duration-300 p-6 transform hover:scale-105 group">
<div class="flex items-center justify-between">
<div>
<div class="text-sm font-medium text-gray-500 group-hover:text-blue-600 transition-colors">Classes actives</div>
<div class="text-3xl font-bold text-gray-900 group-hover:text-blue-700 transition-colors">{{ total_classes }}</div>
<div class="text-xs text-green-600 flex items-center mt-1">
<svg class="w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.707a1 1 0 010-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 01-1.414 1.414L11 5.414V17a1 1 0 11-2 0V5.414L6.707 7.707a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
</svg>
Cliquer pour gérer
</div>
</div>
<div class="w-12 h-12 bg-blue-100 group-hover:bg-blue-200 rounded-full flex items-center justify-center transition-colors">
<svg class="w-6 h-6 text-blue-600" 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>
</div>
</div>
</a>
<a href="{{ url_for('students') }}" class="block bg-white rounded-lg shadow hover:shadow-lg transition-all duration-300 p-6 transform hover:scale-105 group">
<div class="flex items-center justify-between">
<div>
<div class="text-sm font-medium text-gray-500 group-hover:text-green-600 transition-colors">Élèves inscrits</div>
<div class="text-3xl font-bold text-gray-900 group-hover:text-green-700 transition-colors">{{ total_students }}</div>
<div class="text-xs text-blue-600 flex items-center mt-1">
<svg class="w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
Cliquer pour consulter
</div>
</div>
<div class="w-12 h-12 bg-green-100 group-hover:bg-green-200 rounded-full flex items-center justify-center transition-colors">
<svg class="w-6 h-6 text-green-600" fill="currentColor" viewBox="0 0 20 20">
<path d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"/>
</svg>
</div>
</div>
</a>
<a href="{{ url_for('assessments.list') }}" class="block bg-white rounded-lg shadow hover:shadow-lg transition-all duration-300 p-6 transform hover:scale-105 group">
<div class="flex items-center justify-between">
<div>
<div class="text-sm font-medium text-gray-500 group-hover:text-purple-600 transition-colors">Évaluations créées</div>
<div class="text-3xl font-bold text-gray-900 group-hover:text-purple-700 transition-colors">{{ total_assessments }}</div>
<div class="text-xs text-purple-600 flex items-center mt-1">
<svg class="w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-8.293l-3-3a1 1 0 00-1.414 1.414L10.586 9.5H7a1 1 0 100 2h3.586l-1.293 1.293a1 1 0 101.414 1.414l3-3a1 1 0 000-1.414z" clip-rule="evenodd"/>
</svg>
Cliquer pour voir
</div>
</div>
<div class="w-12 h-12 bg-purple-100 group-hover:bg-purple-200 rounded-full flex items-center justify-center transition-colors">
<svg class="w-6 h-6 text-purple-600" 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>
</a>
</div>
<!-- Actions principales prominentes -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<a href="{{ url_for('assessments.new') }}"
class="group bg-gradient-to-r from-green-500 to-green-600 text-white rounded-xl p-6 hover:from-green-600 hover:to-green-700 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-xl">
<div class="flex items-center">
<div class="w-14 h-14 bg-white/20 rounded-xl flex items-center justify-center mr-4 group-hover:bg-white/30 transition-colors">
<svg class="w-7 h-7" 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>
</div>
<div>
<h3 class="text-xl font-bold mb-1">Créer une évaluation</h3>
<p class="text-sm opacity-90">Nouvelle évaluation + exercices en une fois</p>
</div>
</div>
</a>
{% if recent_assessments %}
<a href="{{ url_for('grading.assessment_grading', assessment_id=recent_assessments[0].id) }}"
class="group bg-gradient-to-r from-purple-500 to-purple-600 text-white rounded-xl p-6 hover:from-purple-600 hover:to-purple-700 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-xl">
<div class="flex items-center">
<div class="w-14 h-14 bg-white/20 rounded-xl flex items-center justify-center mr-4 group-hover:bg-white/30 transition-colors">
<svg class="w-7 h-7" 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>
</div>
<div>
<h3 class="text-xl font-bold mb-1">Corriger évaluation</h3>
<p class="text-sm opacity-90">{{ recent_assessments[0].title[:30] }}...</p>
</div>
</div>
</a>
{% else %}
<a href="{{ url_for('assessments.list') }}"
class="group bg-gradient-to-r from-purple-500 to-purple-600 text-white rounded-xl p-6 hover:from-purple-600 hover:to-purple-700 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-xl">
<div class="flex items-center">
<div class="w-14 h-14 bg-white/20 rounded-xl flex items-center justify-center mr-4 group-hover:bg-white/30 transition-colors">
<svg class="w-7 h-7" 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-2V5zm3 2a1 1 0 000 2h2a1 1 0 100-2H7z" clip-rule="evenodd"/>
</svg>
</div>
<div>
<h3 class="text-xl font-bold mb-1">Mes évaluations</h3>
<p class="text-sm opacity-90">Consulter et modifier les évaluations</p>
</div>
</div>
</a>
{% endif %}
</div>
<!-- Évaluations récentes avec priorités -->
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200 flex items-center justify-between">
<h2 class="text-lg font-semibold text-gray-900">Activité récente</h2>
{% if recent_assessments %}
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full font-medium">{{ recent_assessments|length }} évaluations</span>
{% endif %}
</div>
<div class="p-6">
{% if recent_assessments %}
<div class="space-y-3">
{% for assessment in recent_assessments %}
<div class="flex items-center justify-between p-4 bg-gray-50 hover:bg-blue-50 rounded-lg transition-colors group">
<a href="{{ url_for('assessments.detail', id=assessment.id) }}" class="flex items-center space-x-4 flex-1 min-w-0">
<div class="w-10 h-10 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white font-bold text-sm">
{{ assessment.title[0].upper() }}
</div>
<div class="min-w-0 flex-1">
<h3 class="text-sm font-semibold text-gray-900 group-hover:text-blue-700 transition-colors truncate">{{ assessment.title }}</h3>
<div class="flex items-center text-xs text-gray-500 space-x-2">
<span class="flex items-center">
<svg class="w-3 h-3 mr-1" 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>
{{ assessment.class_group.name }}
</span>
<span></span>
<span class="flex items-center">
<svg class="w-3 h-3 mr-1" 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>
{{ assessment.date.strftime('%d/%m/%Y') }}
</span>
</div>
</div>
</a>
<div class="flex items-center space-x-3 flex-shrink-0">
<!-- Indicateur de progression compact -->
{% set progress = assessment.grading_progress %}
{% if progress.status == 'completed' %}
<div class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 border border-green-200" title="100% Terminé">
<svg class="w-3 h-3 mr-1" 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-medium">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-2 py-1 rounded-full text-xs font-medium bg-orange-100 text-orange-800 border border-orange-200 hover:bg-orange-200 transition-colors cursor-pointer"
title="{{ progress.percentage }}% En cours - Cliquer pour corriger"
onclick="event.stopPropagation();">
<div class="relative w-3 h-3 mr-1">
<svg class="w-3 h-3 transform -rotate-90" viewBox="0 0 12 12">
<circle cx="6" cy="6" r="4" stroke="currentColor" stroke-width="1.5" fill="none" class="text-orange-300"/>
<circle cx="6" cy="6" r="4" stroke="currentColor" stroke-width="1.5" fill="none"
class="text-orange-600" stroke-dasharray="25.1"
stroke-dashoffset="{{ 25.1 - (25.1 * progress.percentage / 100) }}"/>
</svg>
</div>
<span class="font-medium">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-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800 border border-red-200 hover:bg-red-200 transition-colors cursor-pointer"
title="Non commencée - Cliquer pour corriger"
onclick="event.stopPropagation();">
<svg class="w-3 h-3 mr-1" 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-medium">Correction 0%</span>
</a>
{% else %}
<div class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 border border-gray-200" title="Non définie">
<svg class="w-3 h-3 mr-1" 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-medium">-</span>
</div>
{% endif %}
<span class="bg-white text-gray-600 text-xs px-2 py-1 rounded-full border group-hover:border-blue-200 transition-colors">
Coeff. {{ assessment.coefficient }}
</span>
<a href="{{ url_for('assessments.detail', id=assessment.id) }}" class="text-blue-600 group-hover:text-blue-800 opacity-70 group-hover:opacity-100 transition-all">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
</svg>
</a>
</div>
</div>
{% endfor %}
</div>
<div class="mt-4 text-center">
<a href="{{ url_for('assessments.list') }}"
class="text-blue-600 hover:text-blue-800 text-sm font-medium hover:underline">
Voir toutes les évaluations →
</a>
</div>
{% else %}
<div class="text-center py-12">
<div class="w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4">
<svg class="w-8 h-8 text-gray-400" 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-2V5zm3 2a1 1 0 000 2h2a1 1 0 100-2H7z" clip-rule="evenodd"/>
</svg>
</div>
<h3 class="text-sm font-medium text-gray-900 mb-1">Aucune évaluation</h3>
<p class="text-sm text-gray-500 mb-4">Commencez par créer votre première évaluation</p>
<a href="{{ url_for('assessments.new') }}"
class="inline-flex items-center text-sm bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors">
<svg class="w-4 h-4 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>
Créer une évaluation
</a>
</div>
{% endif %}
</div>
</div>
<!-- Raccourcis intelligents -->
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">Raccourcis utiles</h2>
</div>
<div class="p-6">
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<a href="{{ url_for('classes') }}"
class="group p-4 border-2 border-gray-200 rounded-xl hover:border-blue-300 hover:bg-blue-50 transition-all duration-200 text-center">
<div class="w-10 h-10 bg-blue-100 group-hover:bg-blue-200 rounded-xl flex items-center justify-center mx-auto mb-3 transition-colors">
<svg class="w-5 h-5 text-blue-600" 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>
</div>
<div class="text-sm font-medium text-gray-900 group-hover:text-blue-900">Classes</div>
<div class="text-xs text-gray-500 mt-1">Gérer</div>
</a>
<a href="{{ url_for('students') }}"
class="group p-4 border-2 border-gray-200 rounded-xl hover:border-green-300 hover:bg-green-50 transition-all duration-200 text-center">
<div class="w-10 h-10 bg-green-100 group-hover:bg-green-200 rounded-xl flex items-center justify-center mx-auto mb-3 transition-colors">
<svg class="w-5 h-5 text-green-600" fill="currentColor" viewBox="0 0 20 20">
<path d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"/>
</svg>
</div>
<div class="text-sm font-medium text-gray-900 group-hover:text-green-900">Élèves</div>
<div class="text-xs text-gray-500 mt-1">Consulter</div>
</a>
<button class="group p-4 border-2 border-dashed border-gray-300 rounded-xl hover:border-orange-300 hover:bg-orange-50 transition-all duration-200 text-center">
<div class="w-10 h-10 bg-orange-100 group-hover:bg-orange-200 rounded-xl flex items-center justify-center mx-auto mb-3 transition-colors">
<svg class="w-5 h-5 text-orange-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd"/>
</svg>
</div>
<div class="text-sm font-medium text-gray-900 group-hover:text-orange-900">Import</div>
<div class="text-xs text-gray-500 mt-1">CSV/Excel</div>
</button>
<button class="group p-4 border-2 border-dashed border-gray-300 rounded-xl hover:border-purple-300 hover:bg-purple-50 transition-all duration-200 text-center">
<div class="w-10 h-10 bg-purple-100 group-hover:bg-purple-200 rounded-xl flex items-center justify-center mx-auto mb-3 transition-colors">
<svg class="w-5 h-5 text-purple-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M6 2a2 2 0 00-2 2v12a2 2 0 002 2h8a2 2 0 002-2V7.414A2 2 0 0015.414 6L12 2.586A2 2 0 0010.586 2H6zm5 6a1 1 0 10-2 0v3.586l-1.293-1.293a1 1 0 10-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 11.586V8z" clip-rule="evenodd"/>
</svg>
</div>
<div class="text-sm font-medium text-gray-900 group-hover:text-purple-900">Rapports</div>
<div class="text-xs text-gray-500 mt-1">Bientôt</div>
</button>
</div>
</div>
</div>
</div>
{% endcall %}
</div>
{% endblock %}