logintnice / index.html
tnicepot's picture
undefined - Initial Deployment
cfff250 verified
Raw History Blame Contribute Delete
14.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WhatsApp Clock-In/Out System</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;
background-color: #e5e7eb;
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiNlNWU3ZWIiLz48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0gMCwwIEwgMCwzMDAgTCAzMDAsMzAwIEwgMzAwLDAgWiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2Utd2lkdGg9IjEiLz48L2c+PC9zdmc+');
background-size: 40px 40px;
position: relative;
}
.location-pin {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -100%);
color: #ef4444;
font-size: 2rem;
text-shadow: 0 0 5px rgba(0,0,0,0.3);
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
transform: translate(-50%, -100%) scale(1);
opacity: 1;
}
70% {
transform: translate(-50%, -100%) scale(1.3);
opacity: 0.7;
}
100% {
transform: translate(-50%, -100%) scale(1);
opacity: 1;
}
}
.status-badge {
transition: all 0.3s ease;
}
</style>
</head>
<body class="bg-gray-100 min-h-screen">
<div class="container mx-auto px-4 py-8 max-w-md">
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
<!-- Header -->
<div class="bg-green-600 p-6 text-white">
<div class="flex items-center justify-between">
<div>
<h1 class="text-2xl font-bold">Work Attendance</h1>
<p class="text-green-100">GPS-enabled clock-in/out system</p>
</div>
<div class="bg-white text-green-600 rounded-full p-3">
<i class="fab fa-whatsapp text-3xl"></i>
</div>
</div>
</div>
<!-- Status Card -->
<div class="p-6 border-b">
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-semibold text-gray-800">Current Status</h2>
<span id="statusBadge" class="status-badge px-3 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
<i class="far fa-clock mr-1"></i> Not clocked in
</span>
</div>
<div class="grid grid-cols-2 gap-4">
<div class="bg-gray-50 p-3 rounded-lg">
<p class="text-gray-500 text-sm">Last Clock-In</p>
<p id="lastClockIn" class="font-medium">--:--</p>
</div>
<div class="bg-gray-50 p-3 rounded-lg">
<p class="text-gray-500 text-sm">Last Clock-Out</p>
<p id="lastClockOut" class="font-medium">--:--</p>
</div>
</div>
</div>
<!-- Location Map -->
<div class="p-6 border-b">
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-semibold text-gray-800">Your Location</h2>
<button id="refreshLocation" class="text-blue-500 hover:text-blue-700">
<i class="fas fa-sync-alt mr-1"></i> Refresh
</button>
</div>
<div class="map-container rounded-lg overflow-hidden mb-3">
<div id="locationPin" class="location-pin pulse">
<i class="fas fa-map-marker-alt"></i>
</div>
</div>
<div class="text-sm text-gray-600">
<p id="locationAddress">Acquiring your location...</p>
<p id="locationTime" class="text-xs text-gray-400 mt-1"></p>
</div>
</div>
<!-- Action Buttons -->
<div class="p-6">
<div class="grid grid-cols-2 gap-4">
<button id="clockInBtn" class="bg-green-600 hover:bg-green-700 text-white py-3 px-4 rounded-lg font-medium flex items-center justify-center">
<i class="fas fa-sign-in-alt mr-2"></i> Clock In
</button>
<button id="clockOutBtn" class="bg-red-600 hover:bg-red-700 text-white py-3 px-4 rounded-lg font-medium flex items-center justify-center" disabled>
<i class="fas fa-sign-out-alt mr-2"></i> Clock Out
</button>
</div>
<div class="mt-6 bg-blue-50 border border-blue-100 rounded-lg p-4">
<h3 class="text-blue-800 font-medium mb-2 flex items-center">
<i class="fas fa-info-circle mr-2"></i> How it works
</h3>
<p class="text-blue-700 text-sm">
This system uses WhatsApp to record your attendance. Your location will be automatically captured when you clock in/out.
</p>
<button id="whatsappBtn" class="mt-3 w-full bg-green-500 hover:bg-green-600 text-white py-2 px-4 rounded-lg font-medium flex items-center justify-center">
<i class="fab fa-whatsapp mr-2"></i> Open WhatsApp
</button>
</div>
</div>
</div>
<!-- History Section -->
<div class="bg-white rounded-xl shadow-lg overflow-hidden mt-6">
<div class="p-6 border-b">
<h2 class="text-lg font-semibold text-gray-800 flex items-center">
<i class="fas fa-history mr-2"></i> Attendance History
</h2>
</div>
<div class="divide-y">
<!-- Sample history item -->
<div class="p-4 flex items-center">
<div class="bg-green-100 text-green-600 p-2 rounded-full mr-3">
<i class="fas fa-sign-in-alt"></i>
</div>
<div class="flex-grow">
<p class="font-medium">Clock In</p>
<p class="text-sm text-gray-500">Today at 08:45 AM</p>
</div>
<div class="text-right">
<p class="text-xs text-gray-500">1.2 km away</p>
<p class="text-xs text-blue-500">View on map</p>
</div>
</div>
<!-- Sample history item -->
<div class="p-4 flex items-center">
<div class="bg-red-100 text-red-600 p-2 rounded-full mr-3">
<i class="fas fa-sign-out-alt"></i>
</div>
<div class="flex-grow">
<p class="font-medium">Clock Out</p>
<p class="text-sm text-gray-500">Yesterday at 05:30 PM</p>
</div>
<div class="text-right">
<p class="text-xs text-gray-500">1.2 km away</p>
<p class="text-xs text-blue-500">View on map</p>
</div>
</div>
</div>
<div class="p-4 text-center border-t">
<button class="text-blue-500 hover:text-blue-700 text-sm font-medium">
View all records in Google Sheets <i class="fas fa-external-link-alt ml-1"></i>
</button>
</div>
</div>
</div>
<script>
// Simulate GPS functionality
document.addEventListener('DOMContentLoaded', function() {
const clockInBtn = document.getElementById('clockInBtn');
const clockOutBtn = document.getElementById('clockOutBtn');
const refreshLocation = document.getElementById('refreshLocation');
const statusBadge = document.getElementById('statusBadge');
const locationAddress = document.getElementById('locationAddress');
const locationTime = document.getElementById('locationTime');
const lastClockIn = document.getElementById('lastClockIn');
const lastClockOut = document.getElementById('lastClockOut');
const whatsappBtn = document.getElementById('whatsappBtn');
let isClockedIn = false;
let lastClockInTime = null;
let lastClockOutTime = null;
// Initialize with current location
updateLocation();
// Clock In Button
clockInBtn.addEventListener('click', function() {
if (!isClockedIn) {
isClockedIn = true;
lastClockInTime = new Date();
// Update UI
statusBadge.innerHTML = '<i class="fas fa-check-circle mr-1"></i> Clocked in';
statusBadge.className = 'status-badge px-3 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800';
clockInBtn.disabled = true;
clockOutBtn.disabled = false;
// Update last clock in time
lastClockIn.textContent = formatTime(lastClockInTime);
// Simulate sending to WhatsApp and Google Sheets
simulateWhatsAppAction('Clock In');
}
});
// Clock Out Button
clockOutBtn.addEventListener('click', function() {
if (isClockedIn) {
isClockedIn = false;
lastClockOutTime = new Date();
// Update UI
statusBadge.innerHTML = '<i class="far fa-clock mr-1"></i> Not clocked in';
statusBadge.className = 'status-badge px-3 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800';
clockInBtn.disabled = false;
clockOutBtn.disabled = true;
// Update last clock out time
lastClockOut.textContent = formatTime(lastClockOutTime);
// Simulate sending to WhatsApp and Google Sheets
simulateWhatsAppAction('Clock Out');
}
});
// Refresh Location
refreshLocation.addEventListener('click', function() {
updateLocation();
// Show loading state
const icon = refreshLocation.querySelector('i');
icon.classList.add('fa-spin');
setTimeout(() => {
icon.classList.remove('fa-spin');
}, 1000);
});
// WhatsApp Button
whatsappBtn.addEventListener('click', function() {
alert('This would open WhatsApp with a pre-filled message for clocking in/out in a real implementation.');
});
// Helper function to update location
function updateLocation() {
// In a real app, this would use the Geolocation API
const now = new Date();
const fakeAddresses = [
"123 Office Street, Business District",
"456 Work Avenue, Downtown",
"789 Corporate Tower, Main Road"
];
const randomAddress = fakeAddresses[Math.floor(Math.random() * fakeAddresses.length)];
locationAddress.textContent = randomAddress;
locationTime.textContent = `Last updated: ${formatTime(now)}`;
}
// Helper function to format time
function formatTime(date) {
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
}
// Simulate WhatsApp action
function simulateWhatsAppAction(action) {
console.log(`Simulating ${action} action via WhatsApp and Google Sheets integration`);
// Show a temporary notification
const notification = document.createElement('div');
notification.className = 'fixed bottom-4 right-4 bg-green-600 text-white px-4 py-2 rounded-lg shadow-lg flex items-center';
notification.innerHTML = `
<i class="fas fa-check-circle mr-2"></i>
<span>${action} recorded successfully!</span>
`;
document.body.appendChild(notification);
setTimeout(() => {
notification.remove();
}, 3000);
}
});
</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=tnicepot/logintnice" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>