Disable appointment selection for holidays

This commit is contained in:
coolneng 2020-07-15 16:52:10 +02:00
parent d3e6b5a549
commit 88c06ce169
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 20 additions and 4 deletions

View File

@ -1,7 +1,7 @@
$(document).ready(function() {
var queryString = window.location.search;
var calendar = $('#calendar').fullCalendar({
selectable: true,
editable: false,
header: {
@ -15,15 +15,31 @@
"holiday_feed.php" + queryString
],
selectable: true,
selectHelper: true,
select: function(start, end) {
$("#dialog-form").dialog({ modal: true, width:450});
var date = $.fullCalendar.formatDate(start, 'YYYY-MM-DD');
$("#fecha").val(date);
},
selectAllow: function(selectInfo){
var holidays = null;
$.ajax({
url: 'holiday_feed.php',
async: false,
dataType: 'json',
success: function (json) {
holidays = json;
}
});
var date = selectInfo.start._d;
var formatted_date = date.toISOString().substr(0, 10);
var found = holidays.find(el => el.start === formatted_date);
if(found == null){
return true;
}
return false;
},
eventClick: function(event) {
var start = $.fullCalendar.formatDate(event.start, 'HH:mm');
var end = $.fullCalendar.formatDate(event.end, 'HH:mm');