Spaces:
Running
Running
Une application "to do list" , avec une date d'échéance, des rappels, des catégories, des priorités, des listes par catégorie et par priorité, assure toi que tous les boutons soient fonctionnels - Initial Deployment
Browse files- README.md +7 -5
- index.html +741 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: task-manager-si
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,741 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
<html lang="fr">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Todo List Avancée</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
/* Animation pour les notifications */
|
| 11 |
+
@keyframes slideIn {
|
| 12 |
+
from { transform: translateX(100%); opacity: 0; }
|
| 13 |
+
to { transform: translateX(0); opacity: 1; }
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
@keyframes fadeOut {
|
| 17 |
+
from { opacity: 1; }
|
| 18 |
+
to { opacity: 0; }
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.notification {
|
| 22 |
+
animation: slideIn 0.3s ease-out;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.notification.hide {
|
| 26 |
+
animation: fadeOut 0.5s ease-out forwards;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/* Style personnalisé pour le datepicker */
|
| 30 |
+
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
|
| 31 |
+
filter: invert(0.5);
|
| 32 |
+
cursor: pointer;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/* Style pour les tâches complétées */
|
| 36 |
+
.completed {
|
| 37 |
+
opacity: 0.7;
|
| 38 |
+
position: relative;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.completed::after {
|
| 42 |
+
content: "";
|
| 43 |
+
position: absolute;
|
| 44 |
+
left: 0;
|
| 45 |
+
top: 50%;
|
| 46 |
+
width: 100%;
|
| 47 |
+
height: 1px;
|
| 48 |
+
background: currentColor;
|
| 49 |
+
transform: translateY(-50%);
|
| 50 |
+
}
|
| 51 |
+
</style>
|
| 52 |
+
</head>
|
| 53 |
+
<body class="bg-gray-100 min-h-screen font-sans">
|
| 54 |
+
<div class="container mx-auto px-4 py-8 max-w-6xl">
|
| 55 |
+
<div class="flex flex-col md:flex-row gap-6">
|
| 56 |
+
<!-- Sidebar -->
|
| 57 |
+
<div class="w-full md:w-64 bg-white rounded-lg shadow-md p-4 h-fit">
|
| 58 |
+
<h1 class="text-2xl font-bold text-gray-800 mb-6 flex items-center gap-2">
|
| 59 |
+
<i class="fas fa-tasks"></i>
|
| 60 |
+
<span>Todo List</span>
|
| 61 |
+
</h1>
|
| 62 |
+
|
| 63 |
+
<div class="mb-6">
|
| 64 |
+
<h2 class="text-lg font-semibold text-gray-700 mb-2">Catégories</h2>
|
| 65 |
+
<ul class="space-y-1">
|
| 66 |
+
<li>
|
| 67 |
+
<button onclick="filterTasks('all')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2 text-blue-600">
|
| 68 |
+
<i class="fas fa-list"></i>
|
| 69 |
+
<span>Toutes les tâches</span>
|
| 70 |
+
</button>
|
| 71 |
+
</li>
|
| 72 |
+
<li>
|
| 73 |
+
<button onclick="filterTasks('work')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 74 |
+
<i class="fas fa-briefcase text-red-500"></i>
|
| 75 |
+
<span>Travail</span>
|
| 76 |
+
</button>
|
| 77 |
+
</li>
|
| 78 |
+
<li>
|
| 79 |
+
<button onclick="filterTasks('personal')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 80 |
+
<i class="fas fa-user text-green-500"></i>
|
| 81 |
+
<span>Personnel</span>
|
| 82 |
+
</button>
|
| 83 |
+
</li>
|
| 84 |
+
<li>
|
| 85 |
+
<button onclick="filterTasks('shopping')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 86 |
+
<i class="fas fa-shopping-cart text-purple-500"></i>
|
| 87 |
+
<span>Shopping</span>
|
| 88 |
+
</button>
|
| 89 |
+
</li>
|
| 90 |
+
<li>
|
| 91 |
+
<button onclick="filterTasks('other')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 92 |
+
<i class="fas fa-ellipsis-h text-yellow-500"></i>
|
| 93 |
+
<span>Autre</span>
|
| 94 |
+
</button>
|
| 95 |
+
</li>
|
| 96 |
+
</ul>
|
| 97 |
+
</div>
|
| 98 |
+
|
| 99 |
+
<div class="mb-6">
|
| 100 |
+
<h2 class="text-lg font-semibold text-gray-700 mb-2">Priorités</h2>
|
| 101 |
+
<ul class="space-y-1">
|
| 102 |
+
<li>
|
| 103 |
+
<button onclick="filterByPriority('all')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 104 |
+
<i class="fas fa-flag text-gray-400"></i>
|
| 105 |
+
<span>Toutes</span>
|
| 106 |
+
</button>
|
| 107 |
+
</li>
|
| 108 |
+
<li>
|
| 109 |
+
<button onclick="filterByPriority('high')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 110 |
+
<i class="fas fa-flag text-red-500"></i>
|
| 111 |
+
<span>Haute</span>
|
| 112 |
+
</button>
|
| 113 |
+
</li>
|
| 114 |
+
<li>
|
| 115 |
+
<button onclick="filterByPriority('medium')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 116 |
+
<i class="fas fa-flag text-yellow-500"></i>
|
| 117 |
+
<span>Moyenne</span>
|
| 118 |
+
</button>
|
| 119 |
+
</li>
|
| 120 |
+
<li>
|
| 121 |
+
<button onclick="filterByPriority('low')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 122 |
+
<i class="fas fa-flag text-green-500"></i>
|
| 123 |
+
<span>Basse</span>
|
| 124 |
+
</button>
|
| 125 |
+
</li>
|
| 126 |
+
</ul>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<div>
|
| 130 |
+
<h2 class="text-lg font-semibold text-gray-700 mb-2">Statut</h2>
|
| 131 |
+
<ul class="space-y-1">
|
| 132 |
+
<li>
|
| 133 |
+
<button onclick="filterByStatus('all')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 134 |
+
<i class="fas fa-circle text-gray-400"></i>
|
| 135 |
+
<span>Toutes</span>
|
| 136 |
+
</button>
|
| 137 |
+
</li>
|
| 138 |
+
<li>
|
| 139 |
+
<button onclick="filterByStatus('completed')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 140 |
+
<i class="fas fa-check-circle text-green-500"></i>
|
| 141 |
+
<span>Complétées</span>
|
| 142 |
+
</button>
|
| 143 |
+
</li>
|
| 144 |
+
<li>
|
| 145 |
+
<button onclick="filterByStatus('pending')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 146 |
+
<i class="fas fa-hourglass-half text-blue-500"></i>
|
| 147 |
+
<span>En attente</span>
|
| 148 |
+
</button>
|
| 149 |
+
</li>
|
| 150 |
+
<li>
|
| 151 |
+
<button onclick="filterByStatus('overdue')" class="w-full text-left px-3 py-2 rounded hover:bg-gray-100 flex items-center gap-2">
|
| 152 |
+
<i class="fas fa-exclamation-circle text-red-500"></i>
|
| 153 |
+
<span>En retard</span>
|
| 154 |
+
</button>
|
| 155 |
+
</li>
|
| 156 |
+
</ul>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
|
| 160 |
+
<!-- Main Content -->
|
| 161 |
+
<div class="flex-1">
|
| 162 |
+
<!-- Add Task Form -->
|
| 163 |
+
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
|
| 164 |
+
<h2 class="text-xl font-bold text-gray-800 mb-4">Ajouter une nouvelle tâche</h2>
|
| 165 |
+
<form id="addTaskForm" class="space-y-4">
|
| 166 |
+
<div>
|
| 167 |
+
<label for="taskTitle" class="block text-sm font-medium text-gray-700 mb-1">Titre de la tâche</label>
|
| 168 |
+
<input type="text" id="taskTitle" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 169 |
+
</div>
|
| 170 |
+
|
| 171 |
+
<div>
|
| 172 |
+
<label for="taskDescription" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 173 |
+
<textarea id="taskDescription" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 177 |
+
<div>
|
| 178 |
+
<label for="taskCategory" class="block text-sm font-medium text-gray-700 mb-1">Catégorie</label>
|
| 179 |
+
<select id="taskCategory" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 180 |
+
<option value="work">Travail</option>
|
| 181 |
+
<option value="personal">Personnel</option>
|
| 182 |
+
<option value="shopping">Shopping</option>
|
| 183 |
+
<option value="other">Autre</option>
|
| 184 |
+
</select>
|
| 185 |
+
</div>
|
| 186 |
+
|
| 187 |
+
<div>
|
| 188 |
+
<label for="taskPriority" class="block text-sm font-medium text-gray-700 mb-1">Priorité</label>
|
| 189 |
+
<select id="taskPriority" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 190 |
+
<option value="high">Haute</option>
|
| 191 |
+
<option value="medium" selected>Moyenne</option>
|
| 192 |
+
<option value="low">Basse</option>
|
| 193 |
+
</select>
|
| 194 |
+
</div>
|
| 195 |
+
|
| 196 |
+
<div>
|
| 197 |
+
<label for="taskDueDate" class="block text-sm font-medium text-gray-700 mb-1">Date d'échéance</label>
|
| 198 |
+
<input type="datetime-local" id="taskDueDate" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 199 |
+
</div>
|
| 200 |
+
</div>
|
| 201 |
+
|
| 202 |
+
<div class="flex items-center">
|
| 203 |
+
<input type="checkbox" id="taskReminder" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
|
| 204 |
+
<label for="taskReminder" class="ml-2 block text-sm text-gray-700">Activer un rappel</label>
|
| 205 |
+
</div>
|
| 206 |
+
|
| 207 |
+
<div id="reminderOptions" class="hidden pl-6 border-l-2 border-gray-200 ml-2">
|
| 208 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 209 |
+
<div>
|
| 210 |
+
<label for="reminderTime" class="block text-sm font-medium text-gray-700 mb-1">Temps avant rappel</label>
|
| 211 |
+
<select id="reminderTime" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 212 |
+
<option value="5">5 minutes avant</option>
|
| 213 |
+
<option value="15">15 minutes avant</option>
|
| 214 |
+
<option value="30" selected>30 minutes avant</option>
|
| 215 |
+
<option value="60">1 heure avant</option>
|
| 216 |
+
<option value="1440">1 jour avant</option>
|
| 217 |
+
</select>
|
| 218 |
+
</div>
|
| 219 |
+
|
| 220 |
+
<div>
|
| 221 |
+
<label for="reminderMethod" class="block text-sm font-medium text-gray-700 mb-1">Méthode de rappel</label>
|
| 222 |
+
<select id="reminderMethod" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 223 |
+
<option value="notification">Notification</option>
|
| 224 |
+
<option value="email">Email</option>
|
| 225 |
+
</select>
|
| 226 |
+
</div>
|
| 227 |
+
</div>
|
| 228 |
+
</div>
|
| 229 |
+
|
| 230 |
+
<div class="flex justify-end">
|
| 231 |
+
<button type="submit" class="px-6 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
|
| 232 |
+
<i class="fas fa-plus mr-2"></i>Ajouter la tâche
|
| 233 |
+
</button>
|
| 234 |
+
</div>
|
| 235 |
+
</form>
|
| 236 |
+
</div>
|
| 237 |
+
|
| 238 |
+
<!-- Tasks List -->
|
| 239 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
| 240 |
+
<div class="flex justify-between items-center mb-6">
|
| 241 |
+
<h2 class="text-xl font-bold text-gray-800">Mes Tâches</h2>
|
| 242 |
+
<div class="flex items-center gap-2">
|
| 243 |
+
<span id="taskCount" class="text-sm text-gray-500">0 tâches</span>
|
| 244 |
+
<button onclick="clearCompletedTasks()" class="text-sm text-red-500 hover:text-red-700">
|
| 245 |
+
<i class="fas fa-trash-alt mr-1"></i>Effacer complétées
|
| 246 |
+
</button>
|
| 247 |
+
</div>
|
| 248 |
+
</div>
|
| 249 |
+
|
| 250 |
+
<div class="mb-4">
|
| 251 |
+
<input type="text" id="searchTask" placeholder="Rechercher des tâches..." class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 252 |
+
</div>
|
| 253 |
+
|
| 254 |
+
<div id="tasksList" class="space-y-3">
|
| 255 |
+
<!-- Les tâches seront ajoutées ici dynamiquement -->
|
| 256 |
+
<div class="text-center py-10 text-gray-500">
|
| 257 |
+
<i class="fas fa-tasks text-4xl mb-2"></i>
|
| 258 |
+
<p>Aucune tâche pour le moment</p>
|
| 259 |
+
<p class="text-sm">Ajoutez votre première tâche ci-dessus</p>
|
| 260 |
+
</div>
|
| 261 |
+
</div>
|
| 262 |
+
</div>
|
| 263 |
+
</div>
|
| 264 |
+
</div>
|
| 265 |
+
</div>
|
| 266 |
+
|
| 267 |
+
<!-- Notification Area -->
|
| 268 |
+
<div id="notificationArea" class="fixed bottom-4 right-4 space-y-2 w-80 z-50"></div>
|
| 269 |
+
|
| 270 |
+
<script>
|
| 271 |
+
// Variables globales
|
| 272 |
+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 273 |
+
let currentFilter = { category: 'all', priority: 'all', status: 'all' };
|
| 274 |
+
let activeReminders = {};
|
| 275 |
+
|
| 276 |
+
// Initialisation
|
| 277 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 278 |
+
renderTasks();
|
| 279 |
+
updateTaskCount();
|
| 280 |
+
setupReminderToggle();
|
| 281 |
+
setupSearch();
|
| 282 |
+
checkForOverdueTasks();
|
| 283 |
+
|
| 284 |
+
// Vérifier les rappels toutes les minutes
|
| 285 |
+
setInterval(checkReminders, 60000);
|
| 286 |
+
});
|
| 287 |
+
|
| 288 |
+
// Gestion du formulaire
|
| 289 |
+
document.getElementById('addTaskForm').addEventListener('submit', function(e) {
|
| 290 |
+
e.preventDefault();
|
| 291 |
+
|
| 292 |
+
const title = document.getElementById('taskTitle').value.trim();
|
| 293 |
+
const description = document.getElementById('taskDescription').value.trim();
|
| 294 |
+
const category = document.getElementById('taskCategory').value;
|
| 295 |
+
const priority = document.getElementById('taskPriority').value;
|
| 296 |
+
const dueDate = document.getElementById('taskDueDate').value;
|
| 297 |
+
const hasReminder = document.getElementById('taskReminder').checked;
|
| 298 |
+
const reminderTime = hasReminder ? parseInt(document.getElementById('reminderTime').value) : null;
|
| 299 |
+
const reminderMethod = hasReminder ? document.getElementById('reminderMethod').value : null;
|
| 300 |
+
|
| 301 |
+
if (!title) return;
|
| 302 |
+
|
| 303 |
+
const newTask = {
|
| 304 |
+
id: Date.now().toString(),
|
| 305 |
+
title,
|
| 306 |
+
description,
|
| 307 |
+
category,
|
| 308 |
+
priority,
|
| 309 |
+
dueDate: dueDate || null,
|
| 310 |
+
completed: false,
|
| 311 |
+
createdAt: new Date().toISOString(),
|
| 312 |
+
reminder: hasReminder ? {
|
| 313 |
+
time: reminderTime,
|
| 314 |
+
method: reminderMethod,
|
| 315 |
+
triggered: false
|
| 316 |
+
} : null
|
| 317 |
+
};
|
| 318 |
+
|
| 319 |
+
tasks.push(newTask);
|
| 320 |
+
saveTasks();
|
| 321 |
+
renderTasks();
|
| 322 |
+
updateTaskCount();
|
| 323 |
+
|
| 324 |
+
// Réinitialiser le formulaire
|
| 325 |
+
this.reset();
|
| 326 |
+
document.getElementById('reminderOptions').classList.add('hidden');
|
| 327 |
+
|
| 328 |
+
// Planifier le rappel si nécessaire
|
| 329 |
+
if (hasReminder && dueDate) {
|
| 330 |
+
scheduleReminder(newTask);
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
showNotification('Tâche ajoutée avec succès!', 'success');
|
| 334 |
+
});
|
| 335 |
+
|
| 336 |
+
// Fonction pour afficher les tâches
|
| 337 |
+
function renderTasks(filteredTasks = null) {
|
| 338 |
+
const tasksList = document.getElementById('tasksList');
|
| 339 |
+
const tasksToRender = filteredTasks || filterTasks();
|
| 340 |
+
|
| 341 |
+
if (tasksToRender.length === 0) {
|
| 342 |
+
tasksList.innerHTML = `
|
| 343 |
+
<div class="text-center py-10 text-gray-500">
|
| 344 |
+
<i class="fas fa-tasks text-4xl mb-2"></i>
|
| 345 |
+
<p>Aucune tâche trouvée</p>
|
| 346 |
+
<p class="text-sm">Essayez de modifier vos filtres</p>
|
| 347 |
+
</div>
|
| 348 |
+
`;
|
| 349 |
+
return;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
tasksList.innerHTML = '';
|
| 353 |
+
|
| 354 |
+
tasksToRender.forEach(task => {
|
| 355 |
+
const taskElement = createTaskElement(task);
|
| 356 |
+
tasksList.appendChild(taskElement);
|
| 357 |
+
});
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
// Fonction pour créer un élément de tâche
|
| 361 |
+
function createTaskElement(task) {
|
| 362 |
+
const taskElement = document.createElement('div');
|
| 363 |
+
taskElement.className = `border rounded-lg p-4 ${task.completed ? 'bg-gray-50 completed' : 'bg-white'} ${isTaskOverdue(task) && !task.completed ? 'border-red-200' : 'border-gray-200'}`;
|
| 364 |
+
taskElement.dataset.id = task.id;
|
| 365 |
+
|
| 366 |
+
// Icône de catégorie
|
| 367 |
+
const categoryIcons = {
|
| 368 |
+
work: 'briefcase',
|
| 369 |
+
personal: 'user',
|
| 370 |
+
shopping: 'shopping-cart',
|
| 371 |
+
other: 'ellipsis-h'
|
| 372 |
+
};
|
| 373 |
+
|
| 374 |
+
const categoryColors = {
|
| 375 |
+
work: 'red',
|
| 376 |
+
personal: 'green',
|
| 377 |
+
shopping: 'purple',
|
| 378 |
+
other: 'yellow'
|
| 379 |
+
};
|
| 380 |
+
|
| 381 |
+
// Icône de priorité
|
| 382 |
+
const priorityIcons = {
|
| 383 |
+
high: 'flag',
|
| 384 |
+
medium: 'flag',
|
| 385 |
+
low: 'flag'
|
| 386 |
+
};
|
| 387 |
+
|
| 388 |
+
const priorityColors = {
|
| 389 |
+
high: 'red',
|
| 390 |
+
medium: 'yellow',
|
| 391 |
+
low: 'green'
|
| 392 |
+
};
|
| 393 |
+
|
| 394 |
+
// Date formatée
|
| 395 |
+
const dueDateFormatted = task.dueDate ? new Date(task.dueDate).toLocaleString('fr-FR', {
|
| 396 |
+
day: '2-digit',
|
| 397 |
+
month: '2-digit',
|
| 398 |
+
year: 'numeric',
|
| 399 |
+
hour: '2-digit',
|
| 400 |
+
minute: '2-digit'
|
| 401 |
+
}) : 'Pas de date';
|
| 402 |
+
|
| 403 |
+
// Statut de la tâche
|
| 404 |
+
let statusText = '';
|
| 405 |
+
let statusColor = '';
|
| 406 |
+
|
| 407 |
+
if (task.completed) {
|
| 408 |
+
statusText = 'Complétée';
|
| 409 |
+
statusColor = 'green';
|
| 410 |
+
} else if (isTaskOverdue(task)) {
|
| 411 |
+
statusText = 'En retard';
|
| 412 |
+
statusColor = 'red';
|
| 413 |
+
} else if (task.dueDate) {
|
| 414 |
+
statusText = 'En cours';
|
| 415 |
+
statusColor = 'blue';
|
| 416 |
+
} else {
|
| 417 |
+
statusText = 'Sans date';
|
| 418 |
+
statusColor = 'gray';
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
taskElement.innerHTML = `
|
| 422 |
+
<div class="flex justify-between items-start mb-2">
|
| 423 |
+
<div class="flex items-center gap-2">
|
| 424 |
+
<input type="checkbox" ${task.completed ? 'checked' : ''} onchange="toggleTaskCompletion('${task.id}')" class="h-5 w-5 rounded border-gray-300 text-blue-600 focus:ring-blue-500">
|
| 425 |
+
<h3 class="font-medium ${task.completed ? 'line-through text-gray-500' : 'text-gray-800'}">${task.title}</h3>
|
| 426 |
+
</div>
|
| 427 |
+
<div class="flex items-center gap-2">
|
| 428 |
+
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-${priorityColors[task.priority]}-100 text-${priorityColors[task.priority]}-800">
|
| 429 |
+
<i class="fas fa-${priorityIcons[task.priority]} text-${priorityColors[task.priority]}-500 mr-1"></i>
|
| 430 |
+
${task.priority === 'high' ? 'Haute' : task.priority === 'medium' ? 'Moyenne' : 'Basse'}
|
| 431 |
+
</span>
|
| 432 |
+
<button onclick="deleteTask('${task.id}')" class="text-gray-400 hover:text-red-500">
|
| 433 |
+
<i class="fas fa-trash-alt"></i>
|
| 434 |
+
</button>
|
| 435 |
+
</div>
|
| 436 |
+
</div>
|
| 437 |
+
|
| 438 |
+
${task.description ? `<p class="text-sm text-gray-600 mb-3">${task.description}</p>` : ''}
|
| 439 |
+
|
| 440 |
+
<div class="flex flex-wrap items-center justify-between gap-2 text-sm">
|
| 441 |
+
<div class="flex items-center gap-2">
|
| 442 |
+
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-${categoryColors[task.category]}-100 text-${categoryColors[task.category]}-800">
|
| 443 |
+
<i class="fas fa-${categoryIcons[task.category]} text-${categoryColors[task.category]}-500 mr-1"></i>
|
| 444 |
+
${task.category === 'work' ? 'Travail' : task.category === 'personal' ? 'Personnel' : task.category === 'shopping' ? 'Shopping' : 'Autre'}
|
| 445 |
+
</span>
|
| 446 |
+
|
| 447 |
+
<span class="text-gray-500">
|
| 448 |
+
<i class="far fa-calendar-alt mr-1"></i>
|
| 449 |
+
${dueDateFormatted}
|
| 450 |
+
</span>
|
| 451 |
+
</div>
|
| 452 |
+
|
| 453 |
+
<div class="flex items-center gap-2">
|
| 454 |
+
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-${statusColor}-100 text-${statusColor}-800">
|
| 455 |
+
${statusText}
|
| 456 |
+
</span>
|
| 457 |
+
|
| 458 |
+
${task.reminder ? `
|
| 459 |
+
<span class="text-gray-500">
|
| 460 |
+
<i class="fas fa-bell ${task.reminder.triggered ? 'text-yellow-500' : ''} mr-1"></i>
|
| 461 |
+
Rappel ${task.reminder.time} min avant
|
| 462 |
+
</span>
|
| 463 |
+
` : ''}
|
| 464 |
+
</div>
|
| 465 |
+
</div>
|
| 466 |
+
`;
|
| 467 |
+
|
| 468 |
+
return taskElement;
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
// Fonction pour basculer l'état de complétion d'une tâche
|
| 472 |
+
function toggleTaskCompletion(taskId) {
|
| 473 |
+
const taskIndex = tasks.findIndex(task => task.id === taskId);
|
| 474 |
+
if (taskIndex !== -1) {
|
| 475 |
+
tasks[taskIndex].completed = !tasks[taskIndex].completed;
|
| 476 |
+
saveTasks();
|
| 477 |
+
renderTasks();
|
| 478 |
+
updateTaskCount();
|
| 479 |
+
|
| 480 |
+
if (tasks[taskIndex].completed) {
|
| 481 |
+
showNotification('Tâche marquée comme complétée!', 'success');
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
}
|
| 485 |
+
|
| 486 |
+
// Fonction pour supprimer une tâche
|
| 487 |
+
function deleteTask(taskId) {
|
| 488 |
+
if (confirm('Êtes-vous sûr de vouloir supprimer cette tâche?')) {
|
| 489 |
+
tasks = tasks.filter(task => task.id !== taskId);
|
| 490 |
+
saveTasks();
|
| 491 |
+
renderTasks();
|
| 492 |
+
updateTaskCount();
|
| 493 |
+
showNotification('Tâche supprimée avec succès!', 'success');
|
| 494 |
+
|
| 495 |
+
// Annuler tout rappel planifié pour cette tâche
|
| 496 |
+
if (activeReminders[taskId]) {
|
| 497 |
+
clearTimeout(activeReminders[taskId]);
|
| 498 |
+
delete activeReminders[taskId];
|
| 499 |
+
}
|
| 500 |
+
}
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
// Fonction pour effacer toutes les tâches complétées
|
| 504 |
+
function clearCompletedTasks() {
|
| 505 |
+
if (confirm('Êtes-vous sûr de vouloir supprimer toutes les tâches complétées?')) {
|
| 506 |
+
// Annuler les rappels pour les tâches complétées
|
| 507 |
+
tasks.forEach(task => {
|
| 508 |
+
if (task.completed && activeReminders[task.id]) {
|
| 509 |
+
clearTimeout(activeReminders[task.id]);
|
| 510 |
+
delete activeReminders[task.id];
|
| 511 |
+
}
|
| 512 |
+
});
|
| 513 |
+
|
| 514 |
+
tasks = tasks.filter(task => !task.completed);
|
| 515 |
+
saveTasks();
|
| 516 |
+
renderTasks();
|
| 517 |
+
updateTaskCount();
|
| 518 |
+
showNotification('Tâches complétées effacées!', 'success');
|
| 519 |
+
}
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
// Fonction pour filtrer les tâches par catégorie
|
| 523 |
+
function filterTasks(category = 'all') {
|
| 524 |
+
currentFilter.category = category;
|
| 525 |
+
return applyFilters();
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
// Fonction pour filtrer les tâches par priorité
|
| 529 |
+
function filterByPriority(priority = 'all') {
|
| 530 |
+
currentFilter.priority = priority;
|
| 531 |
+
return applyFilters();
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
// Fonction pour filtrer les tâches par statut
|
| 535 |
+
function filterByStatus(status = 'all') {
|
| 536 |
+
currentFilter.status = status;
|
| 537 |
+
return applyFilters();
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
// Fonction pour appliquer tous les filtres
|
| 541 |
+
function applyFilters() {
|
| 542 |
+
let filteredTasks = [...tasks];
|
| 543 |
+
|
| 544 |
+
// Filtrer par catégorie
|
| 545 |
+
if (currentFilter.category !== 'all') {
|
| 546 |
+
filteredTasks = filteredTasks.filter(task => task.category === currentFilter.category);
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
// Filtrer par priorité
|
| 550 |
+
if (currentFilter.priority !== 'all') {
|
| 551 |
+
filteredTasks = filteredTasks.filter(task => task.priority === currentFilter.priority);
|
| 552 |
+
}
|
| 553 |
+
|
| 554 |
+
// Filtrer par statut
|
| 555 |
+
if (currentFilter.status !== 'all') {
|
| 556 |
+
if (currentFilter.status === 'completed') {
|
| 557 |
+
filteredTasks = filteredTasks.filter(task => task.completed);
|
| 558 |
+
} else if (currentFilter.status === 'pending') {
|
| 559 |
+
filteredTasks = filteredTasks.filter(task => !task.completed && !isTaskOverdue(task));
|
| 560 |
+
} else if (currentFilter.status === 'overdue') {
|
| 561 |
+
filteredTasks = filteredTasks.filter(task => !task.completed && isTaskOverdue(task));
|
| 562 |
+
}
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
renderTasks(filteredTasks);
|
| 566 |
+
return filteredTasks;
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
// Fonction pour vérifier si une tâche est en retard
|
| 570 |
+
function isTaskOverdue(task) {
|
| 571 |
+
if (!task.dueDate || task.completed) return false;
|
| 572 |
+
return new Date(task.dueDate) < new Date();
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
// Fonction pour vérifier les tâches en retard au chargement
|
| 576 |
+
function checkForOverdueTasks() {
|
| 577 |
+
const overdueTasks = tasks.filter(task => isTaskOverdue(task));
|
| 578 |
+
if (overdueTasks.length > 0) {
|
| 579 |
+
showNotification(`Vous avez ${overdueTasks.length} tâche(s) en retard!`, 'warning');
|
| 580 |
+
}
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
// Fonction pour configurer la recherche
|
| 584 |
+
function setupSearch() {
|
| 585 |
+
const searchInput = document.getElementById('searchTask');
|
| 586 |
+
searchInput.addEventListener('input', function() {
|
| 587 |
+
const searchTerm = this.value.toLowerCase();
|
| 588 |
+
const filteredTasks = tasks.filter(task =>
|
| 589 |
+
task.title.toLowerCase().includes(searchTerm) ||
|
| 590 |
+
(task.description && task.description.toLowerCase().includes(searchTerm))
|
| 591 |
+
);
|
| 592 |
+
renderTasks(filteredTasks);
|
| 593 |
+
});
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
// Fonction pour configurer le toggle des rappels
|
| 597 |
+
function setupReminderToggle() {
|
| 598 |
+
const reminderCheckbox = document.getElementById('taskReminder');
|
| 599 |
+
const reminderOptions = document.getElementById('reminderOptions');
|
| 600 |
+
|
| 601 |
+
reminderCheckbox.addEventListener('change', function() {
|
| 602 |
+
if (this.checked) {
|
| 603 |
+
reminderOptions.classList.remove('hidden');
|
| 604 |
+
} else {
|
| 605 |
+
reminderOptions.classList.add('hidden');
|
| 606 |
+
}
|
| 607 |
+
});
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
// Fonction pour planifier un rappel
|
| 611 |
+
function scheduleReminder(task) {
|
| 612 |
+
if (!task.reminder || !task.dueDate) return;
|
| 613 |
+
|
| 614 |
+
const dueDate = new Date(task.dueDate);
|
| 615 |
+
const reminderTime = task.reminder.time * 60000; // Convertir en millisecondes
|
| 616 |
+
const reminderDate = new Date(dueDate.getTime() - reminderTime);
|
| 617 |
+
|
| 618 |
+
const now = new Date();
|
| 619 |
+
const timeUntilReminder = reminderDate.getTime() - now.getTime();
|
| 620 |
+
|
| 621 |
+
// Si le rappel est dans le futur
|
| 622 |
+
if (timeUntilReminder > 0) {
|
| 623 |
+
activeReminders[task.id] = setTimeout(() => {
|
| 624 |
+
triggerReminder(task);
|
| 625 |
+
}, timeUntilReminder);
|
| 626 |
+
}
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
// Fonction pour déclencher un rappel
|
| 630 |
+
function triggerReminder(task) {
|
| 631 |
+
// Marquer le rappel comme déclenché
|
| 632 |
+
const taskIndex = tasks.findIndex(t => t.id === task.id);
|
| 633 |
+
if (taskIndex !== -1 && tasks[taskIndex].reminder) {
|
| 634 |
+
tasks[taskIndex].reminder.triggered = true;
|
| 635 |
+
saveTasks();
|
| 636 |
+
renderTasks();
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
// Afficher la notification
|
| 640 |
+
const method = task.reminder.method;
|
| 641 |
+
const message = `Rappel: "${task.title}" est due à ${new Date(task.dueDate).toLocaleTimeString('fr-FR', {hour: '2-digit', minute:'2-digit'})}`;
|
| 642 |
+
|
| 643 |
+
if (method === 'notification') {
|
| 644 |
+
showNotification(message, 'info', 10000);
|
| 645 |
+
} else if (method === 'email') {
|
| 646 |
+
// En production, vous enverriez un vrai email ici
|
| 647 |
+
console.log(`Email envoyé: ${message}`);
|
| 648 |
+
showNotification(`Rappel envoyé par email: ${task.title}`, 'info');
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
// Supprimer le rappel des rappels actifs
|
| 652 |
+
delete activeReminders[task.id];
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
// Fonction pour vérifier périodiquement les rappels
|
| 656 |
+
function checkReminders() {
|
| 657 |
+
const now = new Date();
|
| 658 |
+
|
| 659 |
+
tasks.forEach(task => {
|
| 660 |
+
if (task.reminder && !task.reminder.triggered && task.dueDate) {
|
| 661 |
+
const dueDate = new Date(task.dueDate);
|
| 662 |
+
const reminderTime = task.reminder.time * 60000;
|
| 663 |
+
const reminderDate = new Date(dueDate.getTime() - reminderTime);
|
| 664 |
+
|
| 665 |
+
// Si le rappel devrait être déclenché maintenant
|
| 666 |
+
if (reminderDate <= now && dueDate > now) {
|
| 667 |
+
triggerReminder(task);
|
| 668 |
+
}
|
| 669 |
+
}
|
| 670 |
+
});
|
| 671 |
+
}
|
| 672 |
+
|
| 673 |
+
// Fonction pour afficher une notification
|
| 674 |
+
function showNotification(message, type = 'info', duration = 5000) {
|
| 675 |
+
const notificationArea = document.getElementById('notificationArea');
|
| 676 |
+
const notificationId = Date.now().toString();
|
| 677 |
+
|
| 678 |
+
const colors = {
|
| 679 |
+
success: 'bg-green-100 border-green-500 text-green-700',
|
| 680 |
+
error: 'bg-red-100 border-red-500 text-red-700',
|
| 681 |
+
warning: 'bg-yellow-100 border-yellow-500 text-yellow-700',
|
| 682 |
+
info: 'bg-blue-100 border-blue-500 text-blue-700'
|
| 683 |
+
};
|
| 684 |
+
|
| 685 |
+
const icons = {
|
| 686 |
+
success: 'fa-check-circle',
|
| 687 |
+
error: 'fa-exclamation-circle',
|
| 688 |
+
warning: 'fa-exclamation-triangle',
|
| 689 |
+
info: 'fa-info-circle'
|
| 690 |
+
};
|
| 691 |
+
|
| 692 |
+
const notification = document.createElement('div');
|
| 693 |
+
notification.id = `notification-${notificationId}`;
|
| 694 |
+
notification.className = `notification p-4 border-l-4 rounded-lg shadow-md ${colors[type]} flex items-start`;
|
| 695 |
+
|
| 696 |
+
notification.innerHTML = `
|
| 697 |
+
<i class="fas ${icons[type]} mt-1 mr-3"></i>
|
| 698 |
+
<div class="flex-1">
|
| 699 |
+
<p class="text-sm font-medium">${message}</p>
|
| 700 |
+
</div>
|
| 701 |
+
<button onclick="dismissNotification('${notificationId}')" class="ml-2 text-gray-500 hover:text-gray-700">
|
| 702 |
+
<i class="fas fa-times"></i>
|
| 703 |
+
</button>
|
| 704 |
+
`;
|
| 705 |
+
|
| 706 |
+
notificationArea.appendChild(notification);
|
| 707 |
+
|
| 708 |
+
// Fermer automatiquement après la durée spécifiée
|
| 709 |
+
setTimeout(() => {
|
| 710 |
+
dismissNotification(notificationId);
|
| 711 |
+
}, duration);
|
| 712 |
+
}
|
| 713 |
+
|
| 714 |
+
// Fonction pour fermer une notification
|
| 715 |
+
function dismissNotification(id) {
|
| 716 |
+
const notification = document.getElementById(`notification-${id}`);
|
| 717 |
+
if (notification) {
|
| 718 |
+
notification.classList.add('hide');
|
| 719 |
+
setTimeout(() => {
|
| 720 |
+
notification.remove();
|
| 721 |
+
}, 500);
|
| 722 |
+
}
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
// Fonction pour mettre à jour le compteur de tâches
|
| 726 |
+
function updateTaskCount() {
|
| 727 |
+
const totalTasks = tasks.length;
|
| 728 |
+
const completedTasks = tasks.filter(task => task.completed).length;
|
| 729 |
+
const pendingTasks = totalTasks - completedTasks;
|
| 730 |
+
|
| 731 |
+
document.getElementById('taskCount').textContent =
|
| 732 |
+
`${pendingTasks} en cours • ${completedTasks} complétées • ${totalTasks} au total`;
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
// Fonction pour sauvegarder les tâches dans le localStorage
|
| 736 |
+
function saveTasks() {
|
| 737 |
+
localStorage.setItem('tasks', JSON.stringify(tasks));
|
| 738 |
+
}
|
| 739 |
+
</script>
|
| 740 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=stephaneibens/task-manager-si" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 741 |
+
</html>
|