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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WorkTime Tracker - Gestion du temps de travail</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .map-container {
            height: 300px;
            border-radius: 1rem;
            overflow: hidden;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }
        
        .time-card {
            transition: all 0.3s ease;
        }
        
        .time-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }
        
        .pulse {
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% {
                box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
            }
            70% {
                box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
            }
            100% {
                box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
            }
        }
        
        .slide-in {
            animation: slideIn 0.5s forwards;
        }
        
        @keyframes slideIn {
            from {
                transform: translateY(20px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <!-- Header -->
        <header class="flex justify-between items-center mb-10">
            <div>
                <h1 class="text-3xl font-bold text-indigo-700">
                    <i class="fas fa-clock mr-2"></i> WorkTime Tracker
                </h1>
                <p class="text-gray-600">Gestion du temps de travail avec géolocalisation</p>
            </div>
            <div class="flex items-center space-x-4">
                <div class="relative">
                    <img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Profile" class="w-10 h-10 rounded-full border-2 border-indigo-400">
                    <span class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></span>
                </div>
                <span class="font-medium">Sophie Martin</span>
            </div>
        </header>

        <!-- Main Content -->
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
            <!-- Left Column -->
            <div class="lg:col-span-2 space-y-6">
                <!-- Time Tracking Card -->
                <div class="bg-white rounded-xl shadow-md p-6 time-card slide-in">
                    <div class="flex justify-between items-center mb-4">
                        <h2 class="text-xl font-semibold text-gray-800">
                            <i class="fas fa-stopwatch mr-2 text-indigo-600"></i> Suivi du temps
                        </h2>
                        <span id="current-time" class="text-gray-500 font-mono">00:00:00</span>
                    </div>
                    
                    <div class="flex flex-col sm:flex-row justify-between items-center gap-4 mb-6">
                        <div class="text-center">
                            <p class="text-sm text-gray-500">Temps travaillé aujourd'hui</p>
                            <p id="today-time" class="text-3xl font-bold text-indigo-600">04:32:17</p>
                        </div>
                        <div class="text-center">
                            <p class="text-sm text-gray-500">Temps hebdomadaire</p>
                            <p id="week-time" class="text-3xl font-bold text-indigo-600">23:15:42</p>
                        </div>
                        <div class="text-center">
                            <p class="text-sm text-gray-500">Temps mensuel</p>
                            <p id="month-time" class="text-3xl font-bold text-indigo-600">87:29:05</p>
                        </div>
                    </div>
                    
                    <div class="flex justify-center gap-4">
                        <button id="start-btn" class="bg-green-500 hover:bg-green-600 text-white px-6 py-3 rounded-full font-medium flex items-center pulse">
                            <i class="fas fa-play mr-2"></i> Commencer
                        </button>
                        <button id="stop-btn" class="bg-red-500 hover:bg-red-600 text-white px-6 py-3 rounded-full font-medium flex items-center opacity-50 cursor-not-allowed">
                            <i class="fas fa-stop mr-2"></i> Arrêter
                        </button>
                        <button id="pause-btn" class="bg-yellow-500 hover:bg-yellow-600 text-white px-6 py-3 rounded-full font-medium flex items-center opacity-50 cursor-not-allowed">
                            <i class="fas fa-pause mr-2"></i> Pause
                        </button>
                    </div>
                </div>
                
                <!-- Map and Location -->
                <div class="bg-white rounded-xl shadow-md p-6 time-card slide-in" style="animation-delay: 0.2s;">
                    <h2 class="text-xl font-semibold text-gray-800 mb-4">
                        <i class="fas fa-map-marker-alt mr-2 text-indigo-600"></i> Localisation actuelle
                    </h2>
                    
                    <div class="map-container mb-4 bg-gray-200 flex items-center justify-center">
                        <p id="location-status" class="text-gray-500">
                            <i class="fas fa-spinner fa-spin mr-2"></i> Chargement de la localisation...
                        </p>
                        <!-- Map will be inserted here by JavaScript -->
                    </div>
                    
                    <div class="flex flex-wrap gap-4">
                        <div class="flex-1 min-w-[200px] bg-indigo-50 p-4 rounded-lg">
                            <p class="text-sm text-gray-500">Adresse</p>
                            <p id="current-address" class="font-medium">Chargement...</p>
                        </div>
                        <div class="flex-1 min-w-[200px] bg-indigo-50 p-4 rounded-lg">
                            <p class="text-sm text-gray-500">Coordonnées</p>
                            <p id="current-coords" class="font-medium">Chargement...</p>
                        </div>
                        <div class="flex-1 min-w-[200px] bg-indigo-50 p-4 rounded-lg">
                            <p class="text-sm text-gray-500">Précision</p>
                            <p id="current-accuracy" class="font-medium">Chargement...</p>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Right Column -->
            <div class="space-y-6">
                <!-- Today's Summary -->
                <div class="bg-white rounded-xl shadow-md p-6 time-card slide-in" style="animation-delay: 0.4s;">
                    <h2 class="text-xl font-semibold text-gray-800 mb-4">
                        <i class="fas fa-calendar-day mr-2 text-indigo-600"></i> Aujourd'hui
                    </h2>
                    
                    <div class="space-y-4">
                        <div class="flex justify-between items-center">
                            <div>
                                <p class="font-medium">Arrivée</p>
                                <p class="text-sm text-gray-500">08:32 AM</p>
                            </div>
                            <span class="bg-green-100 text-green-800 px-2 py-1 rounded-full text-xs">Enregistré</span>
                        </div>
                        
                        <div class="flex justify-between items-center">
                            <div>
                                <p class="font-medium">Pause déjeuner</p>
                                <p class="text-sm text-gray-500">12:15 PM - 13:30 PM</p>
                            </div>
                            <span class="bg-green-100 text-green-800 px-2 py-1 rounded-full text-xs">Validé</span>
                        </div>
                        
                        <div class="flex justify-between items-center">
                            <div>
                                <p class="font-medium">Départ</p>
                                <p class="text-sm text-gray-500">--:-- --</p>
                            </div>
                            <span class="bg-gray-100 text-gray-800 px-2 py-1 rounded-full text-xs">En attente</span>
                        </div>
                    </div>
                    
                    <div class="mt-6 pt-4 border-t border-gray-200">
                        <div class="flex justify-between">
                            <span class="text-gray-600">Temps total:</span>
                            <span class="font-medium">04:32:17</span>
                        </div>
                    </div>
                </div>
                
                <!-- Recent Activities -->
                <div class="bg-white rounded-xl shadow-md p-6 time-card slide-in" style="animation-delay: 0.6s;">
                    <h2 class="text-xl font-semibold text-gray-800 mb-4">
                        <i class="fas fa-history mr-2 text-indigo-600"></i> Activités récentes
                    </h2>
                    
                    <div class="space-y-4">
                        <div class="flex items-start">
                            <div class="bg-indigo-100 p-2 rounded-full mr-3">
                                <i class="fas fa-play text-indigo-600 text-sm"></i>
                            </div>
                            <div>
                                <p class="font-medium">Temps commencé</p>
                                <p class="text-sm text-gray-500">Aujourd'hui à 08:32 AM • Bureau principal</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-yellow-100 p-2 rounded-full mr-3">
                                <i class="fas fa-pause text-yellow-600 text-sm"></i>
                            </div>
                            <div>
                                <p class="font-medium">Pause déjeuner</p>
                                <p class="text-sm text-gray-500">Aujourd'hui à 12:15 PM • Café du coin</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-green-100 p-2 rounded-full mr-3">
                                <i class="fas fa-play text-green-600 text-sm"></i>
                            </div>
                            <div>
                                <p class="font-medium">Reprise du travail</p>
                                <p class="text-sm text-gray-500">Aujourd'hui à 13:30 PM • Bureau principal</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-red-100 p-2 rounded-full mr-3">
                                <i class="fas fa-stop text-red-600 text-sm"></i>
                            </div>
                            <div>
                                <p class="font-medium">Temps arrêté</p>
                                <p class="text-sm text-gray-500">Hier à 17:45 PM • Bureau principal</p>
                            </div>
                        </div>
                    </div>
                    
                    <button class="mt-4 text-indigo-600 hover:text-indigo-800 text-sm font-medium flex items-center">
                        Voir toutes les activités <i class="fas fa-chevron-right ml-1 text-xs"></i>
                    </button>
                </div>
                
                <!-- Quick Stats -->
                <div class="bg-white rounded-xl shadow-md p-6 time-card slide-in" style="animation-delay: 0.8s;">
                    <h2 class="text-xl font-semibold text-gray-800 mb-4">
                        <i class="fas fa-chart-bar mr-2 text-indigo-600"></i> Statistiques
                    </h2>
                    
                    <div class="grid grid-cols-2 gap-4">
                        <div class="bg-blue-50 p-4 rounded-lg">
                            <p class="text-sm text-gray-500">Heures cette semaine</p>
                            <p class="text-2xl font-bold text-blue-600">23:15</p>
                        </div>
                        <div class="bg-purple-50 p-4 rounded-lg">
                            <p class="text-sm text-gray-500">Heures ce mois</p>
                            <p class="text-2xl font-bold text-purple-600">87:29</p>
                        </div>
                        <div class="bg-green-50 p-4 rounded-lg">
                            <p class="text-sm text-gray-500">Productivité</p>
                            <p class="text-2xl font-bold text-green-600">92%</p>
                        </div>
                        <div class="bg-yellow-50 p-4 rounded-lg">
                            <p class="text-sm text-gray-500">Jours travaillés</p>
                            <p class="text-2xl font-bold text-yellow-600">18</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Update current time
        function updateCurrentTime() {
            const now = new Date();
            const timeString = now.toLocaleTimeString('fr-FR', { hour12: false });
            document.getElementById('current-time').textContent = timeString;
        }
        
        setInterval(updateCurrentTime, 1000);
        updateCurrentTime();
        
        // Time tracking functionality
        const startBtn = document.getElementById('start-btn');
        const stopBtn = document.getElementById('stop-btn');
        const pauseBtn = document.getElementById('pause-btn');
        
        let isTracking = false;
        let startTime = null;
        let totalTime = 0;
        let intervalId = null;
        
        startBtn.addEventListener('click', () => {
            if (!isTracking) {
                isTracking = true;
                startTime = new Date();
                startBtn.classList.remove('pulse');
                stopBtn.classList.remove('opacity-50', 'cursor-not-allowed');
                pauseBtn.classList.remove('opacity-50', 'cursor-not-allowed');
                
                // Simulate location update
                updateLocation();
                
                // Start updating the display
                intervalId = setInterval(() => {
                    const currentTime = new Date();
                    const elapsed = currentTime - startTime;
                    document.getElementById('today-time').textContent = formatTime(elapsed / 1000);
                }, 1000);
            }
        });
        
        stopBtn.addEventListener('click', () => {
            if (isTracking) {
                isTracking = false;
                clearInterval(intervalId);
                startBtn.classList.add('pulse');
                stopBtn.classList.add('opacity-50', 'cursor-not-allowed');
                pauseBtn.classList.add('opacity-50', 'cursor-not-allowed');
                
                // Update today's summary
                const endTime = new Date();
                const elapsed = endTime - startTime;
                totalTime += elapsed;
                
                // Add to recent activities
                // In a real app, you would save this to a database
            }
        });
        
        pauseBtn.addEventListener('click', () => {
            // Pause functionality would go here
            alert("Fonctionnalité de pause à implémenter");
        });
        
        function formatTime(seconds) {
            const hrs = Math.floor(seconds / 3600);
            const mins = Math.floor((seconds % 3600) / 60);
            const secs = Math.floor(seconds % 60);
            
            return `${hrs.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
        }
        
        // Geolocation functionality
        function updateLocation() {
            const locationStatus = document.getElementById('location-status');
            const currentAddress = document.getElementById('current-address');
            const currentCoords = document.getElementById('current-coords');
            const currentAccuracy = document.getElementById('current-accuracy');
            
            if (navigator.geolocation) {
                locationStatus.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Localisation en cours...';
                
                navigator.geolocation.getCurrentPosition(
                    (position) => {
                        const lat = position.coords.latitude;
                        const lng = position.coords.longitude;
                        const accuracy = position.coords.accuracy;
                        
                        // Update location info
                        currentCoords.textContent = `${lat.toFixed(6)}, ${lng.toFixed(6)}`;
                        currentAccuracy.textContent = ${Math.round(accuracy)} mètres`;
                        
                        // Simulate reverse geocoding (in a real app, you'd use a geocoding API)
                        setTimeout(() => {
                            locationStatus.innerHTML = '<i class="fas fa-check-circle text-green-500 mr-2"></i> Localisation confirmée';
                            currentAddress.textContent = "12 Rue de la Paix, 75002 Paris, France";
                            
                            // In a real app, you would display a map here using Leaflet or Google Maps API
                            const mapContainer = document.querySelector('.map-container');
                            mapContainer.innerHTML = `
                                <div class="w-full h-full flex items-center justify-center bg-indigo-50">
                                    <div class="text-center">
                                        <i class="fas fa-map-marked-alt text-4xl text-indigo-400 mb-2"></i>
                                        <p class="text-indigo-700 font-medium">Carte centrée sur votre position</p>
                                        <p class="text-sm text-gray-500">Lat: ${lat.toFixed(4)}, Lng: ${lng.toFixed(4)}</p>
                                    </div>
                                </div>
                            `;
                        }, 1500);
                    },
                    (error) => {
                        console.error("Error getting location:", error);
                        locationStatus.innerHTML = '<i class="fas fa-exclamation-triangle text-yellow-500 mr-2"></i> Localisation non disponible';
                        currentAddress.textContent = "Non disponible";
                        currentCoords.textContent = "Non disponible";
                        currentAccuracy.textContent = "Non disponible";
                        
                        const mapContainer = document.querySelector('.map-container');
                        mapContainer.innerHTML = `
                            <div class="w-full h-full flex items-center justify-center bg-yellow-50">
                                <div class="text-center">
                                    <i class="fas fa-map-marker-alt text-4xl text-yellow-400 mb-2"></i>
                                    <p class="text-yellow-700 font-medium">Localisation désactivée</p>
                                    <p class="text-sm text-gray-500">Activez la localisation pour voir votre position</p>
                                </div>
                            </div>
                        `;
                    },
                    {
                        enableHighAccuracy: true,
                        timeout: 5000,
                        maximumAge: 0
                    }
                );
            } else {
                locationStatus.innerHTML = '<i class="fas fa-exclamation-triangle text-red-500 mr-2"></i> Géolocalisation non supportée';
                currentAddress.textContent = "Non supporté";
                currentCoords.textContent = "Non supporté";
                currentAccuracy.textContent = "Non supporté";
            }
        }
        
        // Initialize with a simulated location
        setTimeout(updateLocation, 1000);
        
        // Add slide-in animation to all time cards
        document.addEventListener('DOMContentLoaded', () => {
            const cards = document.querySelectorAll('.time-card');
            cards.forEach((card, index) => {
                card.style.animationDelay = `${index * 0.1}s`;
            });
        });
    </script>
<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=Francloi/timetracking" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>