1var list_booking_id_for_show = []; 2var prices_per_day = []; 3var cost_curency = ''; 4var wpbc_curency_symbol = '$'; 5 6var wpdev_bk_weekday_conditions_for_range_selection = []; 7var wpdev_bk_seasons_conditions_for_range_selection = []; 8var wpdev_bk_seasons_conditions_for_start_day = []; 9var bk_2clicks_mode_days_selection__saved_variables = []; // Saved initial values of varibales: bk_2clicks_mode_days_specific , bk_2clicks_mode_days_min, bk_2clicks_mode_days_max 10 11 12 13function wpbc_delete_custom_booking_form( form_name, user_id ){ 14 15 wpbc_admin_show_message_processing( 'deleting' ); 16 17 jQuery.ajax({ // Start Ajax Sending 18 url: wpbc_ajaxurl, 19 type:'POST', 20 success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );}, 21 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:' + ' https://wpbookingcalendar.com/faq/#ajax-sending-error');}}, 22 // beforeSend: someFunction, 23 data:{ 24 action : 'DELETE_BK_FORM', 25 formname : form_name, 26 user_id: user_id, 27 wpbc_nonce: document.getElementById('wpbc_admin_panel_nonce').value 28 } 29 }); 30 return false; 31} 32 33 34 35function changeBookingForm(selectObj){ 36 37 var idx = selectObj.selectedIndex; 38 var my_form = selectObj.options[idx].value; 39 40 var loc = location.href; 41 if (loc.substr((loc.length-1),1)=='#') { 42 loc = loc.substr(0,(loc.length-1) ); 43 } 44 45 if ( loc.indexOf('booking_form=') == -1 ) { 46 loc = loc + '&booking_form=' +my_form;} 47 else { // Alredy have this paremeter at URL 48 var start = loc.indexOf('&booking_form='); 49 var fin = loc.indexOf('&', (start+15)); 50 if (fin == -1) {loc = loc.substr(0,start) + '&booking_form=' +my_form;} // at the end of row 51 else { // at the middle of the row 52 var loc1 = loc.substr(0,start) + '&booking_form=' +my_form;//alert(loc) 53 loc = loc1 + loc.substr(fin); 54 } 55 } 56 location.href = loc; 57 58} 59 60 61function changeFilter(selectObj){ 62 var idx = selectObj.selectedIndex; 63 // get the value of the selected option 64 var which = selectObj.options[idx].value; 65 var loc = location.href; 66 if ( loc.indexOf('sybtypefilter=') == -1 ) { 67 loc = location.href + '&sybtypefilter=' +which;} 68 else { // Alredy have this paremeter at URL 69 var start = loc.indexOf('&sybtypefilter='); 70 var fin = loc.indexOf('&', (start+15)); 71 if (fin == -1) {loc = loc.substr(0,start) + '&sybtypefilter=' +which;} // at the end of row 72 else { // at the middle of the row 73 var loc1 = loc.substr(0,start) + '&sybtypefilter=' +which;//alert(loc) 74 loc = loc1 + loc.substr(fin); 75 } 76 } 77 location.href = loc; 78} 79 80 81function filterBookingRowsApply(){ 82 // alert(list_booking_id_for_show); 83 var hide_bk_rows, h, m, s; 84 hide_bk_rows = []; 85 for(var i=0; i<list_booking_id_for_show.length;i++){ 86 if (list_booking_id_for_show[i] == 'hide') { 87 hide_bk_rows[hide_bk_rows.length] = 'booking_row'+i; 88 jQuery('#booking_appr_'+ i).removeClass('booking_appr0'); 89 jQuery('#booking_appr_'+ i).removeClass('booking_appr1'); 90 jQuery('#booking_row'+i).hide(); 91 } 92 // alert(i + ' ' + list_booking_id_for_show[i]) 93 } 94 // alert(hide_bk_rows); 95} 96 97if (location.href.indexOf( 'sybtypefilter=') > 0 ) jQuery(document).ready(filterBookingRowsApply); 98 99function setavailabilitycontent(contnt){ 100 document.getElementById('selectword').innerHTML = contnt; 101} 102 103 104function is_this_day_available( date, bk_type){ //TODO continue here according time 105 106 function in_array(what, where) { 107 var a=false; 108 for(var i=0; i<where.length; i++) { 109 if(what == where[i]) { 110 a=true; 111 break; 112 } 113 } 114 return a; 115 } 116 117 var filters_cnt = avalaibility_filters[ bk_type ].length; 118 var filter_week_days = []; 119 var filter_days = []; 120 var filter_monthes = []; 121 var filter_years = []; 122 123 var d_w = date.getDay(); 124 var d_m = ( date.getMonth()+1 ); 125 var d_d = date.getDate(); 126 var d_y = date.getFullYear(); 127//alert(date+ ' ' +d_w+ ' ' +d_m+ ' ' +d_d+ ' ' +d_y); 128 var is_day_inside_filters = 0; 129 130 var filter_id = 0; //FixIn: 6.0.1.8 131 132 for(var k=0; k<filters_cnt; k++ ) { 133 134 if ( ((typeof(avalaibility_filters[ bk_type ][k][0]) == 'object')) && (avalaibility_filters[ bk_type ][k][0][0] === "2.0")) { // Version 2.0 of Filters 135 136 if ( avalaibility_filters[ bk_type ][k].length > 2 ) //FixIn: 6.0.1.8 137 filter_id = avalaibility_filters[ bk_type ][k][2]; 138 139 is_day_inside_filters = ''; 140 filter_days = avalaibility_filters[ bk_type ][k][1]; 141 if ( in_array( (d_y +'-'+ d_m +'-'+ d_d) , filter_days ) ) { 142 is_day_inside_filters = 'week day month year '; 143 break; 144 } 145 146 } else { 147 filter_week_days = avalaibility_filters[ bk_type ][k][0]; 148 filter_days = avalaibility_filters[ bk_type ][k][1]; 149 filter_monthes = avalaibility_filters[ bk_type ][k][2]; 150 filter_years = avalaibility_filters[ bk_type ][k][3]; 151 152 if ( avalaibility_filters[ bk_type ][k].length > 4 ) //FixIn: 6.0.1.8 153 filter_id = avalaibility_filters[ bk_type ][k][4]; 154 155 is_day_inside_filters = ''; 156 if ( in_array( d_w , filter_week_days ) ) {is_day_inside_filters += 'week ';} 157 if ( in_array( d_d , filter_days ) ) {is_day_inside_filters += 'day ';} 158 if ( in_array( d_m , filter_monthes ) ) {is_day_inside_filters += 'month ';} 159 if ( in_array( d_y , filter_years ) ) {is_day_inside_filters += 'year ';} 160 161 if (is_day_inside_filters == 'week day month year ') {break;} // the days is apply to filter (apply to week days monthes and years of filter) 162 } 163 } 164 165 if (is_day_inside_filters == 'week day month year ') {is_day_inside_filters = true;} else {is_day_inside_filters = false;} 166 167 var is_this_day_available = true; 168 169 if (is_day_inside_filters) { 170 if ( is_all_days_available[ bk_type ] ) is_this_day_available = false;
171 else is_this_day_available = true; 172 } else { 173 if ( is_all_days_available[ bk_type ] ) is_this_day_available = true; 174 else is_this_day_available = false; 175 } 176 177 return [ is_this_day_available, filter_id ]; //FixIn: 6.0.1.8 178} 179 180 181 182 183function getDayPrice4Show(bk_type, tooltip_time, td_class){ 184 185 if (is_show_cost_in_tooltips) { 186 187 if(typeof( prices_per_day[bk_type] ) !== 'undefined') 188 if(typeof( prices_per_day[bk_type][td_class] ) !== 'undefined') { 189 if (tooltip_time!== '') tooltip_time = tooltip_time + '<br/>'; 190 // return tooltip_time + cost_curency + prices_per_day[bk_type][td_class] ; 191 switch( bk_currency_pos ) { //FixIn: 7.0.1.49 192 case 'left': 193 return tooltip_time + cost_curency + wpbc_curency_symbol + prices_per_day[bk_type][td_class]; 194 case 'right': 195 return tooltip_time + cost_curency + prices_per_day[bk_type][td_class] + wpbc_curency_symbol; 196 case 'left_space': 197 return tooltip_time + cost_curency + wpbc_curency_symbol + ' ' + prices_per_day[bk_type][td_class]; 198 case 'right_space': 199 return tooltip_time + cost_curency + prices_per_day[bk_type][td_class] + ' ' + wpbc_curency_symbol; 200 default: 201 return tooltip_time + cost_curency + wpbc_curency_symbol + prices_per_day[bk_type][td_class]; 202 } 203 204 } 205 206 } 207 208 return tooltip_time ; 209 210} 211 212 213 214// Admin panel - Add additional row with cost, which is depends from number of selected days 215function addRowForCustomizationCostDependsFromNumSellDays(row__id) { 216 jQuery('#cost_days_row_help'+row__id ).html( getRowForCustomizationCostDependsFromNumSellDays(row__id)) ; 217} 218function getRowForCustomizationCostDependsFromNumSellDays(row__id) { 219 return '<select name="cost_apply_to'+row__id+'" id="cost_apply_to'+row__id+'" style="width:220px;padding:3px 1px 1px 1px !important;" >\n\ 220 <option value="%">'+bk_cost_depends_from_selection_line2+'</option>\n\ 221 <option value="fixed">'+bk_cost_depends_from_selection_line1+'</option>\n\ 222 <option value="add">'+bk_cost_depends_from_selection_line3+'</option>\n\ 223 </select>'; 224} 225 226function addRowForCustomizationCostDependsFromNumSellDays4Summ(row__id) { 227 jQuery('#cost_days_row_help'+row__id ).html( getRowForCustomizationCostDependsFromNumSellDays4Summ(row__id)) ; 228} 229function getRowForCustomizationCostDependsFromNumSellDays4Summ(row__id) { 230 return '<select name="cost_apply_to'+row__id+'" id="cost_apply_to'+row__id+'" style="width:220px;padding:3px 1px 1px 1px !important;" >\n\ 231 <option value="%">'+bk_cost_depends_from_selection_line24summ+'</option>\n\ 232 <option value="fixed">'+bk_cost_depends_from_selection_line14summ+'</option>\n\ 233 </select>'; 234} 235 236 237function setBookingFormElementsWheelScroll(bk_type){ 238 239 var submit_form = document.getElementById('booking_form' + bk_type ); 240 var element; 241 var i; 242 var count; 243 var wpbc_loader_icon = '<span class="wpbc_ajax_loader"><img style="vertical-align:middle;box-shadow:none;width:14px;" src="' + wpdev_bk_plugin_url + '/assets/img/ajax-loader.gif"><//span>'; 244 //var wpbc_loader_icon = '<span class="wpbc_ajax_loader wpdevelop"><span class="wpbc_icn_rotate_left wpbc_spin wpbc_ajax_icon" aria-hidden="true"><//span><//span>'; 245 246 if ( submit_form != null ) { 247 248 count = submit_form.elements.length; 249 250 for ( i = 0; i < count; i++ ) { 251 element = submit_form.elements[i]; 252 // Calculation in process ... 253 jQuery('#bookinghint_' + element.id + ',.bookinghint_' + element.id ).html( wpbc_loader_icon ); 254 } 255 } 256} 257 258 259function getBookingFormElements(bk_type){ 260 261 var submit_form = document.getElementById('booking_form' + bk_type ); 262 var formdata = ''; 263 264 if (submit_form != null) { 265 var count = submit_form.elements.length; 266 var inp_value; 267 var element; 268 var el_type; 269 // Serialize form here 270 for (var i=0; i<count; i++) { 271 element = submit_form.elements[i]; 272 273 if ( (element.type !=='button') && (element.type !=='hidden') && ( element.name !== ('date_booking' + bk_type) ) ) { // Skip buttons and hidden element - type 274 275 // Get Element Value 276 if ( element.type == 'checkbox' ){ 277 278 if (element.value == '') { 279 inp_value = element.checked; 280 } else { 281 if (element.checked) inp_value = element.value; 282 else inp_value = ''; 283 } 284 285 } else if ( element.type == 'radio' ) { 286 287 if (element.checked) inp_value = element.value; 288 else continue; 289 290 } else { 291 inp_value = element.value; 292 } 293 294 // Get value in selectbox of multiple selection 295 if (element.type =='select-multiple') { 296 inp_value = jQuery('[name="'+element.name+'"]').val() ; 297 if (( inp_value == null ) || (inp_value.toString() == '' )) 298 inp_value=''; 299 } 300 301 302 if ( element.name !== ('captcha_input' + bk_type) ) { 303 if (formdata !=='') formdata += '~'; // next field element 304 305 el_type = element.type; 306 if ( element.className.indexOf('wpdev-validates-as-email') !== -1 ) el_type='email'; 307 if ( element.className.indexOf('wpdev-validates-as-coupon') !== -1 ) el_type='coupon'; 308 309 formdata += el_type + '^' + element.name + '^' + inp_value ; // element attr 310 } 311 } 312 } 313 } 314 return formdata; 315 316} 317 318 319function showCostHintInsideBkForm( bk_type ){ 320 321 // if ( ! jQuery( '#calendar_booking' + bk_type ).length ) //FixIn:6.1.1.16 //FixIn: 8.2.1.13 322 // return false; 323
324 //////////////////////////////////////////////////////////////////// 325 326 // Disable updating cost hint during first click, if range days selection with 2 mouse clicks is active 327 // if ( jQuery('#booking_form_div'+bk_type+' input[type="button"]').prop('disabled' ) ) { 328 // return; 329 // } 330 331 //////////////////////////////////////////////////////////////////// 332 333 // submit_bk_color = jQuery('#booking_form_div'+bk_type+' input[type="button"]').css('color'); 334 // jQuery('#booking_form_div'+bk_type+' input[type="button"]').attr('disabled', 'disabled'); // Disable the submit button 335 // jQuery('#booking_form_div'+bk_type+' input[type="button"]').css('color', '#aaa'); 336 337 //////////////////////////////////////////////////////////////////// 338 339 if (document.getElementById('parent_of_additional_calendar' + bk_type) != null) { // Its mean that we get cost hint clicking at additional calendar 340 bk_type = document.getElementById('parent_of_additional_calendar' + bk_type).value; // Get parent bk type from additional calendar 341 } 342 343 // if (document.getElementById('booking_hint' + bk_type) == null) return false; 344 345 346 var all_dates = jQuery('#date_booking' + bk_type).val(); 347 var formdata = getBookingFormElements(bk_type); 348 349 setBookingFormElementsWheelScroll( bk_type ); 350 351 var wpbc_loader_icon = '<span class="wpbc_ajax_loader"><img style="vertical-align:middle;box-shadow:none;width:14px;" src="' + wpdev_bk_plugin_url + '/assets/img/ajax-loader.gif"><//span>'; 352 //var wpbc_loader_icon = '<span class="wpbc_ajax_loader wpdevelop"><span class="wpbc_icn_rotate_left wpbc_spin wpbc_ajax_icon" aria-hidden="true"><//span><//span>'; 353 354 // Calculation in process ... 355 jQuery('#booking_hint' + bk_type + ',.booking_hint' + bk_type ).html( wpbc_loader_icon ); 356 //FixIn: 8.4.2.1 357 jQuery('#estimate_booking_day_cost_hint' + bk_type + ',.estimate_booking_day_cost_hint' + bk_type ).html( wpbc_loader_icon ); 358 //FixIn: 8.4.4.7 359 jQuery('#estimate_booking_night_cost_hint' + bk_type + ',.estimate_booking_night_cost_hint' + bk_type ).html( wpbc_loader_icon ); 360 jQuery('#additional_booking_hint' + bk_type + ',.additional_booking_hint' + bk_type ).html( wpbc_loader_icon ); 361 jQuery('#original_booking_hint' + bk_type + ',.original_booking_hint' + bk_type ).html( wpbc_loader_icon ); 362 jQuery('#deposit_booking_hint' + bk_type + ',.deposit_booking_hint' + bk_type ).html( wpbc_loader_icon ); 363 jQuery('#coupon_discount_booking_hint' + bk_type + ',.coupon_discount_booking_hint' + bk_type ).html( wpbc_loader_icon ); 364 jQuery('#balance_booking_hint' + bk_type + ',.balance_booking_hint' + bk_type ).html( wpbc_loader_icon ); 365 366 // Dates and Times shortcodes 367 jQuery('#check_in_date_hint_tip' + bk_type + ',.check_in_date_hint_tip' + bk_type ).html( wpbc_loader_icon ); 368 jQuery('#check_out_date_hint_tip' + bk_type + ',.check_out_date_hint_tip' + bk_type ).html( wpbc_loader_icon ); 369 jQuery('#check_out_plus1day_hint_tip' + bk_type + ',.check_out_plus1day_hint_tip' + bk_type ).html( wpbc_loader_icon ); //FixIn: 8.0.2.12 370 371 jQuery('#start_time_hint_tip' + bk_type + ',.start_time_hint_tip' + bk_type ).html( wpbc_loader_icon ); 372 jQuery('#end_time_hint_tip' + bk_type + ',.end_time_hint_tip' + bk_type ).html( wpbc_loader_icon ); 373 jQuery('#selected_dates_hint_tip' + bk_type + ',.selected_dates_hint_tip' + bk_type ).html( wpbc_loader_icon ); 374 jQuery('#selected_timedates_hint_tip' + bk_type + ',.selected_timedates_hint_tip' + bk_type ).html( wpbc_loader_icon ); 375 jQuery('#selected_short_dates_hint_tip' + bk_type + ',.selected_short_dates_hint_tip' + bk_type ).html( wpbc_loader_icon ); 376 jQuery('#selected_short_timedates_hint_tip' + bk_type + ',.selected_short_timedates_hint_tip' + bk_type ).html( wpbc_loader_icon ); 377 jQuery('#days_number_hint_tip' + bk_type + ',.days_number_hint_tip' + bk_type ).html( wpbc_loader_icon ); 378 jQuery('#nights_number_hint_tip' + bk_type + ',.nights_number_hint_tip' + bk_type ).html( wpbc_loader_icon ); 379 380 // Check if calendar exist ( for booking form ONLY shortcode) //FixIn: 8.3.3.11 381 if ( undefined != document.getElementById( 'calendar_booking' + bk_type ) ){ 382 383 // Prevent of showing any hints, if selected only Check In day if we are using range days selection mode using 2 mou
383se clicks 384 if ( bk_days_selection_mode == 'dynamic' ){ //FixIn: 5.4.3 385 var inst = jQuery.datepick._getInst( document.getElementById( 'calendar_booking' + bk_type ) ); 386 if ( typeof(inst) !== 'undefined' ) //FixIn: 6.1.1.16 387 388 var is_show_cost_after_first_click; //FixIn: 8.4.2.6 389 if ( 1 == bk_2clicks_mode_days_min ) { //FixIn: 8.7.6.6 390 is_show_cost_after_first_click = true; 391 } else { 392 is_show_cost_after_first_click = false; 393 } 394 395 if ( ( inst.stayOpen == true ) && ( ! is_show_cost_after_first_click ) ) { 396 397 // Comment these 2 lines, if we need to show cost hints, if selected only 1 day 398 jQuery( '.wpbc_ajax_loader' ).html( '...' ); 399 //jQuery('#selected_short_timedates_hint_tip' + bk_type).html('Please click on check out day to finish days selection'); 400 return false; 401 } 402 } 403 } 404 var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename; 405 var ajax_type_action='CALCULATE_THE_COST'; 406 var my_booking_form=''; 407 if (document.getElementById('booking_form_type' + bk_type) != undefined) 408 my_booking_form =document.getElementById('booking_form_type' + bk_type).value; 409 410 411 jQuery.ajax({ // Start Ajax Sending 412 // url: wpdev_ajax_path, 413 url: wpbc_ajaxurl, 414 type:'POST', 415 success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond_insert' + bk_type).html( data ) ;}, 416 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:' + ' https://wpbookingcalendar.com/faq/#ajax-sending-error');}}, 417 // beforeSend: someFunction, 418 data:{ 419 action: ajax_type_action, 420 // ajax_action : ajax_type_action, 421 form: formdata, 422 all_dates : all_dates, 423 bk_type : bk_type, 424 booking_form_type:my_booking_form, 425 wpdev_active_locale:wpbc_active_locale, 426 wpbc_nonce: document.getElementById('wpbc_nonce'+ ajax_type_action + bk_type).value 427 } 428 }); 429 jQuery( ".booking_form_div" ).trigger( "show_cost_hints" , [ bk_type ] ); //FixIn:7.0.1.53 430 return false; 431} 432 433var temp_click_mode_days_start = []; 434 435function check_conditions_for_start_day_selection(bk_type, selceted_first_day, is_start){ 436 437 if (is_start == 'start') { 438 temp_click_mode_days_start = []; 439 440 441 // S E A S O N C O N D I T I O N S 442 if ( wpdev_bk_seasons_conditions_for_start_day.length > 0 ) 443 if ( typeof( wpdev_bk_seasons_conditions_for_start_day[bk_type] ) != 'undefined' ) 444 if ( wpdev_bk_seasons_conditions_for_start_day[bk_type].length > 0 ) { 445 446 var class_day = (selceted_first_day.getMonth()+1) + '-' + selceted_first_day.getDate() + '-' + selceted_first_day.getFullYear(); 447 if (jQuery('#calendar_booking'+bk_type+' .datepick-days-cell.cal4date-'+class_day).length <= 0) return; // This date is not exist 448 var calendarDateClassList =jQuery('#calendar_booking'+bk_type+' .datepick-days-cell.cal4date-'+class_day).attr('class').split(/\s+/); 449 450 // Check for the Season filters conditions for the range days selection 451 jQuery.each( calendarDateClassList, function(index, singleClassCSS){ 452 453 // S E A S O N F I L T E R C O N D I T I O N S - checking 454 if ( singleClassCSS.indexOf("wpdevbk_season_") >= 0 ) { 455 456 singleClassCSS = singleClassCSS.replace('wpdevbk_season_', ''); 457 458 jQuery.each( wpdev_bk_seasons_conditions_for_start_day[bk_type], function(ind, seasons_condition){ 459 if ( (singleClassCSS == seasons_condition[0] ) && ( temp_click_mode_days_start.length == 0 ) ){ 460 temp_click_mode_days_start = [bk_2clicks_mode_days_start, bk_1click_mode_days_start]; 461 bk_2clicks_mode_days_start = seasons_condition[1] ; 462 bk_1click_mode_days_start = seasons_condition[1]; 463 } 464 }); 465 } 466 }); 467 468 } 469 470 } 471 472 if (is_start == 'end') { 473 if ( temp_click_mode_days_start.length > 0 ) { 474 bk_2clicks_mode_days_start = temp_click_mode_days_start[0]; 475 if ( temp_click_mode_days_start.length > 1 ) { 476 bk_1click_mode_days_start = temp_click_mode_days_start[1]; 477 temp_click_mode_days_start = []; 478 } 479 } 480 } 481} 482 483// TODO:3 Interface in the popup dialog for possibility to enter these conditions 484// TODO:5 Refactoring structure 485function check_conditions_for_range_days_selection(all_dates, bk_type){ 486 487 if ( ( bk_days_selection_mode != 'dynamic') && 488 ( bk_days_selection_mode != 'fixed') ) return false; // This conditional logic is possible only if the rnage days selection using 2 mou
488se clicks is activated 489 if (all_dates == '') return false; // If no days selections so then skip all. 490 491 if ( typeof(all_dates) == 'object' ) { // H I G H L I G H T // If this paramater is object (Date), so its mean that we are highlight the dates 492 var selceted_first_day = all_dates; 493 all_dates = document.getElementById('date_booking'+bk_type).value; // Get dates from the textarea date booking to '' 494 if (all_dates != '') { // If some date is selected 495 var first_date = get_first_day_of_selection(all_dates); // So we are DO NOT MAKE chnaging of highlighting if its was first click. 496 var last_date = get_last_day_of_selection(all_dates); 497 if ( (bk_days_selection_mode != 'fixed') && (first_date == last_date) ){ //FixIn: 8.4.4.8 498 return false; 499 } 500 } 501 } else { // S E L E C T 502 var first_date = get_first_day_of_selection(all_dates); 503 var last_date = get_last_day_of_selection(all_dates); 504 if ( first_date != last_date ) return false; // We are clicked second time 505 var date_sections = first_date.split("."); 506 var selceted_first_day = new Date; 507 selceted_first_day.setFullYear( parseInt(date_sections[2]-0) ,parseInt(date_sections[1]-1), parseInt(date_sections[0]-0) ); 508 } 509 510 511 check_conditions_for_range_days_selection_for_check_in(selceted_first_day, bk_type); 512} 513 514function check_conditions_for_range_days_selection_for_check_in(selceted_first_day, bk_type){ 515 516 517 if ( bk_2clicks_mode_days_selection__saved_variables.length == 0) { // Saved ONLY ONCE initial values of varibales: bk_2clicks_mode_days_specific , bk_2clicks_mode_days_min, bk_2clicks_mode_days_max 518 bk_2clicks_mode_days_selection__saved_variables = [ bk_2clicks_mode_days_specific, 519 bk_2clicks_mode_days_min, 520 bk_2clicks_mode_days_max, 521 bk_1click_mode_days_num 522 ]; 523 } 524 525 var is_condition_applied = false; 526 527 // S E A S O N C O N D I T I O N S 528 if ( wpdev_bk_seasons_conditions_for_range_selection.length > 0 ) 529 if ( typeof( wpdev_bk_seasons_conditions_for_range_selection[bk_type] ) != 'undefined' ) 530 if ( wpdev_bk_seasons_conditions_for_range_selection[bk_type].length > 0 ) { 531 532 var class_day = (selceted_first_day.getMonth()+1) + '-' + selceted_first_day.getDate() + '-' + selceted_first_day.getFullYear(); 533 if (jQuery('#calendar_booking'+bk_type+' .datepick-days-cell.cal4date-'+class_day).length <= 0) return; // This date is not exist 534 var calendarDateClassList =jQuery('#calendar_booking'+bk_type+' .datepick-days-cell.cal4date-'+class_day).attr('class').split(/\s+/); 535 536 // Check for the Season filters conditions for the range days selection 537 jQuery.each( calendarDateClassList, function(index, singleClassCSS){ 538 539 // S E A S O N F I L T E R C O N D I T I O N S - checking 540 if ( singleClassCSS.indexOf("wpdevbk_season_") >= 0 ) { 541 542 singleClassCSS = singleClassCSS.replace('wpdevbk_season_', ''); 543 544 jQuery.each( wpdev_bk_seasons_conditions_for_range_selection[bk_type], function(ind, seasons_condition){ 545 if (singleClassCSS == seasons_condition[0] ) { 546 bk_2clicks_mode_days_specific = seasons_condition[1] ; 547 bk_2clicks_mode_days_min = seasons_condition[1][0]; 548 bk_2clicks_mode_days_max = seasons_condition[1][ (seasons_condition[1].length-1) ]; 549 bk_1click_mode_days_num = seasons_condition[1][0]; 550 is_condition_applied = true; 551 } 552 }); 553 } 554 }); 555 556 } 557 558 559 // W E E K D A Y S C O N D I T I O N S 560 if ( wpdev_bk_weekday_conditions_for_range_selection.length > 0 ) 561 if ( typeof( wpdev_bk_weekday_conditions_for_range_selection[bk_type] ) != 'undefined' ) 562 if ( wpdev_bk_weekday_conditions_for_range_selection[bk_type].length > 0 ) { 563 564 // Check for the WEEK DAY filters conditions for the range days selection 565 jQuery.each( wpdev_bk_weekday_conditions_for_range_selection[bk_type], function(ind, weekday_condition){ 566 if ( selceted_first_day.getDay() == weekday_condition[0] ) { 567 bk_2clicks_mode_days_specific = weekday_condition[1] ; 568 bk_2clicks_mode_days_min = weekday_condition[1][0]; 569 bk_2clicks_mode_days_max = weekday_condition[1][ (weekday_condition[1].length-1) ]; 570 bk_1click_mode_days_num = weekday_condition[1][0]; 571 is_condition_applied = true; 572 } 573 }); 574 } 575 576 if ( is_condition_applied == false ) { 577 // Reset to the global initial conditions 578 bk_2clicks_mode_days_specific = bk_2clicks_mode_days_selection__saved_variables[0]; 579 bk_2clicks_mode_days_min = bk_2clicks_mode_days_selection__saved_variables[1]; 580 bk_2clicks_mode_days_max = bk_2clicks_mode_days_selection__saved_variables[2]; 581 bk_1click_mode_days_num = bk_2clicks_mode_days_selection__saved_variables[3]; 582 } 583} 584 585 586function wpdevbk_get_selected_checkboxes_id(my_link, my_parameter, my_current_id, my_checkboxes){ 587 588 var all_selected_id = my_current_id + ','; 589 590 // Get all selecyed IDs 591 jQuery(my_checkboxes).each(function () { 592 if (this.checked) { 593 if (jQuery(this).val() != my_current_id ) 594 all_selected_id += jQuery(this).val() + ','; 595 } 596 }); 597 598 // Remove last "," 599 all_selected_id = all_selected_id.substring(0,(all_selected_id.length-1) ); 600 601 window.location.href= my_link + '&' + my_parameter + '=' + all_selected_id ; 602} 603 604 605/** 606 * Get daily cost for specific date 607 * 608 * usually used for showing daily cost in bottom of calendar date cell 609 * 610 * @param param_calendar_id {string} ID of calendar - booking resource 611 * @param my_thisDateTime {Date} JavaScript date 612 * @returns {string} Cost - formatted - like "$ 95.99" 613 */
614function wpbc_show_day_cost_in_date_bottom( param_calendar_id, my_thisDateTime ) { 615 616 if( typeof( is_show_cost_in_date_cell ) !== 'undefined' ) 617 if ( is_show_cost_in_date_cell ) { 618 var my_calendar_id = param_calendar_id; 619 my_calendar_id = parseInt( my_calendar_id.replace("calendar_booking","") ); 620 621 var my_day = new Date(my_thisDateTime); 622 623 my_day = parseInt( my_day.getMonth() + 1 ) + '-' + parseInt( my_day.getDate() ) + '-' + parseInt( my_day.getFullYear() ); 624 625 if(typeof( prices_per_day[my_calendar_id] ) !== 'undefined') 626 if(typeof( prices_per_day[my_calendar_id][my_day] ) !== 'undefined') { 627 628 switch( bk_currency_pos ) { //FixIn: 7.0.1.49 629 case 'left': 630 return wpbc_curency_symbol + prices_per_day[ my_calendar_id ][ my_day ]; 631 case 'right': 632 return prices_per_day[ my_calendar_id ][ my_day ] + wpbc_curency_symbol; 633 case 'left_space': 634 return wpbc_curency_symbol + ' ' + prices_per_day[ my_calendar_id ][ my_day ]; 635 case 'right_space': 636 return prices_per_day[ my_calendar_id ][ my_day ] + ' ' + wpbc_curency_symbol; 637 default: 638 return wpbc_curency_symbol + prices_per_day[ my_calendar_id ][ my_day ]; 639 } 640 } 641 } 642 return ''; 643 644 /** 645 '$' dollar symbol 646 '£' Pound 647 '¥' Yen 648 '€' Euro symbol 649 */ 650} 651 652 653/** 654 * Define additional booking details to tooltip 655 * 656 * @param bk_type int - booking resource ID: 12 657 * @param td_class string - date: '4-24-2018' 658 * @param times_array int - end time in minutes: 390 (which is equal to 06:30) 659 * @returns {string} 660 */ 661function wpbc_get_additional_info_for_tooltip( bk_type , td_class , times_array ){ //FixIn: 8.1.3.15 662 663// console.log(bk_type , td_class , times_array); // show in console when mouse over 664 665 if ( ( bk_show_info_in_form == undefined ) || ( ! bk_show_info_in_form ) ) 666 return ''; 667 668 var return_variable = ' <span class=\"wpbc_calendar_tooltip_booking_details\">'; 669 670 if ( undefined != dates_additional_info[ bk_type ] ){ 671 if ( undefined != dates_additional_info[ bk_type ][ td_class ] ){ 672 if ( undefined != dates_additional_info[ bk_type ][ td_class ][ times_array ] ){ 673 return_variable += dates_additional_info[ bk_type ][ td_class ][ times_array ]; 674 } 675 } 676 } 677 678 return_variable += '</span>' 679 680 return return_variable; 681}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.