Implementation of a booking system

Hi everyone!

I’ve been working on implementing a booking system for an auto repair shop and ran into some challenges with the following functionality: There are two branches, and each branch has different time slot intervals (30 and 15 minutes). When creating a booking, the user selects a type of service for the car — and this is where I got stuck. Each service type can have a different duration that should be selectable by the employee (for example, an oil change may take 60 or 90 minutes depending on the car). All time slots that fall within the selected service duration need to be hidden (blocked), and it should also be possible to change the start time and duration of the booking.

In my implementation, the table for bookings was separate from the table containing the slot data (used for selecting time slots depending on the branch and filtering by date and time). The main issue I ran into was the inability to properly pass data between the tables — I was trying to set the start and end time of the booking so that all slots within that range would be blocked. I’d appreciate any tips or suggestions on how to implement this system.

This is a tricky problem—I’ve built similar apps before. The main idea is to have a table where columns represent shop operating hours in intervals (e.g., 15 minutes).
So, Column 1: 9:00 AM, Column 2: 9:15 AM, and so on, up to closing time. Rows would represent dates.
You’d also need another table for booked services.

When a user books a time slot, the algorithm checks the row for the selected date. If all the cells from the start time to end time are empty, the booking can proceed.
It then adds a booking log to the bookings table, retrieves the log ID, and fills the corresponding time slots in the main table with that ID.

This structure helps with clear visualization—but in reality, you don’t need the slots table. A simple JavaScript loop can check for conflicts directly from the booked data.

Why do you need to pass data between tables? The only table that matters is the one with the booked dates.

1 Like