'; $('#category_text').html(str); } if(img != ''){ document.getElementById('header-background-default').style.backgroundImage = "url('"+img_src+"'), linear-gradient(180deg, #004B6C, transparent 30%)"; } } function changeImageText(criteria,id){ var title=''; var description= ''; var img= ''; var givenClass= criteria + '_' + id; var root = document.getElementById('img_filter').value; if(criteria == 'collections'){ for (i = 0; i < collectionJS.length; i++) { if(collectionJS[i].collection_id == id){ if(collectionJS[i].description != ''){ description = collectionJS[i].description; title = collectionJS[i].title; } img = collectionJS[i].img;//if there is no description it shows the image img_src = root + '/'+img; } } } if(criteria == 'country2'){ for (i = 0; i < categoryJS.length; i++) { if(categoryJS[i].cat_id == id){ if(categoryJS[i].cat_desc != ''){ description = categoryJS[i].cat_desc; title = categoryJS[i].cat_name; } img = categoryJS[i].cat_image;//if there is no description it shows the image img_src = root + '/media/com_gvqtravel/images/cats/o/'+img; } } }//console.log(criteria + id); if(description == ''){//console.log('description est vide'); if ($('#parameter-type-travel_1').prop('checked')){description = groupText; title = groupTitle; givenClass = 'type_1'; } if ($('#parameter-type-travel_2').prop('checked')){description = individualText; title = individualTitle; givenClass = 'type_2';} if ($('#parameter-type-travel_3').prop('checked')){description = cruiseText; title = cruiseTitle; givenClass = 'type_3';} } if(description != ''){ var str='
' + description +'
'; $('#category_text').html(str); } if(img != ''){ document.getElementById('header-background-default').style.backgroundImage = "url('"+img_src+"'), linear-gradient(180deg, #004B6C, transparent 30%)"; } } function removeImageText(parentDivId){ var filterOptionId = parentDivId.split('_'); //console.log(filterOptionId[1]); if(filterOptionId[1] == 'country2'){ var filterVal = filterOptionId[2]; var classToRemove = filterOptionId[1] + '_' + filterVal; if($('#cat_text').hasClass(classToRemove)){ $('#category_text').html(''); searchImageText(); } } if(filterOptionId[1] == 'collections'){ var filterVal = filterOptionId[3]; var classToRemove = filterOptionId[1] + '_' + filterVal; //console.log(classToRemove); if($('#cat_text').hasClass(classToRemove)){ $('#category_text').html(''); searchImageText(); } } searchImageText(); } function searchImageText(){ var textFound = false; $(".filterSelectedOption").each(function() { tagId = $(this).attr('id'); var splitTagId = tagId.split('_'); if(splitTagId[1] == 'country2'){ for (i = 0; i < categoryJS.length; i++) { if(categoryJS[i].cat_id == splitTagId[2]){ if(categoryJS[i].cat_desc != ''){ changeImageText('country2',splitTagId[2]); textFound = true; } } } } if(splitTagId[1] == 'collections'){ for (i = 0; i < collectionJS.length; i++) { if(collectionJS[i].collection_id == splitTagId[3]){ if(collectionJS[i].description != ''){ changeImageText('collections',splitTagId[3]); textFound = true; } } } } }); if (!textFound){ if ($('#parameter-type-travel_1').prop('checked')){changeImageText('type','1'); } if ($('#parameter-type-travel_2').prop('checked')){changeImageText('type','2');} if ($('#parameter-type-travel_3').prop('checked')){changeImageText('type','3');} } } var acc = document.getElementsByClassName('accordion1'); acc[0].addEventListener('click', function() { this.classList.toggle('active'); var filter_slide_div = document.getElementById('filter_slide_div'); if (filter_slide_div.style.maxHeight) { filter_slide_div.style.maxHeight = null; $('#countListings').toggleClass('countListings_up'); } else { filter_slide_div.style.maxHeight = '100%'; $('#countListings').toggleClass('countListings_up'); } }); $("body").on("click", "ul.nav-pills li a", function(e) { e.preventDefault(); // changing bg of tab-headers var tabHeader = $(this).parent().parent(); var isActive = $(this).parent().hasClass("active"); if (isActive) { $(tabHeader).addClass('whitebg'); } else { $(tabHeader).removeClass('whitebg'); } var linkSelected = $(this).attr('href').split('_'); var selectD = '#select-dates-' + linkSelected[1] + ' option'; var selectDActive = $(selectD).filter(":selected").val(); if (selectDActive != '') { var parent = $(this).parent('li'); var tab = $($(this).attr('href')); var activate = !tab.hasClass('active'); tab.removeClass('active'); parent.removeClass('active'); if (activate) { $(this).tab('show') } else { return false; } } else { return false; } }); $.datepicker.regional['fr-CA'] = { closeText: "Fermer", prevText: "Précédent", nextText: "Suivant", currentText: "Aujourd'hui", monthNames: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"], monthNamesShort: ["janv.", "févr.", "mars", "avril", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."], dayNames: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"], dayNamesShort: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], dayNamesMin: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"], weekHeader: "Sem.", dateFormat: "yy-mm-dd", firstDay: 0, isRTL: false, showMonthAfterYear: false, yearSuffix: "" }; $.datepicker.setDefaults($.datepicker.regional['fr-CA']); $("body").on("click", ".ui-state-highlight span", function(e) { var parentClass = $(this).parent().get(0).classList; var countItem = parentClass.length; var classDates = parentClass[countItem - 1]; if ($(this).parent().get(0).hasClass('ui-datepicker-today')) { classDates = parentClass[countItem - 2]; } var dateSelected = classDates.split('_'); var parentClassId = $(this).parents('.hasDatepicker'); var idLink = parentClassId.attr('id'); idLink = idLink.split('-'); var idDate = $('#select-dates-' + idLink[2]).val(); var idHotel = $('#select-hotel-' + idLink[2]).val(); $('.selectedDateCalendar').removeClass('selectedDateCalendar'); $(this).addClass('selectedDateCalendar'); multiDateSelect(dateSelected[2], dateSelected[1], dateSelected[0], idDate, idLink[2], idHotel) }); $(".select-dates").live('change', function() { var dataId = parseInt($(this).val()); var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[2]; if (dataId != '0') { $('#select-countperson-' + linkId).prop('disabled', false); listingDateSelect(linkId, true, false, false, false); } else { $('#select-countperson-' + linkId).prop('disabled', true); $('#select-hotel-' + linkId).prop('disabled', true); $('#select-cabine-' + linkId).prop('disabled', true); $('#select-lp-' + linkId).prop('disabled', true); $('#link_' + linkId + ' a.link_to_link').addClass('disabledLink'); $('#link_' + linkId + ' a.link_to_reserv').addClass('disabledLink'); $('#select-dates-' + linkId).next().removeClass("selDate"); $('#link_' + linkId + ' .price-block .transportblock').html(""); } }); $(".select-lp").live('change', function() { var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[2]; listingDateSelect(linkId, false, false, false, false); }); $(".select-countperson").live('change', function() { var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[2]; listingDateSelect(linkId, false, true, false, false); }); $(".select-hotel").live('change', function() { var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[2]; $("#link_" + linkId + " .hotel span").html($('#select-hotel-' + linkId + " option").filter(":selected").text()); listingDateSelect(linkId, false, false, true, false); }); $(".select-cabine").live('change', function() { var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[2]; listingDateSelect(linkId, false, false, false, true); }); $('#slide-group-id-destinations .accordion-heading a').click(function(evt) { evt.preventDefault(); evt.stopPropagation(); }); $("#country2.select2-country").select2({ closeOnSelect: false, placeholder: "Ajouter une destination", minimumResultsForSearch: -1, }); $('.select2-search__field').css('width', '100%'); $('.select2-search__field').attr('placeholder', 'Ajouter des destinations'); $('#country2.select2-country').on('select2:select', function(evt) { $('.select2-search__field').css('width', '100%'); $('.select2-search__field').attr('placeholder', 'Ajouter des destinations'); var parent = $('.select2-dropdown').parent('.select2-container'); var topPosDropdown = $('.select2-selection--multiple').offset(); var newTopPostopPosDropdown = topPosDropdown.top + 32; parent.offset({ top: newTopPostopPosDropdown }); }); $('#country2.select2-country').on('select2:unselect', function(evt) { $('.select2-search__field').css('width', '100%'); $('.select2-search__field').attr('placeholder', 'Ajouter des destinations'); var parent = $('.select2-dropdown').parent('.select2-container'); var topPosDropdown = $('.select2-selection--multiple').offset(); var newTopPostopPosDropdown = topPosDropdown.top + 32; parent.offset({ top: newTopPostopPosDropdown }); }); //to find the last clicked destination var arrayCountryBefore = Array(); if($("select#country2").val() != null){ arrayCountryBefore = $("select#country2").val(); } //console.log('arrayCountryBefore---'+arrayCountryBefore); Array.prototype.diff = function(a) { return this.filter(function(i) {return a.indexOf(i) < 0;}); } $("#country2").change(function() { var arrayCountry = $("select#country2").val(); var countryArr = getSelectedOptions("country2", arrayCountry); AddMultiSelectionItem("sel_country2_", countryArr); ajaxSerialize(); //console.log('arrayCountryBefore---'+arrayCountryBefore); //console.log('arrayCountry---'+arrayCountry); if(arrayCountry != null && arrayCountryBefore != null){ if(arrayCountryBefore.length < arrayCountry.length){ const dif1 = arrayCountry.diff( arrayCountryBefore ); //console.log('diff---'+dif1[0]); changeImageText('country2',dif1[0]); } } arrayCountryBefore = arrayCountry; }); $("body").on("click", "a.close-selected.multi", function(e) { e.preventDefault(); var parentDiv = $(this).parent(); clearFilterOptionMulti(parentDiv); }); /*$('body').on('click', 'a#ten_plus', function(e) { e.preventDefault(); var newPage = parseInt($('#page').val()) + 1; $('#page').val(newPage); ajaxSerialize(newPage); });*/ var countL = $('#countL').val(); var pageL = $('#page').val(); var loading = false; if ((countL * 1) < (pageL * 10)) { loading = true; } if (!loading) { $(window).on('resize scroll', function() { var elementTop = $('#listingsContent').offset().top; var elementBottom = $('#listingsContent').outerHeight(); var lastElementHeight = $('.link').outerHeight(); var elementHeight = elementBottom - elementTop - lastElementHeight; var viewportTop = $(window).scrollTop(); if (elementHeight <= viewportTop) { if (!loading) { loading = true; var newPage = parseInt($('#page').val()) + 1; ajaxSerialize(newPage); //call function to load content when scroll reachs DIV bottom } } }); } $("body").on("click", "a.departMultipleSelect", function(e) { e.preventDefault(); $(this).parent().find("#hideWrapper").removeClass("hidden"); var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[1]; listingDateSelect(linkId, true, false, false, false, true); }); $("body").on("click", "a.repetitionSelect", function(e) { e.preventDefault(); var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[1]; listingDateSelect(linkId, true, false, false, false, true); }); var needAjax = true; var selectedCountry = $("select#country2").val(); if (selectedCountry != 0 && selectedCountry != null) { var countryArr = getSelectedOptions("country2", selectedCountry); AddMultiSelectionItem("sel_country2_", countryArr); //needAjax = true; } var x = location.search; if(location.search.includes("cat_id=")){ var id = x.split("cat_id="); id = id[1].split("&"); var selectedIdArray = id[0].toString().split('%7C'); if(selectedIdArray.length==1){selectedIdArray = id[0].toString().split('|');} $("select#country2").val(selectedIdArray); var countryArrSelected = getSelectedOptions("country2", selectedIdArray); AddMultiSelectionItem("sel_country2_", countryArrSelected); } //needAjax = true; if (needAjax) { ajaxSerialize(); } $('#calendar_ch').change(function() { ajaxSerialize(); }); $(".collections").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_collections_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); //////// var col_id= $(this).attr("value"); changeImageText('collections',col_id); ///////// } else { clearFilterOption("sel_collections_" + $(this).attr("id")); ajaxSerialize(); } }); $(".airlines").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_airlines_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_airlines_" + $(this).attr("id")); ajaxSerialize(); } }); $(document).on('click', '.years', function() { clearFilterOption("sel_month"); AddSelectionItem("sel_year", $(this).val()); $('#year_by_get').val($(this).val()); ajaxSerialize(); }); $(document).on('click', '.month', function() { AddSelectionItem("sel_month", $(this).next('span').text()); $('#month_by_get').val($(this).val()); ajaxSerialize(); }); $(".bus").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_bus_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_bus_" + $(this).attr("id")); ajaxSerialize(); } }); $(".cruiseShips").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_cruiseShips_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_cruiseShips_" + $(this).attr("id")); ajaxSerialize(); } }); $(".regions").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_regions_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_regions_" + $(this).attr("id")); ajaxSerialize(); } }); $(".duration").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_duration_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_duration_" + $(this).attr("id")); ajaxSerialize(); } }); $(".caracteristique").on("change", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_caracteristique_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_caracteristique_" + $(this).attr("id")); ajaxSerialize(); } }); $(".customer_type").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_customer-type_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_customer-type_" + $(this).attr("id")); ajaxSerialize(); } }); $(".type_price_display").on("click", function() { if ($(this).prop('checked')) { // AddSelectionItem("sel_parameter-type-travel_" + $(this).attr("id"), $(this).data("text")); /* var url = new URL(location.href); var search_params = url.searchParams; if($(this).attr("id")== "parameter-type-travel_1"){ search_params.set('typedevoyage', '1'); }else{ search_params.set('typedevoyage', '2'); } url.search = search_params.toString(); var new_url = url.toString(); console.log(new_url); location.href = new_url;*/ if($(this).attr("id")== "parameter-type-travel_2"){ $('#slide-group-id-regions').hide(); $('#slide-group-id-airlines').hide(); $('#slide-group-id-cruiseShips').hide(); }else{ $('#slide-group-id-regions').show(); $('#slide-group-id-airlines').show(); $('#slide-group-id-cruiseShips').show(); } var id; if($(this).attr("id") == "parameter-type-travel_1"){ id='1';}else if($(this).attr("id") == "parameter-type-travel_2"){ id = '2';}else { id = '3';} changeImageText('type',id); ajaxSerialize(); } else { clearFilterOption("sel_parameter-type-travel_" + $(this).attr("id")); ajaxSerialize(); } }); $(".transport").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_transport_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_transport_" + $(this).attr("id")); ajaxSerialize(); } }); $(".rythme").on("click", function() { if ($(this).prop('checked')) { AddSelectionItem("sel_rythme_" + $(this).attr("id"), $(this).data("text")); ajaxSerialize(); } else { clearFilterOption("sel_rythme_" + $(this).attr("id")); ajaxSerialize(); } }); $('#landingPoint').change(function() { ajaxSerialize(); }); $('#landingPointByDate').change(function() { ajaxSerializeLP(); }); $('#airport').change(function() { ajaxSerialize(); }); $('body').on('click', 'a.close-selected', function(e) { e.preventDefault(); var parentDiv = $(this).parent().attr('id'); clearFilterOption(parentDiv); ajaxSerialize(); }); $('body').on('click', 'a.clear-filter', function(e) { e.preventDefault(); if ($(".filterSelectedOption").length > 0) { $(".filterSelectedOption").each(function() { if ($(this).hasClass('multiOption')) { clearFilterOptionMulti($(this)); } else { clearFilterOption($(this).attr('id')); } }); ajaxSerialize(); } }); function AddMultiSelectionItem(idBlock, selectedValues) { $("[id^=" + idBlock + "]").remove(); for (var i = 0; i < selectedValues.length; i++) { var issetBlock = $("#filter-selection").find("div#" + idBlock + selectedValues[i]["value"]); if (issetBlock.length != 0) { $("#filter-selection div#" + idBlock + selectedValues[i]["value"] + " p").html("").html(selectedValues[i]["text"].replace(/^\ \;|
*/gi, "").replace(/\ \;|
$/gi, "").trim()); } else { var newElement = "
" + selectedValues[i]["text"].replace(/^\ \;|
*/gi, "").replace(/\ \;|
$/gi, "").trim() + "
"; $("#filter-selection").append(newElement); } } } function clearFilterOptionMulti(parentDiv) { var idDiv = parentDiv.attr("id"); var OptionId = idDiv.split("_"); var filterOptionId = OptionId[1]; var filterVal = OptionId[2]; parentDiv.remove(); var $select = $("#" + filterOptionId); var idToRemove = filterVal; var values = $select.val(); if (values) { var i = values.indexOf(idToRemove); if (i >= 0) { values.splice(i, 1); $select.val(values).change(); } } removeImageText(idDiv); } function getOptions(selectId) { var opts = document.getElementById(selectId).options; var optsArr = new Array(); for (var i = 0; i < opts.length; i++) { optsArr[i] = new Array(); optsArr[i]["parent"] = opts[i].attributes["data-parent"].value; optsArr[i]["value"] = opts[i].value; optsArr[i]["text"] = opts[i].innerHTML; } return optsArr; } function getSelectedOptions(selectId, selectedArray) { var opts = document.getElementById(selectId).options; var optsArr = new Array(); var counter = 0; for (var i = 0; i < opts.length; i++) { if ($.inArray(opts[i].value, selectedArray) !== -1) { optsArr[counter] = new Array(); optsArr[counter]["value"] = opts[i].value; optsArr[counter]["text"] = opts[i].innerHTML; counter++; } } return optsArr; } function clearFilterOption(parentDiv) { var filterOptionId = parentDiv.split('_'); $('#' + parentDiv).remove(); if (filterOptionId[1] == 'datepicker') { $('#form-datepicker').val(''); } else if (filterOptionId[1] == 'continent' || filterOptionId[1] == 'country' || filterOptionId[1] == 'state') { $('#' + filterOptionId[1] + " option:first-child").attr("selected", "selected"); } else if (filterOptionId[1] == 'year') { //alert('Change y; clear m'); $('#sel_month').remove(); $('.month').prop('checked', false); $('.years').prop('checked', false); $('#month_by_get').val(''); $('#year_by_get').val(''); } else if (filterOptionId[1] == 'month') { //alert('Clear month'); $('.month').prop('checked', false); $('#month_by_get').val(''); } else if (filterOptionId[1] == 'cruiseShips') { $('.cruiseShips').prop('checked', false); $('#cruiseShips').val(''); } else if (filterOptionId[1] == 'airline') { $('.airlines').prop('checked', false); $('#airlines').val(''); } else { $('#' + filterOptionId[2] + "_" + filterOptionId[3]).each(function() { $(this).prop('checked', false); }); removeImageText(parentDiv); } } function ajaxSerialize(pageListings) { if (typeof pageListings === 'undefined') { pageListings = 1; } var dataFilterSerialize = $("#filterForm").serialize(); var dataLandingPointSerialize = $("#landingPointForm").serialize(); var itemid = $('#itemid').val(); //console.log(dataFilterSerialize); $.ajax({ type: "POST", cache: false, url: "https://gvq.ca/index.php", data: "option=com_gvqtravel&task=ajaxfilter&itemid=" + itemid + "&action=filter&" + dataFilterSerialize + "&" + dataLandingPointSerialize + '&pageListings=' + pageListings, dataType: "json", beforeSend: function(xhr) { $('#preloader').show(); $('#no-listings').hide(); }, success: function(data) {//console.log(data.count); /*$('#ten_plus').hide();*/ $('#no-listings').hide(); if (data.yearMonth) { var checkedYear = $('#year_by_get').val(); var checkedMonth = $('#month_by_get').val(); $('.month').attr('disabled', true); $('#year-filter').empty(); $('#month-filter').hide(); $.each(data.yearMonth, function(key, values) { if (checkedYear === key) { $('#year-filter').append(''); $('#year_' + key).prop('checked', true); $.each(values, function(k, v) { $('#month_' + v).attr('disabled', false); if (checkedMonth === v) { $('#month_' + v).prop('checked', true); } }); $('#month-filter').show(); } else { $('#year-filter').append(''); } }); } if (data != null) { $('#countL').val(data.countAllListingsNumb); $('#page').val(pageListings); $('#countListings').html(data.countAllListings); $('#countListings-mobile').html(data.countAllListings); // collections setCountElementValue('collections', data.count.collections); // regions setCountElementValue('regions', data.count.regions); // duration setCountElement('duration', data.count.duration); // type_price_display //setCountElement('type_price_display', data.count.typeTravelCount); // customer_type setCountElement('customer_type', data.count.customerTypeCount); // airlines setCountElementValue('airlines', data.count.airlines); // bus setCountElementValue('bus', data.count.bus); // cruise_ships setCountElementValue('cruiseShips', data.count.cruise_ships); //new var text = $("#caracteristique_1").data('text'); $("#caracteristique_1").prop("disabled", false); $("label[for='caracteristique_1']+span").text(text + "(" + data.count.newCount + ")"); if (data.count.newCount == 0) { $("#caracteristique_1").prop("disabled", true); } //heart_stroke var text = $("#caracteristique_2").data('text'); $("#caracteristique_2").prop("disabled", false); $("label[for='caracteristique_2']+span").text(text + "(" + data.count.heartStrokeCount + ")"); if (data.count.heartStrokeCount == "0") { $("#caracteristique_2").prop("disabled", true); } //heart_stroke1 var text = $("#caracteristique_9").data('text'); $("#caracteristique_9").prop("disabled", false); $("label[for='caracteristique_9']+span").text(text + "(" + data.count.heartStrokeCount1 + ")"); if (data.count.heartStrokeCount1 == "0") { $("#caracteristique_9").prop("disabled", true); } //guaranteed_departure var text = $("#caracteristique_3").data('text'); $("#caracteristique_3").prop("disabled", false); $("label[for='caracteristique_3']+span").text(text + "(" + data.count.guaranteedDepartureCount + ")"); if (data.count.guaranteedDepartureCount == "0") { $("#caracteristique_3").prop("disabled", true); } //collection_guaranteed_departure var text = $("#caracteristique_10").data('text'); $("#caracteristique_10").prop("disabled", false); $("label[for='caracteristique_10']+span").text(text + "(" + data.count.CollectionGuaranteedDepartureCount + ")"); if (data.count.CollectionGuaranteedDepartureCount == "0") { $("#caracteristique_10").prop("disabled", true); } //featured var text = $("#caracteristique_5").data('text'); $("#caracteristique_5").prop("disabled", false); $("label[for='caracteristique_5']+span").text(text + "(" + data.count.featuredCount + ")"); if (data.count.featuredCount == 0) { $("#caracteristique_5").prop("disabled", true); } //discount var text = $("#caracteristique_6").data('text'); $("#caracteristique_6").prop("disabled", false); $("label[for='caracteristique_6']+span").text(text + "(" + data.count.discountCount + ")"); if (data.count.discountCount == "0") { $("#caracteristique_6").prop("disabled", true); } //jumelage var text = $("#caracteristique_7").data('text'); $("#caracteristique_7").prop("disabled", false); $("label[for='caracteristique_7']+span").text(text + "(" + data.count.jumelageCount + ")"); if (data.count.jumelageCount == "0") { $("#caracteristique_7").prop("disabled", true); } // small_group var text = $("#caracteristique_8").data('text'); $("#caracteristique_8").prop("disabled", false); $("label[for='caracteristique_8']+span").text(text + "(" + data.count.smallGroupCount + ")"); if (data.count.smallGroupCount == "0") { $("#caracteristique_8").prop("disabled", true); } } if (data.html == '') { $('#no-listings').show(); $('#listings #listingsContent').find('div.link') .remove() .end() .append(data.html); } else { if (pageListings == 1) { $('#listings #listingsContent').find('div.link') .remove() .end() .append(data.html); } else { $('#listings #listingsContent').append(data.html); } $('#landingPointByDate').find('option') .remove() .end() .append(data.option); $('#listings .select-dates').select2({ minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); if ($('.datesDisponibles').length != 0) { $(".datesDisponibles").each(function() { var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[2]; listingDateSelect(linkId, true, false, false, false, false); }); } /* if($('.departMultipleSelect').length != 0){ $(".departMultipleSelect").each(function () { var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[1]; listingDateSelect( linkId, true, false, false, false, false ); }); } */ if ($('.repetitionSelect').length != 0) { $(".repetitionSelect").each(function() { var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[1]; listingDateSelect(linkId, true, false, false, false, false); }); } if ($('select.select-dates').length != 0) { $("select.select-dates").each(function() { var countOption = $(this).find('option').length; if (countOption === 2) { var linkId = $(this).attr('id'); linkId = linkId.split('-'); linkId = linkId[2]; listingDateSelect(linkId, true, false, false, false, false); } }); } var countL = $('#countL').val(); var pageL = $('#page').val(); if ((countL * 1) > (pageL * 10)) { loading = false; } else { loading = true; } } // changing bg of tab-headers var tabHeaders = $('.link .nav-pills'); for (var i = 0; i < $(tabHeaders).size(); i++) { var tabHeaderLinks = $(tabHeaders[i]).find('li'); var isActive = false; $(tabHeaderLinks).each(function() { if ($(this).hasClass('active')) isActive = true; }); if (!isActive) { $(tabHeaders[i]).addClass('whitebg'); } } $('#preloader').hide(); }, }); } function ajaxSerializeLP() { var dataFilterSerialize = $("#filterForm").serialize(); var dataLandingPointSerialize = $("#landingPointForm").serialize(); var itemid = $('#itemid').val(); $.ajax({ type: "POST", cache: false, url: "https://gvq.ca//index.php", data: "option=com_gvqtravel&task=ajaxfilter&itemid=" + itemid + "&action=filter&" + dataFilterSerialize + "&" + dataLandingPointSerialize, dataType: "json", beforeSend: function(xhr) { $('#preloader').show(); }, success: function(data) { $('#listings #listingsContent').find('div.link') .remove() .end() .append(data.html); $('#preloader').hide(); } }); } function AddSelectionItem(idBlock, selectedValue) { var issetBlock = $('#filter-selection').find('div#' + idBlock); if (issetBlock.length != 0) { $('#filter-selection div#' + idBlock + ' p').html('').html(selectedValue); } else { var newElement = "
" + selectedValue + "
"; $('#filter-selection').append(newElement); } } function setCountElementValue(className, valueArray) {//console.log(className + valueArray); $("." + className).each(function(index) { var elementId = $(this).attr('id');//console.log('++'+elementId); var id = $(this).val(); var count = 0; $.each(valueArray, function(index, value) { if (id == value.value) { count = value.countListings; } }); var text = $(this).data('text');//console.log(text+count); $("label[for='" + elementId + "']+span").text(text + " (" + count + ")"); if (count == "0" || count == 0) { $(this).prop("disabled", true); //$(this).parent('.styled-check').hide(); } else { $(this).prop("disabled", false); //$(this).parent('.styled-check').show(); } }); } function setCountElement(className, valueArray) { $("." + className).each(function(index) { var elementId = $(this).attr('id'); var id = $(this).val(); var count = 0; $.each(valueArray, function(index, value) { if (id == index) { count = value; } }); var text = $(this).data('text'); $("label[for='" + elementId + "']+span").text(text + " (" + count + ")"); if (count == "0" || count == 0) { $(this).prop("disabled", true); //$(this).parent('.styled-check').hide(); } else { $(this).prop("disabled", false); //$(this).parent('.styled-check').show(); } }); } function listingDateSelect(linkId, ifDateSelect, ifCountpersonSelect, ifHotelSelect, ifCabineSelect, ifShowCalendar) { var itemid = $('#itemid').val(); if (typeof ifShowCalendar === "undefined" || ifShowCalendar === null) { ifShowCalendar = 0; } var dataSelectSerialize = $("#form-select-" + linkId).serialize(); var selectLp = '#select-lp-' + linkId + ' option'; var selectD = '#select-dates-' + linkId + ' option'; var selectLpActive = $(selectLp).filter(":selected"); var selectDActive = $(selectD).filter(":selected").val(); var isDefault = $(selectD).filter(":selected").attr('default'); if (ifShowCalendar) { selectDActive = $('#select-dates-' + linkId).val(); } if ($('#select-dates-' + linkId).is(':disabled')) { dataSelectSerialize = dataSelectSerialize + '&select-dates-' + linkId + '=' + selectDActive; } var selectCountpersonActive = $('#select-countperson-' + linkId + " option").filter(":selected").val(); var selectHotelActive = $('#select-hotel-' + linkId + " option").filter(":selected").val(); var selectCabineActive = $('#select-cabine-' + linkId + " option").filter(":selected").val(); //dev-357 price_on_demand var selectLpvalue = $('#select-lp-' + linkId + " option").filter(":selected").val(); //dev-357 price_on_demand var inclutsTab = $('#inclusions_' + linkId); var itinerairiesTab = $('#itineraire_' + linkId); var optionsTab = $('#options_' + linkId); var ifDateSelectRequest = ifDateSelect | 0; var ifHotelSelectRequest = ifHotelSelect | 0; $('#link_' + linkId + ' .listing-depart-garanti').remove(); $.ajax({ type: "POST", cache: false, url: "https://gvq.ca/index.php", data: "option=com_gvqtravel&task=ajaxfilter&itemid=" + itemid + "&action=listingDateSelect&" + dataSelectSerialize + "&linkId=" + linkId + "&ifDateSelect=" + ifDateSelectRequest + "&ifHotelSelect=" + ifHotelSelectRequest + "&isDefault=" + isDefault, dataType: "json", success: function(data) {//console.log(data.linkDate); if (data.conditions && $('#link_' + linkId + ' .listing-depart-garanti').length == 0) { $('#link_' + linkId + ' .price-block .depart-garanti').prepend(data.conditions); } if (!ifShowCalendar) { $('#link_' + linkId + ' .price-block .transportblock').html(data.transportHtml); } if ((data.calendarBlockItems.length == 0)) { $('#select-countperson-' + linkId).prop('disabled', false); $('#select-countperson-' + linkId).select2({ // placeholder: 'Occupation', minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); $('#select-lp-' + linkId).prop('disabled', false); $('#select-lp-' + linkId).select2({ //placeholder: "Point d'embarquement", minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } if (data.cabineOuPont && !ifCabineSelect && !ifShowCalendar) { $('#select-cabine-' + linkId).select2({ //placeholder: 'Cabine ou Pont', minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); $('#select-cabine-' + linkId).prop('disabled', false); $('#select-cabine-' + linkId).show(); } else if (!ifCabineSelect) { $('#select-cabine-' + linkId).prop('disabled', true); $('#select-cabine-' + linkId).hide(); } else if (data.cabineOuPont && ifCabineSelect && !ifShowCalendar){ $('#select-countperson-' + linkId).find('option') .remove() .end() .append(data.selectCountpersonHtml); } if (data.ifIssetHotel && !ifHotelSelect) { $('#select-hotel-' + linkId).select2({ //placeholder: 'Hôtel', minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); $('#select-hotel-' + linkId).show(); $('#select-hotel-' + linkId).prop('disabled', false); } else if (!ifHotelSelect) { $('#select-hotel-' + linkId).hide(); $('#select-hotel-' + linkId).prop('disabled', true); } else if (data.ifIssetHotel && ifHotelSelect){ $('#select-countperson-' + linkId).find('option') .remove() .end() .append(data.selectCountpersonHtml); } if (data.calendarBlockItems.length != 0 && ifShowCalendar) { var currentDate = data.calendarBlockItems[0]; currentDate = currentDate.split('/'); var setCurrentDate = currentDate[0] + '/' + currentDate[1] + '/1'; var divCalendar = '
'; if ($('#date-calendar-' + linkId).length == 0) { $(divCalendar).insertAfter($('#departMultipleSelect-' + linkId)); $('#date-calendar-' + linkId).multiDatesPicker({ beforeShowDay: function(date) { var m = date.getMonth(), d = date.getDate(), y = date.getFullYear(); m = m + 1; var currentDate = "" + y + "_" + m + "_" + d + ""; currentDate = currentDate.toString(); $('td').removeClass('ui-datepicker-current-day'); return [false, currentDate]; }, dateFormat: "yy/mm/dd", defaultDate: setCurrentDate, addDates: data.calendarBlockItems, numberOfMonths: [1, 1] }); } } if (data.calendarBlockItemsRepetition.length != 0 && ifShowCalendar) { var currentDate = data.calendarBlockItemsRepetition[0]; currentDate = currentDate.split('/'); var setCurrentDate = currentDate[0] + '/' + currentDate[1] + '/1'; var divCalendar = '
'; if ($('#date-calendar-' + linkId).length == 0) { $(divCalendar).insertAfter($('#repetitionSelect-' + linkId)); $('#date-calendar-' + linkId).multiDatesPicker({ beforeShowDay: function(date) { var m = date.getMonth(), d = date.getDate(), y = date.getFullYear(); m = m + 1; var currentDate = "" + y + "_" + m + "_" + d + ""; currentDate = currentDate.toString(); $('td').removeClass('ui-datepicker-current-day'); return [false, ""]; }, dateFormat: "yy/mm/dd", defaultDate: setCurrentDate, addDates: data.calendarBlockItemsRepetition, numberOfMonths: [1, 1] }); } } var linkMap = $('#itineraire_' + linkId + ' .listing-map').html(); $(selectLp).show(); $(selectD).show(); $('#link_' + linkId + ' div.listing-actions').find('a.linkComplets').hide(); if (data.linkComplet !== false) { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide(); $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .hide(); if ($('#link_' + linkId + ' div.listing-actions').find('a.linkComplets').length) { $('#link_' + linkId + ' div.listing-actions').find('a.linkComplets') .show(); } else { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_link') .end() .append(data.linkComplet); } } else { if (data.ifSansDate) { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv').length) { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_contactez')) { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide(); $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .show(); } else { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide() .end() .append(data.linkContact); } } } else { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv').length) { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .show(); $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .hide(); } } if (data.idSoftTravel != '') { $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .hide(); if ($('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv').length) { $('#link_' + linkId + ' a.link_to_reserv').remove(); } $('#link_' + linkId + ' div.listing-actions').find('a.link_to_link') .end() .append(data.idSoftTravel); } else { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv').length) { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_contactez')) { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide(); $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .show(); } else { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide() .end() .append(data.linkContact); } } } } if ((selectDActive != '0') || (selectLpActive.val() != null && selectLpActive.val() != '0')) { if (selectDActive != '0' && ifDateSelect) { //dev-431 bus name show based on change dates on listing page $("#link_" + linkId + " .bus span").html(data.transportHtml_bus); //dev-488 $("#link_" + linkId + " .cruise-ship span").html(data.transportHtml_cruise_ship); //dev-488 //dev-431 bus name show based on change dates on listing page if ($(selectLp).length) { $(selectLp).each(function(indx, element) { var ids = $(element).data('ids'); var ifIsset = $.inArray(parseInt(selectDActive), ids); if (ifIsset == -1 && indx != 0) { $(this).prop('disabled', true); } else { $(this).prop('disabled', false); } }); if (data.calendarBlockItems.length == 0) { $('#select-lp-' + linkId).select2(); $('#select-lp-' + linkId).select2('destroy').val("0").select2({ //placeholder: "Point d'embarquement", minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } } } if (typeof data.selectLpAvailable != "undefined" && data.selectLpAvailable != null && data.selectLpAvailable.length != null && data.selectLpAvailable.length > 0 && ifDateSelect && data.calendarBlockItems.length == 0) { if ($(selectLp).length) { $(selectLp).each(function(indx, element) { var lpVal = $(element).val(); var ifLpAvailable = data.selectLpAvailable.includes(lpVal); if (!ifLpAvailable) { //$(element).attr('disabled','disabled'); $(this).prop('disabled', true); } else { $(this).prop('disabled', false); } }); $('#select-lp-' + linkId).select2(); $('#select-lp-' + linkId).select2('destroy').val("0").select2({ //placeholder: "Point d'embarquement", minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } } if (ifDateSelect || (selectLpActive.val() != null && selectLpActive.val() != '0')) { if (data.selectHotelHtml != '' && !ifHotelSelect && data.ifIssetHotel) { $('#select-hotel-' + linkId).find('option') .remove() .end() .append(data.selectHotelHtml); $('#select-hotel-' + linkId).select2({ //placeholder: 'Hôtel', minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } if (data.selectCabineHtml != '' && !ifCabineSelect && data.cabineOuPont && !ifShowCalendar) { $('#select-cabine-' + linkId).find('option') .remove() .end() .append(data.selectCabineHtml); $('#select-cabine-' + linkId).select2({ //placeholder: 'Cabine ou Pont', minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } if (((data.selectCountpersonHtml != '' && !ifCountpersonSelect) || ifDateSelect) && data.calendarBlockItems.length == 0 && !ifShowCalendar) { if (data.selectCountpersonHtml != '') { $('#select-countperson-' + linkId).find('option') .remove() .end() .append(data.selectCountpersonHtml); $('#select-countperson-' + linkId).select2({ // placeholder: 'Occupation', minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } else { $('#select-countperson-' + linkId).select2(); $('#select-countperson-' + linkId).select2('destroy').val("0"); $('#select-countperson-' + linkId).hide(); $('#select-countperson-' + linkId).prop('disabled', true); } } else { if (data.selectCountpersonHtml == '') { $('#select-countperson-' + linkId).select2(); $('#select-countperson-' + linkId).select2('destroy').val("0"); $('#select-countperson-' + linkId).hide(); $('#select-countperson-' + linkId).prop('disabled', true); } } $('#link_' + linkId + ' a.link_to_link').removeClass('disabledLink').attr('href', data.linkDate); $('#link_' + linkId + ' p.link').html(data.linkAllData); $('#link_' + linkId + ' .mobile-link-meal').html(data.linkAllData); $('#link_' + linkId + ' div.listing-discount').html(data.linkDiscount).addClass('plus'); if (data.linkDiscount == '') $('#link_' + linkId + ' div.listing-discount').removeClass('plus'); if (data.inclutsTab != '') { $('#inclusions_' + linkId).html(data.inclutsTab); } if (data.itinerairiesTab != '') { $('#itineraire_' + linkId).html(data.itinerairiesTab); } if (data.trip_map == '') { $('#itineraire_' + linkId + ' .listing-map').html(linkMap); } } if (ifCountpersonSelect) { if (selectHotelActive == '0') { $('#select-hotel-' + linkId).find('option') .remove() .end() .append(data.selectHotelHtml); } if (selectCabineActive == '0') { $('#select-cabine-' + linkId).find('option') .remove() .end() .append(data.selectCabineHtml); } } if (ifHotelSelect) { if (selectCountpersonActive == '0') { $('#select-countperson-' + linkId).find('option') .remove() .end() .append(data.selectCountpersonHtml); } if (selectCabineActive == '0') { $('#select-cabine-' + linkId).find('option') .remove() .end() .append(data.selectCabineHtml); } if (typeof data.selectLpAvailable != "undefined" && data.selectLpAvailable != null && data.selectLpAvailable.length != null && data.selectLpAvailable.length > 0) { if ($(selectLp).length) { $(selectLp).each(function(indx, element) { var lpVal = $(element).val(); var ifLpAvailable = data.selectLpAvailable.includes(lpVal); if (!ifLpAvailable) { //$(element).attr('disabled','disabled'); $(this).prop('disabled', true); } else { $(this).prop('disabled', false); } }); $('#select-lp-' + linkId).select2('destroy').val("0").select2({ //placeholder: "Point d'embarquement", minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } } } if (ifCabineSelect) { if (selectCountpersonActive == '0') { $('#select-countperson-' + linkId).find('option') .remove() .end() .append(data.selectCountpersonHtml); } if (selectHotelActive == '0') { $('#select-hotel-' + linkId).find('option') .remove() .end() .append(data.selectHotelHtml); } } if (!data.prixSurDemande) { $('#link_' + linkId + ' p.price').removeClass("surdemande").html(data.priceBlock); $('#link_' + linkId + ' .price-desc').removeClass("surdemande"); } else { $('#link_' + linkId + ' p.price').addClass("surdemande").html(data.priceBlock); $('#link_' + linkId + ' .price-desc').addClass("surdemande"); } //dev-357 price_on_demand //dev-677 // const array = data.lp_id_available; // const value = selectLpvalue; // const isInArray = array.includes(value); const array = data.lp_id_available; const value = selectLpvalue; // Check if array is defined and is an array before using includes const isInArray = Array.isArray(array) && array.includes(value); //dev-677 if(isInArray){ data.priceBlock = "
Prix sur demande
"; $('#link_' + linkId + ' p.price').addClass("surdemande").html(data.priceBlock); $('#link_' + linkId + ' .price-desc').addClass("surdemande"); $('.tax_icon_listing_page_incluse').hide(); } else { $('#link_' + linkId + ' p.price').removeClass("surdemande").html(data.priceBlock); $('#link_' + linkId + ' .price-desc').removeClass("surdemande"); $('.tax_icon_listing_page_incluse').show() } //dev-357 price_on_demand } if (selectLpActive.val() != null && selectLpActive.val() != '0' && selectDActive == 0) { var ids = $(selectLpActive).data('ids'); if ($(selectD).length) { $(selectD).each(function(indx, element) { var ifIsset = $.inArray(parseInt($(element).val()), ids); if (ifIsset == -1 && indx != 0) { $(this).prop('disabled', true); } else { $(this).prop('disabled', false); } }); $('#select-dates-' + linkId).select2({ //placeholder: "Choisissez une date", minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } } $('#select-dates-' + linkId).next().addClass("selDate"); if (data.particularite != "") { $('#link_' + linkId).find('#particularite_block').empty().prepend('' + data.particularite + ''); } else { $('#link_' + linkId).find('#particularite_block span').remove(); } if (data.jumelage != "") { $('#link_' + linkId).find('#jumelage_block').empty().prepend('' + data.jumelage + ''); } else { $('#link_' + linkId).find('#jumelage_block span').remove(); } if (data.smallGroup != "") { $('#link_' + linkId).find('#small_group_block').empty().prepend('' + data.smallGroup + ''); } else { $('#link_' + linkId).find('#small_group_block span').remove(); } if (isDefault == "1") { if ($('#select-lp-' + linkId).data('select2')) $('#select-lp-' + linkId).select2('destroy'); if ($('#select-hotel-' + linkId).data('select2')) $('#select-hotel-' + linkId).select2('destroy'); if ($('#select-countperson-' + linkId).data('select2')) $('#select-countperson-' + linkId).select2('destroy'); if ($('#select-cabine-' + linkId).data('select2')) $('#select-cabine-' + linkId).select2('destroy'); } //showbydefaultcalendar-dev-129 $(".departMultipleSelect").each(function(currentEvent,val){ id =$(val).attr('id'); var linkId = id.split("-"); if ($("#date-calendar-"+linkId[1]).length == 0) { document.getElementById(id).click(); } }); //showbydefaultcalendar-dev-129 } }); } function multiDateSelect(day, month, year, idDate, linkId, idHotel) { var itemid = $('#itemid').val(); if (parseInt(day) < 10) { day = "0" + day; } if (parseInt(month) < 10) { month = "0" + month; } var selectCabineActive = $('#select-countperson-' + linkId + " option").filter(":selected").val(); $('#link_' + linkId + ' .listing-depart-garanti').remove(); var selectLp = '#select-lp-' + linkId + ' option'; $.ajax({ cache: false, type: "POST", url: "https://gvq.ca//index.php", data: "option=com_gvqtravel&task=ajaxfilter&itemid=" + itemid + "&action=multiDateSelect&year=" + year + "&month=" + month + "&day=" + day + "&idDate=" + idDate + "&cabine=" + selectCabineActive + "&idHotel=" + idHotel, dataType: "json", success: function(data) { $('#link_' + linkId + ' .price-block .transportblock').html(data.transportHtml); $('#select-lp-' + linkId).prop('disabled', false); $('#select-lp-' + linkId).select2({ //placeholder: "Point d'embarquement", minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); if (data.conditions && $('#link_' + linkId + ' .listing-depart-garanti').length == 0) { $('#link_' + linkId + ' .price-block .depart-garanti').prepend(data.conditions); } if (data.linkComplet !== false) { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide(); $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .hide(); if ($('#link_' + linkId + ' div.listing-actions').find('a.linkComplets').length) { $('#link_' + linkId + ' div.listing-actions').find('a.linkComplets') .show(); } else { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_link') .end() .append(data.linkComplet); } } else { $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .show(); if (data.ifSansDate) { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv').length) { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_contactez')) { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide(); $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .show(); } else { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide() .end() .append(data.linkContact); } } } else { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv').length) { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .show(); $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .hide(); } } if (data.idSoftTravel != '') { $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .hide(); if ($('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv').length) { $('#link_' + linkId + ' a.link_to_reserv').remove(); } $('#link_' + linkId + ' div.listing-actions').find('a.link_to_link') .end() .append(data.idSoftTravel); } else { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv').length) { if ($('#link_' + linkId + ' div.listing-actions').find('a.link_contactez')) { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide(); $('#link_' + linkId + ' div.listing-actions').find('a.link_contactez') .show(); } else { $('#link_' + linkId + ' div.listing-actions').find('a.link_to_reserv') .hide() .end() .append(data.linkContact); } } } } if (data.price != false) { $('#link_' + linkId + ' span.digits').html(data.price); if (data.selectHotelHtml != '') { $('#select-hotel-' + linkId).find('option') .remove() .end() .append(data.selectHotelHtml); $('#select-hotel-' + linkId).select2({ //placeholder: 'Hôtel', minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); $('#select-hotel-' + linkId).prop('disabled', false); } else { $('#select-hotel-' + linkId).find('option') .remove() .end(); $('#select-hotel-' + linkId).select2(); $('#select-hotel-' + linkId).select2('destroy').val("0"); $('#select-hotel-' + linkId).hide(); $('#select-hotel-' + linkId).prop('disabled', true); } if (data.selectCountpersonHtml != '') { $('#select-countperson-' + linkId).find('option') .remove() .end() .append(data.selectCountpersonHtml); $('#select-countperson-' + linkId).select2({ minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); $('#select-countperson-' + linkId).prop('disabled', false); } else { $('#select-countperson-' + linkId).select2(); $('#select-countperson-' + linkId).select2('destroy').val("0"); $('#select-countperson-' + linkId).hide(); $('#select-countperson-' + linkId).prop('disabled', true); } $('#form-select-' + linkId + ' .selectDateInfo').remove(); $('#form-select-' + linkId).append(data.selectDateInfo); if (data.selectLpAvailable != '') { if ($(selectLp).length) { $(selectLp).each(function(indx, element) { var lpVal = $(element).val(); var ifLpAvailable = data.selectLpAvailable.includes(lpVal); if (!ifLpAvailable) { //$(element).attr('disabled','disabled'); $(this).prop('disabled', true); } else { $(this).prop('disabled', false); } }); $('#select-lp-' + linkId).select2('destroy').val("0").select2({ //placeholder: "Point d'embarquement", minimumResultsForSearch: -1, dropdownCssClass: 'dd-select' }); } } } } }); } let minPrice = document.querySelector('#minPrice'); $("#priceButton").on("click", function(){ ajaxSerialize(); }); });
Rafiner votre recherche