diff --git a/frontend/src/Pages/booking.jsx b/frontend/src/Pages/booking.jsx index cbcf873..5aaeca4 100644 --- a/frontend/src/Pages/booking.jsx +++ b/frontend/src/Pages/booking.jsx @@ -1,16 +1,16 @@ -import React, { useState, useEffect } from 'react'; -import { IoCalendarOutline, IoArrowBack } from 'react-icons/io5'; -import { useNavigate } from 'react-router-dom'; -import axios from 'axios'; -import DatePicker from 'react-datepicker'; // Import DatePicker -import 'react-datepicker/dist/react-datepicker.css'; // Import default styles +import React, { useState, useEffect } from "react"; +import { IoCalendarOutline, IoArrowBack } from "react-icons/io5"; +import { useNavigate } from "react-router-dom"; +import axios from "axios"; +import DatePicker from "react-datepicker"; // Import DatePicker +import "react-datepicker/dist/react-datepicker.css"; // Import default styles const BookingPage = () => { const [station, setStation] = useState(""); const [selectedStation, setSelectedStation] = useState(null); const [date, setDate] = useState(null); // Date initialized as null const [services, setServices] = useState([ - { id: "cloak", name: "Cloak Room Booking", availability: 0 }, + { id: "cloak", name: "Clock Room Booking", availability: 0 }, { id: "wheelchair", name: "Wheelchair Booking", availability: 0 }, { id: "coolie", name: "Coolie Booking", availability: 0 }, ]); @@ -47,7 +47,8 @@ const BookingPage = () => { const response = await axios.get( `http://localhost:3000/station/${stationId}/bookings` ); - const { coolieBookings, wheelchairBookings, cloakroomBookings } = response.data; + const { coolieBookings, wheelchairBookings, cloakroomBookings } = + response.data; setServices([ { @@ -125,7 +126,7 @@ const BookingPage = () => { } catch (error) { alert( "Failed to complete the booking: " + - (error.response?.data?.message || "Unknown error") + (error.response?.data?.message || "Unknown error") ); } }; @@ -146,7 +147,7 @@ const BookingPage = () => { } catch (error) { alert( "Failed to complete the booking: " + - (error.response?.data?.message || "Unknown error") + (error.response?.data?.message || "Unknown error") ); } }; @@ -165,7 +166,7 @@ const BookingPage = () => { } catch (error) { alert( "Failed to complete the booking: " + - (error.response?.data?.message || "Unknown error") + (error.response?.data?.message || "Unknown error") ); } }; @@ -183,42 +184,47 @@ const BookingPage = () => { }; // Render booking form for selected service + const renderBookingForm = () => { if (!selectedService) return null; if (selectedService === "cloak") { return ( -