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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fr">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>Gestion des Données</title>
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
| 9 |
+
<style>
|
| 10 |
+
@keyframes slideIn {
|
| 11 |
+
from {
|
| 12 |
+
transform: translateY(-20px);
|
| 13 |
+
opacity: 0;
|
| 14 |
+
}
|
| 15 |
+
to {
|
| 16 |
+
transform: translateY(0);
|
| 17 |
+
opacity: 1;
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
@keyframes fadeIn {
|
| 22 |
+
from { opacity: 0; }
|
| 23 |
+
to { opacity: 1; }
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
@keyframes scaleIn {
|
| 27 |
+
from {
|
| 28 |
+
transform: scale(0.95);
|
| 29 |
+
opacity: 0;
|
| 30 |
+
}
|
| 31 |
+
to {
|
| 32 |
+
transform: scale(1);
|
| 33 |
+
opacity: 1;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
@keyframes shimmer {
|
| 38 |
+
0% {
|
| 39 |
+
background-position: -1000px 0;
|
| 40 |
+
}
|
| 41 |
+
100% {
|
| 42 |
+
background-position: 1000px 0;
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.animate-slideIn {
|
| 47 |
+
animation: slideIn 0.5s ease-out;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.animate-fadeIn {
|
| 51 |
+
animation: fadeIn 0.5s ease-out;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.animate-scaleIn {
|
| 55 |
+
animation: scaleIn 0.3s ease-out;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.card-hover {
|
| 59 |
+
transition: all 0.3s ease;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.card-hover:hover {
|
| 63 |
+
transform: translateY(-5px);
|
| 64 |
+
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.shimmer {
|
| 68 |
+
background: linear-gradient(90deg, #f6f7f8 0%, #edeef1 50%, #f6f7f8 100%);
|
| 69 |
+
background-size: 1000px 100%;
|
| 70 |
+
animation: shimmer 2s infinite linear;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.tab-active {
|
| 74 |
+
position: relative;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.tab-active::after {
|
| 78 |
+
content: '';
|
| 79 |
+
position: absolute;
|
| 80 |
+
bottom: -2px;
|
| 81 |
+
left: 0;
|
| 82 |
+
width: 100%;
|
| 83 |
+
height: 2px;
|
| 84 |
+
background: #3b82f6;
|
| 85 |
+
transform: scaleX(0);
|
| 86 |
+
transition: transform 0.3s ease;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.tab-active:hover::after,
|
| 90 |
+
.tab-active.active::after {
|
| 91 |
+
transform: scaleX(1);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
.btn-primary {
|
| 95 |
+
@apply bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded-lg transition-all duration-300 transform hover:scale-105 hover:shadow-lg;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
.btn-warning {
|
| 99 |
+
@apply bg-yellow-500 hover:bg-yellow-600 text-white font-semibold py-2 px-4 rounded-lg transition-all duration-300 transform hover:scale-105 hover:shadow-lg;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.btn-danger {
|
| 103 |
+
@apply bg-red-500 hover:bg-red-600 text-white font-semibold py-2 px-4 rounded-lg transition-all duration-300 transform hover:scale-105 hover:shadow-lg;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.form-input {
|
| 107 |
+
@apply w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-300;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.alert {
|
| 111 |
+
@apply p-4 mb-4 rounded-lg shadow-lg animate-slideIn;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.alert-success {
|
| 115 |
+
@apply bg-green-100 border-l-4 border-green-500 text-green-700;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.alert-danger {
|
| 119 |
+
@apply bg-red-100 border-l-4 border-red-500 text-red-700;
|
| 120 |
+
}
|
| 121 |
+
</style>
|
| 122 |
+
</head>
|
| 123 |
+
<body class="bg-gray-50 min-h-screen">
|
| 124 |
+
<div class="container mx-auto px-4 py-8 animate-fadeIn">
|
| 125 |
+
<h1 class="text-4xl font-bold text-gray-800 mb-8 animate-slideIn">
|
| 126 |
+
Gestion des Données
|
| 127 |
+
</h1>
|
| 128 |
+
|
| 129 |
+
{% with messages = get_flashed_messages(with_categories=true) %}
|
| 130 |
+
{% if messages %}
|
| 131 |
+
{% for category, message in messages %}
|
| 132 |
+
<div class="alert alert-{{ category }} animate-scaleIn">
|
| 133 |
+
{{ message }}
|
| 134 |
+
</div>
|
| 135 |
+
{% endfor %}
|
| 136 |
+
{% endif %}
|
| 137 |
+
{% endwith %}
|
| 138 |
+
|
| 139 |
+
<!-- Tabs -->
|
| 140 |
+
<div class="mb-6 border-b border-gray-200">
|
| 141 |
+
<nav class="flex space-x-8" aria-label="Tabs">
|
| 142 |
+
<button class="tab-active px-4 py-2 text-gray-600 hover:text-blue-600 active">
|
| 143 |
+
<i class="fas fa-book mr-2"></i>Matières
|
| 144 |
+
</button>
|
| 145 |
+
<button class="tab-active px-4 py-2 text-gray-600 hover:text-blue-600">
|
| 146 |
+
<i class="fas fa-list mr-2"></i>Sous-Catégories
|
| 147 |
+
</button>
|
| 148 |
+
<button class="tab-active px-4 py-2 text-gray-600 hover:text-blue-600">
|
| 149 |
+
<i class="fas fa-file-alt mr-2"></i>Textes
|
| 150 |
+
</button>
|
| 151 |
+
<button class="tab-active px-4 py-2 text-gray-600 hover:text-blue-600">
|
| 152 |
+
<i class="fas fa-plus-circle mr-2"></i>Ajouter
|
| 153 |
+
</button>
|
| 154 |
+
</nav>
|
| 155 |
+
</div>
|
| 156 |
+
|
| 157 |
+
<!-- Content -->
|
| 158 |
+
<div class="grid gap-6">
|
| 159 |
+
<!-- Matières Section -->
|
| 160 |
+
<div class="animate-scaleIn">
|
| 161 |
+
{% for matiere in matieres %}
|
| 162 |
+
<div class="card-hover bg-white rounded-lg shadow-md p-6 mb-4">
|
| 163 |
+
<div class="flex justify-between items-center">
|
| 164 |
+
<h3 class="text-lg font-semibold text-gray-800">{{ matiere.nom }}</h3>
|
| 165 |
+
<div class="flex space-x-2">
|
| 166 |
+
<button class="btn-warning edit-button">
|
| 167 |
+
<i class="fas fa-edit mr-2"></i>Modifier
|
| 168 |
+
</button>
|
| 169 |
+
<form method="post" class="inline">
|
| 170 |
+
<input type="hidden" name="action" value="delete_matiere_{{ matiere.id }}">
|
| 171 |
+
<button type="submit" class="btn-danger">
|
| 172 |
+
<i class="fas fa-trash mr-2"></i>Supprimer
|
| 173 |
+
</button>
|
| 174 |
+
</form>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<!-- Form édition -->
|
| 179 |
+
<form method="post" class="hidden editable mt-4">
|
| 180 |
+
<input type="hidden" name="action" value="edit_matiere_{{ matiere.id }}">
|
| 181 |
+
<div class="flex space-x-4">
|
| 182 |
+
<input type="text" name="edit_nom_matiere_{{ matiere.id }}"
|
| 183 |
+
value="{{ matiere.nom }}"
|
| 184 |
+
class="form-input flex-grow"
|
| 185 |
+
placeholder="Nom de la matière">
|
| 186 |
+
<button type="submit" class="btn-primary">
|
| 187 |
+
<i class="fas fa-check mr-2"></i>Sauvegarder
|
| 188 |
+
</button>
|
| 189 |
+
<button type="button" class="btn-danger cancel-edit">
|
| 190 |
+
<i class="fas fa-times mr-2"></i>Annuler
|
| 191 |
+
</button>
|
| 192 |
+
</div>
|
| 193 |
+
</form>
|
| 194 |
+
</div>
|
| 195 |
+
{% endfor %}
|
| 196 |
+
</div>
|
| 197 |
+
|
| 198 |
+
<!-- Add Form -->
|
| 199 |
+
<div class="bg-white rounded-lg shadow-lg p-6 animate-scaleIn">
|
| 200 |
+
<h2 class="text-xl font-bold text-gray-800 mb-4">
|
| 201 |
+
<i class="fas fa-plus-circle mr-2"></i>Ajouter une nouvelle matière
|
| 202 |
+
</h2>
|
| 203 |
+
<form method="post" class="space-y-4">
|
| 204 |
+
<input type="hidden" name="action" value="add_matiere">
|
| 205 |
+
<div>
|
| 206 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">
|
| 207 |
+
Nom de la matière
|
| 208 |
+
</label>
|
| 209 |
+
<input type="text" name="nom_matiere"
|
| 210 |
+
class="form-input"
|
| 211 |
+
placeholder="Entrez le nom de la matière"
|
| 212 |
+
required>
|
| 213 |
+
</div>
|
| 214 |
+
<button type="submit" class="btn-primary w-full">
|
| 215 |
+
<i class="fas fa-plus mr-2"></i>Ajouter la matière
|
| 216 |
+
</button>
|
| 217 |
+
</form>
|
| 218 |
+
</div>
|
| 219 |
+
</div>
|
| 220 |
+
</div>
|
| 221 |
+
|
| 222 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 223 |
+
<script>
|
| 224 |
+
$(document).ready(function() {
|
| 225 |
+
// Tab switching with animations
|
| 226 |
+
$('.tab-active').click(function() {
|
| 227 |
+
$('.tab-active').removeClass('active');
|
| 228 |
+
$(this).addClass('active');
|
| 229 |
+
|
| 230 |
+
// Add slide animation to content
|
| 231 |
+
$('.grid > div').addClass('animate-slideIn');
|
| 232 |
+
setTimeout(() => {
|
| 233 |
+
$('.grid > div').removeClass('animate-slideIn');
|
| 234 |
+
}, 500);
|
| 235 |
+
});
|
| 236 |
+
|
| 237 |
+
// Edit button functionality with animations
|
| 238 |
+
$(document).on('click', '.edit-button', function(e) {
|
| 239 |
+
e.preventDefault();
|
| 240 |
+
const card = $(this).closest('.card-hover');
|
| 241 |
+
const form = card.find('.editable');
|
| 242 |
+
|
| 243 |
+
form.slideDown(300).css('display', 'block');
|
| 244 |
+
card.find('h3').fadeOut(300);
|
| 245 |
+
$(this).fadeOut(300);
|
| 246 |
+
});
|
| 247 |
+
|
| 248 |
+
// Cancel edit with animations
|
| 249 |
+
$(document).on('click', '.cancel-edit', function(e) {
|
| 250 |
+
e.preventDefault();
|
| 251 |
+
const card = $(this).closest('.card-hover');
|
| 252 |
+
const form = card.find('.editable');
|
| 253 |
+
|
| 254 |
+
form.slideUp(300);
|
| 255 |
+
card.find('h3').fadeIn(300);
|
| 256 |
+
card.find('.edit-button').fadeIn(300);
|
| 257 |
+
});
|
| 258 |
+
|
| 259 |
+
// Smooth deletion animation
|
| 260 |
+
$('form[method="post"]').submit(function(e) {
|
| 261 |
+
if ($(this).find('.btn-danger').length) {
|
| 262 |
+
if (!confirm('Êtes-vous sûr de vouloir supprimer cet élément ?')) {
|
| 263 |
+
e.preventDefault();
|
| 264 |
+
} else {
|
| 265 |
+
$(this).closest('.card-hover').addClass('animate-slideIn').fadeOut(500);
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
});
|
| 269 |
+
|
| 270 |
+
// Add loading animation
|
| 271 |
+
$('.btn-primary').click(function() {
|
| 272 |
+
$(this).addClass('shimmer');
|
| 273 |
+
setTimeout(() => {
|
| 274 |
+
$(this).removeClass('shimmer');
|
| 275 |
+
}, 1000);
|
| 276 |
+
});
|
| 277 |
+
});
|
| 278 |
+
</script>
|
| 279 |
+
</body>
|
| 280 |
+
</html>
|