PageSourceSearch

https://www.houston-corporate-housing.com/wp-content/themes/wprentals/js/ajaxcalls_add.js?ver=1.0.1615624125

js houston-corporate-housing.com collected 2026-10-05 21:11:17 UTC 60,640 bytes, 1,503 lines download raw bytes

1/*global $, jQuery, ajaxcalls_vars, document, control_vars, window, control_vars, submit_change,timeConverter, ajaxcalls_add_vars, dashboard_vars, google, wprentals_google_fillInAddress, check_booking_valability_internal, mark_as_booked_actions*/
2jQuery(document).ready(function ($) {
3    "use strict";
4    
5    $('#allinone_set_custom').click(function(event){
6        
7        $('#allinone_set_custom').text(ajaxcalls_vars.saving);   
8        if (jQuery('#block_dates').is(':checked')  ){
9            check_booking_valability_internal_allinone();
10        }else{
11            wpestate_allinone_owner_insert_customprice_internal();
12        }
13        
14    });
15    
16
17    
18    function    wpestate_allinone_owner_insert_customprice_internal(){
19        var   period_extra_price_per_guest, period_price_per_weekeend, period_checkin_change_over, period_checkin_checkout_change_over, period_min_days_booking,start_from, end_to, listing_edit, new_price, ajaxurl;
20        
21        start_from      =   jQuery('#start_date_owner_book').val();
22        end_to          =   jQuery('#end_date_owner_book').val();
23        listing_edit    =   jQuery('#property_id').val();
24        new_price       =   jQuery('#new_custom_price').val();
25        period_min_days_booking             =   jQuery('#period_min_days_booking').val();
26        period_extra_price_per_guest        =   jQuery('#period_extra_price_per_guest').val();
27        period_price_per_weekeend           =   jQuery('#period_price_per_weekeend').val();
28        period_checkin_change_over          =   jQuery('#period_checkin_change_over').val();
29        period_checkin_checkout_change_over =   jQuery('#period_checkin_checkout_change_over').val();
30        
31        ajaxurl         =   control_vars.admin_url + 'admin-ajax.php';
32            
33        jQuery.ajax({
34            type: 'POST',
35            url: ajaxurl,
36            data: {
37                'action'            :   'wpestate_ajax_add_allinone_custom',
38                'book_from'         :   start_from,
39                'book_to'           :   end_to,
40                'listing_id'        :   listing_edit,
41                'new_price'         :   new_price,
42                'period_min_days_booking'               :   period_min_days_booking,
43                'period_extra_price_per_guest'          :   period_extra_price_per_guest,
44                'period_price_per_weekeend'             :   period_price_per_weekeend,
45                'period_checkin_change_over'            :   period_checkin_change_over,
46                'period_checkin_checkout_change_over'   :   period_checkin_checkout_change_over
47            },
48            success: function (data) {
49        
50                location.reload();
51
52
53            },
54            error: function (errorThrown) {
55            }
56
57        });
58    }  
59        
60        
61        
62    function check_booking_valability_internal_allinone() {
63        "use strict";
64    
65        var book_from, book_to, listing_edit, ajaxurl,internal,hour_from,hour_to;
66        jQuery('#book_dates').empty().text(ajaxcalls_vars.saving);
67        book_from       =   jQuery('#start_date_owner_book').val();
68        book_to         =   jQuery('#end_date_owner_book').val();
69        if(jQuery('#start_date_owner_book_hour').length>0 ){
70            hour_from   =   jQuery('#start_date_owner_book_hour').val();
71            book_from   =   book_from+' '+hour_from;
72            hour_to     =   jQuery('#end_date_owner_book_hour').val();
73            book_to     =   book_to+' '+hour_to;
74        }
75        
76        listing_edit    =   jQuery('#listing_edit').val();
77        ajaxurl         =   control_vars.admin_url + 'admin-ajax.php';
78        internal        =   1;
79        jQuery.ajax({
80            type: 'POST',
81            url: ajaxurl,
82            data: {
83                'action'            :   'wpestate_ajax_check_booking_valability_internal',
84                'book_from'         :   book_from,
85                'book_to'           :   book_to,
86                'listing_id'        :   listing_edit,
87                'internal'          :   internal
88            },
89            success: function (data) {
90            
91                if (data === 'run') {
92                    allin_one_owner_insert_book_internal();
93        
94                } else {
95                    jQuery('#book_dates').empty().text(ajaxcalls_vars.reserve);
96                }
97            },
98            error: function (errorThrown) {
99            }
100        });
101    }
102
103    function allin_one_owner_insert_book_internal() {
104        "use strict";
105        var fromdate, todate, listing_edit, nonce, ajaxurl, comment, booking_guest_no,hour_from,hour_to;
106        ajaxurl             =   control_vars.admin_url + 'admin-ajax.php';
107        fromdate            =   jQuery("#start_date_owner_book").val();
108        todate              =   jQuery("#end_date_owner_book").val();
109        listing_edit        =   jQuery('#listing_edit').val();
110        comment             =   jQuery("#book_notes").val();
111        booking_guest_no    =   jQuery('#booking_guest_no_wrapper').attr('data-value');
112        //nonce               =   $('#security-register-booking_front').val();
113        if(jQuery('#start_date_owner_book_hour').length>0 ){
114            hour_from   =   jQuery('#start_date_owner_book_hour').val();
115            fromdate    =   fromdate+' '+hour_from;
116            hour_to     =   jQuery('#end_date_owner_book_hour').val();
117            todate      =   todate+' '+hour_to;
118        }
119        
120        
121        jQuery.ajax({
122            type: 'POST',
123            url: ajaxurl,
124            data: {
125                'action'            :   'wpestate_ajax_add_booking',
126                'fromdate'          :   fromdate,
127                'todate'            :   todate,
128                'listing_edit'      :   listing_edit,
129                'comment'           :   comment,
130                'booking_guest_no'  :   booking_guest_no,
131                'confirmed'         :   1,
132                'security'          :   nonce
133            },
134            success: function (data) {
135                
136                wpestate_allinone_owner_insert_customprice_internal();
137            },
138            error: function (errorThrown) {
139            }
140        });
141    }
142        
143    
144    
145    
146    
147    
148    
149    
150    
151    
152    
153    var all_calendar_click = 0;
154    var curent_id;
155    // $('.booking-calendar-wrapper-allinone .has_future').click(function (event) {
156        
157    //     var has_reservation, parent, detect_start, start_date, end_date;
158    //     has_reservation =   0;
159    //     detect_start    =   0;
160    
161    //     if ($(this).hasClass('calendar-reserved') || $(this).hasClass('pick_block_dates')) { // click on a booked spot
162    //         return;
163    //     }else{
164    //         $(this).addClass('calendar-selected');
165    //     }
166
167     
168
169    //     if (all_calendar_click === 0) { // start a new period
170    //         all_calendar_click = 1;
171    //         $(this).addClass('calendar-reserved-start');
172    //         curent_id=$(this).attr('data-curent-id');
173            
174    //         $('.booking-calendar-wrapper-allinone .has_future[data-curent-id!='+curent_id+']').addClass('pick_block_dates');
175            
176    //     } else {
177    //         var curent_id = $(this).attr('data-curent-id');
178            
179    //         all_calendar_click = 0;
180    //         $(this).addClass('calendar-reserved-stop');
181    //         parent = $(this).parent().parent();
182    //         $('.has_future[data-curent-id="'+curent_id+'"]').each(function () {
183              
184                
185    //             if ($(this).hasClass('calendar-reserved-start')) {
186    //                 detect_start = 1;
187    //                 start_date = $(this).attr('data-curent-date');
188    //             }
189                
190            
191    //             if (detect_start === 1) {
192    //                // $(this).addClass('calendar-reserved');
193    //                 if ( $(this).hasClass('calendar-reserved') ){ 
194    //                     has_reservation=1;
195    //                 }
196    //             }
197                
198    //             if ($(this).hasClass('calendar-reserved-stop')) {
199    //                 detect_start = 0;
200    //                 //$(this).addClass('calendar-reserved');
201    //                 end_date = $(this).attr('data-curent-date');
202    //             }
203                
204    //         });
205            
206            
207    //         $('.clean_reservation').show();
208    //         if(has_reservation==1){
209    //             $('.clean_reservation').hide();
210    //         }
211            
212            
213    //         $('.booking-calendar-wrapper-allinone .calendar-selected').removeClass('calendar-selected ');
214    //         $('.booking-calendar-wrapper-allinone .has_future').removeClass('pick_block_dates calendar-reserved-stop calendar-reserved-start');
215    //         allinone_mark_as_booked(parent, start_date, end_date,curent_id);
216    //     }   
217    // });
218    
219    
220    function allinone_mark_as_booked(parent, start_date, end_date,curent_id) {
221
222        jQuery('#allinone_reservation_modal').modal();
223        var date_format = control_vars.date_format.toUpperCase();
224       
225        start_date =                 moment.unix(start_date).utc().format(date_format);
226        jQuery('#start_date_owner_book').val(start_date);
227        
228        end_date =                 moment.unix(end_date).utc().format(date_format);
229        jQuery('#end_date_owner_book').val(end_date);
230        
231//        
232//        jQuery('#start_date_owner_book').val(wpestate_convert_selected_days_reverse( timeConverter_noconver(start_date) ) );
233//        jQuery('#end_date_owner_book').val(wpestate_convert_selected_days_reverse ( timeConverter_noconver(end_date) ) );
234//      
235        jQuery('#property_id').val(curent_id);
236        jQuery('#listing_edit').val(curent_id);
237       // mark_as_booked_actions();
238    }
239
240    
241    // delete custom period
242    $('.delete_custom_period a').click(function (event) {
243        event.preventDefault();
244        var parent,ajaxurl, edit_id,from_date,to_date;
245        ajaxurl     = ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
246        
247        edit_id     = parseInt( jQuery(this).parent().attr('data-editid'),10  );
248        from_date   = parseInt( jQuery(this).parent().attr('data-fromdate'),10  );  
249        to_date     = parseInt( jQuery(this).parent().attr('data-todate'),10  );
250        parent      =    jQuery(this).parent().parent();
251         
252     
253         $.ajax({
254            type:       'POST',
255            url:        ajaxurl,
256            
257            data: {
258                'action'            :  'wpestate_ajax_delete_custom_period',
259                'edit_id'           :  edit_id,
260                'from_date'         :  from_date,
261                'to_date'           :  to_date,
262               
263            },
264            success: function (data) {
265                parent.remove();
266                location.reload();
267            },
268            error: function (errorThrown) {
269            }
270        });
271         
272    });
273    
274    
275    
276    
277    $('#form_submit_1').click(function () {
278      
279        if( !$(this).hasClass('externalsubmit') ){
280            return;
281        }
282        var security,ajaxurl,title,prop_category,prop_action_category,property_city,property_area_front,property_country,property_description,guest_no,new_estate,instant_booking;
283        
284        title               = jQuery('#title').val();
285        prop_category       = jQuery('#prop_category_submit').val();
286        prop_action_category= jQuery('#prop_action_category_submit').val();
287        property_city       = jQuery('#property_city').val();
288        
289        if(property_city === '' || typeof(property_city)==='undefined'){
290            property_city       = jQuery('#property_city_front_autointernal').val(); 
291        }
292        
293        instant_booking=0;
294        if (jQuery('#instant_booking').is(':checked')  ){
295            instant_booking        =  1;
296        }
297       
298        
299        property_area_front = jQuery('#property_area_front').val();
300        property_country    = jQuery('#property_country').val();
301        property_description= jQuery('#property_description').val();
302        guest_no            = jQuery('#guest_no').val();
303        new_estate          = jQuery('#new_estate').val();
304        security            =   jQuery('#security-login-submit').val();
305        ajaxurl         =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
306       
307       
308       
309        if( wpestate_check_for_mandatory() ) {
310            $([document.documentElement, document.body]).animate({
311                scrollTop: $("#new_post").offset().top
312            }, 500);
313
314            return;
315        }
316        //dataType:   'json',
317        $.ajax({
318            type:       'POST',
319            url:        ajaxurl,
320            
321            data: {
322                'action'                :  'wpestate_ajax_front_end_submit',
323                'title'                 :  title,
324                'prop_category'         :  prop_category,
325                'prop_action_category'  :  prop_action_category,
326                'property_city'         :  property_city,
327                'property_area_front'   :  property_area_front,
328                'property_country'      :  property_country,
329                'property_description'  :  property_description,
330                'guest_no'              :  guest_no,
331                'new_estate'            :  new_estate,
332                'instant_booking'       :  instant_booking,
333                'security'              :  security
334            },
335            success: function (data) {
336         
337                jQuery("#new_estate").val('');
338               // jQuery("#title,#prop_category_submit,#prop_action_category_submit,#guest_no,#property_city_front,#property_country,#property_city,#property_area_front,#property_description").val("");
339              //  jQuery("#new_post").remove();
340                show_login_form(1,0,data); 
341
342            },
343            error: function (errorThrown) {
344            }
345        });
346        
347    });
348    
349    
350    
351    
352    
353    
354    var curent_m,curent_m_set, input , defaultBounds, options, componentForm, autocomplete, place, calendar_click, calendar_click_price;
355    curent_m=2;
356    curent_m_set=1;
357    var max_month = parseInt(ajaxcalls_vars.max_month_no);
358   
359    $('#calendar-next').click(function () {
360        if (curent_m < (max_month-2) ) {
361            curent_m = curent_m + 1;
362        } else {
363            curent_m = max_month;
364        }
365
366        $('.booking-calendar-wrapper').hide();
367        $('.booking-calendar-wrapper').each(function () {
368            var curent;
369            curent   =   parseInt($(this).attr('data-mno'), 10);
370            if (curent === curent_m || curent === curent_m + 1) {
371                $(this).fadeIn();
372            }
373        });
374    });
375
376    $('#calendar-prev').click(function () {
377        if (curent_m > 3) {
378            curent_m = curent_m - 1;
379        } else {
380            curent_m = 2;
381        }
382
383        $('.booking-calendar-wrapper').hide();
384        $('.booking-calendar-wrapper').each(function () {
385            var curent;
386            curent   =   parseInt($(this).attr('data-mno'), 10);
387            if (curent === curent_m || curent === curent_m - 1) {
388                $(this).fadeIn();
389            }
390        });
391    });
392
393
394    $('#calendar-next-internal').click(function () {
395        if (curent_m < (max_month-2)) {
396            curent_m = curent_m + 1;
397        } else {
398            curent_m = max_month-1;
399        }
400
401        $(".booking-calendar-wrapper-in").hide();
402        $('.booking-calendar-wrapper-in').each(function () {
403            var curent;
404            curent   =   parseInt($(this).attr('data-mno'), 10);
405            if (curent === curent_m || curent === curent_m + 1 || curent === curent_m + 2) {
406               // $(this).fadeIn();
407                $(this).css('display','inline-block');
408            }
409        });
410
411    });
412
413    $('#calendar-prev-internal').click(function () {
414        if (curent_m > 3) {
415            curent_m = curent_m - 1;
416        } else {
417            curent_m = 3;
418        }
419
420        $('.booking-calendar-wrapper-in').hide();
421        $('.booking-calendar-wrapper-in').each(function () {
422            var curent;
423            curent   =   parseInt($(this).attr('data-mno'), 10);
424            if (curent === curent_m || curent === curent_m - 1  || curent ===
424 curent_m - 2) {
425                //$(this).fadeIn();
426                 $(this).css('display','inline-block');
427            }
428        });
429    });
430    
431    $('#calendar-prev-internal-set').click(function () {
432        if (curent_m_set > 1) {
433            curent_m_set = curent_m_set - 1;
434        } else {
435            curent_m_set = 1;
436        }
437
438        $('.booking-calendar-wrapper-in').hide();
439        $('.booking-calendar-wrapper-in').each(function () {
440            var curent;
441            curent   =   parseInt($(this).attr('data-mno'), 10);
442            if (curent === curent_m_set ) {
443                //$(this).fadeIn();
444                 $(this).css('display','inline-block');
445            }
446        });
447    });
448    
449       $('#calendar-next-internal-set').click(function () {
450        if (curent_m_set < (max_month-2)) {
451            curent_m_set = curent_m_set + 1;
452        } else {
453            curent_m_set = max_month-1;
454        }
455
456        $(".booking-calendar-wrapper-in").hide();
457        $('.booking-calendar-wrapper-in').each(function () {
458            var curent;
459            curent   =   parseInt($(this).attr('data-mno'), 10);
460            if (curent === curent_m_set ) {
461               // $(this).fadeIn();
462                $(this).css('display','inline-block');
463            }
464        });
465
466    });
467    
468     $('#calendar-prev-internal-allinone,#calendar-prev-internal-allinone2').click(function () {
469
470        if (curent_m_set > 1) {
471            curent_m_set = curent_m_set - 1;
472        } else {
473            curent_m_set = 1;
474        }
475        $('.booking-calendar-wrapper-allinone').hide();
476        $('.booking-calendar-wrapper-allinone').each(function () {
477            var curent;
478            curent   =   parseInt($(this).attr('data-mno'), 10);
479            if (curent === curent_m_set ) {
480                //$(this).fadeIn();
481                 $(this).css('display','inline-block');
482            }
483        });
484        //stickyClendarHeader();
485    });
486    
487    $('#calendar-next-internal-allinone,#calendar-next-internal-allinone2').click(function () {
488        
489        if (curent_m_set < (max_month-2) )  {
490            curent_m_set = curent_m_set + 1;
491        } else {
492            curent_m_set = max_month-1;
493        }
494        $(".booking-calendar-wrapper-allinone ").hide();
495        $('.booking-calendar-wrapper-allinone ').each(function () {
496            var curent;
497            curent   =   parseInt($(this).attr('data-mno'), 10);
498            if (curent === curent_m_set ) {
499               // $(this).fadeIn();
500                $(this).css('display','inline-block');
501            }
502        });
503        //stickyClendarHeader();
504    });
505    
506    
507    
508    
509   // booking-calendar-wrapper-in-price
510    $('#calendar-next-internal-price').click(function () {
511        if (curent_m < (max_month-2) ) {
512            curent_m = curent_m + 1;
513        } else {
514            curent_m = max_month-1;
515        }
516
517        $(".booking-calendar-wrapper-in-price").hide();
518        $('.booking-calendar-wrapper-in-price').each(function () {
519            var curent;
520            curent   =   parseInt($(this).attr('data-mno'), 10);
521            if (curent === curent_m || curent === curent_m + 1 ) {
522                $(this).fadeIn();
523            }
524        });
525
526    });
527
528    $('#calendar-prev-internal-price').click(function () {
529        if (curent_m > 2) {
530            curent_m = curent_m - 1;
531        } else {
532            curent_m = 2;
533        }
534
535        $('.booking-calendar-wrapper-in-price').hide();
536        $('.booking-calendar-wrapper-in-price').each(function () {
537            var curent;
538            curent   =   parseInt($(this).attr('data-mno'), 10);
539            if (curent === curent_m || curent === curent_m - 1 ) {
540                $(this).fadeIn();
541            }
542        });
543    });
544    
545
546//    $('#title, #prop_category_submit, #prop_action_category_submit, #guest_no, #property_city_front,#property_city_front_autointernal').change(function (event) {
547//        event.preventDefault();
548//        submit_change();
549//    });
550
551    $('#close_custom_price_internal').click(function () {
552        $('.booking-calendar-wrapper-in-price td').each(function () {
553            $(this).removeClass('calendar-reserved-start-price');
554            $(this).removeClass('calendar-reserved-stop-price');
555            $(this).removeClass('calendar-reserved-price');
556        });
557    });
558
559    $('#close_reservation_internal').click(function () {
560        var start_remove = 0;
561        $('.calendar-reserved').each(function () {
562            if ($(this).hasClass('calendar-reserved-start')) {
563                $(this).removeClass('calendar-reserved-start');
564                $(this).removeClass('calendar-reserved');
565                start_remove = 1;
566            }
567            if (start_remove === 1) {
568                $(this).removeClass('calendar-reserved');
569            }
570
571            if ($(this).hasClass('calendar-reserved-stop')) {
572                $(this).removeClass('calendar-reserved-stop');
573                $(this).removeClass('calendar-reserved');
574                start_remove = 0;
575            }
576        });
577    });
578
579    
580    ////////////////////////////////////////////////////////////////////////////
581    /// autocomplete for submission step 1
582    ////////////////////////////////////////////////////////////////////////////
583    
584    if (typeof google === 'object' && typeof google.maps === 'object' && parseInt( mapbase_vars.wprentals_places_type) == 1 ) {
585        input = (document.getElementById('property_city_front'));
586        defaultBounds = new google.maps.LatLngBounds(
587            new google.maps.LatLng(-90, -180),
588            new google.maps.LatLng(90, 180)
589        );
590
591        options = {
592            bounds: defaultBounds,
593            types: ['(cities)'],
594
595        };
596
597        componentForm = {
598            establishment: 'long_name',
599            street_number: 'short_name',
600            route: 'long_name',
601            locality: 'long_name',
602            administrative_area_level_1: 'long_name',
603            administrative_area_level_2: 'long_name',
604            administrative_area_level_3: 'long_name',
605            administrative_area_level_4: 'long_name',
606            country: 'long_name',
607            postal_code: 'short_name',
608            postal_code_prefix: 'short_name',
609            neighborhood: 'long_name',
610            colloquial_area:'long_name',
611            natural_feature:'long_name'
612        };
613
614        
615        if (document.getElementById('property_city_front')) {
616            autocomplete = new google.maps.places.Autocomplete(input, options);
617            google.maps.event.addListener(autocomplete, 'place_changed', function () {
618                place = autocomplete.getPlace();
619                wprentals_google_fillInAddress(place);
620            });
621        }
622    }
623
624
625    
626
627
628
629
630
631
632
633
634
635
636
637
638    function wprentals_google_fillInAddress(place) {
639        var i, addressType, temp, val ,have_city,admin_area;
640        have_city=0;
641        admin_area='';
642        var pyrmont = new google.maps.LatLng(-33.8665433,151.1956316);
643        var map_city = new google.maps.Map(document.getElementById('property_country'), {
644            center: pyrmont,
645            zoom: 15
646        });
647
648        
649        for (i = 0; i < place.address_components.length; i++) {
650            addressType = place.address_components[i].types[0];
651            temp = '';
652            val = place.address_components[i][componentForm[addressType]];
653    
654            if (addressType === 'street_number' || addressType === 'route') {
655              //  document.getElementById('property_address').value =  document.getElementById('property_address').value +', '+ val;
656            } else if (addressType === 'neighborhood') {
657
658            } else if (addressType === 'postal_code_prefix') {
659
660            } else if (addressType === 'postal_code') {
661
662            } else if (addressType === 'administrative_area_level_4') {
663                admin_area = wpestate_build_admin_area(admin_area,val);
664            } else if (addressType === 'administrative_area_level_3') {
665                admin_area = wpestate_build_admin_area(admin_area,val);
666            } else if (addressType === 'administrative_area_level_2') {
667                admin_area = wpestate_build_admin_area(admin_area,val);
668            } else if (addressType === 'administrative_area_level_1') {
669                admin_area = wpestate_build_admin_area(admin_area,val);
670            } else if (addressType === 'locality' ){
671                 $('#property_city').val(val); have_city=1;
672            } else if ( addressType === 'colloquial_area'  ){
673                $('#property_city').val(val); have_city=1;
674            } else if (addressType === 'country' || addressType === 'natural_feature') {
675                $('#property_country').val(val); have_city=1;
676            } else {
677
678            }
679            if(have_city===0){
680                second_measure_city_submit('property_city',place.adr_address);
681            }
682        }
683        
684            
685        if( $('#property_city').val()!==''){
686            $('#property_admin_area').val( $('#property_city').val()+", "+admin_area);
687        }
688        
689//       / submit_change();
690    }
691 
692    function  second_measure_city_submit(stringplace,adr_address){
693        var new_city;
694        new_city = $(adr_address).filter('span.locality').html() ;
695      
696        $('#'+stringplace).val(new_city);
697    }
698    
699    function wpestate_build_admin_area(admin_area,val,map_city){
700       // wpestate_translate_google_fuckups(val);
701        if(admin_area ===''){
702            admin_area = admin_area+val;
703        }else{
704            admin_area = admin_area+", "+val;
705        }
706        
707        $('#property_admin_area').val(admin_area);
708      
709        return admin_area;
710    }
711    
712    
713    function wpestate_translate_google_fuckups(translate){
714  
715
716        var request = {
717            query: translate
718        };
719
720        var service = new google.maps.places.PlacesService(map_city);
721        service.textSearch(request, callback);
722    }
723    
724    function callback(results, status) {
725        if (status == google.maps.places.PlacesServiceStatus.OK) {
726    
727        }
728    }
729
730
731    ////////////////////////////////////////////////////////////////////////////
732    //calendar function
733    //////////////////////////////////////////////////////////////////////////// 
734    function custom_price_set(parent, start_date, end_date) {
735        jQuery('#owner_price_modal').modal();
736        jQuery('#start_date_owner_book').val( wpestate_convert_selected_days_reverse( timeConverter_noconver(start_date) ) );
737        jQuery('#end_date_owner_book').val(wpestate_convert_selected_days_reverse ( timeConverter_noconver(end_date) ) );
738        mark_as_price_actions();
739    }
740    
741    function mark_as_price_actions(){
742        "use strict";
743        var   period_price_per_month,period_price_per_week,period_extra_price_per_guest, period_price_per_weekeend, period_checkin_change_over, period_checkin_checkout_change_over, period_min_days_booking,start_from, end_to, listing_edit, new_price, ajaxurl;
744        $('#set_price_dates').click(function () {
745            jQuery('#book_dates').empty().text(ajaxcalls_vars.saving);
746            start_from                          =   jQuery('#start_date_owner_book').val();
747            end_to                              =   jQuery('#end_date_owner_book').val();
748            listing_edit                        =   jQuery('#listing_edit').val();
749            new_price                           =   jQuery('#new_custom_price').val();
750            period_min_days_booking             =   jQuery('#period_min_days_booking').val();
751            period_extra_price_per_guest        =   jQuery('#period_extra_price_per_guest').val();
752            period_price_per_weekeend           =   jQuery('#period_price_per_weekeend').val();
753            period_checkin_change_over          =   jQuery('#period_checkin_change_over').val();
754            period_checkin_checkout_change_over =   jQuery('#period_checkin_checkout_change_over').val();
755            period_price_per_week               =   jQuery('#period_week_price').val();
756            period_price_per_month              =   jQuery('#period_month_price').val();
757            
758            ajaxurl         =   control_vars.admin_url + 'admin-ajax.php';
759            if(new_price===''){
760              //  return;
761            }
762            
763            
764        
765            jQuery.ajax({
766                type: 'POST',
767                url: ajaxurl,
768                data: {
769                    'action'                                :   'wpestate_ajax_add_custom_price',
770                    'book_from'                             :   start_from,
771                    'book_to'                               :   end_to,
772                    'listing_id'                            :   listing_edit,
773                    'new_price'                             :   new_price,
774                    'period_min_days_booking'               :   period_min_days_booking,
775                    'period_extra_price_per_guest'          :   period_extra_price_per_guest,
776                    'period_price_per_weekeend'             :   period_price_per_weekeend,
777                    'period_checkin_change_over'            :   period_checkin_change_over,
778                    'period_checkin_checkout_change_over'   :   period_checkin_checkout_change_over,
779                    'period_price_per_week'                 :   period_price_per_week,
780                    'period_price_per_month'                :   period_price_per_month
781                },
782                success: function (data) {
783              
784                    jQuery(this).removeClass('calendar-reserved-stop-price');
785                    jQuery(this).removeClass('calendar-reserved-start-price');
786                    jQuery('#owner_price_modal').modal('hide');
787                    jQuery('.booking-calendar-wrapper-in-price .calendar-reserved-price .price-day').remove();
788                    jQuery('.booking-calendar-wrapper-in-price .calendar-reserved-price .custom_set_price').remove();
789                    jQuery('.booking-calendar-wrapper-in-price .calendar-reserved-price').append('<span class="custom_set_price">'+data+'</span>');
790                    jQuery('.booking-calendar-wrapper-in-price .calendar-reserved-price').removeClass('calendar-reserved-price,calendar-reserved-start-price,calendar-reserved-stop-price');
791                    jQuery('#book_dates').empty().text(ajaxcalls_vars.reserve);
792                    jQuery('#book_notes').val('');
793                    jQuery('.booking-calendar-wrapper-in-price td').removeClass('calendar-reserved-stop-price');
794                    jQuery('.booking-calendar-wrapper-in-price td').removeClass('calendar-reserved-start-price');
795                    jQuery('.booking-calendar-wrapper-in-price td').removeClass('calendar-reserved-price');
796                    location.reload();
797                },
798                error: function (errorThrown) {
799                    
800                }
801            });
802        });
803    }
804    
805    
806    function mark_as_booked(parent, start_date, end_date) {
807        jQuery('#owner_reservation_modal').modal();
808        
809       
810        var date_format = control_vars.date_format.toUpperCase();
811       
812        start_date =                 moment.unix(start_date).utc().format(date_format);
813        jQuery('#start_date_owner_book').val(start_date);
814        
815        end_date =                 moment.unix(end_date).utc().format(date_format);
816        jQuery('#end_date_owner_book').val(end_date);
817        
818        
819//        jQuery('#start_date_owner_book').val(wpestate_convert_selected_days_reverse ( timeConverter_noconver(start_date) ) );
820//        jQuery('#end_date_owner_book').val(wpestate_convert_selected_days_reverse ( timeConverter_noconver(end_date) ) );
821       mark_as_booked_actions();
822    }
823
824    function mark_as_booked_actions() {
825        $('#book_dates').unbind('click');
826        $('#book_dates').click(function () {
827            check_booking_valability_internal();
828        });
829    }
830
831    calendar_click = 0;
832    $('.booking-calendar-wrapper-in .has_future').click(function (event) {
833  
834        if ($(this).hasClass('calendar-reserved')) { // click on a booked spot
835            if (!$(this).hasClass('start_reservation') ){
836                return;
837            } else{
838               
839                if(calendar_click === 0){
840                    return;
841                }else{
842                    $(this).addClass('calendar-selected');
843                }
844                
845            }   
846            
847        }else{
848            $(this).addClass('calendar-selected');
849        }
850
851        var parent, detect_start, start_date, end_date;
852        detect_start = 0;
853
854        if (calendar_click === 0) { // start a new period
855            calendar_click = 1;
856            $(this).addClass('calendar-reserved-start');
857        } else {
858            calendar_click = 0;
859            $(this).addClass('calendar-reserved-stop');
860            parent = $(this).parent().parent();
861            $('.has_future').each(function () {
862                if ($(this).hasClass('calendar-reserved-start')) {
863                    detect_start = 1;
864                    start_date = $(this).attr('data-curent-date');
865                }
866                if ($(this).hasClass('calendar-reserved-stop')) {
867                    detect_start = 0;
868                    $(this).addClass('calendar-reserved');
869                    end_date = $(this).attr('data-curent-date');
870                }
871                if (detect_start === 1) {
872                    $(this).addClass('calendar-reserved');
873                }
874            });
875            $('.booking-calendar-wrapper-in .calendar-selected').removeClass('calendar-selected');
876            mark_as_booked(parent, start_date, end_date);
877        }   
878    });
879
880    // custom adding price
881    calendar_click_price = 0;
882    $('.booking-calendar-wrapper-in-price .has_future').click(function () {
883       
884        $(this).addClass('calendar-selected');
885     
886
887        var parent, detect_start, start_date, end_date;
888        detect_start = 0;
889
890        if (calendar_click_price === 0) { // start a new period
891            calendar_click_price = 1;
892            $(this).addClass('calendar-reserved-start-price');
893        } else {
894            calendar_click_price = 0;
895            $(this).addClass('calendar-reserved-stop-price');
896            parent = $(this).parent().parent();
897            $('.has_future').each(function () {
898                if ($(this).hasClass('calendar-reserved-start-price')) {
899                    detect_start = 1;
900                    start_date = $(this).attr('data-curent-date');
901                }
902                if ($(this).hasClass('calendar-reserved-stop-price')) {
903                    detect_start = 0;
904                    $(this).addClass('calendar-reserved-price');
905                    end_date = $(this).attr('data-curent-date');
906                }
907                if (detect_start === 1) {
908                    $(this).addClass('calendar-reserved-price');
909                }
910            });
911            $('.booking-calendar-wrapper-in-price .calendar-selected').removeClass('calendar-selected');
912            custom_price_set(parent, start_date, end_date);
913        }   
914    });
915    
916     function timeConverter_noconver(UNIX_timestamp) {
917        var a, year, month, date, time;
918    
919       
920        a       = new Date(UNIX_timestamp * 1000);
921        year    = a.getUTCFullYear();
922        month   = a.getUTCMonth() + 1;
923        date    = a.getUTCDate();
924   
925        time    = year + '-' + ('0' + month).slice(-2)   + '-' + date;
926        return time;
927    }
928
929    
930    function timeConverter(UNIX_timestamp) {
931        var a, year, month, date, time;
932        var d = new Date()
933        var n = d.getTimezoneOffset();
934      
935    
936        a       = new Date(UNIX_timestamp * 1000+n*60000);
937        year    = a.getUTCFullYear();
938        month   = a.getMonth() + 1;
939        date    = a.getDate();
940        
941    
942        
943        time    = year + '-' + ('0' + month).slice(-2)   + '-' + date;
944        return time;
945    }
946
947    ////////////////////////////////////////////////////////////////////////////
948    //edit property location
949    //////////////////////////////////////////////////////////////////////////// 
950    $('#edit_prop_ammenities').click(function () {
951        var jsonData, ajaxurl, listing_edit, custom_fields_amm, counter, i;
952        listing_edit    =  jQuery('#listing_edit').val();
953
954        jsonData = JSON.parse(ajaxcalls_add_vars.transport_custom_array_amm);
955        for (i = 0; i < jsonData.length; i++) {
956            counter = jsonData[i];
957            
958            
959            if (jQuery("#" + counter).prop('checked')) {
960                custom_fields_amm = custom_fields_amm + "~1";
961            } else {
962                custom_fields_amm = custom_fields_amm + "~0";
963            }
964        }
965        
966        wpestate_scrollToAnchor('all_wrapper');
967        if( wpestate_check_for_mandatory(1) ) {
968            return;
969        }
970    
971        
972        ajaxurl  =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
973        $('#profile_message').empty().append('<div class="login-alert">' +  ajaxcalls_vars.saving + '<div>');
974        $.ajax({
975            type:       'POST',
976            url:        ajaxurl,
977            dataType:   'json',
978            data: {
979                'action'                :  'wpestate_ajax_update_listing_ammenities',
980                'listing_edit'          :  listing_edit,
981                'custom_fields_amm'     :  custom_fields_amm
982            },
983            success: function (data) {
984                if (data.edited) {
985                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
986                } else {
987                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
988                }
989                var redirect = jQuery('.next_submit_page').attr('href');
990                window.location = redirect;
991            },
992            error: function (errorThrown) {
993            }
994        });
995    });
996    ////////////////////////////////////////////////////////////////////////////
997    //edit property location
998    //////////////////////////////////////////////////////////////////////////// 
999    $('#edit_prop_locations').click(function () {
1000        var jsonData, ajaxurl, listing_edit, property_county, property_state, property_address, property_zip, property_latitude, property_longitude, google_camera_angle, property_google_view;
1001        jsonData = JSON.parse(ajaxcalls_add_vars.tranport_custom_array);
1002        property_address        =  jQuery('#property_address').val();
1003        property_zip            =  jQuery('#property_zip').val();
1004        property_county         =  jQuery('#property_county').val();
1005        property_state          =  jQuery('#property_state').val();
1006            
1007        property_latitude       =  jQuery('#property_latitude').val();
1008        property_longitude      =  jQuery('#property_longitude').val();
1009        google_camera_angle     =  jQuery('#google_camera_angle').val();
1010        listing_edit            =  jQuery('#listing_edit').val();
1011     
1012     
1013        wpestate_scrollToAnchor('all_wrapper');
1014        if( wpestate_check_for_mandatory() ) {
1015            return;
1016        }
1017     
1018        ajaxurl         =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
1019        $('#profile_message').empty().append('<div class="login-alert">' +  ajaxcalls_vars.saving + '<div>');
1020        $.ajax({
1021            type:       'POST',
1022            url:        ajaxurl,
1023            dataType:   'json',
1024            data: {
1025                'action'                    :  'wpestate_ajax_update_listing_location',
1026                'property_address'          :  property_address,
1027                'property_zip'              :  property_zip,
1028                'property_latitude'         :  property_latitude,
1029                'property_longitude'        :  property_longitude,
1030                'google_camera_angle'       :  google_camera_angle,
1031                'property_state'            :   property_state,
1032                'property_county'           :   property_county,
1033                'listing_edit'              :   listing_edit
1034
1035            },
1036            success: function (data) {
1037
1038                if (data.edited) {
1039                    $('#profile_message').empty().append('<div class="login-alert">
1039' + data.response + '<div>');
1040                } else {
1041                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
1042                }
1043                var redirect = jQuery('.next_submit_page').attr('href');
1044                window.location = redirect;
1045            },
1046            error: function (errorThrown) {
1047            }
1048        });
1049    });
1050        ////////////////////////////////////////////////////////////////////////////
1051    //edit property calendar
1052    //////////////////////////////////////////////////////////////////////////// 
1053    $('#edit_calendar').click(function () {
1054        var jsonData, ajaxurl, listing_edit, property_icalendar_import,array_labels,array_feeds;
1055       
1056        property_icalendar_import   =  jQuery('#property_icalendar_import').val();
1057        listing_edit                =  jQuery('#listing_edit').val();
1058       
1059        ajaxurl         =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
1060        $('#profile_message2').empty().append('<div class="login-alert">' +  ajaxcalls_vars.saving + '<div>');
1061        
1062        array_labels=[];
1063        $('.property_icalendar_import_name_new').each(function(){
1064            array_labels.push( $(this).val() )
1065        });
1066        
1067        array_feeds=[];
1068         $('.property_icalendar_import_feed_new').each(function(){
1069            array_feeds.push( $(this).val() )
1070        });
1071        
1072  
1073        $.ajax({
1074            type:       'POST',
1075            url:        ajaxurl,
1076            dataType:   'json',
1077            data: {
1078                'action'                    :  'wpestate_ajax_update_ical_feed',
1079                'property_icalendar_import' :   property_icalendar_import,
1080                'listing_edit'              :   listing_edit,
1081                'array_feeds'               :   array_feeds,
1082                'array_labels'              :   array_labels
1083
1084            },
1085            success: function (data) {
1086          
1087                if (data.edited) {
1088                    $('#profile_message2').empty().append('<div class="login-alert">' + data.response + '<div>');
1089                } else {
1090                    $('#profile_message2').empty().append('<div class="login-alert">' + data.response + '<div>');
1091                }
1092
1093            },
1094            error: function (errorThrown) {
1095            
1096            }
1097        });
1098    });
1099    
1100    
1101    $('.delete_imported_dates_singular').click(function(event){
1102        event.preventDefault();
1103        var edit_id,key, ajaxurl,parent;
1104       
1105        edit_id         =  jQuery(this).attr('data-edit-id');
1106        key             =  jQuery(this).attr('data-edit-id-key');
1107        ajaxurl         =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
1108        
1109      
1110        $(this).parent().remove();
1111        
1112        $.ajax({
1113            type:       'POST',
1114            url:        ajaxurl,
1115          
1116            data: {
1117                'action'    :  'wpestate_ajax_delete_imported_dates',
1118                'edit_id'   :   edit_id,
1119                'key'       :   key
1120            },
1121            success: function (data) {
1122             
1123                if(data=='done'){
1124                  
1125                    location.reload();
1126                }
1127
1128            },
1129            error: function (errorThrown) {
1130            }
1131        });
1132    });
1133        
1134  
1135    
1136    ////////////////////////////////////////////////////////////////////////////
1137    //edit property details
1138    ////////////////////////////////////////////////////////////////////////////  
1139    $('#edit_prop_details').click(function () {
1140        "use strict"
1141        var value,temp_opt,i, jsonData, ajaxurl, property_size, property_rooms, property_bedrooms, property_bathrooms, listing_edit, custom_fields_val, variable, counter;
1142        property_size       =  jQuery('#property_size').val();
1143        property_rooms      =  jQuery('#property_rooms').val();
1144        property_bedrooms   =  jQuery('#property_bedrooms').val();
1145        property_bathrooms  =  jQuery('#property_bathrooms').val();
1146        listing_edit        =  jQuery('#listing_edit').val();
1147        custom_fields_val   =   '';
1148        jsonData = JSON.parse(ajaxcalls_add_vars.tranport_custom_array);
1149        for (i = 0; i < jsonData.length; i++) {
1150            counter = jsonData[i];
1151            value =$("#" + counter).val();
1152            if(typeof value==='undefined'){
1153                value='';
1154            }
1155            custom_fields_val = custom_fields_val + "~" + value;
1156        } 
1157        
1158        wpestate_scrollToAnchor('all_wrapper');
1159        if( wpestate_check_for_mandatory() ) {
1160            return;
1161        }
1162       
1163        var extra_details_options              =    [];
1164          
1165        $('.extra_detail_option_wrapper').each(function(){
1166            temp_opt    =   '';
1167            temp_opt    =   $(this).find('.extra_option_name').val();
1168            temp_opt    =   temp_opt + '|' + $(this).find('.extra_option_value ').val();
1169            extra_details_options.push(temp_opt);
1170        }); 
1171        
1172
1173        ajaxurl         =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
1174        $('#profile_message').empty().append('<div class="login-alert">
1174' +  ajaxcalls_vars.saving + '<div>');
1175
1176      
1177        
1178
1179        $.ajax({
1180            type:       'POST',
1181            url:        ajaxurl,
1182            dataType:   'json',
1183            data: {
1184                'action'                :  'wpestate_ajax_update_listing_details',
1185                'property_size'         :  property_size,
1186                'property_rooms'        :  property_rooms,
1187                'property_bedrooms'     :  property_bedrooms,
1188                'property_bathrooms'    :  property_bathrooms,
1189                'listing_edit'          :  listing_edit,
1190                'custom_fields_val'     :  custom_fields_val,
1191                'extra_details_options' :  extra_details_options
1192            },
1193            success: function (data) {
1194
1195                if (data.edited) {
1196                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
1197                } else {
1198                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
1199                }
1200                
1201                var redirect = jQuery('.next_submit_page').attr('href');
1202                window.location = redirect;
1203            },
1204            error: function (errorThrown) {
1205            }
1206        });
1207    });
1208    ////////////////////////////////////////////////////////////////////////////
1209    //edit property images
1210    ////////////////////////////////////////////////////////////////////////////  
1211    $('#edit_prop_image').click(function () {
1212        var ajaxurl, video_type, video_id, attachid, attachthumb, listing_edit;
1213        video_type    =  jQuery('#embed_video_type').val();
1214        video_id      =  jQuery('#embed_video_id').val();
1215        attachid      =  jQuery('#attachid').val();
1216        attachthumb   =  jQuery('#attachthumb').val();
1217        listing_edit  =  jQuery('#listing_edit').val();
1218
1219        ajaxurl         =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
1220        
1221        wpestate_scrollToAnchor('all_wrapper');
1222        if( wpestate_check_for_mandatory() ) {
1223            return;
1224        }
1225        
1226
1227
1228        $('#profile_message').empty().append('<div class="login-alert">' +  ajaxcalls_vars.saving + '<div>');
1229        $.ajax({
1230            type:       'POST',
1231            url:        ajaxurl,
1232            dataType:   'json',
1233            data: {
1234                'action'         :  'wpestate_ajax_update_listing_images',
1235                'video_type'     :  video_type,
1236                'video_id'       :  video_id,
1237                'attachid'       :  attachid,
1238                'attachthumb'    :  attachthumb,
1239                'listing_edit'   :  listing_edit
1240
1241            },
1242            success: function (data) {
1243                if (data.edited) {
1244                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
1245                } else {
1246                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
1247                }
1248                var redirect = jQuery('.next_submit_page').attr('href');
1249                window.location = redirect;
1250            },
1251            error: function (errorThrown) {
1252            }
1253        });
1254    });
1255
1256
1257    ////////////////////////////////////////////////////////////////////////////
1258    //edit property price
1259    ////////////////////////////////////////////////////////////////////////////   
1260    $('#edit_prop_price').click(function () {
1261        var booking_start_hour,booking_end_hour,book_type,temp_opt,extra_pay_options,early_bird_days,early_bird_percent,property_price_before_label,property_price_after_label,security_deposit,city_fee_percent,property_taxes,overload_guest,ajaxurl,checkin_checkout_change_over, checkin_change_over, price_per_weekeend,extra_price_per_guest,price_per_guest_from_one, price, price_label, price_week, price_month, listing_edit, city_fee, cleaning_fee,cleaning_fee_per_day,city_fee_per_day,min_days_booking;
1262        book_type       =  jQuery('#local_booking_type').val();
1263        price           =  jQuery('#property_price').val();
1264        city_fee        =  jQuery('#city_fee').val();
1265        cleaning_fee    =  jQuery('#cleaning_fee').val();
1266        price_label     =  jQuery('#property_label').val();
1267        price_week      =  jQuery('#property_price_per_week').val();
1268        price_month     =  jQuery('#property_price_per_month').val();
1269        listing_edit    =  jQuery('#listing_edit').val();
1270        
1271        
1272        property_taxes                 =    jQuery('#property_taxes').val();
1273        cleaning_fee_per_day           =    jQuery('#cleaning_fee_per_day').val();
1274        city_fee_per_day               =    jQuery('#city_fee_per_day').val();
1275        security_deposit               =    jQuery('#security_deposit').val();
1276        property_price_after_label     =    jQuery('#property_price_after_label').val();
1277        property_price_before_label    =    jQuery('#property_price_before_label').val();
1278        early_bird_percent             =    jQuery('#early_bird_percent').val();
1279        early_bird_days                =    jQuery('#early_bird_days').val();
1280        extra_pay_options              =    [];
1281        booking_start_hour             =    jQuery('#booking_start_hour').val();
1282        booking_end_hour               =    jQuery('#booking_end_hour').val();
1283           
1284        $('.extra_pay_option').each(function(){
1285            temp_opt    =   '';
1286            temp_opt    =   $(this).find('.extra_option_name').val();
1287            temp_opt    =   temp_opt + '|' + $(this).find('.extra_option_value ').val();
1288            temp_opt    =   temp_opt + '|' + $(this).find('select').val();
1289            extra_pay_options.push(temp_opt);
1290        }); 
1291           
1292  
1293           
1294        city_fee_percent = 0;
1295        if (jQuery('#city_fee_percent').is(':checked') ){
1296            city_fee_percent        =  1;
1297        }
1298        
1299        price_per_guest_from_one    =   0;
1300        overload_guest              =   0;
1301        if (jQuery('#price_per_guest_from_one').is(':checked')  ){
1302            price_per_guest_from_one        =  1;
1303        }
1304        if (jQuery('#overload_guest').is(':checked')  ){
1305            overload_guest        =  1;
1306        }
1307        
1308        
1309      
1310        min_days_booking            =  jQuery('#min_days_booking').val();
1311        extra_price_per_guest       =  jQuery('#extra_price_per_guest').val();
1312        price_per_weekeend          =  jQuery('#price_per_weekeend').val();
1313        checkin_change_over         =  jQuery('#checkin_change_over').val();
1314        checkin_checkout_change_over=  jQuery('#checkin_checkout_change_over').val();
1315
1316        wpestate_scrollToAnchor('all_wrapper');
1317        if( wpestate_check_for_mandatory() ) {
1318            return;
1319        }
1320        
1321
1322        
1323        ajaxurl         =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
1324        $('#profile_message').empty().append('<div class="login-alert">
1324' +  ajaxcalls_vars.saving + '<div>');
1325         // 
1326        $.ajax({
1327            type:       'POST',
1328            url:        ajaxurl,
1329            dataType:   'json',
1330            data: {
1331                'action'                        :   'wpestate_ajax_update_listing_price',
1332                'price'                         :   price,
1333                'price_week'                    :   price_week,
1334                'price_month'                   :   price_month,
1335                'listing_edit'                  :   listing_edit,
1336                'city_fee'                      :   city_fee,
1337                'cleaning_fee'                  :   cleaning_fee,
1338                'cleaning_fee_per_day'          :   cleaning_fee_per_day,
1339                'city_fee_per_day'              :   city_fee_per_day,
1340                'min_days_booking'              :   min_days_booking,
1341                'price_per_guest_from_one'      :   price_per_guest_from_one,
1342                'price_per_weekeend'            :   price_per_weekeend,
1343                'checkin_change_over'           :   checkin_change_over,
1344                'checkin_checkout_change_over'  :   checkin_checkout_change_over,
1345                'extra_price_per_guest'         :   extra_price_per_guest,
1346                'overload_guest'                :   overload_guest,
1347                'property_taxes'                :   property_taxes,    
1348                'security_deposit'              :   security_deposit,
1349                'property_price_after_label'    :   property_price_after_label,  
1350                'property_price_before_label'   :   property_price_before_label,
1351                'early_bird_percent'            :   early_bird_percent, 
1352                'early_bird_days'               :   early_bird_days,
1353                'extra_pay_options'             :   extra_pay_options,
1354                'city_fee_percent'              :   city_fee_percent,
1355                'book_type'                     :   book_type,
1356                'booking_start_hour'            :   booking_start_hour,
1357                'booking_end_hour'              :   booking_end_hour
1358            },
1359            success: function (data) {
1360            
1361                if (data.edited) {
1362                    $('#profile_message').empty().append('<div class="login-alert">' + data.response +'<div>');
1363                } else {
1364                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
1365                }
1366                var redirect = jQuery('.next_submit_page').attr('href');
1367                window.location = redirect;
1368            },
1369            error: function (errorThrown) {
1370            }
1371        });
1372    });
1373
1374    ////////////////////////////////////////////////////////////////////////////
1375    //edit property description
1376    ////////////////////////////////////////////////////////////////////////////
1377    $('#edit_prop_1').click(function () {
1378        var ajaxurl, title, category, action_category, guests, city, country, area,listing_edit,prop_desc,property_admin_area,instant_booking;
1379        title           =  jQuery('#title').val();
1380        category        =  jQuery('#prop_category_submit').val();
1381        action_category =  jQuery('#prop_action_category_submit').val();
1382        guests          =  jQuery('#guest_no').val();
1383        city            =  jQuery('#property_city').val();
1384
1385        if(city ===''){
1386            city            =  jQuery('#property_city_front_autointernal').val(); 
1387        }
1388        if(ajaxcalls_add_vars.wpestate_autocomplete ==='no'){
1389            city            =  jQuery('#property_city_front_autointernal').val(); 
1390        }
1391        instant_booking=0;
1392        if (jQuery('#instant_booking').is(':checked')  ){
1393            instant_booking        =  1;
1394        }
1395        
1396        area            =  jQuery('#property_area_front').val();
1397        country         =  jQuery('#property_country').val();
1398        listing_edit    =  jQuery('#listing_edit').val();
1399        prop_desc       =  jQuery('#property_description').val();
1400        property_admin_area = jQuery ('#property_admin_area').val();
1401        ajaxurl         =  ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
1402        
1403        
1404        wpestate_scrollToAnchor('all_wrapper');
1405        if( wpestate_check_for_mandatory() ) {
1406            return;
1407        }
1408        
1409        
1410
1411        $('#profile_message').empty().append('<div class="login-alert">
1411' +  ajaxcalls_vars.saving + '<div>');
1412        $.ajax({
1413            type:       'POST',
1414            url:        ajaxurl,
1415            dataType:   'json',
1416            data: {
1417                'action'            :   'wpestate_ajax_update_listing_description',
1418                'title'             :   title,
1419                'category'          :   category,
1420                'action_category'   :   action_category,
1421                'guests'            :   guests,
1422                'city'              :   city,
1423                'area'              :   area,
1424                'country'           :   country,
1425                'listing_edit'      :   listing_edit,
1426                'prop_desc'         :   prop_desc,
1427                'property_admin_area':  property_admin_area,
1428                'instant_booking'   :   instant_booking
1429            },
1430            success: function (data) {
1431               
1432                if (data.edited) {
1433                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
1434                    var redirect = jQuery('.next_submit_page').attr('href');
1435                    window.location = redirect;
1436                } else {
1437                    $('#profile_message').empty().append('<div class="login-alert">' + data.response + '<div>');
1438                }
1439               
1440            },
1441            error: function (errorThrown) {
1442            }
1443        });
1444    });
1445}); // end jquery
1446
1447function wpestate_scrollToAnchor(aid){
1448    var aTag = jQuery("#"+ aid);
1449    jQuery('html,body').animate({scrollTop: aTag.offset().top},'slow');
1450}
1451
1452
1453function wpestate_check_for_mandatory(is_check=0){
1454    var reply='';
1455    if(   ajaxcalls_add_vars.mandatory_fields.constructor === Array)  {
1456        ajaxcalls_add_vars.mandatory_fields.forEach( function(field) {   
1457      
1458            if( jQuery("#"+field).length > 0 ) { // daca exista
1459
1460             
1461                if( jQuery("#"+field).is(':checkbox') &&  !jQuery("#"+field).prop('checked')){
1462                    reply=wpestate_build_warning(reply,field);
1463                }
1464
1465                if( jQuery("#"+field).val()==='' ) { // check value
1466                    reply=wpestate_build_warning(reply,field);
1467                }
1468
1469
1470                if( field==="prop_category_submit" || field==="prop_action_category_submit" ){
1471                    if( jQuery("#"+field).val()==='-1' ) { // check value
1472                        reply=wpestate_build_warning(reply,field);
1473                    }
1474                }
1475
1476                if(  field=="checkin_change_over" ||  field=="checkin_checkout_change_over" ){
1477                    if( jQuery("#"+field).val()==='0' ) { // check value
1478                        reply=wpestate_build_warning(reply,field);
1479                    }
1480                }
1481            }
1482        
1483        });
1484    } 
1485    
1486 
1487    if(reply!==''){
1488        jQuery('#profile_message').empty().append('<div class="login-alert alert_err">'+ajaxcalls_add_vars.pls_fill +': '+ reply + '<div>');
1489        return true;
1490    }else{
1491        return false; // ready to edit
1492    }
1493}
1494
1495
1496function wpestate_build_warning(reply,field){
1497    if(reply===''){
1498        reply=reply+ajaxcalls_add_vars.mandatory_fields_label[field];
1499    }else{
1500        reply=reply+', '+ajaxcalls_add_vars.mandatory_fields_label[field];
1501    }
1502    return reply;
1503}

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.