forked from marlonpondavilla/BussingWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
334 lines (301 loc) · 15.4 KB
/
Copy pathindex.html
File metadata and controls
334 lines (301 loc) · 15.4 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Bussing - Your Ticketing & Schedule App</title>
<!-- Latest Tailwind CSS CDN from official source -->
<script src="https://cdn.tailwindcss.com"></script>
<style>
@keyframes pulse-fade {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
.animate-pulse-fade {
animation: pulse-fade 3s ease-in-out infinite;
}
</style>
</head>
<body class="bg-gray-50 text-gray-800 font-sans">
<!-- Header -->
<header class="bg-white shadow">
<div class="max-w-7xl mx-auto px-6 md:px-12 py-5 flex justify-between items-center">
<h1 class="text-2xl font-bold text-indigo-600">Bussing</h1>
<nav class="space-x-6 text-gray-600 font-medium hidden md:flex">
<a href="#schedule" class="hover:text-indigo-600 transition">Schedule</a>
<a href="#bus-info" class="hover:text-indigo-600 transition">Bus & Drivers</a>
<a href="#ratings" class="hover:text-indigo-600 transition">Ratings</a>
<a href="#download" class="hover:text-indigo-600 transition">Download</a>
</nav>
<div id="user-status" class="flex items-center">
<h2 class="font-semibold">Hello, <span id="username" class="mr-4 font-normal">User</span></h2>
<button id="logout-btn" class="bg-red-600 text-white px-4 py-2 rounded-full hover:bg-red-700 transition duration-300">
Logout
</button>
</div>
</div>
</header>
<!-- Hero Section -->
<section class="bg-indigo-600 text-white">
<div class="max-w-7xl mx-auto px-6 md:px-12 py-20 flex flex-col md:flex-row items-center justify-between">
<div class="md:w-1/2 mb-12 md:mb-0">
<h2 class="text-4xl font-extrabold leading-tight mb-4">The Smarter Way to Book & Ride All in One at Bussing</h2>
<p class="mb-6 text-lg">Book tickets in seconds, track live bus schedules, and meet the fantastic journey with us — all from one reliable app. Travel made effortless.</p>
<a href="#download" class="inline-block bg-white text-indigo-600 font-semibold rounded-full px-8 py-3 shadow-md hover:bg-indigo-50 transition animate-pulse-fade">
Get the App Now
</a>
</div>
<div class="md:w-1/2">
<img src="./src/assets/image.png" alt="Bus app illustration" class="rounded-lg shadow-lg mx-auto max-w-full">
</div>
</div>
</section>
<!-- Schedule Section with Table -->
<section id="schedule" class="max-w-7xl mx-auto px-6 md:px-12 py-16">
<h3 class="text-3xl font-bold text-indigo-600 mb-8 text-center">Bussing Today's Schedules</h3>
<!-- Schedule Table -->
<div class="overflow-x-auto" id="schedule-container" style="display: none;">
<table class="min-w-full bg-white rounded-lg shadow border border-gray-200">
<thead class="bg-indigo-100 text-indigo-700">
<tr>
<th class="text-left py-3 px-6 font-semibold uppercase text-sm">Bus No</th>
<th class="text-left py-3 px-6 font-semibold uppercase text-sm">From</th>
<th class="text-left py-3 px-6 font-semibold uppercase text-sm">To</th>
<th class="text-left py-3 px-6 font-semibold uppercase text-sm">Status</th>
<th class="text-left py-3 px-6 font-semibold uppercase text-sm">Available Seats</th>
<th class="text-left py-3 px-6 font-semibold uppercase text-sm">Price</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100" id="scheduleTable">
<!-- js generated content -->
</tbody>
</table>
</div>
<!-- Sign-in Button -->
<div class="login-guest-container flex justify-center mt-10" id="google-login-bt">
<button class="bg-red-600 text-white px-6 py-3 rounded-full shadow hover:bg-red-700 transition duration-300">
Sign in to view
</button>
</div>
</section>
<script type="module">
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.22.2/firebase-app.js';
import { getAuth, onAuthStateChanged, signInWithPopup, GoogleAuthProvider, signOut } from 'https://www.gstatic.com/firebasejs/9.22.2/firebase-auth.js';
import { firebaseConfig } from './src/services/firebaseConfig.js';
import { getFirestoreData, addDataToFirestore } from './src/firebase/db.js';
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth();
const googleProvider = new GoogleAuthProvider();
// Schedule data rendering
async function renderSchedules() {
const scheduleData = await getFirestoreData('ScheduleDocumentsCollection');
const scheduleSectionHTML = document.getElementById('scheduleTable');
let scheduleHTML = "";
if (!scheduleData || scheduleData.length === 0) {
scheduleHTML = `<tr><td colspan="6" class="text-center text-gray-700 py-4">No schedules available</td></tr>`;
} else {
scheduleData.forEach(scheduleDoc => {
scheduleHTML += `
<tr class="hover:bg-indigo-50 transition">
<td class="py-4 px-6 text-gray-700 font-medium">Bus 0${scheduleDoc.busNo}</td>
<td class="py-4 px-6 text-gray-600">${scheduleDoc.from}</td>
<td class="py-4 px-6 text-gray-600">${scheduleDoc.to}</td>
<td class="py-4 px-6 ${scheduleDoc.status === 'Active' ? 'text-green-600' : 'text-red-600'} font-semibold">
${scheduleDoc.status === 'Active' ? 'Active' : 'Inactive'}
</td>
<td class="py-4 px-6 text-gray-600">${scheduleDoc.availableSeats}</td>
<td class="py-4 px-6 text-gray-800 font-semibold">₱${scheduleDoc.price}</td>
</tr>`;
});
}
scheduleSectionHTML.innerHTML = scheduleHTML;
}
// Check authentication status
onAuthStateChanged(auth, (user) => {
const scheduleContainer = document.getElementById('schedule-container');
const googleLoginButton = document.getElementById('google-login-bt');
const logoutButton = document.getElementById('logout-btn');
const userStatus = document.getElementById('user-status');
const usernameDisplay = document.getElementById('username');
if (user) {
// hide login button
scheduleContainer.style.display = 'block';
googleLoginButton.style.display = 'none';
logoutButton.style.display = 'block';
userStatus.style.display = 'flex';
usernameDisplay.textContent = user.displayName || "No Name";
renderSchedules();
} else {
//show the login button
scheduleContainer.style.display = 'none';
googleLoginButton.style.display = 'flex';
logoutButton.style.display = 'none';
userStatus.style.display = 'none';
}
});
// Google Sign-In
const googleBtn = document.getElementById('google-login-bt').querySelector('button');
googleBtn.addEventListener('click', async () => {
try {
const result = await signInWithPopup(auth, googleProvider);
const user = result.user;
// Store user information in localStorage
localStorage.setItem('userId', user.uid);
localStorage.setItem('userName', user.displayName);
localStorage.setItem('userEmail', user.email);
localStorage.setItem('userPhoto', user.photoURL);
const userDataObject = {
uid: user.uid,
name: user.displayName,
email: user.email,
photoURL: user.photoURL,
createdAt: new Date()
};
// Add user to Firestore
await addDataToFirestore('UserLoggedInCollection', userDataObject);
window.location.href = 'index.html';
} catch (error) {
console.error('Error during sign-in: ', error.message);
alert('Error: ' + error.message);
}
});
// Logout Button Logic
const logoutBtn = document.getElementById('logout-btn');
logoutBtn.addEventListener('click', async () => {
try {
await signOut(auth);
//clear localStorage
localStorage.clear();
//update UI after logout
window.location.href = 'index.html';
} catch (error) {
console.error('Error during logout:', error.message);
alert('Error: ' + error.message);
}
});
</script>
<!-- Bus & Drivers Info Section updated with featured pictures -->
<section id="bus-info" class="bg-indigo-50 py-16">
<div class="max-w-7xl mx-auto px-6 md:px-12">
<h3 class="text-3xl font-bold text-indigo-600 mb-10 text-center">Our Buses & Drivers</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-10">
<!-- Card 1 -->
<div class="bg-white rounded-lg shadow border border-gray-200 hover:shadow-lg transition overflow-hidden">
<img src="https://img.philkotse.com/2020/01/11/b7Fg1q9w/bus-in-the-philippines-7b69.jpg" alt="Bus 101" class="w-full h-40 object-cover">
<div class="p-6 flex flex-col items-center text-center space-y-4">
<h4 class="text-xl font-semibold text-indigo-700">Sleek & Stylish Fleet</h4>
<p class="text-gray-700">All our buses are clean, well-maintained, and visually appealing—ensuring a professional look on every route.</p>
<div class="flex items-center space-x-4">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Driver John" class="w-16 h-16 rounded-full object-cover border-4 border-indigo-600">
<div>
<p class="font-semibold text-indigo-800">Marlon Pondavilla</p>
<p class="text-gray-600 text-sm">Driver</p>
<p class="text-gray-600 text-sm">Experience: 8 years</p>
</div>
</div>
</div>
</div>
<!-- Card 2 -->
<div class="bg-white rounded-lg shadow border border-gray-200 hover:shadow-lg transition overflow-hidden">
<img src="https://uffizio.com/wp-content/uploads/2024/01/Frame-2608661-1.jpg" alt="Bus 205" class="w-full h-40 object-cover">
<div class="p-6 flex flex-col items-center text-center space-y-4">
<h4 class="text-xl font-semibold text-indigo-700">Safety-First Maintenance</h4>
<p class="text-gray-700">Every vehicle undergoes routine inspections and servicing to ensure maximum safety and performance on the road.</p>
<div class="flex items-center space-x-4">
<img src="https://randomuser.me/api/portraits/women/45.jpg" alt="Driver Sara" class="w-16 h-16 rounded-full object-cover border-4 border-indigo-600">
<div>
<p class="font-semibold text-indigo-800">Kim Frane</p>
<p class="text-gray-600 text-sm">Driver</p>
<p class="text-gray-600 text-sm">Experience: 5 years</p>
</div>
</div>
</div>
</div>
<!-- Card 3 -->
<div class="bg-white rounded-lg shadow border border-gray-200 hover:shadow-lg transition overflow-hidden">
<img src="https://t3.ftcdn.net/jpg/02/18/58/32/360_F_218583233_yg8kbaiSn9RPQKYXTR7VCq1IheFiFrf4.jpg" alt="Bus 310" class="w-full h-40 object-cover">
<div class="p-6 flex flex-col items-center text-center space-y-4">
<h4 class="text-xl font-semibold text-indigo-700">Comfortable & Connected Interior</h4>
<p class="text-gray-700">Enjoy a clean, fresh-smelling cabin equipped with relaxing seating and onboard Wi-Fi for a pleasant ride.</p>
<div class="flex items-center space-x-4">
<img src="https://randomuser.me/api/portraits/men/67.jpg" alt="Driver Mike" class="w-16 h-16 rounded-full object-cover border-4 border-indigo-600">
<div>
<p class="font-semibold text-indigo-800">Darwin Gregorio</p>
<p class="text-gray-600 text-sm">Driver</p>
<p class="text-gray-600 text-sm">Experience: 6 years</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Ratings Section -->
<section id="ratings" class="max-w-7xl mx-auto px-6 md:px-12 py-16">
<h3 class="text-3xl font-bold text-indigo-600 mb-10 text-center">What Our Users Say</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-10">
<div class="bg-white rounded-lg shadow p-6 border border-gray-200 hover:shadow-lg transition">
<p class="text-gray-800 mb-4">"Sobrang smooth ng transaction at mabait ung driver, single pa kaya sha? parang bet ko ata sya sana sya ulit masakyan ko kahit"</p>
<div class="flex items-center space-x-3">
<img src="https://randomuser.me/api/portraits/women/78.jpg" alt="User 1" class="w-12 h-12 rounded-full object-cover border-2 border-indigo-600">
<div>
<p class="font-semibold text-indigo-700">Emily R.</p>
<div class="flex text-yellow-400">
<span>★</span><span>★</span><span>★</span><span>★</span><span>☆</span>
</div>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6 border border-gray-200 hover:shadow-lg transition">
<p class="text-gray-800 mb-4">"In fairness mabango ung loob ng bus parang naalala ko ung lola ko amoy albatros palagi hehe"</p>
<div class="flex items-center space-x-3">
<img src="https://randomuser.me/api/portraits/men/55.jpg" alt="User 2" class="w-12 h-12 rounded-full object-cover border-2 border-indigo-600">
<div>
<p class="font-semibold text-indigo-700">Carlos M.</p>
<div class="flex text-yellow-400">
<span>★</span><span>★</span><span>★</span><span>★</span><span>★</span>
</div>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6 border border-gray-200 hover:shadow-lg transition">
<p class="text-gray-800 mb-4">"Very convenient ng app na to kasi live mo makikita ung schedule at kung ilang seats pa"</p>
<div class="flex items-center space-x-3">
<img src="https://randomuser.me/api/portraits/women/89.jpg" alt="User 3" class="w-12 h-12 rounded-full object-cover border-2 border-indigo-600">
<div>
<p class="font-semibold text-indigo-700">Nina K.</p>
<div class="flex text-yellow-400">
<span>★</span><span>★</span><span>★</span><span>☆</span><span>☆</span>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Download Section -->
<section id="download" class="bg-indigo-600 text-white py-16">
<div class="max-w-7xl mx-auto px-6 md:px-12 text-center">
<h3 class="text-4xl font-extrabold mb-6">Get the Bussing App Now!</h3>
<p class="text-lg mb-8 max-w-xl mx-auto">Download our mobile app to book tickets, check schedules, and get real-time updates wherever you go.</p>
<div class="flex justify-center space-x-6">
<a href="#" class="bg-white text-indigo-600 font-semibold px-8 py-3 rounded-lg shadow hover:bg-indigo-50 transition flex items-center space-x-3">
<img src="https://cdn-icons-png.flaticon.com/512/599/599502.png" alt="Apple App Store" class="w-6 h-6"/>
<span>App Store</span>
</a>
<a href="#" class="bg-white text-indigo-600 font-semibold px-8 py-3 rounded-lg shadow hover:bg-indigo-50 transition flex items-center space-x-3">
<img src="https://cdn-icons-png.flaticon.com/512/888/888857.png" alt="Google Play Store" class="w-6 h-6"/>
<span>Google Play</span>
</a>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-white border-t border-gray-200 py-6 mt-16">
<div class="max-w-7xl mx-auto px-6 md:px-12 text-center text-gray-500 text-sm">
© 2025 Bussing. All rights reserved.
</div>
</footer>
<script type="module" src="./src/components/landingPage.js"></script>
</body>
</html>