Spaces:
Running
Running
Add 2 files
Browse files- index.html +488 -20
- prompts.txt +2 -1
index.html
CHANGED
|
@@ -24,6 +24,19 @@
|
|
| 24 |
.pulse {
|
| 25 |
animation: pulse 2s infinite;
|
| 26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
</style>
|
| 28 |
</head>
|
| 29 |
<body class="bg-gray-50">
|
|
@@ -37,11 +50,15 @@
|
|
| 37 |
<h1 class="text-2xl font-bold">Indirect Time Management</h1>
|
| 38 |
</div>
|
| 39 |
<div class="flex items-center space-x-4">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
<div class="relative">
|
| 41 |
-
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="User" class="w-10 h-10 rounded-full border-2 border-white">
|
| 42 |
<span class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full"></span>
|
| 43 |
</div>
|
| 44 |
-
<span class="font-medium">Sarah Johnson</span>
|
| 45 |
</div>
|
| 46 |
</div>
|
| 47 |
</div>
|
|
@@ -57,6 +74,12 @@
|
|
| 57 |
<h2 class="text-xl font-semibold mb-4 text-gray-800">Log Indirect Time</h2>
|
| 58 |
<form id="timeEntryForm" class="space-y-4">
|
| 59 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
<div>
|
| 61 |
<label for="activityType" class="block text-sm font-medium text-gray-700 mb-1">Activity Type</label>
|
| 62 |
<select id="activityType" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
|
@@ -69,6 +92,9 @@
|
|
| 69 |
<option value="other">Other</option>
|
| 70 |
</select>
|
| 71 |
</div>
|
|
|
|
|
|
|
|
|
|
| 72 |
<div>
|
| 73 |
<label for="project" class="block text-sm font-medium text-gray-700 mb-1">Project/Department</label>
|
| 74 |
<select id="project" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
|
@@ -80,11 +106,10 @@
|
|
| 80 |
<option value="general">General</option>
|
| 81 |
</select>
|
| 82 |
</div>
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
<
|
| 87 |
-
<textarea id="description" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="Brief description of the activity"></textarea>
|
| 88 |
</div>
|
| 89 |
|
| 90 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
@@ -112,6 +137,10 @@
|
|
| 112 |
<div class="flex justify-between items-center mb-4">
|
| 113 |
<h2 class="text-xl font-semibold text-gray-800">Recent Time Entries</h2>
|
| 114 |
<div class="flex space-x-2">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
<select id="timeFilter" class="px-3 py-1 border border-gray-300 rounded-lg text-sm">
|
| 116 |
<option value="today">Today</option>
|
| 117 |
<option value="week">This Week</option>
|
|
@@ -129,6 +158,7 @@
|
|
| 129 |
<table class="min-w-full divide-y divide-gray-200">
|
| 130 |
<thead class="bg-gray-50">
|
| 131 |
<tr>
|
|
|
|
| 132 |
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
|
| 133 |
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Activity</th>
|
| 134 |
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Project</th>
|
|
@@ -189,11 +219,11 @@
|
|
| 189 |
</div>
|
| 190 |
</div>
|
| 191 |
|
| 192 |
-
<!--
|
| 193 |
<div class="bg-white rounded-xl shadow-md p-6">
|
| 194 |
-
<h2 class="text-xl font-semibold mb-4 text-gray-800">
|
| 195 |
-
<div class="
|
| 196 |
-
<
|
| 197 |
</div>
|
| 198 |
</div>
|
| 199 |
|
|
@@ -224,7 +254,83 @@
|
|
| 224 |
</main>
|
| 225 |
</div>
|
| 226 |
|
| 227 |
-
<!-- Modal -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
<div id="exportModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 229 |
<div class="bg-white rounded-xl p-6 w-full max-w-md">
|
| 230 |
<div class="flex justify-between items-center mb-4">
|
|
@@ -251,6 +357,13 @@
|
|
| 251 |
</label>
|
| 252 |
</div>
|
| 253 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
<div>
|
| 255 |
<label class="block text-sm font-medium text-gray-700 mb-1">Date Range</label>
|
| 256 |
<select id="exportDateRange" class="w-full px-4 py-2 border border-gray-300 rounded-lg">
|
|
@@ -286,13 +399,43 @@
|
|
| 286 |
document.addEventListener('DOMContentLoaded', function() {
|
| 287 |
// Initialize variables
|
| 288 |
let timeEntries = JSON.parse(localStorage.getItem('timeEntries')) || [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
let activityChart = null;
|
|
|
|
| 290 |
|
| 291 |
// DOM Elements
|
| 292 |
const timeEntryForm = document.getElementById('timeEntryForm');
|
| 293 |
const timeEntriesList = document.getElementById('timeEntriesList');
|
| 294 |
const noEntriesMessage = document.getElementById('noEntriesMessage');
|
| 295 |
const timeFilter = document.getElementById('timeFilter');
|
|
|
|
| 296 |
const exportBtn = document.getElementById('exportBtn');
|
| 297 |
const exportModal = document.getElementById('exportModal');
|
| 298 |
const closeModalBtn = document.getElementById('closeModalBtn');
|
|
@@ -300,12 +443,34 @@
|
|
| 300 |
const confirmExportBtn = document.getElementById('confirmExportBtn');
|
| 301 |
const exportDateRange = document.getElementById('exportDateRange');
|
| 302 |
const customDateRange = document.getElementById('customDateRange');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
|
| 304 |
// Summary elements
|
| 305 |
const todayHours = document.getElementById('todayHours');
|
| 306 |
const weekHours = document.getElementById('weekHours');
|
| 307 |
const monthHours = document.getElementById('monthHours');
|
| 308 |
const lastMonthHours = document.getElementById('lastMonthHours');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
|
| 310 |
// Quick action buttons
|
| 311 |
const quickMeetingBtn = document.getElementById('quickMeetingBtn');
|
|
@@ -317,8 +482,16 @@
|
|
| 317 |
initApp();
|
| 318 |
|
| 319 |
function initApp() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
renderTimeEntries();
|
| 321 |
updateSummary();
|
|
|
|
| 322 |
renderActivityChart();
|
| 323 |
setupEventListeners();
|
| 324 |
}
|
|
@@ -335,8 +508,14 @@
|
|
| 335 |
renderTimeEntries();
|
| 336 |
});
|
| 337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
// Export button
|
| 339 |
exportBtn.addEventListener('click', function() {
|
|
|
|
| 340 |
exportModal.classList.remove('hidden');
|
| 341 |
});
|
| 342 |
|
|
@@ -375,16 +554,214 @@
|
|
| 375 |
quickTrainingBtn.addEventListener('click', function() {
|
| 376 |
quickAddEntry('training', 'Quick Training');
|
| 377 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
}
|
| 379 |
|
| 380 |
function addTimeEntry() {
|
|
|
|
| 381 |
const activityType = document.getElementById('activityType').value;
|
| 382 |
const project = document.getElementById('project').value;
|
| 383 |
const description = document.getElementById('description').value;
|
| 384 |
const startTime = document.getElementById('startTime').value;
|
| 385 |
const endTime = document.getElementById('endTime').value;
|
| 386 |
|
| 387 |
-
if (!activityType || !project || !startTime || !endTime) {
|
| 388 |
alert('Please fill in all required fields');
|
| 389 |
return;
|
| 390 |
}
|
|
@@ -407,6 +784,7 @@
|
|
| 407 |
|
| 408 |
const newEntry = {
|
| 409 |
id: Date.now(),
|
|
|
|
| 410 |
activityType,
|
| 411 |
project,
|
| 412 |
description,
|
|
@@ -420,10 +798,12 @@
|
|
| 420 |
saveTimeEntries();
|
| 421 |
renderTimeEntries();
|
| 422 |
updateSummary();
|
|
|
|
| 423 |
renderActivityChart();
|
| 424 |
|
| 425 |
// Reset form
|
| 426 |
timeEntryForm.reset();
|
|
|
|
| 427 |
|
| 428 |
// Show success feedback
|
| 429 |
const submitBtn = timeEntryForm.querySelector('button[type="submit"]');
|
|
@@ -447,6 +827,11 @@
|
|
| 447 |
document.getElementById('startTime').value = formatDateTimeLocal(now);
|
| 448 |
document.getElementById('endTime').value = formatDateTimeLocal(endTime);
|
| 449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
// Highlight the quick action button
|
| 451 |
const quickBtn = document.getElementById(`quick${activityType.charAt(0).toUpperCase() + activityType.slice(1)}Btn`);
|
| 452 |
quickBtn.classList.add('pulse');
|
|
@@ -471,6 +856,7 @@
|
|
| 471 |
saveTimeEntries();
|
| 472 |
renderTimeEntries();
|
| 473 |
updateSummary();
|
|
|
|
| 474 |
renderActivityChart();
|
| 475 |
}
|
| 476 |
|
|
@@ -478,12 +864,23 @@
|
|
| 478 |
localStorage.setItem('timeEntries', JSON.stringify(timeEntries));
|
| 479 |
}
|
| 480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
function renderTimeEntries() {
|
| 482 |
-
const
|
|
|
|
| 483 |
const now = new Date();
|
| 484 |
let filteredEntries = [...timeEntries];
|
| 485 |
|
| 486 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
case 'today':
|
| 488 |
filteredEntries = filteredEntries.filter(entry => {
|
| 489 |
const entryDate = new Date(entry.startTime);
|
|
@@ -524,6 +921,7 @@
|
|
| 524 |
let html = '';
|
| 525 |
|
| 526 |
filteredEntries.forEach(entry => {
|
|
|
|
| 527 |
const startDate = new Date(entry.startTime);
|
| 528 |
const endDate = new Date(entry.endTime);
|
| 529 |
|
|
@@ -552,6 +950,16 @@
|
|
| 552 |
|
| 553 |
html += `
|
| 554 |
<tr class="time-entry hover:bg-gray-50">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 555 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 556 |
${startDate.toLocaleDateString()}
|
| 557 |
</td>
|
|
@@ -626,7 +1034,11 @@
|
|
| 626 |
let monthTotal = 0;
|
| 627 |
let lastMonthTotal = 0;
|
| 628 |
|
| 629 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 630 |
const entryDate = new Date(entry.startTime);
|
| 631 |
const minutes = entry.duration;
|
| 632 |
|
|
@@ -657,6 +1069,46 @@
|
|
| 657 |
lastMonthHours.textContent = formatDuration(lastMonthTotal);
|
| 658 |
}
|
| 659 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 660 |
function formatDuration(minutes) {
|
| 661 |
const hours = Math.floor(minutes / 60);
|
| 662 |
const mins = minutes % 60;
|
|
@@ -671,10 +1123,14 @@
|
|
| 671 |
function renderActivityChart() {
|
| 672 |
const ctx = document.getElementById('activityChart').getContext('2d');
|
| 673 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 674 |
// Group by activity type
|
| 675 |
const activityGroups = {};
|
| 676 |
|
| 677 |
-
|
| 678 |
if (!activityGroups[entry.activityType]) {
|
| 679 |
activityGroups[entry.activityType] = 0;
|
| 680 |
}
|
|
@@ -733,11 +1189,21 @@
|
|
| 733 |
|
| 734 |
function exportTimeEntries() {
|
| 735 |
const format = document.querySelector('input[name="exportFormat"]:checked').value;
|
|
|
|
| 736 |
const range = exportDateRange.value;
|
| 737 |
|
| 738 |
let filteredEntries = [...timeEntries];
|
| 739 |
let filename = 'indirect_time_entries';
|
| 740 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 741 |
// Filter by date range
|
| 742 |
const now = new Date();
|
| 743 |
|
|
@@ -800,13 +1266,14 @@
|
|
| 800 |
}
|
| 801 |
|
| 802 |
// Prepare CSV content
|
| 803 |
-
let csvContent = "Date,Activity Type,Project,Description,Start Time,End Time,Duration (minutes)\n";
|
| 804 |
|
| 805 |
filteredEntries.forEach(entry => {
|
|
|
|
| 806 |
const startDate = new Date(entry.startTime);
|
| 807 |
const endDate = new Date(entry.endTime);
|
| 808 |
|
| 809 |
-
csvContent += `"${startDate.toLocaleDateString()}","${getActivityName(entry.activityType)}","${getProjectName(entry.project)}","${entry.description}","${startDate.toLocaleTimeString()}","${endDate.toLocaleTimeString()}","${entry.duration}"\n`;
|
| 810 |
});
|
| 811 |
|
| 812 |
// Create download link
|
|
@@ -835,8 +1302,9 @@
|
|
| 835 |
exportModal.classList.add('hidden');
|
| 836 |
}
|
| 837 |
|
| 838 |
-
// Make
|
| 839 |
window.deleteTimeEntry = deleteTimeEntry;
|
|
|
|
| 840 |
});
|
| 841 |
</script>
|
| 842 |
<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=lordjames82/test2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
|
|
|
| 24 |
.pulse {
|
| 25 |
animation: pulse 2s infinite;
|
| 26 |
}
|
| 27 |
+
.slide-in {
|
| 28 |
+
animation: slideIn 0.3s ease-out forwards;
|
| 29 |
+
}
|
| 30 |
+
@keyframes slideIn {
|
| 31 |
+
from {
|
| 32 |
+
transform: translateX(100%);
|
| 33 |
+
opacity: 0;
|
| 34 |
+
}
|
| 35 |
+
to {
|
| 36 |
+
transform: translateX(0);
|
| 37 |
+
opacity: 1;
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
</style>
|
| 41 |
</head>
|
| 42 |
<body class="bg-gray-50">
|
|
|
|
| 50 |
<h1 class="text-2xl font-bold">Indirect Time Management</h1>
|
| 51 |
</div>
|
| 52 |
<div class="flex items-center space-x-4">
|
| 53 |
+
<button id="manageEmployeesBtn" class="px-4 py-2 bg-indigo-700 rounded-lg hover:bg-indigo-800 flex items-center space-x-2">
|
| 54 |
+
<i class="fas fa-users"></i>
|
| 55 |
+
<span>Manage Employees</span>
|
| 56 |
+
</button>
|
| 57 |
<div class="relative">
|
| 58 |
+
<img id="currentUserAvatar" src="https://randomuser.me/api/portraits/women/44.jpg" alt="User" class="w-10 h-10 rounded-full border-2 border-white">
|
| 59 |
<span class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full"></span>
|
| 60 |
</div>
|
| 61 |
+
<span id="currentUserName" class="font-medium">Sarah Johnson</span>
|
| 62 |
</div>
|
| 63 |
</div>
|
| 64 |
</div>
|
|
|
|
| 74 |
<h2 class="text-xl font-semibold mb-4 text-gray-800">Log Indirect Time</h2>
|
| 75 |
<form id="timeEntryForm" class="space-y-4">
|
| 76 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 77 |
+
<div>
|
| 78 |
+
<label for="employeeSelect" class="block text-sm font-medium text-gray-700 mb-1">Employee</label>
|
| 79 |
+
<select id="employeeSelect" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 80 |
+
<!-- Employees will be populated here -->
|
| 81 |
+
</select>
|
| 82 |
+
</div>
|
| 83 |
<div>
|
| 84 |
<label for="activityType" class="block text-sm font-medium text-gray-700 mb-1">Activity Type</label>
|
| 85 |
<select id="activityType" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
|
|
|
| 92 |
<option value="other">Other</option>
|
| 93 |
</select>
|
| 94 |
</div>
|
| 95 |
+
</div>
|
| 96 |
+
|
| 97 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 98 |
<div>
|
| 99 |
<label for="project" class="block text-sm font-medium text-gray-700 mb-1">Project/Department</label>
|
| 100 |
<select id="project" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
|
|
|
| 106 |
<option value="general">General</option>
|
| 107 |
</select>
|
| 108 |
</div>
|
| 109 |
+
<div>
|
| 110 |
+
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 111 |
+
<textarea id="description" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="Brief description of the activity"></textarea>
|
| 112 |
+
</div>
|
|
|
|
| 113 |
</div>
|
| 114 |
|
| 115 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
| 137 |
<div class="flex justify-between items-center mb-4">
|
| 138 |
<h2 class="text-xl font-semibold text-gray-800">Recent Time Entries</h2>
|
| 139 |
<div class="flex space-x-2">
|
| 140 |
+
<select id="employeeFilter" class="px-3 py-1 border border-gray-300 rounded-lg text-sm">
|
| 141 |
+
<option value="all">All Employees</option>
|
| 142 |
+
<!-- Employee filter options will be added here -->
|
| 143 |
+
</select>
|
| 144 |
<select id="timeFilter" class="px-3 py-1 border border-gray-300 rounded-lg text-sm">
|
| 145 |
<option value="today">Today</option>
|
| 146 |
<option value="week">This Week</option>
|
|
|
|
| 158 |
<table class="min-w-full divide-y divide-gray-200">
|
| 159 |
<thead class="bg-gray-50">
|
| 160 |
<tr>
|
| 161 |
+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Employee</th>
|
| 162 |
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
|
| 163 |
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Activity</th>
|
| 164 |
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Project</th>
|
|
|
|
| 219 |
</div>
|
| 220 |
</div>
|
| 221 |
|
| 222 |
+
<!-- Employee Time Summary -->
|
| 223 |
<div class="bg-white rounded-xl shadow-md p-6">
|
| 224 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800">Employee Time</h2>
|
| 225 |
+
<div id="employeeTimeSummary" class="space-y-3">
|
| 226 |
+
<!-- Employee time summaries will be added here -->
|
| 227 |
</div>
|
| 228 |
</div>
|
| 229 |
|
|
|
|
| 254 |
</main>
|
| 255 |
</div>
|
| 256 |
|
| 257 |
+
<!-- Employee Management Modal -->
|
| 258 |
+
<div id="employeeModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 259 |
+
<div class="bg-white rounded-xl p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto">
|
| 260 |
+
<div class="flex justify-between items-center mb-4">
|
| 261 |
+
<h3 class="text-lg font-semibold">Manage Employees</h3>
|
| 262 |
+
<button id="closeEmployeeModalBtn" class="text-gray-500 hover:text-gray-700">
|
| 263 |
+
<i class="fas fa-times"></i>
|
| 264 |
+
</button>
|
| 265 |
+
</div>
|
| 266 |
+
|
| 267 |
+
<!-- Add Employee Form -->
|
| 268 |
+
<div class="bg-gray-50 p-4 rounded-lg mb-6">
|
| 269 |
+
<h4 class="font-medium text-gray-700 mb-3">Add New Employee</h4>
|
| 270 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 271 |
+
<div>
|
| 272 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">First Name</label>
|
| 273 |
+
<input type="text" id="employeeFirstName" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 274 |
+
</div>
|
| 275 |
+
<div>
|
| 276 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Last Name</label>
|
| 277 |
+
<input type="text" id="employeeLastName" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 278 |
+
</div>
|
| 279 |
+
</div>
|
| 280 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
|
| 281 |
+
<div>
|
| 282 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
| 283 |
+
<input type="email" id="employeeEmail" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 284 |
+
</div>
|
| 285 |
+
<div>
|
| 286 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Department</label>
|
| 287 |
+
<select id="employeeDepartment" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 288 |
+
<option value="hr">HR</option>
|
| 289 |
+
<option value="it">IT</option>
|
| 290 |
+
<option value="finance">Finance</option>
|
| 291 |
+
<option value="operations">Operations</option>
|
| 292 |
+
<option value="marketing">Marketing</option>
|
| 293 |
+
<option value="sales">Sales</option>
|
| 294 |
+
</select>
|
| 295 |
+
</div>
|
| 296 |
+
</div>
|
| 297 |
+
<div class="mt-4">
|
| 298 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Avatar URL</label>
|
| 299 |
+
<div class="flex items-center space-x-4">
|
| 300 |
+
<input type="text" id="employeeAvatar" placeholder="https://example.com/avatar.jpg" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 301 |
+
<div class="w-12 h-12 rounded-full bg-gray-200 overflow-hidden">
|
| 302 |
+
<img id="employeeAvatarPreview" src="" alt="Preview" class="w-full h-full object-cover hidden">
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
</div>
|
| 306 |
+
<div class="flex justify-end mt-4">
|
| 307 |
+
<button id="addEmployeeBtn" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">Add Employee</button>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
|
| 311 |
+
<!-- Employee List -->
|
| 312 |
+
<div>
|
| 313 |
+
<h4 class="font-medium text-gray-700 mb-3">Employee List</h4>
|
| 314 |
+
<div class="overflow-x-auto">
|
| 315 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 316 |
+
<thead class="bg-gray-50">
|
| 317 |
+
<tr>
|
| 318 |
+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Employee</th>
|
| 319 |
+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Department</th>
|
| 320 |
+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
|
| 321 |
+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
|
| 322 |
+
</tr>
|
| 323 |
+
</thead>
|
| 324 |
+
<tbody id="employeeList" class="bg-white divide-y divide-gray-200">
|
| 325 |
+
<!-- Employees will be added here -->
|
| 326 |
+
</tbody>
|
| 327 |
+
</table>
|
| 328 |
+
</div>
|
| 329 |
+
</div>
|
| 330 |
+
</div>
|
| 331 |
+
</div>
|
| 332 |
+
|
| 333 |
+
<!-- Export Modal -->
|
| 334 |
<div id="exportModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 335 |
<div class="bg-white rounded-xl p-6 w-full max-w-md">
|
| 336 |
<div class="flex justify-between items-center mb-4">
|
|
|
|
| 357 |
</label>
|
| 358 |
</div>
|
| 359 |
</div>
|
| 360 |
+
<div>
|
| 361 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Employee</label>
|
| 362 |
+
<select id="exportEmployeeFilter" class="w-full px-4 py-2 border border-gray-300 rounded-lg">
|
| 363 |
+
<option value="all">All Employees</option>
|
| 364 |
+
<!-- Employee options will be added here -->
|
| 365 |
+
</select>
|
| 366 |
+
</div>
|
| 367 |
<div>
|
| 368 |
<label class="block text-sm font-medium text-gray-700 mb-1">Date Range</label>
|
| 369 |
<select id="exportDateRange" class="w-full px-4 py-2 border border-gray-300 rounded-lg">
|
|
|
|
| 399 |
document.addEventListener('DOMContentLoaded', function() {
|
| 400 |
// Initialize variables
|
| 401 |
let timeEntries = JSON.parse(localStorage.getItem('timeEntries')) || [];
|
| 402 |
+
let employees = JSON.parse(localStorage.getItem('employees')) || [
|
| 403 |
+
{
|
| 404 |
+
id: 1,
|
| 405 |
+
firstName: 'Sarah',
|
| 406 |
+
lastName: 'Johnson',
|
| 407 |
+
email: 'sarah.johnson@example.com',
|
| 408 |
+
department: 'hr',
|
| 409 |
+
avatar: 'https://randomuser.me/api/portraits/women/44.jpg',
|
| 410 |
+
isCurrentUser: true
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
id: 2,
|
| 414 |
+
firstName: 'Michael',
|
| 415 |
+
lastName: 'Smith',
|
| 416 |
+
email: 'michael.smith@example.com',
|
| 417 |
+
department: 'it',
|
| 418 |
+
avatar: 'https://randomuser.me/api/portraits/men/32.jpg'
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
id: 3,
|
| 422 |
+
firstName: 'Emily',
|
| 423 |
+
lastName: 'Davis',
|
| 424 |
+
email: 'emily.davis@example.com',
|
| 425 |
+
department: 'finance',
|
| 426 |
+
avatar: 'https://randomuser.me/api/portraits/women/65.jpg'
|
| 427 |
+
}
|
| 428 |
+
];
|
| 429 |
+
|
| 430 |
let activityChart = null;
|
| 431 |
+
let currentUser = employees.find(emp => emp.isCurrentUser) || employees[0];
|
| 432 |
|
| 433 |
// DOM Elements
|
| 434 |
const timeEntryForm = document.getElementById('timeEntryForm');
|
| 435 |
const timeEntriesList = document.getElementById('timeEntriesList');
|
| 436 |
const noEntriesMessage = document.getElementById('noEntriesMessage');
|
| 437 |
const timeFilter = document.getElementById('timeFilter');
|
| 438 |
+
const employeeFilter = document.getElementById('employeeFilter');
|
| 439 |
const exportBtn = document.getElementById('exportBtn');
|
| 440 |
const exportModal = document.getElementById('exportModal');
|
| 441 |
const closeModalBtn = document.getElementById('closeModalBtn');
|
|
|
|
| 443 |
const confirmExportBtn = document.getElementById('confirmExportBtn');
|
| 444 |
const exportDateRange = document.getElementById('exportDateRange');
|
| 445 |
const customDateRange = document.getElementById('customDateRange');
|
| 446 |
+
const exportEmployeeFilter = document.getElementById('exportEmployeeFilter');
|
| 447 |
+
|
| 448 |
+
// Employee management elements
|
| 449 |
+
const manageEmployeesBtn = document.getElementById('manageEmployeesBtn');
|
| 450 |
+
const employeeModal = document.getElementById('employeeModal');
|
| 451 |
+
const closeEmployeeModalBtn = document.getElementById('closeEmployeeModalBtn');
|
| 452 |
+
const employeeList = document.getElementById('employeeList');
|
| 453 |
+
const addEmployeeBtn = document.getElementById('addEmployeeBtn');
|
| 454 |
+
const employeeSelect = document.getElementById('employeeSelect');
|
| 455 |
+
|
| 456 |
+
// Employee form elements
|
| 457 |
+
const employeeFirstName = document.getElementById('employeeFirstName');
|
| 458 |
+
const employeeLastName = document.getElementById('employeeLastName');
|
| 459 |
+
const employeeEmail = document.getElementById('employeeEmail');
|
| 460 |
+
const employeeDepartment = document.getElementById('employeeDepartment');
|
| 461 |
+
const employeeAvatar = document.getElementById('employeeAvatar');
|
| 462 |
+
const employeeAvatarPreview = document.getElementById('employeeAvatarPreview');
|
| 463 |
|
| 464 |
// Summary elements
|
| 465 |
const todayHours = document.getElementById('todayHours');
|
| 466 |
const weekHours = document.getElementById('weekHours');
|
| 467 |
const monthHours = document.getElementById('monthHours');
|
| 468 |
const lastMonthHours = document.getElementById('lastMonthHours');
|
| 469 |
+
const employeeTimeSummary = document.getElementById('employeeTimeSummary');
|
| 470 |
+
|
| 471 |
+
// User display elements
|
| 472 |
+
const currentUserAvatar = document.getElementById('currentUserAvatar');
|
| 473 |
+
const currentUserName = document.getElementById('currentUserName');
|
| 474 |
|
| 475 |
// Quick action buttons
|
| 476 |
const quickMeetingBtn = document.getElementById('quickMeetingBtn');
|
|
|
|
| 482 |
initApp();
|
| 483 |
|
| 484 |
function initApp() {
|
| 485 |
+
// Set current user display
|
| 486 |
+
if (currentUser) {
|
| 487 |
+
currentUserAvatar.src = currentUser.avatar;
|
| 488 |
+
currentUserName.textContent = `${currentUser.firstName} ${currentUser.lastName}`;
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
renderEmployeeSelects();
|
| 492 |
renderTimeEntries();
|
| 493 |
updateSummary();
|
| 494 |
+
renderEmployeeTimeSummary();
|
| 495 |
renderActivityChart();
|
| 496 |
setupEventListeners();
|
| 497 |
}
|
|
|
|
| 508 |
renderTimeEntries();
|
| 509 |
});
|
| 510 |
|
| 511 |
+
// Employee filter change
|
| 512 |
+
employeeFilter.addEventListener('change', function() {
|
| 513 |
+
renderTimeEntries();
|
| 514 |
+
});
|
| 515 |
+
|
| 516 |
// Export button
|
| 517 |
exportBtn.addEventListener('click', function() {
|
| 518 |
+
renderExportEmployeeFilter();
|
| 519 |
exportModal.classList.remove('hidden');
|
| 520 |
});
|
| 521 |
|
|
|
|
| 554 |
quickTrainingBtn.addEventListener('click', function() {
|
| 555 |
quickAddEntry('training', 'Quick Training');
|
| 556 |
});
|
| 557 |
+
|
| 558 |
+
// Employee management
|
| 559 |
+
manageEmployeesBtn.addEventListener('click', function() {
|
| 560 |
+
renderEmployeeList();
|
| 561 |
+
employeeModal.classList.remove('hidden');
|
| 562 |
+
});
|
| 563 |
+
|
| 564 |
+
closeEmployeeModalBtn.addEventListener('click', function() {
|
| 565 |
+
employeeModal.classList.add('hidden');
|
| 566 |
+
});
|
| 567 |
+
|
| 568 |
+
// Add employee
|
| 569 |
+
addEmployeeBtn.addEventListener('click', function() {
|
| 570 |
+
addEmployee();
|
| 571 |
+
});
|
| 572 |
+
|
| 573 |
+
// Avatar URL preview
|
| 574 |
+
employeeAvatar.addEventListener('input', function() {
|
| 575 |
+
if (this.value) {
|
| 576 |
+
employeeAvatarPreview.src = this.value;
|
| 577 |
+
employeeAvatarPreview.classList.remove('hidden');
|
| 578 |
+
} else {
|
| 579 |
+
employeeAvatarPreview.classList.add('hidden');
|
| 580 |
+
}
|
| 581 |
+
});
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
function renderEmployeeSelects() {
|
| 585 |
+
// Render employee select in time entry form
|
| 586 |
+
employeeSelect.innerHTML = '';
|
| 587 |
+
employees.forEach(employee => {
|
| 588 |
+
const option = document.createElement('option');
|
| 589 |
+
option.value = employee.id;
|
| 590 |
+
option.textContent = `${employee.firstName} ${employee.lastName}`;
|
| 591 |
+
if (employee.isCurrentUser) {
|
| 592 |
+
option.selected = true;
|
| 593 |
+
}
|
| 594 |
+
employeeSelect.appendChild(option);
|
| 595 |
+
});
|
| 596 |
+
|
| 597 |
+
// Render employee filter in time entries list
|
| 598 |
+
employeeFilter.innerHTML = '<option value="all">All Employees</option>';
|
| 599 |
+
employees.forEach(employee => {
|
| 600 |
+
const option = document.createElement('option');
|
| 601 |
+
option.value = employee.id;
|
| 602 |
+
option.textContent = `${employee.firstName} ${employee.lastName}`;
|
| 603 |
+
employeeFilter.appendChild(option);
|
| 604 |
+
});
|
| 605 |
+
}
|
| 606 |
+
|
| 607 |
+
function renderExportEmployeeFilter() {
|
| 608 |
+
exportEmployeeFilter.innerHTML = '<option value="all">All Employees</option>';
|
| 609 |
+
employees.forEach(employee => {
|
| 610 |
+
const option = document.createElement('option');
|
| 611 |
+
option.value = employee.id;
|
| 612 |
+
option.textContent = `${employee.firstName} ${employee.lastName}`;
|
| 613 |
+
exportEmployeeFilter.appendChild(option);
|
| 614 |
+
});
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
function renderEmployeeList() {
|
| 618 |
+
employeeList.innerHTML = '';
|
| 619 |
+
|
| 620 |
+
if (employees.length === 0) {
|
| 621 |
+
employeeList.innerHTML = `
|
| 622 |
+
<tr>
|
| 623 |
+
<td colspan="4" class="px-6 py-4 text-center text-gray-500">
|
| 624 |
+
No employees found. Add your first employee.
|
| 625 |
+
</td>
|
| 626 |
+
</tr>
|
| 627 |
+
`;
|
| 628 |
+
return;
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
employees.forEach(employee => {
|
| 632 |
+
const row = document.createElement('tr');
|
| 633 |
+
row.className = 'hover:bg-gray-50';
|
| 634 |
+
|
| 635 |
+
row.innerHTML = `
|
| 636 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 637 |
+
<div class="flex items-center">
|
| 638 |
+
<div class="flex-shrink-0 h-10 w-10">
|
| 639 |
+
<img class="h-10 w-10 rounded-full" src="${employee.avatar}" alt="${employee.firstName} ${employee.lastName}">
|
| 640 |
+
</div>
|
| 641 |
+
<div class="ml-4">
|
| 642 |
+
<div class="text-sm font-medium text-gray-900">${employee.firstName} ${employee.lastName}</div>
|
| 643 |
+
<div class="text-sm text-gray-500">${employee.email}</div>
|
| 644 |
+
</div>
|
| 645 |
+
</div>
|
| 646 |
+
</td>
|
| 647 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 648 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-indigo-100 text-indigo-800">
|
| 649 |
+
${employee.department.toUpperCase()}
|
| 650 |
+
</span>
|
| 651 |
+
</td>
|
| 652 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 653 |
+
${employee.email}
|
| 654 |
+
</td>
|
| 655 |
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 656 |
+
<button onclick="deleteEmployee(${employee.id})" class="text-red-600 hover:text-red-900 mr-3">
|
| 657 |
+
<i class="fas fa-trash"></i>
|
| 658 |
+
</button>
|
| 659 |
+
${employee.isCurrentUser ? '<span class="text-green-600">Current User</span>' : ''}
|
| 660 |
+
</td>
|
| 661 |
+
`;
|
| 662 |
+
|
| 663 |
+
employeeList.appendChild(row);
|
| 664 |
+
});
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
function addEmployee() {
|
| 668 |
+
const firstName = employeeFirstName.value.trim();
|
| 669 |
+
const lastName = employeeLastName.value.trim();
|
| 670 |
+
const email = employeeEmail.value.trim();
|
| 671 |
+
const department = employeeDepartment.value;
|
| 672 |
+
const avatar = employeeAvatar.value.trim() || `https://ui-avatars.com/api/?name=${firstName}+${lastName}&background=random`;
|
| 673 |
+
|
| 674 |
+
if (!firstName || !lastName || !email) {
|
| 675 |
+
alert('Please fill in all required fields');
|
| 676 |
+
return;
|
| 677 |
+
}
|
| 678 |
+
|
| 679 |
+
// Simple email validation
|
| 680 |
+
if (!email.includes('@') || !email.includes('.')) {
|
| 681 |
+
alert('Please enter a valid email address');
|
| 682 |
+
return;
|
| 683 |
+
}
|
| 684 |
+
|
| 685 |
+
// Check if email already exists
|
| 686 |
+
if (employees.some(emp => emp.email === email)) {
|
| 687 |
+
alert('An employee with this email already exists');
|
| 688 |
+
return;
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
const newEmployee = {
|
| 692 |
+
id: Date.now(),
|
| 693 |
+
firstName,
|
| 694 |
+
lastName,
|
| 695 |
+
email,
|
| 696 |
+
department,
|
| 697 |
+
avatar,
|
| 698 |
+
isCurrentUser: false
|
| 699 |
+
};
|
| 700 |
+
|
| 701 |
+
employees.push(newEmployee);
|
| 702 |
+
saveEmployees();
|
| 703 |
+
renderEmployeeList();
|
| 704 |
+
renderEmployeeSelects();
|
| 705 |
+
|
| 706 |
+
// Reset form
|
| 707 |
+
employeeFirstName.value = '';
|
| 708 |
+
employeeLastName.value = '';
|
| 709 |
+
employeeEmail.value = '';
|
| 710 |
+
employeeAvatar.value = '';
|
| 711 |
+
employeeAvatarPreview.src = '';
|
| 712 |
+
employeeAvatarPreview.classList.add('hidden');
|
| 713 |
+
|
| 714 |
+
// Show success feedback
|
| 715 |
+
const originalText = addEmployeeBtn.innerHTML;
|
| 716 |
+
addEmployeeBtn.innerHTML = '<i class="fas fa-check mr-2"></i> Employee Added';
|
| 717 |
+
addEmployeeBtn.classList.add('bg-green-600', 'hover:bg-green-700');
|
| 718 |
+
|
| 719 |
+
setTimeout(() => {
|
| 720 |
+
addEmployeeBtn.innerHTML = originalText;
|
| 721 |
+
addEmployeeBtn.classList.remove('bg-green-600', 'hover:bg-green-700');
|
| 722 |
+
}, 2000);
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
function deleteEmployee(id) {
|
| 726 |
+
if (confirm('Are you sure you want to delete this employee? This will also delete all their time entries.')) {
|
| 727 |
+
// Delete employee
|
| 728 |
+
employees = employees.filter(emp => emp.id !== id);
|
| 729 |
+
|
| 730 |
+
// Delete time entries for this employee
|
| 731 |
+
timeEntries = timeEntries.filter(entry => entry.employeeId !== id);
|
| 732 |
+
|
| 733 |
+
// If we deleted the current user, set the first employee as current
|
| 734 |
+
if (currentUser && currentUser.id === id) {
|
| 735 |
+
if (employees.length > 0) {
|
| 736 |
+
currentUser = employees[0];
|
| 737 |
+
currentUser.isCurrentUser = true;
|
| 738 |
+
currentUserAvatar.src = currentUser.avatar;
|
| 739 |
+
currentUserName.textContent = `${currentUser.firstName} ${currentUser.lastName}`;
|
| 740 |
+
} else {
|
| 741 |
+
currentUser = null;
|
| 742 |
+
}
|
| 743 |
+
}
|
| 744 |
+
|
| 745 |
+
saveEmployees();
|
| 746 |
+
saveTimeEntries();
|
| 747 |
+
renderEmployeeList();
|
| 748 |
+
renderEmployeeSelects();
|
| 749 |
+
renderTimeEntries();
|
| 750 |
+
updateSummary();
|
| 751 |
+
renderEmployeeTimeSummary();
|
| 752 |
+
renderActivityChart();
|
| 753 |
+
}
|
| 754 |
}
|
| 755 |
|
| 756 |
function addTimeEntry() {
|
| 757 |
+
const employeeId = parseInt(employeeSelect.value);
|
| 758 |
const activityType = document.getElementById('activityType').value;
|
| 759 |
const project = document.getElementById('project').value;
|
| 760 |
const description = document.getElementById('description').value;
|
| 761 |
const startTime = document.getElementById('startTime').value;
|
| 762 |
const endTime = document.getElementById('endTime').value;
|
| 763 |
|
| 764 |
+
if (!employeeId || !activityType || !project || !startTime || !endTime) {
|
| 765 |
alert('Please fill in all required fields');
|
| 766 |
return;
|
| 767 |
}
|
|
|
|
| 784 |
|
| 785 |
const newEntry = {
|
| 786 |
id: Date.now(),
|
| 787 |
+
employeeId,
|
| 788 |
activityType,
|
| 789 |
project,
|
| 790 |
description,
|
|
|
|
| 798 |
saveTimeEntries();
|
| 799 |
renderTimeEntries();
|
| 800 |
updateSummary();
|
| 801 |
+
renderEmployeeTimeSummary();
|
| 802 |
renderActivityChart();
|
| 803 |
|
| 804 |
// Reset form
|
| 805 |
timeEntryForm.reset();
|
| 806 |
+
employeeSelect.value = currentUser ? currentUser.id : employees[0]?.id;
|
| 807 |
|
| 808 |
// Show success feedback
|
| 809 |
const submitBtn = timeEntryForm.querySelector('button[type="submit"]');
|
|
|
|
| 827 |
document.getElementById('startTime').value = formatDateTimeLocal(now);
|
| 828 |
document.getElementById('endTime').value = formatDateTimeLocal(endTime);
|
| 829 |
|
| 830 |
+
// Set current user as selected
|
| 831 |
+
if (currentUser) {
|
| 832 |
+
document.getElementById('employeeSelect').value = currentUser.id;
|
| 833 |
+
}
|
| 834 |
+
|
| 835 |
// Highlight the quick action button
|
| 836 |
const quickBtn = document.getElementById(`quick${activityType.charAt(0).toUpperCase() + activityType.slice(1)}Btn`);
|
| 837 |
quickBtn.classList.add('pulse');
|
|
|
|
| 856 |
saveTimeEntries();
|
| 857 |
renderTimeEntries();
|
| 858 |
updateSummary();
|
| 859 |
+
renderEmployeeTimeSummary();
|
| 860 |
renderActivityChart();
|
| 861 |
}
|
| 862 |
|
|
|
|
| 864 |
localStorage.setItem('timeEntries', JSON.stringify(timeEntries));
|
| 865 |
}
|
| 866 |
|
| 867 |
+
function saveEmployees() {
|
| 868 |
+
localStorage.setItem('employees', JSON.stringify(employees));
|
| 869 |
+
}
|
| 870 |
+
|
| 871 |
function renderTimeEntries() {
|
| 872 |
+
const timeFilterValue = timeFilter.value;
|
| 873 |
+
const employeeFilterValue = employeeFilter.value;
|
| 874 |
const now = new Date();
|
| 875 |
let filteredEntries = [...timeEntries];
|
| 876 |
|
| 877 |
+
// Filter by employee
|
| 878 |
+
if (employeeFilterValue !== 'all') {
|
| 879 |
+
filteredEntries = filteredEntries.filter(entry => entry.employeeId === parseInt(employeeFilterValue));
|
| 880 |
+
}
|
| 881 |
+
|
| 882 |
+
// Filter by time
|
| 883 |
+
switch (timeFilterValue) {
|
| 884 |
case 'today':
|
| 885 |
filteredEntries = filteredEntries.filter(entry => {
|
| 886 |
const entryDate = new Date(entry.startTime);
|
|
|
|
| 921 |
let html = '';
|
| 922 |
|
| 923 |
filteredEntries.forEach(entry => {
|
| 924 |
+
const employee = employees.find(emp => emp.id === entry.employeeId);
|
| 925 |
const startDate = new Date(entry.startTime);
|
| 926 |
const endDate = new Date(entry.endTime);
|
| 927 |
|
|
|
|
| 950 |
|
| 951 |
html += `
|
| 952 |
<tr class="time-entry hover:bg-gray-50">
|
| 953 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 954 |
+
<div class="flex items-center">
|
| 955 |
+
<div class="flex-shrink-0 h-10 w-10">
|
| 956 |
+
<img class="h-10 w-10 rounded-full" src="${employee ? employee.avatar : 'https://ui-avatars.com/api/?name=Unknown&background=random'}" alt="${employee ? `${employee.firstName} ${employee.lastName}` : 'Unknown'}">
|
| 957 |
+
</div>
|
| 958 |
+
<div class="ml-4">
|
| 959 |
+
<div class="text-sm font-medium text-gray-900">${employee ? `${employee.firstName} ${employee.lastName}` : 'Unknown Employee'}</div>
|
| 960 |
+
</div>
|
| 961 |
+
</div>
|
| 962 |
+
</td>
|
| 963 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 964 |
${startDate.toLocaleDateString()}
|
| 965 |
</td>
|
|
|
|
| 1034 |
let monthTotal = 0;
|
| 1035 |
let lastMonthTotal = 0;
|
| 1036 |
|
| 1037 |
+
// Filter entries for current user if one exists
|
| 1038 |
+
const currentUserId = currentUser ? currentUser.id : null;
|
| 1039 |
+
const userEntries = currentUserId ? timeEntries.filter(entry => entry.employeeId === currentUserId) : timeEntries;
|
| 1040 |
+
|
| 1041 |
+
userEntries.forEach(entry => {
|
| 1042 |
const entryDate = new Date(entry.startTime);
|
| 1043 |
const minutes = entry.duration;
|
| 1044 |
|
|
|
|
| 1069 |
lastMonthHours.textContent = formatDuration(lastMonthTotal);
|
| 1070 |
}
|
| 1071 |
|
| 1072 |
+
function renderEmployeeTimeSummary() {
|
| 1073 |
+
employeeTimeSummary.innerHTML = '';
|
| 1074 |
+
|
| 1075 |
+
if (employees.length === 0) {
|
| 1076 |
+
employeeTimeSummary.innerHTML = '<p class="text-gray-500 text-center">No employees found</p>';
|
| 1077 |
+
return;
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
+
const now = new Date();
|
| 1081 |
+
const startOfWeek = new Date(now);
|
| 1082 |
+
startOfWeek.setDate(now.getDate() - now.getDay());
|
| 1083 |
+
startOfWeek.setHours(0, 0, 0, 0);
|
| 1084 |
+
|
| 1085 |
+
employees.forEach(employee => {
|
| 1086 |
+
const employeeEntries = timeEntries.filter(entry => entry.employeeId === employee.id);
|
| 1087 |
+
const weekEntries = employeeEntries.filter(entry => new Date(entry.startTime) >= startOfWeek);
|
| 1088 |
+
|
| 1089 |
+
const totalMinutes = weekEntries.reduce((sum, entry) => sum + entry.duration, 0);
|
| 1090 |
+
|
| 1091 |
+
const item = document.createElement('div');
|
| 1092 |
+
item.className = 'flex items-center justify-between p-3 hover:bg-gray-50 rounded-lg';
|
| 1093 |
+
|
| 1094 |
+
item.innerHTML = `
|
| 1095 |
+
<div class="flex items-center space-x-3">
|
| 1096 |
+
<img src="${employee.avatar}" alt="${employee.firstName} ${employee.lastName}" class="w-10 h-10 rounded-full">
|
| 1097 |
+
<div>
|
| 1098 |
+
<p class="font-medium">${employee.firstName} ${employee.lastName}</p>
|
| 1099 |
+
<p class="text-xs text-gray-500">${employee.department.toUpperCase()}</p>
|
| 1100 |
+
</div>
|
| 1101 |
+
</div>
|
| 1102 |
+
<div class="text-right">
|
| 1103 |
+
<p class="text-sm text-gray-500">This Week</p>
|
| 1104 |
+
<p class="font-medium">${formatDuration(totalMinutes)}</p>
|
| 1105 |
+
</div>
|
| 1106 |
+
`;
|
| 1107 |
+
|
| 1108 |
+
employeeTimeSummary.appendChild(item);
|
| 1109 |
+
});
|
| 1110 |
+
}
|
| 1111 |
+
|
| 1112 |
function formatDuration(minutes) {
|
| 1113 |
const hours = Math.floor(minutes / 60);
|
| 1114 |
const mins = minutes % 60;
|
|
|
|
| 1123 |
function renderActivityChart() {
|
| 1124 |
const ctx = document.getElementById('activityChart').getContext('2d');
|
| 1125 |
|
| 1126 |
+
// Filter entries for current user if one exists
|
| 1127 |
+
const currentUserId = currentUser ? currentUser.id : null;
|
| 1128 |
+
const userEntries = currentUserId ? timeEntries.filter(entry => entry.employeeId === currentUserId) : timeEntries;
|
| 1129 |
+
|
| 1130 |
// Group by activity type
|
| 1131 |
const activityGroups = {};
|
| 1132 |
|
| 1133 |
+
userEntries.forEach(entry => {
|
| 1134 |
if (!activityGroups[entry.activityType]) {
|
| 1135 |
activityGroups[entry.activityType] = 0;
|
| 1136 |
}
|
|
|
|
| 1189 |
|
| 1190 |
function exportTimeEntries() {
|
| 1191 |
const format = document.querySelector('input[name="exportFormat"]:checked').value;
|
| 1192 |
+
const employeeFilter = exportEmployeeFilter.value;
|
| 1193 |
const range = exportDateRange.value;
|
| 1194 |
|
| 1195 |
let filteredEntries = [...timeEntries];
|
| 1196 |
let filename = 'indirect_time_entries';
|
| 1197 |
|
| 1198 |
+
// Filter by employee
|
| 1199 |
+
if (employeeFilter !== 'all') {
|
| 1200 |
+
filteredEntries = filteredEntries.filter(entry => entry.employeeId === parseInt(employeeFilter));
|
| 1201 |
+
const employee = employees.find(emp => emp.id === parseInt(employeeFilter));
|
| 1202 |
+
if (employee) {
|
| 1203 |
+
filename += `_${employee.firstName}_${employee.lastName}`;
|
| 1204 |
+
}
|
| 1205 |
+
}
|
| 1206 |
+
|
| 1207 |
// Filter by date range
|
| 1208 |
const now = new Date();
|
| 1209 |
|
|
|
|
| 1266 |
}
|
| 1267 |
|
| 1268 |
// Prepare CSV content
|
| 1269 |
+
let csvContent = "Employee,Date,Activity Type,Project,Description,Start Time,End Time,Duration (minutes)\n";
|
| 1270 |
|
| 1271 |
filteredEntries.forEach(entry => {
|
| 1272 |
+
const employee = employees.find(emp => emp.id === entry.employeeId);
|
| 1273 |
const startDate = new Date(entry.startTime);
|
| 1274 |
const endDate = new Date(entry.endTime);
|
| 1275 |
|
| 1276 |
+
csvContent += `"${employee ? `${employee.firstName} ${employee.lastName}` : 'Unknown'}","${startDate.toLocaleDateString()}","${getActivityName(entry.activityType)}","${getProjectName(entry.project)}","${entry.description}","${startDate.toLocaleTimeString()}","${endDate.toLocaleTimeString()}","${entry.duration}"\n`;
|
| 1277 |
});
|
| 1278 |
|
| 1279 |
// Create download link
|
|
|
|
| 1302 |
exportModal.classList.add('hidden');
|
| 1303 |
}
|
| 1304 |
|
| 1305 |
+
// Make functions available globally
|
| 1306 |
window.deleteTimeEntry = deleteTimeEntry;
|
| 1307 |
+
window.deleteEmployee = deleteEmployee;
|
| 1308 |
});
|
| 1309 |
</script>
|
| 1310 |
<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=lordjames82/test2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
prompts.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
write me a stand alone employee indirect time management system
|
|
|
|
|
|
| 1 |
+
write me a stand alone employee indirect time management system
|
| 2 |
+
add an option to add and select employees
|