PageSourceSearch

https://www.viajesvicalvaro.com/wp-content/themes/traveler/v3/js/form-search.js

js viajesvicalvaro.com collected 2026-10-09 02:04:54 UTC 36,915 bytes, 736 lines download raw bytes

1;
2(function ($) {
3    "use strict";
4    //Search form
5    let SearchForm = {
6        $body: $('body'),
7        isValidated: {},
8        init: function () {
9            let base = this;
10            var advFacilities = [];
11            base._dropdownselect();
12            base._destinationSelect();
13            base._destinationSelectCarTransfer();
14            // base._scrollFormSearch();
15            base._dropdownselectDate();
16            base._addNextPreInput();
17            base._rangeSliderPrice();
18            base._chooseTaxonomy(advFacilities);
19            base._chooseTaxonomyChecked(advFacilities);
20            base._initSearchLocation();
21            base._initSearchLocationCarTransfer();
22        },
23
24        _initSearchLocation() {
25            var base = this;
26            $(".st-banner-search-form.style_2 .tab-pane").each(function (index) {
27                var input = $(this).find('[name="location_name"]');
28                var timer = null;
29                input.on('keydown', function () {
30                    clearTimeout(timer);
31                    timer = setTimeout(doStuff, 200)
32                });
33            });
34
35
36            function doStuff() {
37                let parent = input.closest('.destination-search'),
38                    ulEl = $('.dropdown-menu ul', parent),
39                    loader = $('.dropdown-menu .loader-wrapper', parent);
40
41                loader.show();
42                $.post(st_params.ajax_url, {
43                    action: 'st_get_list_location',
44                    _s: input.val(),
45                    post_type: input.data('post-type')
46                }, function (respon) {
47                    if (typeof respon === 'object') {
48                        ulEl.find('.item').remove();
49                        if (respon.options !== '') {
50                            $(respon.options).insertAfter($('.location-heading', ulEl));
51                            $('.location-heading', ulEl).hide();
52                            ulEl.removeClass('no-data');
53                        } else {
54                            $('.location-heading', ulEl).text(input.data('text-no')).show();
55                            ulEl.addClass('no-data');
56                        }
57                    } else {
58                        console.log('Can not get data');
59                    }
60                    $('#dropdown-destination').dropdown('show');
61                    base._destinationSelect();
62                    loader.hide();
63                }, 'json');
64            }
65        },
66
67        _initSearchLocationCarTransfer() {
68            var base = this;
69            var input_to = $('.st-banner-search-form.style_2 [name="location_name_to"]');
70            var timer = null;
71            input_to.on('keydown', function () {
72                clearTimeout(timer);
73                timer = setTimeout(doStuff, 200)
74            });
75
76            function doStuff() {
77                let parent = input.closest('.destination-search'),
78                    ulEl = $('.dropdown-menu ul', parent),
79                    loader = $('.dropdown-menu .loader-wrapper', parent);
80
81                loader.show();
82                $.post(st_params.ajax_url, {
83                    action: 'st_get_list_location',
84                    _s: input.val(),
85                    post_type: input.data('post-type')
86                }, function (respon) {
87                    if (typeof respon === 'object') {
88                        ulEl.find('.item').remove();
89                        if (respon.options !== '') {
90                            $(respon.options).insertAfter($('.location-heading', ulEl));
91                            $('.location-heading', ulEl).hide();
92                            ulEl.removeClass('no-data');
93                        } else {
94                            $('.location-heading', ulEl).text(input.data('text-no')).show();
95                            ulEl.addClass('no-data');
96                        }
97                    } else {
98                        console.log('Can not get data');
99                    }
100                    $('#dropdown-destination-to').dropdown('show');
101                    base._destinationSelectCarTransfer();
102                    loader.hide();
103                }, 'json');
104            }
105        },
106
107        _chooseTaxonomyChecked: function (advFacilities) {
108            $('.advance-item.facilities input[type="checkbox"]').each(function () {
109                var t = $(this);
110                if (t.is(':checked')) {
111                    advFacilities.push(t.val());
112                }
113            });
114        },
115        _chooseTaxonomy: function (advFacilities) {
116            $('.advance-item.facilities input[type="checkbox"]').on('change', function () {
117                var t = $(this);
118                if (t.is(':checked')) {
119                    advFacilities.push(t.val());
120                } else {
121                    var index = advFacilities.indexOf(t.val());
122                    if (index > -1) {
123                        advFacilities.splice(index, 1);
124                    }
125                }
126                t.closest('.facilities').find('.data_taxonomy').val(advFacilities.join(','));
127            });
128        },
129        //pure JS
130        scrollToBottom(id, name_item) {
131            $(id)
132                .on('click', function (event) {
133                    console.log();
134                    var target = $(id);
135                    if (target.length) {
136                        // Only prevent default if animation is actually gonna happen
137                        event.preventDefault();
138                        $('html, body').animate({
139                            scrollTop: target.offset().top - 30
140                        }, 300, function () {
141
142                        });
143                    }
144                });
145        },
146
147        _scrollFormSearch: function () {
148            $('.search-form-v2 .field-detination').each(function () {
149                SearchForm.scrollToBottom(this, '.field-detination');
150            });
151            $('.search-form-v2 .form-date-search').each(function () {
152                SearchForm.scrollToBottom(this, '.form-date-search');
153            });
154            $('.search-form-v2 .field-guest').each(function () {
155                SearchForm.scrollToBottom(this, '.field-guest');
156            });
157        },
158
159        _destinationSelect: function () {
160            /*Destination selection*/
161
162            $('.field-detination').each(function () {
163
164                var t = $(this),
165                    parent = $(this).closest('.border-right'),
166                    dropdown_menu = $('.dropdown-menu', parent);
167                if (parent.length < 1) {
168                    parent = $(this).closest('.destination-search');
169                    dropdown_menu = $('.dropdown-menu', parent);
170                }
171
172
173
174                $('li', dropdown_menu).on('click', function () {
175                    console.log(this);
176                    var target = $(this).closest('.dropdown-menu').attr('aria-labelledby');
177                    var focus = parent.find('#' + target);
178
179                    $('.destination', focus).text($(this).find('span').text());
180                    $('input[name="location_name"]', focus).val($(this).find('span').text());
181                    $('input.location_name', focus).val($(this).find('span').text());
182                    $('input[name="location_id"]', focus).val($(this).data('value'));
183                    $('input.location_id', focus).val($(this).data('value'));
184                    t.dropdown('hide');
185                });
186            });
187        },
188        _destinationSelectCarTransfer: function () {
189            /*Destination selection*/
190            //From
191            $('.field-detination-from').each(function () {
192
193                var t = $(this),
194                    parent = $(this).closest('.border-right'),
195                    dropdown_menu = $('.dropdown-menu', parent);
196                if (parent.length < 1) {
197                    parent = $(this).closest('.destination-search');
198                    dropdown_menu = $('.dropdown-menu', parent);
199                }
200
201
202
203                $('li', dropdown_menu).on('click', function () {
204                    console.log(this);
205                    var target = $(this).closest('.dropdown-menu').attr('aria-labelledby');
206                    var focus = parent.find('#' + target);
207
208                    $('.destination', focus).text($(this).find('span').text());
209                    $('input[name="transfer_from_name"]', focus).val($(this).find('span').text());
210                    $('input.transfer_from_name', focus).val($(this).find('span').text());
211                    $('input[name="transfer_from"]', focus).val($(this).data('value'));
212                    t.dropdown('hide');
213                });
214            });
215            //To
216            $('.field-detination-to').each(function () {
217
218                var t = $(this),
219                    parent = $(this).closest('.border-right'),
220                    dropdown_menu = $('.dropdown-menu', parent);
221                if (parent.length < 1) {
222                    parent = $(this).closest('.destination-search');
223                    dropdown_menu = $('.dropdown-menu', parent);
224                }
225
226
227
228                $('li', dropdown_menu).on('click', function () {
229                    console.log(this);
230                    var target = $(this).closest('.dropdown-menu').attr('aria-labelledby');
231                    var focus = parent.find('#' + target);
232
233                    $('.destination', focus).text($(this).find('span').text());
234                    $('input[name="transfer_to_name"]', focus).val($(this).find('span').text());
235                    $('input.transfer_to_name', focus).val($(this).find('span').text());
236                    $('input[name="transfer_to"]', focus).val($(this).data('value'));
237                    t.dropdown('hide');
238                });
239            });
240        },
241        _rangeSliderPrice: function () {
242            function format_money($money) {
243
244                $money = st_number_format($money, st_params.booking_currency_precision, st_params.decimal_separator, st_params.thousand_separator);
245                var $symbol = st_params.currency_symbol;
246                var $money_string = '';
247
248                switch (st_params.currency_position) {
249                    case "right":
250                        $money_string = $money + $symbol;
251                        break;
252                    case "left_space":
253                        $money_string = $symbol + " " + $money;
254                        break;
255
256                    case "right_space":
257                        $money_string = $money + " " + $symbol;
258                        break;
259                    case "left":
260                    default:
261                        $money_string = $symbol + $money;
262                        break;
263                }
264
265                return $money_string;
266            }
267
268            function st_number_format(number, decimals, dec_point, thousands_sep) {
269                number = (number + '')
270                    .replace(/[^0-9+\-Ee.]/g, '');
271                var n = !isFinite(+number) ? 0 : +number,
272                    prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
273                    sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
274                    dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
275                    s = '',
276                    toFixedFix = function (n, prec) {
277                        var k = Math.pow(10, prec);
278                        return '' + (Math.round(n * k) / k)
279                            .toFixed(prec);
280                    };
281                // Fix for IE parseFloat(0.55).toFixed(0) = 0;
282                s = (prec ? toFixedFix(n, prec) : '' + Math.round(n))
283                    .split('.');
284                if (s[0].length > 3) {
285                    s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
286                }
287                if ((s[1] || '')
288                    .length < prec) {
289                    s[1] = s[1] || '';
290                    s[1] += new Array(prec - s[1].length + 1)
291                        .join('0');
292                }
293                return s.join(dec);
294            }
295            $(".price_range").each(function () {
296                var t = $(this);
297                var min = $(this).data('min');
298                var max = $(this).data('max');
299                var step = $(this).data('step');
300                var value = $(this).val();
301                var from = value.split(';');
302                var prefix_symbol = $(this).data('symbol');
303                var to = from[1];
304                from = from[0];
305                $(this).ionRangeSlider({
306                    min: min,
307                    max: max,
308                    type: 'double',
309                    prefix: prefix_symbol,
310                    prettify: false,
311                    step: step,
312					onStart: function (data) {
313						t.trigger('st_ranger_price_change');
314                        set_price_range_val(data, $('input[name="price_range"]'));
315                        format_price_price_ranger(data, t);
316						update_value_input(t)
317					},
318                    onChange: function (data) {
319                        t.trigger('st_ranger_price_change');
320                        set_price_range_val(data, $('input[name="price_range"]'));
321                        format_price_price_ranger(data, t);
322						update_value_input(t)
323                    },
324					onFinish: function(data) {
325						t.trigger('st_ranger_price_change');
326                        set_price_range_val(data, $('input[name="price_range"]'));
327                        format_price_price_ranger(data, t);
328						update_value_input(t)
329					},
330					onUpdate: function(data) {
331						t.trigger('st_ranger_price_change');
332                        set_price_range_val(data, $('input[name="price_range"]'));
333                        format_price_price_ranger(data, t);
334						update_value_input(t)
335					},
336                    from: from,
337                    to: to,
338                    force_edges: true,
339                });
340
341				let priceRange = t.data("ionRangeSlider");
342				$('.price-action a.clear-price').on('click', function () {
343					if ( st_params.currency_position == 'right' || st_params.currency_position == 'right_space' ) {
344						priceRange.update( {
345							from: from,
346							to: to,
347							prefix: '',
348							postfix: prefix_symbol,
349                    		prettify: false,
350						} );
351					}
352					if ( st_params.currency_position == 'left' || st_params.currency_position == 'left_space' ) {
353						priceRange.update( {
354							from: from,
355							to: to,
356							prefix: prefix_symbol,
357							postfix: '',
358                    		prettify: false,
359						} );
360					}
361					// priceRange.reset();
362				});
363            });
364
365            function format_price_price_ranger(data, t) {
366                var convert_price_min = format_money(data.from);
367                var convert_price_max = format_money(data.to);
368                t.parents('.range-slider').find('.irs-from').text(convert_price_min);
369                t.parents('.range-slider').find('.irs-to').text(convert_price_max);
370            }
371
372            function set_price_range_val(data, element) {
373                var exchange = 1;
374                var from = Math.round(parseInt(data.from) / exchange);
375                var to = Math.round(parseInt(data.to) / exchange);
376                var text = from + ";" + to;
377                element.val(text);
378            }
379
380			function update_value_input(t) {
381				let parent = t.closest('.range-slider'),
382					from   = $('.irs-from', parent).text(),
383					to     = $('.irs-to', parent).text();
384				$('.min-max-value .item-value', parent).first().find('span').text(from);
385				$('.min-max-value .item-value', parent).last().find('span').text(to);
386			}
387        },
388        _addNextPreInput: function () {
389            $('.st-number-wrapper').each(function () {
390                var timeOut = 0;
391                var t = $(this);
392                var input = t.find('.st-input-number');
393                input.before('<span class="prev"><svg width="18px" height="2px" viewBox="0 0 18 2" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n' +
394                    '    <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n' +
395                    '    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">\n' +
396                    '        <g id="Tour_Detail_1" transform="translate(-1180.000000, -1085.000000)" stroke="#5E6D77" stroke-width="1.5">\n' +
397                    '            <g id="check-avai" transform="translate(1034.000000, 867.000000)">\n' +
398                    '                <g id="adults" transform="translate(0.000000, 184.000000)">\n' +
399                    '                    <g id="ico_subtract" transform="translate(147.000000, 35.000000)">\n' +
400                    '                        <path d="M0.5,0.038 L15.5,0.038" id="Shape"></path>\n' +
401                    '                    </g>\n' +
402                    '                </g>\n' +
403                    '            </g>\n' +
404                    '        </g>\n' +
405                    '    </g>\n' +
406                    '</svg></span>');
407                input.after('<span class="next"><svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n' +
408                    '    <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n' +
409                    '    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">\n' +
410                    '        <g id="Tour_Detail_1" transform="translate(-1258.000000, -1077.000000)" stroke="#5E6D77" stroke-width="1.5">\n' +
411                    '            <g id="check-avai" transform="translate(1034.000000, 867.000000)">\n' +
412                    '                <g id="adults" transform="translate(0.000000, 184.000000)">\n' +
413                    '                    <g id="ico_add" transform="translate(225.000000, 27.000000)">\n' +
414                    '                        <path d="M0.5,8 L15.5,8" id="Shape"></path>\n' +
415                    '                        <path d="M8,0.5 L8,15.5" id="Shape"></path>\n' +
416                    '                    </g>\n' +
417                    '                </g>\n' +
418                    '            </g>\n' +
419                    '        </g>\n' +
420                    '    </g>\n' +
421                    '</svg></span>');
422
423                t.find('span').on("click", function () {
424                    var $button = $(this);
425                    var min = parseFloat( $button.closest('.st-number-wrapper').find('.st-input-number').attr('data-min') );
426                    var max = parseFloat( $button.closest('.st-number-wrapper').find('.st-input-number').attr('data-max') );
427					if ( $( 'body' ).hasClass( 'single-hotel_room' ) ) {
428						numberButtonFuncRoom($button, min, max);
429					} else {
430						numberButtonFunc($button, min, max);
431					}
432                });
433                t.find('span').on("touchstart", function (e) {
434                    $(this).trigger('click');
435                    e.preventDefault();
436                    var $button = $(this);
437                    timeOut = setInterval(function () {
438                        // numberButtonFunc($button);
439                    }, 150);
440                }).on('mouseup mouseleave touchend', function () {
441                    clearInterval(timeOut);
442                });
443
444                function numberButtonFunc($button, min = 0, max = 20) {
445                    var oldValue = $button.parent().find("input").val();
446                    if ($('.single-st_rental').length > 0) {
447                        var container = $button.closest('.st-number-wrapper');
448                    } else {
449                        var container = $button.closest('.form-guest-search');
450                    }
451
452                    var total = 0;
453                    $('input[type="text"]', container).each(function () {
454                        total += parseInt($(this).val());
455                    });
456                    var newVal = oldValue;
457                    if ($button.hasClass('next')) {
458                        if (total < max) {
459                            if (oldValue < max) {
460                                newVal = parseFloat(oldValue) + 1;
461                            } else {
462                                newVal = max;
463                            }
464                        } else {
465							let text_max_people = ( st_params.text_max_people || 'Max of people is %s people' ).replace( '%s', total );
466							let html = `<div class="alert alert-danger"> ${text_max_people}</div>`;
467							$( '#form-booking-inpage .message-wrapper-2' ).append( html ).fadeTo( 5000, 1, () => {
468								$( '#form-booking-inpage .message-wrapper-2 .alert' ).remove();
469							} );
470						}
471                    } else {
472                        if (oldValue > min) {
473                            newVal = parseFloat(oldValue) - 1;
474                        } else {
475                            newVal = min;
476                        }
477                    }
478                    $button.parent().find("input").val(newVal);
479                    $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.search-form').trigger('change');
480                    $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.form-check-availability-hotel').trigger('change');
481                    $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.single-room-form').trigger('change');
482                    $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.activity-booking-form').trigger('change');
483                    if (window.matchMedia('(max-width: 767px)').matches) {
484                        $('#dropdown-1 label', $button.closest('.field-guest')).hide();
485                        $('#dropdown-1 .render', $button.closest('.field-guest')).show();
486                    }
487                };
488				function numberButtonFuncRoom($button, min = 0, max = 20) {
489                    var oldValue = $button.parent().find("input").val();
490					var container = $button.closest('.st-number-wrapper');
491
492                    var total = 0;
493                    $('input[type="text"]', container).each(function () {
494                        total += parseInt($(this).val());
495                    });
496                    var newVal = oldValue;
497                    if ($button.hasClass('next')) {
498                        if (total < max) {
499                            if (oldValue < max) {
500                                newVal = parseFloat(oldValue) + 1;
501                            } else {
502                                newVal = max;
503                            }
504                        } else {
505							let text_max_people = ( st_params.text_max_people || 'Max of people is %s people' ).replace( '%s', total );
506							let html = `<div class="alert alert-danger"> ${text_max_people}</div>`;
507							$( '#form-booking-inpage .message-wrapper-2' ).append( html ).fadeTo( 2000, 1, () => {
508								$( '#form-booking-inpage .message-wrapper-2 .alert' ).remove();
509							} );
510						}
511                    } else {
512                        if (oldValue > min) {
513                            newVal = parseFloat(oldValue) - 1;
514                        } else {
515                            newVal = min;
516                        }
517                    }
518                    $button.parent().find("input").val(newVal);
519                    $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.search-form').trigger('change');
520                    $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.form-check-availability-hotel').trigger('change');
521                    $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.single-room-form').trigger('change');
522                    $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.activity-booking-form').trigger('change');
523                    if (window.matchMedia('(max-width: 767px)').matches) {
524                        $('#dropdown-1 label', $button.closest('.field-guest')).hide();
525                        $('#dropdown-1 .render', $button.closest('.field-guest')).show();
526                    }
527                }
528            });
529        },
530        _dropdownselectDate: function () {
531            if (!$('body').hasClass("single-hotel_room") && !$('body').hasClass("single-st_hotel") && !$('body').hasClass("single-st_activity") && !$('body').hasClass("single-st_tours") &&
532                !$('body').hasClass("single-st_cars") && !$('body').hasClass("single-st_rental")
533            ) {
534
535                $('.form-date-search', 'body').each(function () {
536                    var parent = $(this),
537                        date_wrapper = $('.date-wrapper', parent),
538                        check_in_input = $('.check-in-input', parent),
539                        check_out_input = $('.check-out-input', parent),
540                        check_in_out = $('.check-in-out', parent),
541                        check_in_render = $('.check-in-render', parent),
542                        check_out_render = $('.check-out-render', parent);
543                    var timepicker = parent.data('timepicker');
544
545                    if (typeof timepicker == 'undefined' || timepicker == '') {
546                        timepicker = false;
547                    } else {
548                        timepicker = true;
549                    }
550                    var options = {
551                        singleDatePicker: false,
552                        sameDate: false,
553                        autoApply: true,
554                        minDate: new Date(),
555                        dateFormat: 'DD/MM/YYYY',
556                        customClass: '',
557                        widthSingle: 500,
558                        onlyShowCurrentMonth: true,
559                        timePicker: timepicker,
560                        timePicker24Hour: (st_params.time_format == '12h') ? false : true,
561                    };
562                    if (typeof locale_daterangepicker == 'object') {
563                        options.locale = locale_daterangepicker;
564                    }
565                    check_in_out.daterangepicker(options,
566                        function (start, end, label) {
567                            check_in_input.val(start.format(parent.data('format'))).trigger('change');
568                            $('#tp_hotel .form-date-search .check-in-input').val(start.format('YYYY-MM-DD')).trigger('change');
569                            check_in_render.html(start.format(parent.data('format'))).trigger('change');
570                            check_out_input.val(end.format(parent.data('format'))).trigger('change');
571                            $('#tp_hotel .form-date-search .check-out-input').val(end.format('YYYY-MM-DD')).trigger('change');
572                            check_out_render.html(end.format(parent.data('format'))).trigger('change');
573                            if (timepicker) {
574                                check_in_input.val(start.format(parent.data('date-format'))).trigger('change');
575                                $('.check-in-input-time', parent).val(start.format(parent.data('time-format'))).trigger('change');
576                                check_out_input.val(end.format(parent.data('date-format'))).trigger('change');
577                                $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
578                                $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
579                            }
580                            check_in_out.trigger('daterangepicker_change', [start, end]);
581                            if (window.matchMedia('(max-width: 767px)').matches) {
582                                $('label', parent).hide();
583                                $('.render', parent).show();
584                                $('.check-in-wrapper span', parent).show();
585                            }
586                        }
587                    );
588
589                    date_wrapper.on('click', function (e) {
590                        check_in_out.trigger('click');
591                    });
592                });
593                $('.form-date-search-v3', 'body').each(function () {
594
595                    var parent = $(this),
596                        date_wrapper = $('.date-wrapper', parent),
597                        check_in_input = $('.check-in-input', parent),
598                        check_out_input = $('.check-out-input', parent),
599                        check_in_out = $('.check-in-out', parent),
600                        check_in_render = $('.check-in-render', parent),
601                        check_out_render = $('.check-out-render', parent);
602                    var timepicker = parent.data('timepicker');
603                    if (typeof timepicker == 'undefined' || timepicker == '') {
604                        timepicker = false;
605                    } else {
606                        timepicker = true;
607                    }
608                    var customClass = parent.data('custom-class') || '';
609                    var options = {
610                        singleDatePicker: false,
611                        autoApply: true,
612                        disabledPast: true,
613                        dateFormat: 'DD/MM/YYYY',
614                        customClass: customClass,
615                        widthSingle: 500,
616                        onlyShowCurrentMonth: true,
617                        timePicker: timepicker,
618                        timePicker24Hour: (st_params.time_format == '12h') ? false : true,
619                    };
620                    if (typeof locale_daterangepicker == 'object') {
621                        options.locale = locale_daterangepicker;
622                    }
623                    check_in_out.daterangepicker(options,
624                        function (start, end, label) {
625                            check_in_input.val(start.format(parent.data('format'))).trigger('change');
626                            $('#tp_hotel .form-date-search .check-in-in
626put').val(start.format('YYYY-MM-DD')).trigger('change');
627                            var html = start.format(parent.data('format')) + ' - ';
628                            check_in_render.html(html).trigger('change');
629                            check_out_input.val(end.format(parent.data('format'))).trigger('change');
630                            $('#tp_hotel .form-date-search .check-out-input').val(end.format('YYYY-MM-DD')).trigger('change');
631                            check_out_render.html(end.format(parent.data('format'))).trigger('change');
632
633                            if (timepicker) {
634                                check_in_input.val(start.format(parent.data('date-format'))).trigger('change');
635                                $('.check-in-input-time', parent).val(start.format(parent.data('time-format'))).trigger('change');
636                                check_out_input.val(end.format(parent.data('date-format'))).trigger('change');
637                                $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
638                                $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
639
640
641                            }
642                            check_in_out.trigger('daterangepicker_change', [start, end]);
643                            $('body').removeClass('st_overflow');
644                            if (window.matchMedia('(max-width: 767px)').matches) {
645                                $('label', parent).hide();
646                                $('.render', parent).show();
647                                $('.check-in-wrapper span', parent).show();
648                            }
649                        });
650                    date_wrapper.on('click', function (e) {
651                        console.log('ok đã click');
652                        check_in_out.trigger('click');
653                    });
654                });
655            }
656
657        },
658        _dropdownselect: function () {
659            $('.form-extra-field').each(function () {
660                let wrapper = $('.field-guest');
661                var parent = $(this).parent('.form-group');
662                parent.on('click', function (e) {
663                    console.log('ok');
664                    $(this).find('.arrow').toggleClass('fa-angle-down fa-angle-up');
665                });
666
667                $('.arrow', parent).on('click', function (e) {
668                    var drop_down = $(this).closest('.dropdown');
669                    var dropdown_menu = $('[aria-labelledby="' + drop_down.find('.dropdown-toggle').attr('id') + '"]', parent);
670                    $('.form-extra-field').find('.dropdown-menu').not(dropdown_menu).slideUp(50);
671                    dropdown_menu.slideToggle(50);
672                    $(this).toggleClass('fa-angle-down fa-angle-up');
673                });
674                $('input[name="adult_number"]', parent).on('change', function () {
675                    var adults = parseInt($(this).val());
676                    var html = adults;
677                    if (typeof adults == 'number') {
678                        if (adults < 2) {
679                            html = adults + ' ' + $('.render .adult', wrapper).data('text');
680                        } else {
681                            html = adults + ' ' + $('.render .adult', wrapper).data('text-multi');
682                        }
683                    }
684                    $('.render .adult', parent).html(html);
685                });
686                //$('input[name="adult_number"]', parent).trigger('change');
687                $('input[name="child_number"]', parent).on('change', function () {
688                    var children = parseInt($(this).val());
689                    var html = children;
690                    if (typeof children == 'number') {
691                        if (children < 2) {
692                            html = children + ' ' + $('.render .children', wrapper).data('text');
693                        } else {
694                            html = children + ' ' + $('.render .children', wrapper).data('text-multi');
695                        }
696                    }
697                    $('.render .children', parent).html(html);
698                });
699                //$('input[name="child_number"]', parent).trigger('change');
700            });
701
702            /*Travel Payout Hotel*/
703            $('#nav-tp_hotel .form-extra-field').each(function () {
704                var parent = $(this);
705                $('input[name="adults"]', parent).on('change', function () {
706
707                    var adults = parseInt($(this).val());
708                    var html = adults;
709                    if (typeof adults == 'number') {
710                        if (adults < 2) {
711                            html = adults + ' ' + $('.render .adult', parent).data('text');
712                        } else {
713                            html = adults + ' ' + $('.render .adult', parent).data('text-multi');
714                        }
715                    }
716                    $('.render .adult', parent).html(html);
717                });
718                $('input[name="children"]', parent).on('change', function () {
719                    var children = parseInt($(this).val());
720                    var html = children;
721                    if (typeof children == 'number') {
722                        if (children < 2) {
723                            html = children + ' ' + $('.render .children', parent).data('text');
724                        } else {
725                            html = children + ' ' + $('.render .children', parent).data('text-multi');
726                        }
727                    }
728                    $('.render .children', parent).html(html);
729                });
730            });
731
732
733        }
734    }
735    SearchForm.init();
736})(jQuery);

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.