Skip to content

Commit

Permalink
Revert "✨Added a localStorage and refactored CSS ✨"
Browse files Browse the repository at this point in the history
  • Loading branch information
PriyaGhosal authored Oct 7, 2024
1 parent fc7925e commit 1b8646b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 84 deletions.
82 changes: 0 additions & 82 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ <h3>Romantic Getaway</h3>
</section>

<!-- Cab or Auto Booking -->

<section
id="cab-booking"
class="cab-booking-section"
Expand All @@ -293,7 +292,6 @@ <h3>Romantic Getaway</h3>
margin-top: 10px;
"
>

Book a Cab or Auto
</h2>
<p style="margin-left: 40px; font-size: 1.5em; margin-bottom: 10px">
Expand Down Expand Up @@ -393,88 +391,8 @@ <h3>Romantic Getaway</h3>
Book now
</button>
</form>
</section> -->
<section id="cab-booking" class="cab-booking-section">
<h2>Book a Cab or Auto</h2>
<p>Book a cab or auto with ease</p>

<form id="cab-booking-form">
<label for="pickup-location">Pickup Location:</label>
<input
type="text"
id="pickup-location"
name="pickup-location"
placeholder="Enter pickup location"
required />

<label for="drop-location">Drop Location:</label>
<input
type="text"
id="drop-location"
name="drop-location"
placeholder="Enter drop location"
required />

<label for="vehicle-type">Vehicle Type:</label>
<select id="vehicle-type" name="vehicle-type" required>
<option value="cab">Cab</option>
<option value="auto">Auto</option>
</select>

<label for="travel-date">Travel Date:</label>
<input type="date" id="travel-date" name="travel-date" required />

<label for="travel-time">Travel Time:</label>
<input type="time" id="travel-time" name="travel-time" required />

<input type="submit" value="Book Now" />
</form>

<div id="form-message" class="form-message"></div>
</section>

<script>
document.addEventListener("DOMContentLoaded", function () {
// Load stored data from localStorage if exists
const storedData = localStorage.getItem("cabBookingData");
if (storedData) {
const formData = JSON.parse(storedData);
document.getElementById("pickup-location").value = formData.pickupLocation;
document.getElementById("drop-location").value = formData.dropLocation;
document.getElementById("vehicle-type").value = formData.vehicleType;
document.getElementById("travel-date").value = formData.travelDate;
document.getElementById("travel-time").value = formData.travelTime;
}

// Form submission handler
document.getElementById("cab-booking-form").addEventListener("submit", function (event) {
event.preventDefault(); // Prevent form submission

// Capture form data
const formData = {
pickupLocation: document.getElementById("pickup-location").value,
dropLocation: document.getElementById("drop-location").value,
vehicleType: document.getElementById("vehicle-type").value,
travelDate: document.getElementById("travel-date").value,
travelTime: document.getElementById("travel-time").value,
};

// Store data in localStorage
localStorage.setItem("cabBookingData", JSON.stringify(formData));

// Display success message
document.getElementById("form-message").innerText = "Cab booked successfully!";

// Clear form
document.getElementById("cab-booking-form").reset();
});
});
</script>





<!-- recommendations -->
<section id="recommendations" class="recommendations-section">
<h2>Personalized Recommendations</h2>
Expand Down
2 changes: 0 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,6 @@ body.dark-mode {
transition: transform 0.3s ease, color 0.3s ease;
}


.twitter:hover {
background-color: #1e97e3; /* Twitter's official blue color */
transform: scale(1.1);
Expand Down Expand Up @@ -999,4 +998,3 @@ body.dark-mode {

/* Extra large devices (large laptops and desktops, 1200px and up) */
/*@media only screen and (min-width: 1200px) {...}*/

0 comments on commit 1b8646b

Please sign in to comment.