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|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fr">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Centre de Gestion - Admin</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
|
| 9 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
| 10 |
+
<script>
|
| 11 |
+
tailwind.config = {
|
| 12 |
+
theme: {
|
| 13 |
+
extend: {
|
| 14 |
+
colors: {
|
| 15 |
+
primary: {
|
| 16 |
+
50: '#eff6ff',
|
| 17 |
+
500: '#3b82f6',
|
| 18 |
+
600: '#2563eb',
|
| 19 |
+
700: '#1d4ed8',
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
</script>
|
| 26 |
+
</head>
|
| 27 |
+
<body class="bg-gray-50 min-h-screen">
|
| 28 |
+
<div x-data="adminApp()" class="min-h-screen">
|
| 29 |
+
<!-- Header -->
|
| 30 |
+
<header class="bg-white shadow-sm border-b border-gray-200">
|
| 31 |
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 32 |
+
<div class="flex justify-between items-center h-16">
|
| 33 |
+
<div class="flex items-center">
|
| 34 |
+
<i class="fas fa-cogs text-primary-600 text-2xl mr-3"></i>
|
| 35 |
+
<h1 class="text-xl font-semibold text-gray-900">Centre de Gestion</h1>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="flex items-center space-x-4">
|
| 38 |
+
<button @click="refreshData()"
|
| 39 |
+
class="inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
|
| 40 |
+
<i class="fas fa-sync-alt mr-2" :class="{'animate-spin': loading}"></i>
|
| 41 |
+
Actualiser
|
| 42 |
+
</button>
|
| 43 |
+
<a href="/" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
|
| 44 |
+
<i class="fas fa-home mr-2"></i>
|
| 45 |
+
Retour à l'accueil
|
| 46 |
+
</a>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
</header>
|
| 51 |
+
|
| 52 |
+
<!-- Dashboard Stats -->
|
| 53 |
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
| 54 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
|
| 55 |
+
<!-- Total Tasks -->
|
| 56 |
+
<div class="bg-white overflow-hidden shadow rounded-lg">
|
| 57 |
+
<div class="p-5">
|
| 58 |
+
<div class="flex items-center">
|
| 59 |
+
<div class="flex-shrink-0">
|
| 60 |
+
<i class="fas fa-tasks text-primary-600 text-2xl"></i>
|
| 61 |
+
</div>
|
| 62 |
+
<div class="ml-5 w-0 flex-1">
|
| 63 |
+
<dl>
|
| 64 |
+
<dt class="text-sm font-medium text-gray-500 truncate">Total des tâches</dt>
|
| 65 |
+
<dd class="text-lg font-medium text-gray-900" x-text="stats.total_tasks"></dd>
|
| 66 |
+
</dl>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<!-- Completed Tasks -->
|
| 73 |
+
<div class="bg-white overflow-hidden shadow rounded-lg">
|
| 74 |
+
<div class="p-5">
|
| 75 |
+
<div class="flex items-center">
|
| 76 |
+
<div class="flex-shrink-0">
|
| 77 |
+
<i class="fas fa-check-circle text-green-600 text-2xl"></i>
|
| 78 |
+
</div>
|
| 79 |
+
<div class="ml-5 w-0 flex-1">
|
| 80 |
+
<dl>
|
| 81 |
+
<dt class="text-sm font-medium text-gray-500 truncate">Tâches terminées</dt>
|
| 82 |
+
<dd class="text-lg font-medium text-gray-900" x-text="stats.completed_tasks"></dd>
|
| 83 |
+
</dl>
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
|
| 89 |
+
<!-- Error Tasks -->
|
| 90 |
+
<div class="bg-white overflow-hidden shadow rounded-lg">
|
| 91 |
+
<div class="p-5">
|
| 92 |
+
<div class="flex items-center">
|
| 93 |
+
<div class="flex-shrink-0">
|
| 94 |
+
<i class="fas fa-exclamation-triangle text-red-600 text-2xl"></i>
|
| 95 |
+
</div>
|
| 96 |
+
<div class="ml-5 w-0 flex-1">
|
| 97 |
+
<dl>
|
| 98 |
+
<dt class="text-sm font-medium text-gray-500 truncate">Tâches en erreur</dt>
|
| 99 |
+
<dd class="text-lg font-medium text-gray-900" x-text="stats.error_tasks"></dd>
|
| 100 |
+
</dl>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<!-- PDF Files -->
|
| 107 |
+
<div class="bg-white overflow-hidden shadow rounded-lg">
|
| 108 |
+
<div class="p-5">
|
| 109 |
+
<div class="flex items-center">
|
| 110 |
+
<div class="flex-shrink-0">
|
| 111 |
+
<i class="fas fa-file-pdf text-red-600 text-2xl"></i>
|
| 112 |
+
</div>
|
| 113 |
+
<div class="ml-5 w-0 flex-1">
|
| 114 |
+
<dl>
|
| 115 |
+
<dt class="text-sm font-medium text-gray-500 truncate">Fichiers PDF</dt>
|
| 116 |
+
<dd class="text-lg font-medium text-gray-900" x-text="stats.pdf_files"></dd>
|
| 117 |
+
</dl>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
|
| 124 |
+
<!-- System Status -->
|
| 125 |
+
<div class="bg-white shadow rounded-lg mb-8">
|
| 126 |
+
<div class="px-4 py-5 sm:p-6">
|
| 127 |
+
<h3 class="text-lg leading-6 font-medium text-gray-900 mb-4">
|
| 128 |
+
<i class="fas fa-server mr-2"></i>
|
| 129 |
+
État du système
|
| 130 |
+
</h3>
|
| 131 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 132 |
+
<div class="flex items-center">
|
| 133 |
+
<div class="flex-shrink-0">
|
| 134 |
+
<div class="w-3 h-3 rounded-full" :class="stats.latex_installed ? 'bg-green-400' : 'bg-red-400'"></div>
|
| 135 |
+
</div>
|
| 136 |
+
<div class="ml-3">
|
| 137 |
+
<p class="text-sm font-medium text-gray-900">LaTeX</p>
|
| 138 |
+
<p class="text-sm text-gray-500" x-text="stats.latex_installed ? 'Installé' : 'Non installé'"></p>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
<div class="flex items-center">
|
| 142 |
+
<div class="flex-shrink-0">
|
| 143 |
+
<i class="fas fa-images text-blue-600"></i>
|
| 144 |
+
</div>
|
| 145 |
+
<div class="ml-3">
|
| 146 |
+
<p class="text-sm font-medium text-gray-900">Images utilisateur</p>
|
| 147 |
+
<p class="text-sm text-gray-500" x-text="stats.user_images + ' fichiers'"></p>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
<div class="flex items-center">
|
| 151 |
+
<div class="flex-shrink-0">
|
| 152 |
+
<i class="fas fa-clock text-yellow-600"></i>
|
| 153 |
+
</div>
|
| 154 |
+
<div class="ml-3">
|
| 155 |
+
<p class="text-sm font-medium text-gray-900">Tâches en cours</p>
|
| 156 |
+
<p class="text-sm text-gray-500" x-text="stats.pending_tasks + ' actives'"></p>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
</div>
|
| 162 |
+
|
| 163 |
+
<!-- Tasks Table -->
|
| 164 |
+
<div class="bg-white shadow rounded-lg">
|
| 165 |
+
<div class="px-4 py-5 sm:p-6">
|
| 166 |
+
<div class="flex justify-between items-center mb-4">
|
| 167 |
+
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
| 168 |
+
<i class="fas fa-list mr-2"></i>
|
| 169 |
+
Gestion des tâches
|
| 170 |
+
</h3>
|
| 171 |
+
<div class="flex items-center space-x-2">
|
| 172 |
+
<select x-model="statusFilter" class="block w-40 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm rounded-md">
|
| 173 |
+
<option value="">Tous les statuts</option>
|
| 174 |
+
<option value="completed">Terminées</option>
|
| 175 |
+
<option value="error">En erreur</option>
|
| 176 |
+
<option value="processing">En cours</option>
|
| 177 |
+
<option value="pending">En attente</option>
|
| 178 |
+
</select>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
|
| 182 |
+
<!-- Loading state -->
|
| 183 |
+
<div x-show="loading" class="flex justify-center items-center py-8">
|
| 184 |
+
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"></div>
|
| 185 |
+
<span class="ml-2 text-gray-600">Chargement...</span>
|
| 186 |
+
</div>
|
| 187 |
+
|
| 188 |
+
<!-- Tasks table -->
|
| 189 |
+
<div x-show="!loading" class="overflow-hidden">
|
| 190 |
+
<template x-if="filteredTasks.length === 0">
|
| 191 |
+
<div class="text-center py-8">
|
| 192 |
+
<i class="fas fa-inbox text-gray-400 text-4xl mb-4"></i>
|
| 193 |
+
<p class="text-gray-500">Aucune tâche trouvée</p>
|
| 194 |
+
</div>
|
| 195 |
+
</template>
|
| 196 |
+
|
| 197 |
+
<div x-show="filteredTasks.length > 0" class="overflow-x-auto">
|
| 198 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 199 |
+
<thead class="bg-gray-50">
|
| 200 |
+
<tr>
|
| 201 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
| 202 |
+
Tâche
|
| 203 |
+
</th>
|
| 204 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
| 205 |
+
Statut
|
| 206 |
+
</th>
|
| 207 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
| 208 |
+
Style
|
| 209 |
+
</th>
|
| 210 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
| 211 |
+
Fichiers
|
| 212 |
+
</th>
|
| 213 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
| 214 |
+
Date
|
| 215 |
+
</th>
|
| 216 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
| 217 |
+
Actions
|
| 218 |
+
</th>
|
| 219 |
+
</tr>
|
| 220 |
+
</thead>
|
| 221 |
+
<tbody class="bg-white divide-y divide-gray-200">
|
| 222 |
+
<template x-for="task in filteredTasks" :key="task.id">
|
| 223 |
+
<tr class="hover:bg-gray-50">
|
| 224 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 225 |
+
<div class="flex items-center">
|
| 226 |
+
<div class="flex-shrink-0 h-10 w-10">
|
| 227 |
+
<div class="h-10 w-10 rounded-full bg-gray-300 flex items-center justify-center">
|
| 228 |
+
<i class="fas fa-file-alt text-gray-600"></i>
|
| 229 |
+
</div>
|
| 230 |
+
</div>
|
| 231 |
+
<div class="ml-4">
|
| 232 |
+
<div class="text-sm font-medium text-gray-900" x-text="task.id.substring(0, 8) + '...'"></div>
|
| 233 |
+
<div class="text-sm text-gray-500" x-text="task.first_filename"></div>
|
| 234 |
+
</div>
|
| 235 |
+
</div>
|
| 236 |
+
</td>
|
| 237 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 238 |
+
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full"
|
| 239 |
+
:class="{
|
| 240 |
+
'bg-green-100 text-green-800': task.status === 'completed',
|
| 241 |
+
'bg-red-100 text-red-800': task.status === 'error',
|
| 242 |
+
'bg-yellow-100 text-yellow-800': task.status === 'processing',
|
| 243 |
+
'bg-gray-100 text-gray-800': task.status === 'pending'
|
| 244 |
+
}">
|
| 245 |
+
<template x-if="task.status === 'completed'">
|
| 246 |
+
<span><i class="fas fa-check mr-1"></i>Terminée</span>
|
| 247 |
+
</template>
|
| 248 |
+
<template x-if="task.status === 'error'">
|
| 249 |
+
<span><i class="fas fa-exclamation-triangle mr-1"></i>Erreur</span>
|
| 250 |
+
</template>
|
| 251 |
+
<template x-if="task.status === 'processing'">
|
| 252 |
+
<span><i class="fas fa-spinner fa-spin mr-1"></i>En cours</span>
|
| 253 |
+
</template>
|
| 254 |
+
<template x-if="task.status === 'pending'">
|
| 255 |
+
<span><i class="fas fa-clock mr-1"></i>En attente</span>
|
| 256 |
+
</template>
|
| 257 |
+
</span>
|
| 258 |
+
</td>
|
| 259 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 260 |
+
<span class="inline-flex px-2 py-1 text-xs font-medium rounded-md"
|
| 261 |
+
:class="{
|
| 262 |
+
'bg-purple-100 text-purple-800': task.style === 'colorful',
|
| 263 |
+
'bg-blue-100 text-blue-800': task.style === 'light'
|
| 264 |
+
}"
|
| 265 |
+
x-text="task.style === 'colorful' ? 'Coloré' : 'Léger'">
|
| 266 |
+
</span>
|
| 267 |
+
</td>
|
| 268 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
| 269 |
+
<div class="flex items-center space-x-2">
|
| 270 |
+
<span x-show="task.file_count.images > 0" class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-blue-100 text-blue-800">
|
| 271 |
+
<i class="fas fa-image mr-1"></i>
|
| 272 |
+
<span x-text="task.file_count.images"></span>
|
| 273 |
+
</span>
|
| 274 |
+
<span x-show="task.file_count.pdfs > 0" class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-red-100 text-red-800">
|
| 275 |
+
<i class="fas fa-file-pdf mr-1"></i>
|
| 276 |
+
<span x-text="task.file_count.pdfs"></span>
|
| 277 |
+
</span>
|
| 278 |
+
</div>
|
| 279 |
+
</td>
|
| 280 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 281 |
+
<span x-text="task.time_started_formatted"></span>
|
| 282 |
+
</td>
|
| 283 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
| 284 |
+
<div class="flex items-center space-x-2">
|
| 285 |
+
<template x-if="task.status === 'completed' && task.pdf_filename">
|
| 286 |
+
<a :href="'/download/' + task.id"
|
| 287 |
+
class="text-primary-600 hover:text-primary-900 flex items-center">
|
| 288 |
+
<i class="fas fa-download mr-1"></i>
|
| 289 |
+
PDF
|
| 290 |
+
</a>
|
| 291 |
+
</template>
|
| 292 |
+
<button @click="showTaskDetails(task)"
|
| 293 |
+
class="text-indigo-600 hover:text-indigo-900 flex items-center">
|
| 294 |
+
<i class="fas fa-eye mr-1"></i>
|
| 295 |
+
Détails
|
| 296 |
+
</button>
|
| 297 |
+
<button @click="deleteTask(task.id)"
|
| 298 |
+
class="text-red-600 hover:text-red-900 flex items-center">
|
| 299 |
+
<i class="fas fa-trash mr-1"></i>
|
| 300 |
+
Supprimer
|
| 301 |
+
</button>
|
| 302 |
+
</div>
|
| 303 |
+
</td>
|
| 304 |
+
</tr>
|
| 305 |
+
</template>
|
| 306 |
+
</tbody>
|
| 307 |
+
</table>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
</div>
|
| 311 |
+
</div>
|
| 312 |
+
</div>
|
| 313 |
+
|
| 314 |
+
<!-- Task Details Modal -->
|
| 315 |
+
<div x-show="showModal"
|
| 316 |
+
class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50"
|
| 317 |
+
x-transition:enter="ease-out duration-300"
|
| 318 |
+
x-transition:enter-start="opacity-0"
|
| 319 |
+
x-transition:enter-end="opacity-100"
|
| 320 |
+
x-transition:leave="ease-in duration-200"
|
| 321 |
+
x-transition:leave-start="opacity-100"
|
| 322 |
+
x-transition:leave-end="opacity-0">
|
| 323 |
+
<div class="relative top-20 mx-auto p-5 border w-11/12 md:w-3/4 lg:w-1/2 shadow-lg rounded-md bg-white">
|
| 324 |
+
<div class="mt-3">
|
| 325 |
+
<div class="flex justify-between items-center mb-4">
|
| 326 |
+
<h3 class="text-lg font-medium text-gray-900">Détails de la tâche</h3>
|
| 327 |
+
<button @click="showModal = false"
|
| 328 |
+
class="text-gray-400 hover:text-gray-600">
|
| 329 |
+
<i class="fas fa-times text-xl"></i>
|
| 330 |
+
</button>
|
| 331 |
+
</div>
|
| 332 |
+
|
| 333 |
+
<template x-if="selectedTask">
|
| 334 |
+
<div class="space-y-4">
|
| 335 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 336 |
+
<div>
|
| 337 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">ID de la tâche</label>
|
| 338 |
+
<p class="text-sm text-gray-900 font-mono bg-gray-100 p-2 rounded" x-text="selectedTask.id"></p>
|
| 339 |
+
</div>
|
| 340 |
+
<div>
|
| 341 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Statut</label>
|
| 342 |
+
<span class="inline-flex px-2 py-1 text-sm font-semibold rounded-full"
|
| 343 |
+
:class="{
|
| 344 |
+
'bg-green-100 text-green-800': selectedTask.status === 'completed',
|
| 345 |
+
'bg-red-100 text-red-800': selectedTask.status === 'error',
|
| 346 |
+
'bg-yellow-100 text-yellow-800': selectedTask.status === 'processing',
|
| 347 |
+
'bg-gray-100 text-gray-800': selectedTask.status === 'pending'
|
| 348 |
+
}"
|
| 349 |
+
x-text="selectedTask.status">
|
| 350 |
+
</span>
|
| 351 |
+
</div>
|
| 352 |
+
</div>
|
| 353 |
+
|
| 354 |
+
<div x-show="selectedTask.error" class="p-4 bg-red-50 border border-red-200 rounded-md">
|
| 355 |
+
<label class="block text-sm font-medium text-red-700 mb-1">Message d'erreur</label>
|
| 356 |
+
<p class="text-sm text-red-600" x-text="selectedTask.error"></p>
|
| 357 |
+
</div>
|
| 358 |
+
|
| 359 |
+
<div x-show="selectedTask.response" class="p-4 bg-gray-50 border border-gray-200 rounded-md">
|
| 360 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Réponse</label>
|
| 361 |
+
<p class="text-sm text-gray-600" x-text="selectedTask.response"></p>
|
| 362 |
+
</div>
|
| 363 |
+
|
| 364 |
+
<div x-show="selectedTask.user_images && selectedTask.user_images.length > 0">
|
| 365 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Images utilisateur</label>
|
| 366 |
+
<div class="grid grid-cols-2 md:grid-cols-4 gap-2">
|
| 367 |
+
<template x-for="image in selectedTask.user_images" :key="image">
|
| 368 |
+
<div class="relative group">
|
| 369 |
+
<img :src="'/user_images/' + image"
|
| 370 |
+
:alt="image"
|
| 371 |
+
class="w-full h-24 object-cover rounded-md border border-gray-300">
|
| 372 |
+
<div class="absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-30 transition-opacity rounded-md"></div>
|
| 373 |
+
</div>
|
| 374 |
+
</template>
|
| 375 |
+
</div>
|
| 376 |
+
</div>
|
| 377 |
+
</div>
|
| 378 |
+
</template>
|
| 379 |
+
</div>
|
| 380 |
+
</div>
|
| 381 |
+
</div>
|
| 382 |
+
|
| 383 |
+
<!-- Delete Confirmation Modal -->
|
| 384 |
+
<div x-show="showDeleteModal"
|
| 385 |
+
class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50"
|
| 386 |
+
x-transition:enter="ease-out duration-300"
|
| 387 |
+
x-transition:enter-start="opacity-0"
|
| 388 |
+
x-transition:enter-end="opacity-100"
|
| 389 |
+
x-transition:leave="ease-in duration-200"
|
| 390 |
+
x-transition:leave-start="opacity-100"
|
| 391 |
+
x-transition:leave-end="opacity-0">
|
| 392 |
+
<div class="relative top-32 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white">
|
| 393 |
+
<div class="mt-3 text-center">
|
| 394 |
+
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100">
|
| 395 |
+
<i class="fas fa-exclamation-triangle text-red-600"></i>
|
| 396 |
+
</div>
|
| 397 |
+
<h3 class="text-lg font-medium text-gray-900 mt-2">Supprimer la tâche</h3>
|
| 398 |
+
<div class="mt-2 px-7 py-3">
|
| 399 |
+
<p class="text-sm text-gray-500">
|
| 400 |
+
Êtes-vous sûr de vouloir supprimer cette tâche ? Cette action supprimera tous les fichiers associés et ne peut pas être annulée.
|
| 401 |
+
</p>
|
| 402 |
+
</div>
|
| 403 |
+
<div class="flex justify-center space-x-3 mt-4">
|
| 404 |
+
<button @click="showDeleteModal = false"
|
| 405 |
+
class="px-4 py-2 bg-gray-300 text-gray-700 rounded-md hover:bg-gray-400 transition-colors">
|
| 406 |
+
Annuler
|
| 407 |
+
</button>
|
| 408 |
+
<button @click="confirmDeleteTask()"
|
| 409 |
+
class="px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors">
|
| 410 |
+
Supprimer
|
| 411 |
+
</button>
|
| 412 |
+
</div>
|
| 413 |
+
</div>
|
| 414 |
+
</div>
|
| 415 |
+
</div>
|
| 416 |
+
</div>
|
| 417 |
+
|
| 418 |
+
<script>
|
| 419 |
+
function adminApp() {
|
| 420 |
+
return {
|
| 421 |
+
tasks: [],
|
| 422 |
+
stats: {
|
| 423 |
+
total_tasks: 0,
|
| 424 |
+
completed_tasks: 0,
|
| 425 |
+
error_tasks: 0,
|
| 426 |
+
pending_tasks: 0,
|
| 427 |
+
pdf_files: 0,
|
| 428 |
+
user_images: 0,
|
| 429 |
+
latex_installed: false
|
| 430 |
+
},
|
| 431 |
+
loading: true,
|
| 432 |
+
showModal: false,
|
| 433 |
+
showDeleteModal: false,
|
| 434 |
+
selectedTask: null,
|
| 435 |
+
taskToDelete: null,
|
| 436 |
+
statusFilter: '',
|
| 437 |
+
|
| 438 |
+
async init() {
|
| 439 |
+
await this.refreshData();
|
| 440 |
+
// Auto-refresh every 30 seconds
|
| 441 |
+
setInterval(() => {
|
| 442 |
+
this.refreshData(false);
|
| 443 |
+
}, 30000);
|
| 444 |
+
},
|
| 445 |
+
|
| 446 |
+
async refreshData(showLoading = true) {
|
| 447 |
+
if (showLoading) this.loading = true;
|
| 448 |
+
|
| 449 |
+
try {
|
| 450 |
+
const [tasksResponse, statsResponse] = await Promise.all([
|
| 451 |
+
fetch('/admin/api/tasks'),
|
| 452 |
+
fetch('/admin/api/stats')
|
| 453 |
+
]);
|
| 454 |
+
|
| 455 |
+
this.tasks = await tasksResponse.json();
|
| 456 |
+
this.stats = await statsResponse.json();
|
| 457 |
+
} catch (error) {
|
| 458 |
+
console.error('Erreur lors du rafraîchissement des données:', error);
|
| 459 |
+
} finally {
|
| 460 |
+
if (showLoading) this.loading = false;
|
| 461 |
+
}
|
| 462 |
+
},
|
| 463 |
+
|
| 464 |
+
showTaskDetails(task) {
|
| 465 |
+
this.selectedTask = task;
|
| 466 |
+
this.showModal = true;
|
| 467 |
+
},
|
| 468 |
+
|
| 469 |
+
deleteTask(taskId) {
|
| 470 |
+
this.taskToDelete = taskId;
|
| 471 |
+
this.showDeleteModal = true;
|
| 472 |
+
},
|
| 473 |
+
|
| 474 |
+
async confirmDeleteTask() {
|
| 475 |
+
if (!this.taskToDelete) return;
|
| 476 |
+
|
| 477 |
+
try {
|
| 478 |
+
const response = await fetch(`/admin/delete_task/${this.taskToDelete}`, {
|
| 479 |
+
method: 'POST'
|
| 480 |
+
});
|
| 481 |
+
|
| 482 |
+
if (response.ok) {
|
| 483 |
+
await this.refreshData();
|
| 484 |
+
this.showDeleteModal = false;
|
| 485 |
+
this.taskToDelete = null;
|
| 486 |
+
} else {
|
| 487 |
+
const error = await response.json();
|
| 488 |
+
alert('Erreur lors de la suppression: ' + error.error);
|
| 489 |
+
}
|
| 490 |
+
} catch (error) {
|
| 491 |
+
console.error('Erreur lors de la suppression:', error);
|
| 492 |
+
alert('Erreur lors de la suppression de la tâche');
|
| 493 |
+
}
|
| 494 |
+
},
|
| 495 |
+
|
| 496 |
+
get filteredTasks() {
|
| 497 |
+
if (!this.statusFilter) return this.tasks;
|
| 498 |
+
return this.tasks.filter(task => task.status === this.statusFilter);
|
| 499 |
+
}
|
| 500 |
+
};
|
| 501 |
+
}
|
| 502 |
+
</script>
|
| 503 |
+
</body>
|
| 504 |
+
</html>
|