Spaces:
Running
Running
Download index.html from LIAMARTEK/libur-trial: direct link, hf CLI and curl.
- Browser
- Download file 40.5 kB
-
https://huggingface.co/spaces/LIAMARTEK/libur-trial/resolve/main/index.html
- Command line
-
hf download hf://spaces/LIAMARTEK/libur-trial/index.html
-
curl -L -o index.html https://huggingface.co/spaces/LIAMARTEK/libur-trial/resolve/main/index.html
40.5 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>LIBUR - Raun Gud Long PNG</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"> | |
| <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places&callback=initMap" async defer></script> | |
| <style> | |
| .map-container { | |
| height: 400px; | |
| border-radius: 1rem; | |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); | |
| } | |
| .slide-fade-enter-active { | |
| transition: all 0.3s ease-out; | |
| } | |
| .slide-fade-leave-active { | |
| transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1); | |
| } | |
| .slide-fade-enter-from, | |
| .slide-fade-leave-to { | |
| transform: translateY(20px); | |
| opacity: 0; | |
| } | |
| .pulse-animation { | |
| animation: pulse 2s infinite; | |
| } | |
| @keyframes pulse { | |
| 0% { | |
| transform: scale(0.95); | |
| box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); | |
| } | |
| 70% { | |
| transform: scale(1); | |
| box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); | |
| } | |
| 100% { | |
| transform: scale(0.95); | |
| box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); | |
| } | |
| } | |
| .driver-marker { | |
| width: 24px; | |
| height: 24px; | |
| border-radius: 50%; | |
| background: #3B82F6; | |
| border: 2px solid white; | |
| position: relative; | |
| } | |
| .driver-marker::after { | |
| content: ''; | |
| position: absolute; | |
| width: 8px; | |
| height: 8px; | |
| background: white; | |
| border-radius: 50%; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| } | |
| .driver-marker.available { | |
| background: #10B981; | |
| } | |
| .driver-marker.busy { | |
| background: #EF4444; | |
| } | |
| .libur-gradient { | |
| background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #10b981 100%); | |
| } | |
| .whatsapp-bg { | |
| background-color: #25D366; | |
| } | |
| .whatsapp-bg:hover { | |
| background-color: #128C7E; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100 font-sans"> | |
| <!-- App Container --> | |
| <div class="max-w-md mx-auto bg-white min-h-screen shadow-lg overflow-hidden relative"> | |
| <!-- Header --> | |
| <header class="libur-gradient text-white p-4"> | |
| <div class="flex justify-between items-center"> | |
| <div> | |
| <h1 class="text-xl font-bold">LIBUR</h1> | |
| <p class="text-xs opacity-80">Raun Gud Long PNG</p> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button class="bg-white bg-opacity-20 p-2 rounded-full"> | |
| <i class="fas fa-bell"></i> | |
| </button> | |
| <button id="profileBtn" class="bg-white bg-opacity-20 p-2 rounded-full"> | |
| <i class="fas fa-user"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="p-4"> | |
| <!-- Authentication Section (shown when not logged in) --> | |
| <div id="authSection" class="mb-6"> | |
| <div class="bg-blue-50 p-4 rounded-lg mb-4"> | |
| <h2 class="font-bold text-blue-800 mb-2">Welcome to LIBUR</h2> | |
| <p class="text-sm text-blue-700">Register with WhatsApp or email to book rides</p> | |
| </div> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Full Name</label> | |
| <input type="text" id="fullName" placeholder="John B. Kama" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">WhatsApp Number</label> | |
| <div class="flex"> | |
| <select class="bg-gray-100 border border-gray-300 rounded-l-lg px-3 py-2 text-sm"> | |
| <option>+675</option> | |
| </select> | |
| <input type="tel" id="whatsappNumber" placeholder="7XXXXXXX" class="flex-1 border border-gray-300 rounded-r-lg px-3 py-2 text-sm"> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Email (Optional)</label> | |
| <input type="email" id="email" placeholder="your@email.com" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm"> | |
| </div> | |
| <button id="requestOtpBtn" class="w-full whatsapp-bg text-white py-2 px-4 rounded-lg font-medium hover:bg-green-600 transition flex items-center justify-center"> | |
| <i class="fab fa-whatsapp mr-2 text-lg"></i> Send Verification Code | |
| </button> | |
| </div> | |
| <div id="otpSection" class="hidden mt-4 space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Verification Code</label> | |
| <input type="text" id="otpCode" placeholder="6-digit code" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm"> | |
| </div> | |
| <button id="verifyOtpBtn" class="w-full whatsapp-bg text-white py-2 px-4 rounded-lg font-medium hover:bg-green-600 transition"> | |
| Verify & Continue | |
| </button> | |
| <div class="text-center"> | |
| <button id="useEmailInstead" class="text-sm text-blue-600 hover:underline">Verify with email instead</button> | |
| </div> | |
| </div> | |
| <div id="emailVerificationSection" class="hidden mt-4 space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Email Verification Code</label> | |
| <input type="text" id="emailOtpCode" placeholder="6-digit code" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm"> | |
| </div> | |
| <button id="verifyEmailOtpBtn" class="w-full bg-blue-600 text-white py-2 px-4 rounded-lg font-medium hover:bg-blue-700 transition"> | |
| Verify Email & Continue | |
| </button> | |
| <div class="text-center"> | |
| <button id="useWhatsAppInstead" class="text-sm text-blue-600 hover:underline">Verify with WhatsApp instead</button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Ride Booking Section (shown after login) --> | |
| <div id="rideSection" class="hidden"> | |
| <!-- Current Location & Destination --> | |
| <div class="bg-white rounded-lg shadow p-4 mb-4"> | |
| <div class="flex items-center mb-3"> | |
| <div class="bg-blue-100 p-2 rounded-full mr-3"> | |
| <i class="fas fa-map-marker-alt text-blue-600"></i> | |
| </div> | |
| <input type="text" id="pickupLocation" placeholder="Current location" class="flex-1 border-b border-gray-300 py-2 focus:outline-none focus:border-blue-500"> | |
| </div> | |
| <div class="flex items-center"> | |
| <div class="bg-red-100 p-2 rounded-full mr-3"> | |
| <i class="fas fa-flag text-red-600"></i> | |
| </div> | |
| <input type="text" id="dropoffLocation" placeholder="Where to?" class="flex-1 border-b border-gray-300 py-2 focus:outline-none focus:border-blue-500"> | |
| </div> | |
| </div> | |
| <!-- Map Container --> | |
| <div id="map" class="map-container mb-4"></div> | |
| <!-- Available Drivers --> | |
| <div class="mb-4"> | |
| <h3 class="font-medium text-gray-700 mb-2">Available Taxis Nearby</h3> | |
| <div id="driversList" class="space-y-2"> | |
| <!-- Driver cards will be added here dynamically --> | |
| </div> | |
| </div> | |
| <!-- Ride Options --> | |
| <div class="bg-white rounded-lg shadow p-4 mb-4"> | |
| <h3 class="font-medium text-gray-700 mb-3">Choose Your Ride</h3> | |
| <div class="grid grid-cols-3 gap-2"> | |
| <button class="border border-gray-200 rounded-lg p-2 hover:border-blue-500 transition"> | |
| <div class="bg-blue-100 p-2 rounded-full mb-1 w-10 h-10 mx-auto"> | |
| <i class="fas fa-car text-blue-600"></i> | |
| </div> | |
| <span class="text-xs font-medium">Standard</span> | |
| <span class="text-xs text-gray-500 block">PGK 15+</span> | |
| </button> | |
| <button class="border border-gray-200 rounded-lg p-2 hover:border-blue-500 transition"> | |
| <div class="bg-green-100 p-2 rounded-full mb-1 w-10 h-10 mx-auto"> | |
| <i class="fas fa-car text-green-600"></i> | |
| </div> | |
| <span class="text-xs font-medium">Premium</span> | |
| <span class="text-xs text-gray-500 block">PGK 25+</span> | |
| </button> | |
| <button class="border border-gray-200 rounded-lg p-2 hover:border-blue-500 transition"> | |
| <div class="bg-purple-100 p-2 rounded-full mb-1 w-10 h-10 mx-auto"> | |
| <i class="fas fa-van-shuttle text-purple-600"></i> | |
| </div> | |
| <span class="text-xs font-medium">Group</span> | |
| <span class="text-xs text-gray-500 block">PGK 40+</span> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Book Ride Button --> | |
| <button id="bookRideBtn" class="w-full libur-gradient text-white py-3 px-4 rounded-lg font-medium hover:opacity-90 transition flex items-center justify-center"> | |
| <i class="fas fa-car mr-2"></i> Book Ride Now | |
| </button> | |
| </div> | |
| <!-- Ride Confirmation Modal --> | |
| <div id="rideConfirmationModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden"> | |
| <div class="bg-white rounded-lg w-full max-w-sm p-6"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="font-bold text-lg">Confirm Your Ride</h3> | |
| <button id="closeConfirmationModal" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="mb-4"> | |
| <div class="flex items-center mb-2"> | |
| <div class="bg-blue-100 p-2 rounded-full mr-3"> | |
| <i class="fas fa-map-marker-alt text-blue-600"></i> | |
| </div> | |
| <div> | |
| <p class="text-sm font-medium" id="confirmPickup">Port Moresby, Waigani</p> | |
| </div> | |
| </div> | |
| <div class="flex items-center"> | |
| <div class="bg-red-100 p-2 rounded-full mr-3"> | |
| <i class="fas fa-flag text-red-600"></i> | |
| </div> | |
| <div> | |
| <p class="text-sm font-medium" id="confirmDropoff">Jackson Airport</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="border-t border-b border-gray-200 py-3 mb-4"> | |
| <div class="flex justify-between mb-2"> | |
| <span class="text-sm text-gray-600">Ride Type:</span> | |
| <span class="text-sm font-medium" id="confirmRideType">Standard Taxi</span> | |
| </div> | |
| <div class="flex justify-between"> | |
| <span class="text-sm text-gray-600">Estimated Fare:</span> | |
| <span class="text-sm font-medium" id="confirmFare">PGK 25.00</span> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <h4 class="text-sm font-medium mb-2">Select Payment Method</h4> | |
| <div class="space-y-2"> | |
| <label class="flex items-center space-x-3 p-2 border border-gray-200 rounded-lg"> | |
| <input type="radio" name="paymentMethod" value="cash" checked class="text-blue-600"> | |
| <span class="text-sm">Cash</span> | |
| </label> | |
| <label class="flex items-center space-x-3 p-2 border border-gray-200 rounded-lg"> | |
| <input type="radio" name="paymentMethod" value="eftpos" class="text-blue-600"> | |
| <span class="text-sm">EFTPOS</span> | |
| </label> | |
| <label class="flex items-center space-x-3 p-2 border border-gray-200 rounded-lg"> | |
| <input type="radio" name="paymentMethod" value="nfc" class="text-blue-600"> | |
| <span class="text-sm">NFC Tap & Pay</span> | |
| </label> | |
| </div> | |
| </div> | |
| <button id="confirmRideBtn" class="w-full bg-green-600 text-white py-2 px-4 rounded-lg font-medium hover:bg-green-700 transition"> | |
| Confirm & Book Ride | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Ride Status Modal --> | |
| <div id="rideStatusModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden"> | |
| <div class="bg-white rounded-lg w-full max-w-sm p-6"> | |
| <div class="text-center mb-4"> | |
| <div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-3"> | |
| <i class="fas fa-check-circle text-green-600 text-2xl"></i> | |
| </div> | |
| <h3 class="font-bold text-lg mb-1">Ride Confirmed!</h3> | |
| <p class="text-sm text-gray-600">Your driver is on the way</p> | |
| </div> | |
| <div class="flex items-center mb-4"> | |
| <div class="w-12 h-12 bg-gray-200 rounded-full overflow-hidden mr-3"> | |
| <img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Driver" class="w-full h-full object-cover"> | |
| </div> | |
| <div> | |
| <h4 class="font-medium" id="driverName">John B. Kama</h4> | |
| <div class="flex items-center"> | |
| <div class="text-yellow-400 mr-1"> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star-half-alt"></i> | |
| </div> | |
| <span class="text-xs text-gray-600">4.7</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-gray-100 p-3 rounded-lg mb-4"> | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-sm font-medium">Taxi Number:</span> | |
| <span class="text-sm" id="taxiNumber">PMV 1234</span> | |
| </div> | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-sm font-medium">Vehicle:</span> | |
| <span class="text-sm" id="taxiModel">Toyota Corolla (White)</span> | |
| </div> | |
| <div class="flex justify-between items-center"> | |
| <span class="text-sm font-medium">ETA:</span> | |
| <span class="text-sm" id="driverEta">5 minutes</span> | |
| </div> | |
| </div> | |
| <div class="flex justify-between"> | |
| <button id="cancelRideBtn" class="bg-red-100 text-red-600 py-2 px-4 rounded-lg font-medium hover:bg-red-200 transition"> | |
| Cancel Ride | |
| </button> | |
| <button id="contactDriverBtn" class="bg-blue-100 text-blue-600 py-2 px-4 rounded-lg font-medium hover:bg-blue-200 transition"> | |
| <i class="fas fa-phone-alt mr-1"></i> Call | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Bottom Navigation --> | |
| <nav id="bottomNav" class="hidden bg-white border-t border-gray-200 fixed bottom-0 w-full max-w-md flex justify-around py-2"> | |
| <button class="flex flex-col items-center p-2 text-blue-600"> | |
| <i class="fas fa-home"></i> | |
| <span class="text-xs mt-1">Home</span> | |
| </button> | |
| <button class="flex flex-col items-center p-2 text-gray-500 hover:text-blue-600"> | |
| <i class="fas fa-history"></i> | |
| <span class="text-xs mt-1">History</span> | |
| </button> | |
| <button class="flex flex-col items-center p-2 text-gray-500 hover:text-blue-600"> | |
| <i class="fas fa-wallet"></i> | |
| <span class="text-xs mt-1">Wallet</span> | |
| </button> | |
| <button class="flex flex-col items-center p-2 text-gray-500 hover:text-blue-600"> | |
| <i class="fas fa-cog"></i> | |
| <span class="text-xs mt-1">Settings</span> | |
| </button> | |
| </nav> | |
| </div> | |
| <script> | |
| // App State | |
| const appState = { | |
| isLoggedIn: false, | |
| userName: '', | |
| userWhatsApp: '', | |
| userEmail: '', | |
| currentLocation: null, | |
| destination: null, | |
| selectedDriver: null, | |
| drivers: [ | |
| { | |
| id: 1, | |
| name: "John B. Kama", | |
| phone: "+67571234567", | |
| rating: 4.7, | |
| taxiNumber: "PMV 1234", | |
| taxiModel: "Toyota Corolla (White)", | |
| location: { lat: -9.4789, lng: 147.1496 }, | |
| available: true, | |
| eta: "5 min", | |
| fare: "PGK 25.00" | |
| }, | |
| { | |
| id: 2, | |
| name: "Michael Wan", | |
| phone: "+67572233445", | |
| rating: 4.5, | |
| taxiNumber: "PMV 5678", | |
| taxiModel: "Toyota Hiace (Blue)", | |
| location: { lat: -9.4800, lng: 147.1500 }, | |
| available: true, | |
| eta: "7 min", | |
| fare: "PGK 30.00" | |
| }, | |
| { | |
| id: 3, | |
| name: "Sarah Koim", | |
| phone: "+67573344556", | |
| rating: 4.9, | |
| taxiNumber: "PMV 9101", | |
| taxiModel: "Nissan Sunny (Red)", | |
| location: { lat: -9.4770, lng: 147.1480 }, | |
| available: false, | |
| eta: "15 min", | |
| fare: "PGK 20.00" | |
| } | |
| ], | |
| map: null, | |
| markers: [] | |
| }; | |
| // DOM Elements | |
| const authSection = document.getElementById('authSection'); | |
| const rideSection = document.getElementById('rideSection'); | |
| const fullNameInput = document.getElementById('fullName'); | |
| const whatsappNumberInput = document.getElementById('whatsappNumber'); | |
| const emailInput = document.getElementById('email'); | |
| const requestOtpBtn = document.getElementById('requestOtpBtn'); | |
| const otpSection = document.getElementById('otpSection'); | |
| const otpCodeInput = document.getElementById('otpCode'); | |
| const verifyOtpBtn = document.getElementById('verifyOtpBtn'); | |
| const emailVerificationSection = document.getElementById('emailVerificationSection'); | |
| const emailOtpCodeInput = document.getElementById('emailOtpCode'); | |
| const verifyEmailOtpBtn = document.getElementById('verifyEmailOtpBtn'); | |
| const useEmailInsteadBtn = document.getElementById('useEmailInstead'); | |
| const useWhatsAppInsteadBtn = document.getElementById('useWhatsAppInstead'); | |
| const pickupLocationInput = document.getElementById('pickupLocation'); | |
| const dropoffLocationInput = document.getElementById('dropoffLocation'); | |
| const bookRideBtn = document.getElementById('bookRideBtn'); | |
| const driversList = document.getElementById('driversList'); | |
| const rideConfirmationModal = document.getElementById('rideConfirmationModal'); | |
| const closeConfirmationModal = document.getElementById('closeConfirmationModal'); | |
| const confirmRideBtn = document.getElementById('confirmRideBtn'); | |
| const rideStatusModal = document.getElementById('rideStatusModal'); | |
| const cancelRideBtn = document.getElementById('cancelRideBtn'); | |
| const contactDriverBtn = document.getElementById('contactDriverBtn'); | |
| const bottomNav = document.getElementById('bottomNav'); | |
| const profileBtn = document.getElementById('profileBtn'); | |
| // Initialize the app | |
| function initApp() { | |
| // Check if user is logged in (in a real app, this would check localStorage or a session) | |
| if (appState.isLoggedIn) { | |
| showRideSection(); | |
| } else { | |
| showAuthSection(); | |
| } | |
| // Initialize map | |
| initMap(); | |
| // Render drivers list | |
| renderDriversList(); | |
| // Set up event listeners | |
| setupEventListeners(); | |
| } | |
| // Initialize Google Map | |
| function initMap() { | |
| // Default to Port Moresby coordinates | |
| const portMoresby = { lat: -9.4789, lng: 147.1496 }; | |
| // Create map | |
| appState.map = new google.maps.Map(document.getElementById('map'), { | |
| center: portMoresby, | |
| zoom: 15, | |
| styles: [ | |
| { | |
| "featureType": "poi", | |
| "elementType": "labels", | |
| "stylers": [ | |
| { | |
| "visibility": "off" | |
| } | |
| ] | |
| } | |
| ] | |
| }); | |
| // Add markers for drivers | |
| appState.drivers.forEach(driver => { | |
| const marker = new google.maps.Marker({ | |
| position: driver.location, | |
| map: appState.map, | |
| icon: { | |
| path: google.maps.SymbolPath.CIRCLE, | |
| fillColor: driver.available ? '#10B981' : '#EF4444', | |
| fillOpacity: 1, | |
| strokeColor: '#FFFFFF', | |
| strokeWeight: 2, | |
| scale: 10 | |
| } | |
| }); | |
| // Add info window | |
| const infoWindow = new google.maps.InfoWindow({ | |
| content: ` | |
| <div class="p-2"> | |
| <h3 class="font-bold">${driver.name}</h3> | |
| <p class="text-sm">${driver.taxiModel}</p> | |
| <p class="text-sm">${driver.taxiNumber}</p> | |
| <p class="text-sm">Rating: ${driver.rating} <i class="fas fa-star text-yellow-400"></i></p> | |
| <p class="text-sm">Status: <span class="${driver.available ? 'text-green-600' : 'text-red-600'}">${driver.available ? 'Available' : 'Busy'}</span></p> | |
| </div> | |
| ` | |
| }); | |
| marker.addListener('click', () => { | |
| infoWindow.open(appState.map, marker); | |
| }); | |
| appState.markers.push(marker); | |
| }); | |
| // Add current location marker (would use geolocation API in a real app) | |
| new google.maps.Marker({ | |
| position: portMoresby, | |
| map: appState.map, | |
| icon: { | |
| url: "https://maps.google.com/mapfiles/ms/icons/blue-dot.png" | |
| } | |
| }); | |
| // Initialize autocomplete for pickup and dropoff locations | |
| const pickupAutocomplete = new google.maps.places.Autocomplete(pickupLocationInput); | |
| const dropoffAutocomplete = new google.maps.places.Autocomplete(dropoffLocationInput); | |
| // Bias the autocomplete to Papua New Guinea | |
| pickupAutocomplete.setComponentRestrictions({ country: ['pg'] }); | |
| dropoffAutocomplete.setComponentRestrictions({ country: ['pg'] }); | |
| } | |
| // Render drivers list | |
| function renderDriversList() { | |
| driversList.innerHTML = ''; | |
| appState.drivers.forEach(driver => { | |
| const driverCard = document.createElement('div'); | |
| driverCard.className = `bg-white rounded-lg shadow p-3 flex items-center ${driver.available ? '' : 'opacity-60'}`; | |
| driverCard.innerHTML = ` | |
| <div class="mr-3"> | |
| <div class="w-10 h-10 bg-gray-200 rounded-full overflow-hidden"> | |
| <img src="https://randomuser.me/api/portraits/men/${driver.id}.jpg" alt="${driver.name}" class="w-full h-full object-cover"> | |
| </div> | |
| </div> | |
| <div class="flex-1"> | |
| <h4 class="font-medium">${driver.name}</h4> | |
| <div class="flex items-center justify-between"> | |
| <div class="flex items-center"> | |
| <div class="text-yellow-400 mr-1"> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star-half-alt"></i> | |
| </div> | |
| <span class="text-xs text-gray-600">${driver.rating}</span> | |
| </div> | |
| <span class="text-xs ${driver.available ? 'text-green-600' : 'text-red-600'}">${driver.available ? 'Available' : 'Busy'}</span> | |
| </div> | |
| </div> | |
| <div class="ml-3 text-right"> | |
| <p class="text-sm font-medium">${driver.fare}</p> | |
| <p class="text-xs text-gray-500">${driver.eta}</p> | |
| </div> | |
| `; | |
| if (driver.available) { | |
| driverCard.addEventListener('click', () => selectDriver(driver)); | |
| driverCard.classList.add('cursor-pointer', 'hover:bg-blue-50'); | |
| } | |
| driversList.appendChild(driverCard); | |
| }); | |
| } | |
| // Select a driver | |
| function selectDriver(driver) { | |
| appState.selectedDriver = driver; | |
| // Highlight the selected driver in the list | |
| const driverCards = driversList.querySelectorAll('div'); | |
| driverCards.forEach((card, index) => { | |
| if (appState.drivers[index].id === driver.id) { | |
| card.classList.add('border-2', 'border-blue-500'); | |
| } else { | |
| card.classList.remove('border-2', 'border-blue-500'); | |
| } | |
| }); | |
| // Center map on selected driver | |
| appState.map.setCenter(driver.location); | |
| // Update confirmation modal details | |
| document.getElementById('confirmPickup').textContent = pickupLocationInput.value || 'Current Location'; | |
| document.getElementById('confirmDropoff').textContent = dropoffLocationInput.value || 'Destination'; | |
| document.getElementById('confirmRideType').textContent = 'Standard Taxi'; | |
| document.getElementById('confirmFare').textContent = driver.fare; | |
| // Show confirmation modal | |
| rideConfirmationModal.classList.remove('hidden'); | |
| } | |
| // Show authentication section | |
| function showAuthSection() { | |
| authSection.classList.remove('hidden'); | |
| rideSection.classList.add('hidden'); | |
| bottomNav.classList.add('hidden'); | |
| } | |
| // Show ride section | |
| function showRideSection() { | |
| authSection.classList.add('hidden'); | |
| rideSection.classList.remove('hidden'); | |
| bottomNav.classList.remove('hidden'); | |
| } | |
| // Setup event listeners | |
| function setupEventListeners() { | |
| // Request OTP button | |
| requestOtpBtn.addEventListener('click', () => { | |
| const fullName = fullNameInput.value; | |
| const whatsappNumber = whatsappNumberInput.value; | |
| const email = emailInput.value; | |
| if (!fullName) { | |
| alert('Please enter your full name'); | |
| return; | |
| } | |
| if (!whatsappNumber && !email) { | |
| alert('Please enter either WhatsApp number or email'); | |
| return; | |
| } | |
| if (whatsappNumber && whatsappNumber.length < 7) { | |
| alert('Please enter a valid PNG WhatsApp number (7 digits)'); | |
| return; | |
| } | |
| if (email && !email.includes('@')) { | |
| alert('Please enter a valid email address'); | |
| return; | |
| } | |
| // In a real app, this would send an OTP to WhatsApp or email | |
| if (whatsappNumber) { | |
| otpSection.classList.remove('hidden'); | |
| emailVerificationSection.classList.add('hidden'); | |
| // Simulate WhatsApp OTP sent | |
| setTimeout(() => { | |
| alert(`WhatsApp OTP sent to +675${whatsappNumber}. In a real app, this would be sent via WhatsApp.`); | |
| }, 1000); | |
| } else if (email) { | |
| emailVerificationSection.classList.remove('hidden'); | |
| otpSection.classList.add('hidden'); | |
| // Simulate email OTP sent | |
| setTimeout(() => { | |
| alert(`Email verification code sent to ${email}. In a real app, this would be sent via email.`); | |
| }, 1000); | |
| } | |
| }); | |
| // Verify OTP button (WhatsApp) | |
| verifyOtpBtn.addEventListener('click', () => { | |
| const otpCode = otpCodeInput.value; | |
| if (otpCode && otpCode.length === 6) { | |
| // In a real app, this would verify the OTP with your backend | |
| appState.isLoggedIn = true; | |
| appState.userName = fullNameInput.value; | |
| appState.userWhatsApp = `+675${whatsappNumberInput.value}`; | |
| appState.userEmail = emailInput.value; | |
| // Show ride section | |
| showRideSection(); | |
| // In a real app, you would store the auth token or session | |
| localStorage.setItem('isLoggedIn', 'true'); | |
| localStorage.setItem('userName', appState.userName); | |
| localStorage.setItem('userWhatsApp', appState.userWhatsApp); | |
| localStorage.setItem('userEmail', appState.userEmail); | |
| } else { | |
| alert('Please enter the 6-digit verification code'); | |
| } | |
| }); | |
| // Verify OTP button (Email) | |
| verifyEmailOtpBtn.addEventListener('click', () => { | |
| const otpCode = emailOtpCodeInput.value; | |
| if (otpCode && otpCode.length === 6) { | |
| // In a real app, this would verify the OTP with your backend | |
| appState.isLoggedIn = true; | |
| appState.userName = fullNameInput.value; | |
| appState.userWhatsApp = whatsappNumberInput.value ? `+675${whatsappNumberInput.value}` : ''; | |
| appState.userEmail = emailInput.value; | |
| // Show ride section | |
| showRideSection(); | |
| // In a real app, you would store the auth token or session | |
| localStorage.setItem('isLoggedIn', 'true'); | |
| localStorage.setItem('userName', appState.userName); | |
| localStorage.setItem('userWhatsApp', appState.userWhatsApp); | |
| localStorage.setItem('userEmail', appState.userEmail); | |
| } else { | |
| alert('Please enter the 6-digit verification code'); | |
| } | |
| }); | |
| // Switch to email verification | |
| useEmailInsteadBtn.addEventListener('click', () => { | |
| otpSection.classList.add('hidden'); | |
| emailVerificationSection.classList.remove('hidden'); | |
| // Simulate email OTP sent | |
| setTimeout(() => { | |
| alert(`Email verification code sent to ${emailInput.value}. In a real app, this would be sent via email.`); | |
| }, 1000); | |
| }); | |
| // Switch to WhatsApp verification | |
| useWhatsAppInsteadBtn.addEventListener('click', () => { | |
| emailVerificationSection.classList.add('hidden'); | |
| otpSection.classList.remove('hidden'); | |
| // Simulate WhatsApp OTP sent | |
| setTimeout(() => { | |
| alert(`WhatsApp OTP sent to +675${whatsappNumberInput.value}. In a real app, this would be sent via WhatsApp.`); | |
| }, 1000); | |
| }); | |
| // Book ride button | |
| bookRideBtn.addEventListener('click', () => { | |
| if (!pickupLocationInput.value || !dropoffLocationInput.value) { | |
| alert('Please enter pickup and dropoff locations'); | |
| return; | |
| } | |
| if (!appState.selectedDriver) { | |
| alert('Please select a driver from the list'); | |
| return; | |
| } | |
| // Show confirmation modal | |
| rideConfirmationModal.classList.remove('hidden'); | |
| }); | |
| // Close confirmation modal | |
| closeConfirmationModal.addEventListener('click', () => { | |
| rideConfirmationModal.classList.add('hidden'); | |
| }); | |
| // Confirm ride button | |
| confirmRideBtn.addEventListener('click', () => { | |
| // Get selected payment method | |
| const paymentMethod = document.querySelector('input[name="paymentMethod"]:checked').value; | |
| // In a real app, this would process the payment and book the ride | |
| console.log(`Booking ride with ${appState.selectedDriver.name} via ${paymentMethod} payment`); | |
| // Close confirmation modal | |
| rideConfirmationModal.classList.add('hidden'); | |
| // Show ride status modal | |
| document.getElementById('driverName').textContent = appState.selectedDriver.name; | |
| document.getElementById('taxiNumber').textContent = appState.selectedDriver.taxiNumber; | |
| document.getElementById('taxiModel').textContent = appState.selectedDriver.taxiModel; | |
| document.getElementById('driverEta').textContent = appState.selectedDriver.eta; | |
| rideStatusModal.classList.remove('hidden'); | |
| }); | |
| // Cancel ride button | |
| cancelRideBtn.addEventListener('click', () => { | |
| if (confirm('Are you sure you want to cancel this ride?')) { | |
| rideStatusModal.classList.add('hidden'); | |
| alert('Ride cancelled successfully'); | |
| } | |
| }); | |
| // Contact driver button | |
| contactDriverBtn.addEventListener('click', () => { | |
| if (appState.selectedDriver) { | |
| alert(`Calling driver ${appState.selectedDriver.name} at ${appState.selectedDriver.phone}`); | |
| // In a real app, this would initiate a phone call | |
| } | |
| }); | |
| // Profile button | |
| profileBtn.addEventListener('click', () => { | |
| if (appState.isLoggedIn) { | |
| alert(`Logged in as:\nName: ${appState.userName}\nWhatsApp: ${appState.userWhatsApp}\nEmail: ${appState.userEmail}\n\nIn a real app, this would show user profile and settings`); | |
| } else { | |
| alert('Please login to view your profile'); | |
| } | |
| }); | |
| } | |
| // Initialize the app when DOM is loaded | |
| document.addEventListener('DOMContentLoaded', initApp); | |
| </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=LIAMARTEK/libur-trial" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |