From b9e24f7baf609341064f37230f9664bd8aad6e71 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 29 Jun 2016 21:25:57 +0200 Subject: [PATCH] Due to jquery ui datepicker issue the unavailable dates will be greyed out manually by adding the required classes. --- src/assets/js/frontend_book_api.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/assets/js/frontend_book_api.js b/src/assets/js/frontend_book_api.js index a299eebb..20c038ef 100644 --- a/src/assets/js/frontend_book_api.js +++ b/src/assets/js/frontend_book_api.js @@ -230,15 +230,13 @@ window.FrontendBookApi = window.FrontendBookApi || {}; $('#available-hours').text(EALang['no_available_hours']); } - // Apply the new beforeShowDayHandler method to the #select-date datepicker. - var beforeShowDayHandler = function(date) { - if ($.inArray(date.toString('yyyy-MM-dd'), response) != -1) { - return [false]; + // Grey out unavailable dates. + $('#select-date .ui-datepicker-calendar td:not(.ui-datepicker-other-month)').each(function(index, td) { + selectedDate.set({day: index + 1}); + if ($.inArray(selectedDate.toString('yyyy-MM-dd'), response) != -1) { + $(td).addClass('ui-datepicker-unselectable ui-state-disabled'); } - return [true]; - }; - - $('#select-date').datepicker('option', 'beforeShowDay', beforeShowDayHandler); + }); }) .fail(GeneralFunctions.ajaxFailureHandler); };