Due to jquery ui datepicker issue the unavailable dates will be greyed out manually by adding the required classes.

This commit is contained in:
Alex Tselegidis 2016-06-29 21:25:57 +02:00
parent 0522186a4e
commit b9e24f7baf

View file

@ -230,15 +230,13 @@ window.FrontendBookApi = window.FrontendBookApi || {};
$('#available-hours').text(EALang['no_available_hours']); $('#available-hours').text(EALang['no_available_hours']);
} }
// Apply the new beforeShowDayHandler method to the #select-date datepicker. // Grey out unavailable dates.
var beforeShowDayHandler = function(date) { $('#select-date .ui-datepicker-calendar td:not(.ui-datepicker-other-month)').each(function(index, td) {
if ($.inArray(date.toString('yyyy-MM-dd'), response) != -1) { selectedDate.set({day: index + 1});
return [false]; 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); .fail(GeneralFunctions.ajaxFailureHandler);
}; };