alextselegidis / easyappointments

:date: Easy!Appointments - Self Hosted Appointment Scheduler
https://easyappointments.org
GNU General Public License v3.0
3.34k stars 1.28k forks source link

1.5.0-dev.4 invalid or no date selected if the first provider in the booking page has no availability times #1389

Closed KRUAndu closed 1 year ago

KRUAndu commented 1 year ago

Issue

When selecting a service but the first provider in the list has no available times, selecting a second provider does not trigger an event to select the first available date in calendar and gives incorrect availability hours.

This issue does not happen when "Any Provider" is enabled, but this might maybe the cause of one or more people having available times in for the current month.

This might be a niche problem but could affect others in some scenarios. I found this when trying to make a user that pretty much forces a person to "Select a service" and "Select a provider (if no other providers are available for the service)". Should I create a feature request for this?

To recreate:

  1. Have two providers ready, where the first one does not have any and the second one has available times for the current month.
  2. Assign all services for the user that has no available times.
  3. Assign a service for the user that has available times for the current month.
  4. The frontend booking page must preselect the user with no available times. (add ! or 1 to the beginning of the first name to make it come first in the Provider list).
  5. If all prerequisites are met, then all you have to do now to recreate the problem is to select a service and a provider with available times.

Result:

This should show the issue where no date is selected in the calendar but its giving me availability times (later found it to be the current date which is not an available DateTime): image

Going to the submit page shows that the start date is 15/07/2023 which is not even an available date for that provider. Confirming the appointment thankfully results in an error but people might not select a valid date as they might have the assumption that the first available date is selected. image

alextselegidis commented 1 year ago

Hello!

Thanks for posting this ticket.

This is already fixed on develop with the addition of this feature:

https://github.com/alextselegidis/easyappointments/issues/1204

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

KRUAndu commented 1 year ago

@alextselegidis I just built the latest nightly and seems #1204 or something else caused a new problem. If you select the service/provider and they have available times, the first available date is selected and works as expected. But now if I go back and select another provider who is unavailable for the current month (not changing the service here), then I am still provided with the previous providers available times. Confirming the appointment still thankfully fails.

alextselegidis commented 1 year ago

Hello!

Do you get a JS error or similar?

I tried to reproduce this but I was always getting the right results.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

KRUAndu commented 1 year ago

Hi,

There does not seem to be any major JS errors in the console, only one deprecation warning for moment.min.js. No errors came up when building with "npm run build". As I am not a PHP/JS developer I can't pinpoint these exact issues here in code.

I did make a E!A 1.3.1 SQL database clone and migrate to 1.4.0 ... 1.4.3 to then 1.5-dev.3, the usual SQL upgrades and haven't done any clean database testing, but I'm quite sure these issues might not be due to the database. I can however check these bugs with a clean database later.

Speaking of JS errors, changing the month in the calendar does however give a deprecation warning I also saw with dev3 and dev4 releases and caused some issues with Safari (iOS): image image

I also found some other problems, one of them is the new "is_month_unavailable" that you've added in #1204, the frontend does not seem to know what to do with that response and does not mark days as unavailable at all. I really don't want to clutter this issue any further, so if there is something else I find, I'll be sure to open an issue if there seems to be one.

alextselegidis commented 1 year ago

Hello!

I just found and fixed this error with this commit:

https://github.com/alextselegidis/easyappointments/commit/0fdb1ffdae62241f15cffde823fe31635b25883c

You may check again and let us know in case you experience other similar errors.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!