import { useState } from 'react'; import { Calendar, Clock } from 'lucide-react'; export default function LaundryBooking() { const [selectedDate, setSelectedDate] = useState(''); const [selectedTime, setSelectedTime] = useState(''); const [bookings, setBookings] = useState([]); const [name, setName] = useState(''); const [unit, setUnit] = useState(''); const timeSlots = [ '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00' ]; const handleBooking = (e) => { e.preventDefault(); if (!selectedDate || !selectedTime || !name || !unit) { alert('Please fill in all fields'); return; } const newBooking = { id: Date.now(), date: selectedDate, time: selectedTime, name, unit }; setBookings([...bookings, newBooking]); setSelectedDate(''); setSelectedTime(''); setName(''); setUnit(''); }; const isSlotBooked = (date, time) => { return bookings.some(booking => booking.date === date && booking.time === time ); }; return (

Laundry Booking System

{/* Booking Form */}

Make a Booking

setName(e.target.value)} className="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent" placeholder="Enter your name" />
setUnit(e.target.value)} className="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent" placeholder="Enter your unit number" />
setSelectedDate(e.target.value)} min={new Date().toISOString().split('T')[0]} className="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent" />
{/* Bookings List */}

Current Bookings

{bookings.map(booking => (
{booking.date} at {booking.time}

Name: {booking.name}

Unit: {booking.unit}

))} {bookings.length === 0 && (

No bookings yet

)}
); }