- Issue created by @hewi1345
-
rfmarcelino โ
committed 1ec5586d on main
#3425796 Hide calendar if no availability
-
rfmarcelino โ
committed 1ec5586d on main
- Status changed to Needs review
8 months ago 6:03pm 5 March 2024 - Status changed to RTBC
8 months ago 10:48am 8 March 2024 - Status changed to Fixed
8 months ago 12:51pm 8 March 2024 - ๐ฎ๐นItaly luca_cracco
With these changes the month selector does not appear if the prev month the current has no slots.
In this way you cannot select a next months.Example:
Start date: April 10th
End date: June 28th
Current date: May 11th - ๐ฉ๐ชGermany hewi1345 Flensburg
I can confirm luca_craccoโs comment. If the start date is in the previous month, the
daysData
variable remains empty.
Consequently, the conditionif (!daysData || daysData.length === 0)
is triggered, resulting in the display of theno-slots-message
. - ๐ฉ๐ชGermany hewi1345 Flensburg
I created two new branches.
The first one contains changes that fix the issue where the calendar is hidden when the start date is in a past month.As a workaround, I added a month selection because otherwise, the bookable days were not displayed on page load.
If someone can solve it without the selection, feel free to change it. However, it would be good to keep my workaround as an option.The second branch is identical functionwise, but now it no longer uses jQuery, only pure JavaScript.
I did this because Drupal Core is trying to deprecate jQuery.
https://www.drupal.org/project/drupal/issues/3052002 ๐ฑ [meta] Replace JQuery with vanilla Javascript in core Active@rfmarcelino
Could you reopen the issue and change the status to Needs review? - Status changed to Needs review
5 months ago 2:33pm 6 June 2024 - ๐ต๐นPortugal rfmarcelino
Thank you @hewi1345
Yes, I also considered using plain js.
From my tests, the code in both branches seem to need some work:
- Assigned to Corn696
- Status changed to Needs work
5 months ago 10:03am 9 June 2024 - Issue was unassigned.
- ๐ฉ๐ชGermany Corn696 Flensburg
I worked on the vanilla js branch.
I tried another approach and the code now removes the month without available slots from the select list.
If this would an option we would not need the "no slots available" message anymore or?However the code still needs some work. I am not so familiar with the core/once implementation.
If two webforms are placed on a page with the same booking field id the second form does not work. -
rfmarcelino โ
committed ebda258e on 1.0.x
#3425796 - Plain js (remove jquery and jquery once)
-
rfmarcelino โ
committed ebda258e on 1.0.x
- ๐ต๐นPortugal rfmarcelino
Thank you for your work!
I committed the plain js version with some changes.
From my tests it worked but I didn't made a release tag yet since I want to do some more testing and eventualy also send the webform settings validation in plain js.
Meanwile, feel free to play around with it and give your feedback. - ๐ฉ๐ชGermany Corn696 Flensburg
I want to do some more testing
That would be good.
and eventualy also send the webform settings validation in plain js.
Do you mean the validation on the config form?
Take a look at Use form validation instead of custom js for exclusion dates and time intervals ๐ Use form validation instead of custom js for exclusion dates and time intervals Needs review
- ๐ต๐นPortugal rfmarcelino
The commit was released allong with the new form validation.
Thank you for your contribution. - Status changed to Fixed
5 months ago 11:25pm 27 June 2024