You may not get any responses to this request as it is a bit "can I do this, can you do it for me".
I would start with four business objects.
Members
use the RegularUser BO or create a member BO in the Business Object Group SystemUsers.
Court -
a simple BO with a name and any other information that you want to capture about each court.
Add attributes:
Court Number Number Required
Court Name Text (Calculated)
Surface check box (Clay, Grass etc)
Floodlights (Y/N)
Rules
If Court is New OR Court.Number Was Changed then Court.Name = 'Court '+Court.Number
If Court is new and Exists Court Where Court.Number=ThisCourt.Number AND Court.ID<>ThisCourt.ID then Report error 'Court Already Exists'
Booking Periods -
use this as reference data to set the time that a court can be booked
Start Time
End Time
Name
Rules
If Start Time changed make End Time = TIME_ADD(StartTime, 0.5)
Ensure End time > Start Time
If Booking Period was changed then BookingPeriod.Name=Start Time+' - '+End Time
Booking
Use an appointment type BO
Add fields
peer single to Member - relationship to the member
peer single to Court
SelectedDate
peer single to Booking Period - Put a filter on Booking Period to ensure that you only show Booking Periods only where there is not a Booking for the court for that time. This is a better UX than producing an error when the user tries to book at a time that already exists.
Rule
If Booking IS NEW
-
then set the Booking StartTime to be Booking.SelectedDate contatenated with the Booking.psBookingPeriod.StartTime and Booking EndTime to be Booking.SelectedDate concatenated with the Booking.psBookingPeriod.EndTime
Booking Subject becomes Booking.psCourt + Booking.psMember
If Exists Booking Where Booking.psCourt = ThisBooking.psCourt, Booking.StartTime=ThisBooking.StartTime, Booking.EndTIme = ThisBooking.EndTime Booking.ID<>ThisBooking.ID then report error 'Court booked at this time' (You want this to check that someone didn't book the same court/time as the user)
Create a query of type Calendar/Schedule
Put the Query on a Visual Perspective for the members view.
Allow users to create bookings as an operation from this Query. Use the new form that you have created.
Resources:
Time and Date Calculations p 403 of user guide
Calendar/Schedules See https://www.youtube.com/watch?v=MlthX36WPxk, p42, 313 of User Guide
Things I would not do:
Create an instance for every booking slot - this is pointless effort and you will end up having to go and delete these when you want to block courts and then recreate them when you unblock courts. You will also end up creating issues for users who want to book the court 1 day later than you have created the booking slots for.