Sounds like a cool app! For the collection structure, you might look at:
- Employees (one Company has many Employees, each Employee has only one Company)
- Days (create one for every Day going forward, with a date field as the date)
- Appointments with a start time and end time (each Day has many Appointments, each Appointment has one Day), (each Employee has many Appointments, each Appointment has one Employee)
- Clients (each Client has many Appointments, each Appointment has one Client)
- You may also want to do an ‘Appointment Type’ for the different kinds of services (each type could have a different price, say). (Each Appointment has one Appointment Type, an Appointment Type can have many Appointments)
Question 1 - How do I avoid repeat appointments?
When a Client ‘books’ an Appointment, you can set the Appointment’s Client to that client. In this way, each Appointment can only have one Client. At this point, you could link the Appointment to an Appointment Type (so you know how much you charged the customer and can produce reports later by day, by Employee etc).
Question 2 - How can I choose when employees receive appointments?
So, you might decide to create all your days and appointments in Excel (because this is faster) and then upload them.
You could create say, 3,650 days (10 years) of Days and upload those. Each one should have a ‘date’ field in it for the correct day. Make sure this is the top field in the list when you look at the Day collection (drag it to the top).
Create your Employees (as they currently exist) and give each one a unique name (eg, ‘Employee 1’, ‘Employee 2’ etc). If you have lots of employees, do this in Excel and upload them. Include any other information you want. Make sure this field is the top of the list when you view the collection (drag and drop it at the top if not).
As of last week, you can now link records when you upload them, which is super helpful for this sort of app. For your Appointments, you might consider:
| Date | Start Time | End Time | Employee |
| 01/05/2020 | 08:00 | 08:50 | Employee 1 |
| 01/05/2020 | 08:00 | 08:50 | Employee 2 |
| 01/05/2020 | 08:00 | 08:50 | Employee 3 |
| 01/05/2020 | 08:00 | 08:50 | Employee 4 |
| 01/05/2020 | 09:00 | 09:50 | Employee 1 |
| 01/05/2020 | 09:00 | 09:50 | Employee 2 |
| 01/05/2020 | 09:00 | 09:50 | Employee 3 |
| 01/05/2020 | 09:00 | 09:50 | Employee 4 |
all the way to the end of the day for each day (once you have set up the structure in Excel, you should be able to just drag the corner down to let it do the work…
| 02/05/2020 | 08:00 | 08:50 | Employee 1 |
| 02/05/2020 | 08:00 | 08:50 | Employee 2 |
| 02/05/2020 | 08:00 | 08:50 | Employee 3 |
| 02/05/2020 | 08:00 | 08:50 | Employee 4 |
And so on… There will be a lot of empty appointments to fill! Given that employees might move about, I would suggest only doing this on a rolling, say, monthly basis (as you accept bookings going ahead), because there is no present way to bulk-delete things once you’ve uploaded them!
When you upload these to the collection, you can link them to the right Day (using the date) and to the right Employee (using that unique code I mentioned above).
You now have (a) basic database structure to build a booking system! (Other Adaloers may have suggestions to improve it…)
Question 3 - Blocking Appointments
You might assume now that Employee 2 will work every weekend (and so create the Appointment slots for him in advance as above, including weekend slots. She might get sick, or not fancy working Sunday afternoon. If you want to be able to close a slot, you could add a checkbox to the Appointment collection called ‘unavailable’.
When you are making lists of available appointments for Clients to book, be sure to filter so that the linked client is empty (eg, you aren’t double-booking) and the ‘unavailable’ is false (you aren’t booking an employee when they want time off. Your employees, or your salon manager, could then set slots to ‘unavailable’ to block them for lunch breaks, holidays, weekends off etc.