Ajuda para bloquear agenda de reservas

I really need help!
I am making an application for scheduling services.
Each company has its employees, and each employee has its agenda.
It works like this, when a user makes an appointment to shave in a barber shop, he can choose who to shave with, he chooses the day and time.

Thus, a salon with three barbers, manages to serve three people at the same time because each employee has his agenda.

But here comes my difficulties.
1st how to block the schedule of each employee so as not to receive a repeated schedule at the same time.
2nd How can I receive reservations only at a pre-defined time and day. for example.
Employee “A” can take reservations from Monday to Friday from 8 am until 7 pm

I really need that help!

1 Like

Hi @CNST

Sounds like a cool app! For the collection structure, you might look at:

  1. Companies
  2. Employees (one Company has many Employees, each Employee has only one Company)
  3. Days (create one for every Day going forward, with a date field as the date)
  4. 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)
  5. Clients (each Client has many Appointments, each Appointment has one Client)
  6. 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.

1 Like

Good thank you so much , if you can make video that will more good