-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
111 lines (106 loc) · 6.49 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title data-translate="welcome_title">Freddy: Where are you?</title>
<!-- Tailwind CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
<!-- Main CSS -->
<link rel="stylesheet" href="css/main.css">
<!-- Favicon -->
<link rel="icon" href="img/favicon.ico">
<!-- Google Maps JavaScript API -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBd3xQgm7vnL2LCmxpabVT5qAhSFOteuGY&callback=initMap" async defer></script>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body onload="initMap()">
<div class="container mx-auto p-4">
<div id="content"></div>
<div id="root" class="flex flex-col items-center my-4 min-h-screen">
<h1 data-translate="welcome_message" class="text-3xl font-bold mb-4"></h1>
<p data-translate="description_part1" class="mb-4 text-lg text-gray-700 text-center max-w-lg"></p>
<p data-translate="description_part2" class="mb-4 text-lg text-gray-900 font-black text-center max-w-lg"></p>
<!-- Tabs -->
<div class="w-full max-w-lg">
<div class="flex border-b border-gray-200">
<button data-translate="checkin_tab" id="checkInTab" class="flex-1 py-2 px-4 text-center text-blue-600 border-b-2 border-blue-600">Check In</button>
<button data-translate="checkin_ponts_tab" id="recordedCheckInsTab" class="flex-1 py-2 px-4 text-center text-gray-600 border-b-2 border-gray-200">Freddys trail</button>
</div>
</div>
<!-- Check In Content -->
<div id="checkInContent" class="tab-content w-full max-w-5xl my-5">
<p data-translate="description_checkin" class="text-gray-700 text-base mb-4 my-4"></p>
<input type="text" id="nameInput" data-translate="checkin_name_placeholder" placeholder="Your name?" class="mb-4 p-2 border border-gray-300 rounded w-full required">
<div data-translate="checkin_error" id="error-message" class="hidden text-red-500 mb-4"></div>
<form id="checkInForm" onsubmit="handleFormSubmit(event)">
<!-- Existing form fields -->
<div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY"></div>
<button data-translate="checkin_button_text" id="clickButton" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded w-full"></button>
</form>
<div data-translate="checkin_loading" id="spinner" class="hidden mt-4"></div>
<div data-translate="checkin_success" id="success-message" class="hidden text-green-500 mt-4"></div>
<div id="map" class="mt-5" style="height: 400px; width: 100%;"></div>
</div>
<!-- Recorded Check-Ins Content -->
<div id="recordedCheckInsContent" class="tab-content hidden w-full max-w-5xl my-5">
<div id="checkInsListContainer" class="mt-5 w-full">
<p data-translate="checkin_points_description" class="text-gray-700 text-base mb-4 my-4"></p>
<div id="recordedMap" class="mt-5 my-5" style="height: 400px; width: 100%;"></div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th data-translate="checkin_point" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
<th data-translate="checkin_point_lat" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
<th data-translate="checkin_point_long" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
<th data-translate="checkin_point_date" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
<th data-translate="checkin_point_time" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
</tr>
</thead>
<tbody id="checkInsList" class="bg-white divide-y divide-gray-200">
<!-- Rows will be dynamically inserted here -->
</tbody>
</table>
</div>
<div class="flex justify-between mt-4">
<button data-translate="checkin_point_prev" id="prevPage" class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded"></button>
<button data-translate="checkin_point_next" id="nextPage" class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded"></button>
</div>
</div>
</div>
</div>
</div>
<script type="module" src="js/app.js"></script>
<script>
function initMap() {
window.map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 55.6606758, lng: 12.5226001 },
zoom: 15
});
window.recordedMap = new google.maps.Map(document.getElementById('recordedMap'), {
center: { lat: 55.6606758, lng: 12.5226001 },
zoom: 15
});
}
window.initMap = initMap; // Expose initMap to the global scope
// Tab switching logic
document.getElementById('checkInTab').addEventListener('click', () => {
document.getElementById('checkInContent').classList.remove('hidden');
document.getElementById('recordedCheckInsContent').classList.add('hidden');
document.getElementById('checkInTab').classList.add('text-blue-600', 'border-blue-600');
document.getElementById('checkInTab').classList.remove('text-gray-600', 'border-gray-200');
document.getElementById('recordedCheckInsTab').classList.add('text-gray-600', 'border-gray-200');
document.getElementById('recordedCheckInsTab').classList.remove('text-blue-600', 'border-blue-600');
});
document.getElementById('recordedCheckInsTab').addEventListener('click', () => {
document.getElementById('checkInContent').classList.add('hidden');
document.getElementById('recordedCheckInsContent').classList.remove('hidden');
document.getElementById('recordedCheckInsTab').classList.add('text-blue-600', 'border-blue-600');
document.getElementById('recordedCheckInsTab').classList.remove('text-gray-600', 'border-gray-200');
document.getElementById('checkInTab').classList.add('text-gray-600', 'border-gray-200');
document.getElementById('checkInTab').classList.remove('text-blue-600', 'border-blue-600');
});
</script>
</body>
</html>