Disable appointment selection for holidays
This commit is contained in:
parent
d3e6b5a549
commit
88c06ce169
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue