timetracking / index.html
Francloi's picture
Add 3 files
700f5b7 verified
Raw
History Blame Contribute Delete
22.1 kB
<!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>