$('.booked-calendar-wrap').on('click', 'tr.week td', function(e) {
e.preventDefault();
var $thisDate = $(this),
$thisRow = $thisDate.parent(),
date = $thisDate.attr('data-date'),
booked_ajaxURL = $('#data-ajax-url').html(),
calendar_id = $thisDate.parents('table.booked-calendar').attr('data-calendar-id'),
colspanSetting = $thisRow.find('td').length;
if ($thisDate.hasClass('blur') || $thisDate.hasClass('booked') || $thisDate.hasClass('prev-date')){
// Do nothing.
} else if ($thisDate.hasClass('active')){
$thisDate.removeClass('active');
$('tr.entryBlock').remove();
} else {
$('tr.week td').removeClass('active');
$thisDate.addClass('active');
$('tr.entryBlock').remove();
$thisRow.after('<tr class="entryBlock loading"><td colspan="'+colspanSetting+'"></td></tr>');
$('tr.entryBlock').find('td').spin('booked');
booked_load_calendar_date_booking_options = {'load':'calendar_date','date':date,'calendar_id':calendar_id};
/*
* allow other script to apply their modification before loading the booking options
* $(document).on("booked-before-loading-calendar-booking-options", function(event, params) { code goes here });
*/
$(document).trigger("booked-before-loading-calendar-booking-options");
$('tr.entryBlock').find('td').load(booked_ajaxURL, booked_load_calendar_date_booking_options, function(){
$('tr.entryBlock').removeClass('loading');
$('tr.entryBlock').find('.booked-appt-list').fadeIn(300);
$('tr.entryBlock').find('.booked-appt-list').addClass('shown');
adjust_calendar_boxes();
});
}
adjust_calendar_boxes();
return false;
});
// Calendar Date Click
$('.booked-calendar-wrap').on('click', 'tr.week td', function(e) {
e.preventDefault();
var $thisDate = $(this),
$thisRow = $thisDate.parent(),
date = $thisDate.attr('data-date'),
booked_ajaxURL = $('#data-ajax-url').html(),
calendar_id = $thisDate.parents('table.booked-calendar').attr('data-calendar-id'),
colspanSetting = $thisRow.find('td').length;
if ($thisDate.hasClass('blur') || $thisDate.hasClass('booked') || $thisDate.hasClass('prev-date')){
// Do nothing.
} else if ($thisDate.hasClass('active')){
$thisDate.removeClass('active');
$('tr.entryBlock').remove();
} else {
$('tr.week td').removeClass('active');
$thisDate.addClass('active');
$('tr.entryBlock').remove();
$thisRow.after('<tr class="entryBlock loading"><td colspan="'+colspanSetting+'"></td></tr>');
$('tr.entryBlock').find('td').spin('booked');
booked_load_calendar_date_booking_options = {'load':'calendar_date','date':date,'calendar_id':calendar_id};
/*
* allow other script to apply their modification before loading the booking options
* $(document).on("booked-before-loading-calendar-booking-options", function(event, params) { code goes here });
*/
$(document).trigger("booked-before-loading-calendar-booking-options");
$('tr.entryBlock').find('td').load(booked_ajaxURL, booked_load_calendar_date_booking_options, function(){
$('tr.entryBlock').removeClass('loading');
$('tr.entryBlock').find('.booked-appt-list').fadeIn(300);
$('tr.entryBlock').find('.booked-appt-list').addClass('shown');
adjust_calendar_boxes();
});
}
adjust_calendar_boxes();
return false;
});
var date = new Date(),
day = date.getDate();
var today = day;
$(".number").each(function() {
if ($(this).text() == today) {
$(this).closest('td').trigger('click');
}
});