var date_approved = []; var date2approve = []; var date_admin_blank = []; var dates_additional_info = []; //var tooltips = []; var is_all_days_available = []; var avalaibility_filters = []; var is_show_cost_in_tooltips = false; var is_show_availability_in_tooltips = false; var global_avalaibility_times = []; // Time availability var wpdev_bk_calendarViewMode = ''; // // var numbb = 0; // Initialisation function init_datepick_cal(bk_type, date_approved_par, my_num_month, start_day ){ var cl = document.getElementById('calendar_booking'+ bk_type);if (cl == null) return; // Get calendar instance and exit if its not exist date_approved[ bk_type ] = date_approved_par; function click_on_cal_td(){ if(typeof( selectDayPro ) == 'function') {selectDayPro( bk_type);} } function selectDay(date) { jWPDev('#date_booking' + bk_type).val(date); if(typeof( selectDayPro ) == 'function') {selectDayPro( date, bk_type);} } function hoverDay(value, date){ if(typeof( hoverDayTime ) == 'function') {hoverDayTime(value, date, bk_type);} if ( (location.href.indexOf('admin.php?page=booking/wpdev-booking.phpwpdev-booking')==-1) || (location.href.indexOf('admin.php?page=booking/wpdev-booking.phpwpdev-booking-reservation')>0) ) { // Do not show it (range) at the main admin page if(typeof( hoverDayPro ) == 'function') {hoverDayPro(value, date, bk_type);} } //if(typeof( hoverAdminDay ) == 'function') { hoverAdminDay(value, date, bk_type); } } function applyCSStoDays(date ){ if (typeof( is_this_day_available ) == 'function') { var is_day_available = is_this_day_available( date, bk_type); if (! is_day_available) {return [false, 'cal4date-' + class_day +' date_user_unavailable'];} } // Time availability if (typeof( check_global_time_availability ) == 'function') {check_global_time_availability( date, bk_type );} var class_day = (date.getMonth()+1) + '-' + date.getDate() + '-' + date.getFullYear(); // Check availability per day for H.E. var reserved_days_count = 1; if(typeof(availability_per_day) !== 'undefined') if(typeof(availability_per_day[ bk_type ]) !== 'undefined') if(typeof(availability_per_day[ bk_type ][ class_day ]) !== 'undefined') { reserved_days_count = parseInt( availability_per_day[ bk_type ][ class_day ] ); } //if( date.getDate() == '05') alert(class_day); // we have 0 available at this day - Only for resources, which have childs if ( parent_booking_resources.wpdev_in_array( bk_type ) ) if (reserved_days_count <= 0) return [false, 'cal4date-' + class_day +' date2approve date_unavailable_for_all_childs ' + blank_admin_class_day]; //var class_day_previos = (date.getMonth()+1) + '-' + (date.getDate()-1) + '-' + date.getFullYear(); var blank_admin_class_day = ''; if(typeof(date_admin_blank[ bk_type ]) !== 'undefined') if(typeof(date_admin_blank[ bk_type ][ class_day ]) !== 'undefined') { blank_admin_class_day = ' date_admin_blank '; } var th=0; var tm=0; var ts=0; var time_return_value = false; // Select dates which need to approve, its exist only in Admin if(typeof(date2approve[ bk_type ]) !== 'undefined') if(typeof(date2approve[ bk_type ][ class_day ]) !== 'undefined') { th = date2approve[ bk_type ][ class_day ][0][3]; tm = date2approve[ bk_type ][ class_day ][0][4]; ts = date2approve[ bk_type ][ class_day ][0][5]; if ( ( th == 0 ) && ( tm == 0 ) && ( ts == 0 ) ) return [false, 'cal4date-' + class_day +' date2approve' + blank_admin_class_day]; // Orange else { time_return_value = [true, 'cal4date-' + class_day +' date2approve timespartly']; // Times if(typeof( isDayFullByTime ) == 'function') { if ( isDayFullByTime(bk_type, class_day ) ) return [false, 'cal4date-' + class_day +' date2approve' + blank_admin_class_day]; // Orange } } } //select Approved dates if(typeof(date_approved[ bk_type ]) !== 'undefined') if(typeof(date_approved[ bk_type ][ class_day ]) !== 'undefined') { th = date_approved[ bk_type ][ class_day ][0][3]; tm = date_approved[ bk_type ][ class_day ][0][4]; ts = date_approved[ bk_type ][ class_day ][0][5]; if ( ( th == 0 ) && ( tm == 0 ) && ( ts == 0 ) ) return [false, 'cal4date-' + class_day +' date_approved' + blank_admin_class_day]; //Blue or Grey in client else { time_return_value = [true, 'cal4date-' + class_day +' date_approved timespartly']; // Times if(typeof( isDayFullByTime ) == 'function') { if ( isDayFullByTime(bk_type, class_day ) ) return [false, 'cal4date-' + class_day +' date_approved' + blank_admin_class_day]; // Blue or Grey in client } } } for (var i=0; i date) return [false, 'cal4date-' + class_day +' date_user_unavailable' ]; if ( time_return_value !== false ) return time_return_value; else return [true, 'cal4date-' + class_day +' reserved_days_count' + reserved_days_count + ' ' ]; } function changeMonthYear(year, month){ if(typeof( prepare_tooltip ) == 'function') { setTimeout("prepare_tooltip("+bk_type+");",1000); } if(typeof( prepare_highlight ) == 'function') { setTimeout("prepare_highlight();",1000); } } // Configure and show calendar jWPDev('#calendar_booking'+ bk_type).datepick( {beforeShowDay: applyCSStoDays, onSelect: selectDay, onHover:hoverDay, onChangeMonthYear:changeMonthYear, showOn: 'both', multiSelect: multiple_day_selections, numberOfMonths: my_num_month, stepMonths: 1, prevText: '<<', nextText: '>>', dateFormat: 'dd.mm.yy', changeMonth: false, changeYear: false, minDate: 0, maxDate: booking_max_monthes_in_calendar, //'1Y', showStatus: false, multiSeparator: ', ', closeAtTop: false, firstDay:start_day, gotoCurrent: false, hideIfNoPrevNext:true, rangeSelect:wpdev_bk_is_dynamic_range_selection, calendarViewMode:wpdev_bk_calendarViewMode, useThemeRoller :false // ui-cupertino.datepick.css } ); //jWPDev('td.datepick-days-cell').bind('click', 'selectDayPro'); if(typeof( prepare_tooltip ) == 'function') {setTimeout("prepare_tooltip("+bk_type+");",1000);} } // A D M I N Highlight dates when mouse over function highlightDay(td_class, bk_color){ //jWPDev('.'+td_class).css({'background-color' : bk_color }); //jWPDev('.'+td_class + ' a').css({'background-color' : bk_color }); jWPDev('td a').removeClass('admin_calendar_selection'); if (bk_color == '#ff0000') jWPDev('td.'+td_class + ' a').addClass('admin_calendar_selection'); jWPDev('td').removeClass('admin_calendar_selection'); if (bk_color == '#ff0000') jWPDev('td.'+td_class + '').addClass('admin_calendar_selection'); } // A D M I N Run this function at Admin side when click at Approve button function bookingApprove(is_delete, is_in_approved, user_id){ var checkedd = jWPDev(".booking_appr"+is_in_approved+":checked"); id_for_approve = ""; // get all IDs checkedd.each(function(){ var id_c = jWPDev(this).attr('id'); id_c = id_c.substr(13,id_c.length-13) id_for_approve += id_c + "|"; }); //delete last "|" id_for_approve = id_for_approve.substr(0,id_for_approve.length-1); var denyreason ; if (is_delete ==1) { if (is_in_approved==0) {denyreason= jWPDev('#denyreason').val();} else {denyreason= jWPDev('#cancelreason').val();} } else {denyreason = '';} if (id_for_approve!='') { var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ; var ajax_type_action=''; if (is_delete) {ajax_type_action = 'DELETE_APPROVE';var ajax_bk_message = 'Deleting...';} else {ajax_type_action = 'UPDATE_APPROVE';var ajax_bk_message = 'Updating...';}; document.getElementById('ajax_working').innerHTML = '
\n\
'+ajax_bk_message+'
\n\
\n\ \n\
\n\
'; var is_send_emeils = 1; var elm1 = document.getElementById("is_send_email_for_all"); if (elm1 != null) { is_send_emeils = jWPDev('#is_send_email_for_all').attr('checked' ); } else { if (is_in_approved==0) {is_send_emeils= jWPDev('#is_send_email_for_pending').attr('checked' ); } else {is_send_emeils= jWPDev('#is_send_email_for_aproved').attr('checked' ); } } if (is_send_emeils) is_send_emeils = 1; else is_send_emeils = 0; if (is_delete == 2 ) is_send_emeils = 0; jWPDev.ajax({ // Start Ajax Sending url: wpdev_ajax_path, type:'POST', success: function (data, textStatus){if( textStatus == 'success') jWPDev('#ajax_respond').html( data );}, error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://onlinebookingcalendar.com/faq/#faq-13');}}, // beforeSend: someFunction, data:{ ajax_action : ajax_type_action, approved : id_for_approve, is_in_approved : is_in_approved, is_send_emeils : is_send_emeils, denyreason: denyreason, user_id: user_id } }); return false; } return true; } // Send booking Cacel by visitor function bookingCancelByVisitor(booking_hash, bk_type){ if (booking_hash!='') { document.getElementById('submiting' + bk_type).innerHTML = '
'; var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ; var ajax_type_action='DELETE_BY_VISITOR'; jWPDev.ajax({ // Start Ajax Sending url: wpdev_ajax_path, type:'POST', success: function (data, textStatus){if( textStatus == 'success') jWPDev('#ajax_respond_insert' + bk_type).html( data ) ;}, error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://onlinebookingcalendar.com/faq/#faq-13');}}, // beforeSend: someFunction, data:{ ajax_action : ajax_type_action, booking_hash : booking_hash, bk_type : bk_type } }); return false; } return true; } // Scroll to script function makeScroll(object_name) { var targetOffset = jWPDev( object_name ).offset().top; jWPDev('html,body').animate({scrollTop: targetOffset}, 1000); } // Aftre reservation action is done function setReservedSelectedDates( bk_type ){ if (document.getElementById('calendar_booking'+bk_type) === null ) { document.getElementById("booking_form_div"+bk_type).style.display="none"; makeScroll('#booking_form'+bk_type); } else { var sel_dates = jWPDev('#calendar_booking'+bk_type).datepick('getDate'); for( var i =0; i '+ errorMessage +'
'); // Show message jWPDev(".wpdev-help-message") .css( {'color' : 'red'} ) .animate( {opacity: 1}, 10000 ) .fadeOut( 2000 ); // hide message element.focus(); // make focus to elemnt return; } var count = submit_form.elements.length; var formdata = ''; var inp_value; var element; // Serialize form here for (i=0; i