"; $("#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(); } } } 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 { $('#' + filterOptionId[2] + "_" + filterOptionId[3]).each(function() { $(this).prop('checked', false); }); } } function ajaxSerialize(pageListings) { if (typeof pageListings === 'undefined') { pageListings = 1; } var dataFilterSerialize = $("#filterForm").serialize(); var dataLandingPointSerialize = $("#landingPointForm").serialize(); var itemid = $('#itemid').val(); $.ajax({ type: "POST", cache: false, url: "https://agencegvq.com/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) { /*$('#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) { $('#countListings').html(data.countAllListings); $('#countL').val(data.countAllListingsNumb); $('#page').val(pageListings); // 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); } //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); } //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); } } if (data.html == '') { $('#no-listings').show(); $('#listings #listingsContent').find('div.link') .remove(); $('#countListings').html('0 résultats'); } 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://agencegvq.com//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) { $("." + className).each(function(index) { var elementId = $(this).attr('id'); var id = $(this).val(); var count = 0; $.each(valueArray, function(index, value) { if (id == value.value) { count = value.countListings; } }); 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 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 ($('#select-dates-' + linkId).is(':disabled')) { dataSelectSerialize = dataSelectSerialize + '&select-dates-' + linkId + '=' + selectDActive; } if (ifShowCalendar) { selectDActive = $('#select-dates-' + linkId).val(); } 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(); var inclutsTab = $('#inclusions_' + linkId); var itinerairiesTab = $('#itineraire_' + linkId); var ifDateSelectRequest = ifDateSelect | 0; var ifHotelSelectRequest = ifHotelSelect | 0; $('#link_' + linkId + ' .listing-depart-garanti').remove(); $.ajax({ type: "POST", cache: false, url: "https://agencegvq.com//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) { 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(); } 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); } 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 { 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); } } } } } 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 ((((selectDActive != '0')) || (selectLpActive.val() != null && selectLpActive.val() != '0'))) { if (selectDActive != '0' && ifDateSelect) { 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); } } $('#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.trip_map == '') { $('#itineraire_' + linkId + ' .listing-map').html(linkMap); } if (data.itinerairiesTab != '') { $('#itineraire_' + linkId).html(data.itinerairiesTab); } } 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(); $('#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"); } } 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.sub_title != '' && data.sub_title != null) { if ($('#link_' + linkId).find('h3.link_subtitle').length) { $('#link_' + linkId + ' h3.link_subtitle').html(data.sub_title); } else { $('#link_' + linkId + ' div.listing-title-subtitle').find('h2.link_title') .end() .append('
' + data.sub_title + '
'); } } else if (data.sub_title == null) { if ($('#link_' + linkId).find('h3.link_subtitle').length) { $('#link_' + linkId + ' h3.link_subtitle').html(''); } else { $('#link_' + linkId + ' div.listing-title-subtitle').find('h2.link_title') .end() .append('
'); } } 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 (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'); } } }); } 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://agencegvq.com//index.php", data: "option=com_gvqtravel&task=ajaxfilter&itemid=" + itemid + "&action=multiDateSelect&year=" + year + "&month=" + month + "&day=" + day + "&idDate=" + idDate + "&cabine=0" + "&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' }); } } } } }); } });
RAFFINEZ VOTRE RECHERCHE
FERMER