Hi,
You can achieve this in different ways.
One way to do this would be to have an “Occupied until” field in your Barber Data Type. Every time an appointment is created it adds the number of minutes that specific appointment usually takes.
So let’s say the current time is 9:00 AM, shop just opened. Someone books a regular haircut. Whichever barber that person chose will now have Occupied until field of 9:30.
If someone else enters the shop at 9:15 and also wants a regular haircut from that same barber, you will add 30 minutes to the Barber’s “Occupied until” time. So now the barber is Occupied until 10:00 AM.
When they close shop, their occupied time will stay at like 6 PM until the next morning, so you have to reset it everyday. Choose your method:
-A button that every barber has to click, kind of like a “check-in”, which will reset the occupied time to Empty.
-A button that the Head barber clicks that will reset all the barbers’ “Occupied Time”
-Or a backend workflow that will reset each barber’s “Occupied Time” at like 12AM (recommended!)
Workflow for "Occupied Time"
you’ll need 2 workflows with different sets of conditionals to change the occupied time of the barber.
Workflow 1: When this barber’s “Occupied Time” is empty (Shop just opened), set their occupied time to current/date time + however many minutes the appointment takes
Workflow 2: When this barber’s “Occupied Time” is not empty, set their occupied time to the current “Occupied Time” + however many minutes the appointment takes.
Now to let the customers know the wait times:
-Available Now = When the current date/time is bigger than the barber’s “Occupied Until” time.
-Available Soon = When the current time minus 15 minutes is bigger than barber’s “Occupied Until” time
-Available Later = When the current time minus 15 minutes is smaller than barber’s “Occupied Until” time
Workflow to Notify the Barber
So I’m assuming you want to notify the Barber whenever a customer books a new appointment similar to an Uber driver’s notification right?
-To achieve this, you need to create a new data type called notification
-It will have a field called “Barber” to refer to who needs to get the notification
-It will have a field called “Seen” to remove the notification once the barber has seen it. Give it default value of “no”
So now, whenever the customer books the appointment, create a notification and send it to the barber they chose.
Display in Order
To display the Barbers in the repeating group in the order, available-soon-later, you’ll have to do this search:
-This Barbershop’s barbers sorted by “Occupied Time” descending = No
Hope this helps, let me know!
Cheers 