Spaces:
Running
Running
show the time tracking
Browse files- index.html +34 -7
index.html
CHANGED
|
@@ -350,7 +350,6 @@
|
|
| 350 |
|
| 351 |
<script>
|
| 352 |
feather.replace();
|
| 353 |
-
|
| 354 |
// Sample users database (in a real app, this would be server-side)
|
| 355 |
const users = [
|
| 356 |
{ email: 'admin@example.com', password: 'admin123', role: 'admin', name: 'Admin User' },
|
|
@@ -372,18 +371,46 @@
|
|
| 372 |
|
| 373 |
// Show appropriate dashboard
|
| 374 |
if (user.role === 'admin') {
|
| 375 |
-
|
| 376 |
-
// Update admin name in sidebar
|
| 377 |
-
document.querySelector('#admin-dashboard .sidebar-link.active + div p').textContent = user.name;
|
| 378 |
} else {
|
| 379 |
-
|
| 380 |
-
// Update employee name in sidebar
|
| 381 |
-
document.querySelector('#employee-dashboard .sidebar-link.active + div p').textContent = user.name;
|
| 382 |
}
|
| 383 |
} else {
|
| 384 |
alert('Invalid email or password');
|
| 385 |
}
|
| 386 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
</script>
|
| 388 |
</body>
|
| 389 |
</html>
|
|
|
|
| 350 |
|
| 351 |
<script>
|
| 352 |
feather.replace();
|
|
|
|
| 353 |
// Sample users database (in a real app, this would be server-side)
|
| 354 |
const users = [
|
| 355 |
{ email: 'admin@example.com', password: 'admin123', role: 'admin', name: 'Admin User' },
|
|
|
|
| 371 |
|
| 372 |
// Show appropriate dashboard
|
| 373 |
if (user.role === 'admin') {
|
| 374 |
+
window.location.href = "admin-dashboard.html";
|
|
|
|
|
|
|
| 375 |
} else {
|
| 376 |
+
window.location.href = "time-tracking.html";
|
|
|
|
|
|
|
| 377 |
}
|
| 378 |
} else {
|
| 379 |
alert('Invalid email or password');
|
| 380 |
}
|
| 381 |
});
|
| 382 |
+
|
| 383 |
+
// Time tracking demo functionality
|
| 384 |
+
if (document.getElementById('employee-dashboard')) {
|
| 385 |
+
const clockInBtn = document.querySelector('#employee-dashboard button:first-child');
|
| 386 |
+
const clockOutBtn = document.querySelector('#employee-dashboard button:nth-child(2)');
|
| 387 |
+
const breakStartBtn = document.querySelector('#employee-dashboard button:nth-child(3)');
|
| 388 |
+
const breakEndBtn = document.querySelector('#employee-dashboard button:nth-child(4)');
|
| 389 |
+
|
| 390 |
+
clockInBtn.addEventListener('click', function() {
|
| 391 |
+
alert('Clocked in at ' + new Date().toLocaleTimeString());
|
| 392 |
+
clockInBtn.disabled = true;
|
| 393 |
+
clockOutBtn.disabled = false;
|
| 394 |
+
});
|
| 395 |
+
|
| 396 |
+
clockOutBtn.addEventListener('click', function() {
|
| 397 |
+
alert('Clocked out at ' + new Date().toLocaleTimeString());
|
| 398 |
+
clockOutBtn.disabled = true;
|
| 399 |
+
clockInBtn.disabled = false;
|
| 400 |
+
});
|
| 401 |
+
|
| 402 |
+
breakStartBtn.addEventListener('click', function() {
|
| 403 |
+
alert('Break started at ' + new Date().toLocaleTimeString());
|
| 404 |
+
breakStartBtn.disabled = true;
|
| 405 |
+
breakEndBtn.disabled = false;
|
| 406 |
+
});
|
| 407 |
+
|
| 408 |
+
breakEndBtn.addEventListener('click', function() {
|
| 409 |
+
alert('Break ended at ' + new Date().toLocaleTimeString());
|
| 410 |
+
breakEndBtn.disabled = true;
|
| 411 |
+
breakStartBtn.disabled = false;
|
| 412 |
+
});
|
| 413 |
+
}
|
| 414 |
</script>
|
| 415 |
</body>
|
| 416 |
</html>
|