| @@ -154,9 +154,9 @@ | ||
| 154 | 154 | $this->add_control( |
| 155 | 155 | 'booking_hide_if_сhildrens_allowed_field', |
| 156 | 156 | [ |
| 157 | 157 | 'label' => esc_html__('Childrens allowed field hide', 'wpdirectorykit'), |
| 158 | - 'type' => Controls_Manager::SWITCHER, | |
| 158 | + 'type' => Controls_Manager::HIDDEN, | |
| 159 | 159 | 'none' => esc_html__('Yes', 'wpdirectorykit'), |
| 160 | 160 | 'block' => esc_html__('No', 'wpdirectorykit'), |
| 161 | 161 | 'return_value' => 'yes', |
| 162 | 162 | 'default' => '', |
| @@ -173,8 +173,20 @@ | ||
| 173 | 173 | 'return_value' => 'yes', |
| 174 | 174 | 'default' => '', |
| 175 | 175 | ] |
| 176 | 176 | ); |
| 177 | + | |
| 178 | + $this->add_control( | |
| 179 | + 'booking_hide_count_childs_field', | |
| 180 | + [ | |
| 181 | + 'label' => esc_html__('Hide booking field count childs', 'wpdirectorykit'), | |
| 182 | + 'type' => Controls_Manager::SWITCHER, | |
| 183 | + 'none' => esc_html__('Yes', 'wpdirectorykit'), | |
| 184 | + 'block' => esc_html__('No', 'wpdirectorykit'), | |
| 185 | + 'return_value' => 'yes', | |
| 186 | + 'default' => '', | |
| 187 | + ] | |
| 188 | + ); | |
| 177 | 189 | $this->end_controls_section(); |
| 178 | 190 | } |
| 179 | 191 | |
| 180 | 192 | /** |
| @@ -196,9 +208,9 @@ | ||
| 196 | 208 | foreach ($settings['form_fields'] as $field) { |
| 197 | 209 | |
| 198 | 210 | $field_name = ''; |
| 199 | 211 | |
| 200 | - if(empty($field['field_id'])) { | |
| 212 | + if(!empty($field['field_id'])) { | |
| 201 | 213 | $field_name = $field['field_id']; |
| 202 | 214 | } |
| 203 | 215 | |
| 204 | 216 | if(empty($field_name)) { |
| @@ -261,17 +273,24 @@ | ||
| 261 | 273 | </a></div>'; |
| 262 | 274 | } else { |
| 263 | 275 | $calendar = $calendar[0]; |
| 264 | 276 | |
| 265 | - if(intval(wdk_get_option('wdk_bookings_max_guests')) > 0) { | |
| 277 | + if(!empty($calendar->guests)) { | |
| 278 | + $options = range(1, intval($calendar->guests)); | |
| 279 | + } elseif(intval(wdk_get_option('wdk_bookings_max_guests')) > 0) { | |
| 266 | 280 | $options = range(1, intval(wdk_get_option('wdk_bookings_max_guests'))); |
| 267 | - } else { | |
| 281 | + } else { | |
| 268 | 282 | $options = range(1, 10); |
| 269 | 283 | } |
| 270 | 284 | |
| 271 | 285 | if(empty($calendar->is_guests_disabled)) { |
| 272 | 286 | |
| 273 | - $output ='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 50%;-webkit-flex: 0 0 50%;flex: 0 0 50%;">'; | |
| 287 | + if($settings['booking_hide_count_childs_field'] != 'yes' && !empty($calendar->is_children_acceptable) ) { | |
| 288 | + $output ='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 50%;-webkit-flex: 0 0 50%;flex: 0 0 50%;">'; | |
| 289 | + } else { | |
| 290 | + $output ='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;">'; | |
| 291 | + } | |
| 292 | + | |
| 274 | 293 | $output .='<select name="guests_number_adults" id="guests_number_adults" type="select" class="elementinvader_addons_for_elementor_f_field" value="'.wmvc_show_data('guests_number', $_GET).'">'; |
| 275 | 294 | $output .= '<option value="">'.esc_html__('Adults','wpdirectorykit').'</option>'; |
| 276 | 295 | foreach ($options as $key => $option){ |
| 277 | 296 | if(!next($options)) { |
| @@ -282,20 +301,23 @@ | ||
| 282 | 301 | } |
| 283 | 302 | $output .='</select> |
| 284 | 303 | </div>'; |
| 285 | 304 | |
| 286 | - $output .='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 50%;-webkit-flex: 0 0 50%;flex: 0 0 50%;">'; | |
| 287 | - $output .='<select name="guests_number_childs" id="guests_number_childs" type="select" class="elementinvader_addons_for_elementor_f_field" value="'.wmvc_show_data('guests_number', $_GET).'">'; | |
| 288 | - $output .= '<option value="">'.esc_html__('Childs','wpdirectorykit').'</option>'; | |
| 289 | - foreach ($options as $key => $option){ | |
| 290 | - if(!next($options)) { | |
| 291 | - $output .= '<option value="'.esc_attr($option).'+">'.esc_html($option).'+</option>'; | |
| 292 | - } else { | |
| 293 | - $output .= '<option value="'.esc_attr($option).'">'.esc_html($option).'</option>'; | |
| 305 | + if($settings['booking_hide_count_childs_field'] != 'yes' && !empty($calendar->is_children_acceptable)) { | |
| 306 | + $output .='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 50%;-webkit-flex: 0 0 50%;flex: 0 0 50%;">'; | |
| 307 | + $output .='<select name="guests_number_childs" id="guests_number_childs" type="select" class="elementinvader_addons_for_elementor_f_field" value="'.wmvc_show_data('guests_number', $_GET).'">'; | |
| 308 | + $output .= '<option value="">'.esc_html__('Childs','wpdirectorykit').'</option>'; | |
| 309 | + foreach ($options as $key => $option){ | |
| 310 | + if(!next($options)) { | |
| 311 | + $output .= '<option value="'.esc_attr($option).'+">'.esc_html($option).'+</option>'; | |
| 312 | + } else { | |
| 313 | + $output .= '<option value="'.esc_attr($option).'">'.esc_html($option).'</option>'; | |
| 314 | + } | |
| 294 | 315 | } |
| 295 | - } | |
| 296 | - $output .='</select> | |
| 297 | - </div>'; | |
| 316 | + $output .='</select> | |
| 317 | + </div>'; | |
| 318 | + } | |
| 319 | + | |
| 298 | 320 | $this->content ['wlisting_fields'] .= $output; |
| 299 | 321 | } |
| 300 | 322 | |
| 301 | 323 | |
| @@ -343,9 +365,9 @@ | ||
| 343 | 365 | |
| 344 | 366 | foreach ($calendar_fees as $fee) { |
| 345 | 367 | if(!wmvc_show_data('is_activated', $fee, false,TRUE,TRUE)) continue; |
| 346 | 368 | |
| 347 | - $field = str_replace(' ','_',strtolower(esc_html(wmvc_show_data('title', $fee,'-',TRUE,TRUE)))); | |
| 369 | + $field = wdk_generate_slug(strtolower(esc_html(wmvc_show_data('title', $fee,'-',TRUE,TRUE)))); | |
| 348 | 370 | |
| 349 | 371 | $readonly = ''; |
| 350 | 372 | if(wmvc_show_data('is_required', $fee, false,TRUE,TRUE)) { |
| 351 | 373 | $readonly = 'readonly disabled'; |
| @@ -361,19 +383,9 @@ | ||
| 361 | 383 | } |
| 362 | 384 | } |
| 363 | 385 | } |
| 364 | 386 | |
| 365 | - if($settings['booking_hide_if_сhildrens_allowed_field'] != 'yes') { | |
| 366 | - $this->content ['wlisting_fields'] .='<div class="elementinvader_addons_for_elementor_f_group checkbox elementinvader_addons_for_elementor_f_group_el_сhildrens" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;"> | |
| 367 | - <label for="сhildrens_allowed"> | |
| 368 | - <input name="сhildrens_allowed" id="сhildrens_allowed" type="checkbox" class="elementinvader_addons_for_elementor_f_field_checkbox" value="yes" placeholder="'.esc_attr__('Childrens allowed ','wpdirectorykit').'" > | |
| 369 | - '.esc_html__('Childrens ','wpdirectorykit').' | |
| 370 | - </label> | |
| 371 | - </div>'; | |
| 372 | - } | |
| 373 | - | |
| 374 | - | |
| 375 | - if ($settings['booking_hide_if_pets_allowed_field'] != 'yes') { | |
| 387 | + if ($settings['booking_hide_if_pets_allowed_field'] != 'yes' && wmvc_show_data('is_pets_acceptable',$calendar, false)) { | |
| 376 | 388 | $this->content ['wlisting_fields'] .='<div class="elementinvader_addons_for_elementor_f_group checkbox elementinvader_addons_for_elementor_f_group_el_pets" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;"> |
| 377 | 389 | <label for="pets_allowed"> |
| 378 | 390 | <input name="pets_allowed" id="pets_allowed" type="checkbox" class="elementinvader_addons_for_elementor_f_field_checkbox" value="yes" placeholder="'.esc_attr__('Pets allowed', 'wpdirectorykit').'" > |
| 379 | 391 | '.esc_html__('Pets', 'wpdirectorykit').' |