var $root = $('html, body'); $( window ).on( "load", function() { $('body').addClass('loaded'); }); if($(".xs-hidden").length && $(window).width()<=575) { $(".xs-hidden").remove(); } function infoAggiornate(e) { swal({ type: 'success', text: e, timer: 1500, showConfirmButton: false }) } $('[data-fancybox="galleria-prestige"]').fancybox({ thumbs: { autoStart: true, axis: "y" // Vertical (y) or horizontal (x) scrolling }, }); const filter_form_action_url = 'https://www.prestigeimmobiliare.info/'; let filter_already_submitted = false; function aggiornaComune(modalita) { $.get(window.url_sito + "/override/modules/richieste/ajax/comuni.php", { provincia: $("#provincia").val(), comune_precedente: $("#form-comune_precedente").val(), modalita: modalita }).done(function (data) { $("#boxComune").html(data); $("#comune").selectpicker(); }); } function cambiaTipoContratto() { let contratto = $("#contratto").val(); // $('#form1').parsley().destroy(); let request_id = 0; if ($('#form-id_richiesta').val() != undefined) { request_id = $('#form-id_richiesta').val(); } $.post("https://www.prestigeimmobiliare.info/assets/ajax/fields.php", { type: contratto, id_richiesta: request_id }).done(function (data) { $('.content_request').html(data); // renizializzazione di tutto aggiornaComune("load"); $('#form1').parsley(); $('select').selectpicker(); if ($('.datetimepicker').length && $.fn.datetimepicker) { $('.datetimepicker').each(function () { //alert($(this).val()); var datetimepicker_inline = $(this).data('inline') ? $(this).data('inline') : false; $(this).datetimepicker({ lang: 'it', format: 'Y-m-d H:i', formatTime: 'H:i', dayOfWeekStart: 1, formatDate: 'Y-m-d', value: $(this).val(), step: 15, showClear: true, inline: datetimepicker_inline }); }); }; let lista_input_autonumeric = $('.js-input-autonumeric'); for (var i = 0; i < lista_input_autonumeric.length; i++) { let this_form = {}; this_form.id = $(lista_input_autonumeric[i]).prop('id'); this_form.value = $(lista_input_autonumeric[i]).val(); this_form.asep = $(lista_input_autonumeric[i]).data('asep'); this_form.adec = $(lista_input_autonumeric[i]).data('adec'); this_form.asign = $(lista_input_autonumeric[i]).data('asign'); if (this_form.asign === 'euro') { this_form.asign = '€ '; } if (this_form.asign === 'dollaro') { this_form.asign = '$ '; } $('#' + this_form.id).autoNumeric('init', {aSep: this_form.asep, aDec: this_form.adec, aSign: this_form.asign}); } }); } $(document).ready(function () { $(document).on("change", "#provincia",function () { aggiornaComune("change"); }); //cambiaTipoContratto(); $("#contratto").on("change", function () { cambiaTipoContratto(); }); if ($("#contattiForm").length > 0) { // needs for recaptacha ready grecaptcha.ready(function () { // do request for recaptcha token // response is promise with passed token $('#contattiForm').parsley().on('form:error', function () { swal({ title: "Errore", text: "Per procedere è necessario completare tutti i campi obbligatori", type: "error", showConfirmButton: true }); }).on('form:submit', function () { $('#contattiForm').find('button[type=submit]').prop('disabled', true); grecaptcha.execute('6LdxdKEaAAAAAHk3D3Hli9gg0mjrTlQRnJDhO7K6', {action: 'homepage'}) .then(function (token) { // add token to form document.getElementById('g-recaptcha-response').value = token; form = $('#contattiForm'); $.ajax({ url: "https://www.prestigeimmobiliare.info/assets/ajax/invia.php", type: "POST", data: form.serialize(), success: function (data) { if (data.status == "success") { infoAggiornate(data.message); setTimeout(function () { window.location = 'https://www.prestigeimmobiliare.info/' }, 2000); } else if (data.status == "error") { swal({ title: "Errore", text: data.message, type: "error", showConfirmButton: true }); $('#contattiForm').find('button[type=submit]').prop('disabled', false); return false; } }, }); }); return false; }); }); } $('.fancy').fancybox({ thumbs: { autoStart: true, axis: "y" // Vertical (y) or horizontal (x) scrolling }, // Enable keyboard navigation keyboard: true, slideShow: { autoStart: false, speed: 3000 } }); // Load more data $('.load-more').click(function () { var close = $(this).closest('.row'); var row = Number(close.find('#row').val()); var allcount = Number(close.find('#all').val()); var rowperpage = 4; row = row + rowperpage; if (row <= allcount) { $(".portfolio-wrapper").isotope({ layoutMode: 'masonry' }); close.find("#row").val(row); $.ajax({ url: 'https://www.prestigeimmobiliare.info/assets/ajax/getimmagini.php', type: 'post', data: {row: row, quante: rowperpage}, beforeSend: function () { close.find(".load-more").text("Caricamento..."); }, success: function (response) { // Setting little delay while displaying new content setTimeout(function () { // appending posts after last post with class="post" newItems = $(response).appendTo(close.find('.portfolio-grid')); newItems.imagesLoaded(function () { close.find(".portfolio-grid").isotope('appended', newItems); }); var rowno = row + rowperpage; // checking row value is greater than allcount or not if (rowno > allcount) { // Change the text and background close.find('.load-more').hide(); //$('.load-more').css("background","darkorchid"); } else { close.find(".load-more").text("Visualizza altri"); } $('.fancy').fancybox({ thumbs: { autoStart: true, axis: "y" // Vertical (y) or horizontal (x) scrolling }, // Enable keyboard navigation keyboard: true, slideShow: { autoStart: false, speed: 3000 } }); }, 100); } }); } else { close.find('.load-more').text("Caricamento..."); // Setting little delay while removing contents setTimeout(function () { // Reset the value of row close.find("#row").val(0); // Change the text and background close.find('.load-more').text("Visualizza altri"); }, 2000); } }); $('.filter-form').submit(function () { if (filter_already_submitted === false) { filter_already_submitted = true; event.preventDefault(); // Get form data let data = $(this).serializeArray(); let json_data = {}; // Serialize form data $.map(data, function (val, index) { json_data[val['name']] = val['value']; }); // Change action url based on chosen modality let category = json_data['categoria'].replace('tipologia_', ''); let action_url = $(this).attr('action', filter_form_action_url + json_data['modalita'] + '-' + category); // Remove modality and category data from json so they will not be inserted in url as params delete json_data['modalita']; delete json_data['categoria']; // Add locality to url only if type is 'comune' or 'provincia' //let locality_url_param = ''; if (json_data['localita'] != '') { let locality_resource_url = json_data['localita']; action_url = $(this).attr('action', action_url.attr('action') + '/' + locality_resource_url); delete json_data['localita']; } // Add tipology to url if (json_data['tipologia'] != "") { let typology = json_data['tipologia'].replaceAll(' - ', '-'); typology = typology.replace(' ', '_'); action_url = $(this).attr('action', action_url.attr('action') + '/' + typology); delete json_data['tipologia']; } // Add form params in the action url let first_param = true; for (let key in json_data) { if (json_data.hasOwnProperty(key)) { if (json_data[key] !== "") { let value = json_data[key].replace('tipologia_', ''); value = value.replaceAll(' / ', '-').toLowerCase(); value = value.replaceAll(' ', '_'); let interpolation = first_param == true ? '?' : '&'; action_url = $(this).attr('action', action_url.attr('action') + interpolation + key + '=' + value); first_param = false; } } } $(this).submit(); } }); // Change typology options based on chosen category $('.filter-category').change(function () { const selected_value = $(this).val(); changeTypologyOptions(selected_value, $(this)); // enable/disable property type select on category change const property_type_select = $('.property_type_select'); if (selected_value == 'tipologia_residenziali') { // Enable the select property_type_select.removeAttr('disabled'); property_type_select.selectpicker('refresh'); } else { // Deselect previous value property_type_select.val(''); // Disable the select property_type_select.attr('disabled', true); property_type_select.selectpicker('refresh'); } }); // Trigger the onChange event of category select on document ready $('.filter-category').change(); // Initialize locality filter select picker with ajax call $('select.locality-ajax-select').selectpicker({liveSearch: true}).ajaxSelectPicker({ ajax: { url: 'https://www.prestigeimmobiliare.info/' + 'assets/ajax/ricerca-localita.php', type: 'POST', dataType: 'json', data: function () { let params = {locality: '{{{q}}}'}; return params; }, locale: { emptyTitle: 'SESESE', currentlySelected: 'Selezionato', statusInitialized: 'daje però' }, preprocessData: function (data) { return data; }, log: 4 } }); // Sorting of the `immobili` $('#ordinamento-immobili').change(function () { const value = $(this).val(); let url = window.location.href; if (value != '') { // Remove all from 'ordinamento' from the string, 'ordinamento' included url = url.replace(/(.*?)ordinamento.*/i, "$1"); url = url.replace('ordinamento', ''); const string_to_interpolate = 'ordinamento=' + value; if (url.includes('?')) { if (url[url.length - 1] == '?') { url = url + string_to_interpolate; } else { url = url + '&' + string_to_interpolate } } else { url = url + '?' + string_to_interpolate; } } else { url = url.replace(/(.*?)\?ordinamento.*/i, "$1"); } window.location = url; }); }); function changeTypologyOptions(selected_value, category_element) { // Remove all options from select category_element.closest('.select-ricerca').next('.select-ricerca').find('.filter-typology option:gt(0)').remove(); // Get array of params from php variable let config_values = {"categoria_immobile":{"tipologia_residenziali":"Residenziale","tipologia_palazzi":"Palazzi \/ Edifici","tipologia_garage":"Garage \/ Posti auto","tipologia_terreni":"Terreni","tipologia_negozi":"Negozi \/ Locali commerciali"},"tipologia_negozi":["Attivit\u00e0 commerciale","Locale Commerciale - Mura del negozio","Laboratorio","Ufficio","Studio","Magazzino","Deposito"],"tipologia_terreni":["Terreno agricolo","Terreno edificabile","Terreno non edificabile"],"tipologia_palazzi":["Edificio - Palazzo"],"tipologia_garage":["Garage - Box","Posto auto - moto"],"tipologia_residenziali":["Appartamento","Attico","Mansarda","Terratetto unifamiliare","Terratetto plurifamiliare","Loft","Open space","Soffitta","Baglio","Baita","Casa indipendente","Casa semindipendente","Casa a schiera","Villa unifamiliare","Villa bifamiliare","Villa plurifamiliare","Villa a schiera","Appartamento in villa","Casa colonica","Casale","Cascina","Chalet","Dammuso","Maso","Masseria","Nuraghe","Rifugio","Rustico","Sasso","Trullo"],"tipo_proprieta":["nuda propriet\u00e0","intera propriet\u00e0","parziale propriet\u00e0","usufrutto","multipropriet\u00e0","diritto di superficie"],"categoria_catastale":["A\/1","A\/2","A\/3","A\/4","A\/5","A\/6","A\/7","A\/8","A\/9","A\/10","A\/11","B\/1","B\/2","B\/3","B\/4","B\/5","B\/6","B\/7","B\/8","C\/1","C\/2","C\/3","C\/4","C\/5","C\/6","C\/7","D\/1","D\/2","D\/3","D\/4","D\/5","D\/6","D\/7","D\/8","D\/9","D\/10","D\/11","D\/12","E\/1","E\/2","E\/3","E\/4","E\/5","E\/6","E\/7","E\/8","E\/9","F\/1","F\/2","F\/3","F\/4","F\/5","F\/6","T"],"cucina":["Abitabile","Angolo cottura","Cucinotto","Semi abitabile","A vista"],"arredamento":["Arredato","Non Arredato","Parzialmente Arredato","Solo Cucina Arredata"],"bagni":["1","2","3",">3"],"giardino":["Privato","Comune","Nessuno"],"box_auto":["Singolo","Doppio","Nessuno"],"infissi_esterni":["Vetro \/ Legno","Vetro \/ Metallo","Vetro \/ PVC","Doppio Vetro \/ Legno","Doppio Vetro \/ Metallo","Doppio Vetro \/ PVC","Triplo Vetro \/ Legno","Triplo Vetro \/ Metallo","Triplo Vetro \/ PVC"],"impianto_tv":["Centralizzato","Singolo","Parabola satellitare"],"servizio_portineria":["Intera giornata","Mezza giornata","No"],"classi_immobile":["Di lusso","Signorile","Media","Economica"],"stato":["Nuovo \/ In costruzione","Ottimo \/ Ristrutturato","Buono \/ Abitabile","Da ristrutturare"],"piano":["interrato (-5)","interrato (-4)","interrato (-3)","interrato (-2)","interrato (-1)","seminterrato","piano terra","ammezzato","piano rialzato","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"],"lati_liberi":["uno","due, paralleli","due, ad angolo","tre","quattro"],"affaccio":["Interno","Esterno","Doppio"],"riscaldamento":["Autonomo","Centralizzato","Assente"],"tipo_impianto_riscaldamento":["A radiatori","A pavimento","Ad aria","A stufa"],"alimentazione_riscaldamento":["Gas","Metano","GPL","Gasolio","Pellet","Legna","Solare","Fotovoltaico","Teleriscaldamento","Pompa di calore","Elettrica"],"climatizzazione":["Autonomo","Centralizzato","Predisposizione impianto","Assente"],"tipo_impianto_climatizzazione":["Solo freddo","Solo caldo","Freddo\/Caldo"],"tipo_mandato":["Esclusiva","Co-Esclusiva","Verbale","Nessun Mandato"],"classe_energetica":{"DL 192 del 19\/08\/05":["A+","A","B","C","D","E","F","G"],"Legge 90\/2013":["A4","A3","A2","A1","B","C","D","E","F","G"]},"misura_consumo":["kWh\/m\u00b2 anno","kWh\/m\u00b3 anno"],"contratto_affitto":["4+4","Libero","Transitorio","6+6","9+9","Concordato","3+2","Studenti (6-36 mesi)"],"uso_attuale_edificio":["Industriale","Residenziale","Albergo","Altro","Commerciale","Castello","Ufficio"],"tipo_posto":["Box indipendente","Box in garage comune","Posto in garage comune","Posto esterno coperto","Posto esterno scoperto"],"dislivello":["Leggero","Medio","Forte"],"accesso_in_strada":["In autostrada","In strada asfaltata","In strada sterrata","Non presente"],"esposizione":["Nord","Sud","Est","Ovest","Sud-Est","Sud-Ovest","Nord-Est","Nord-Ovest"],"consistenza":["Abitazione","Mansarda","Box o garage","Posto auto","Cantina","Soppalco","Soffitta","Balcone","Terrazzo","Giardino","Terreno","Esterno","Parti comuni","Ufficio","Studio","Magazzino","Deposito","Altro"]}; const typology_param = $('.filter-typology-hidden-value').val(); // Get only typologies associated to selected category and fill the input with these options $.each(config_values[selected_value], function (key, value) { let formatted_value = value.replaceAll(' - ', '-').toLowerCase(); formatted_value = formatted_value.replaceAll(' ', '_'); const option = ''; category_element.closest('.select-ricerca').next('.select-ricerca').find('select.filter-typology').append($(option)); }); // Bootstrap select needs a refresh $('.filter-typology').selectpicker('refresh'); } var bsCarouselItems = 1; if ($('.bs_carousel .carousel-item').length) { $('.bs_carousel .carousel-item').each(function (index, element) { if (index == 0) { $('.bs_carousel_prices').addClass('pprty-price-active pprty-first-time'); } $('.bs_carousel_prices .property-carousel-ticker-counter').append('0' + bsCarouselItems + ''); bsCarouselItems += 1; }); } $('.bs_carousel_prices .property-carousel-ticker-total').append('0' + $('.bs_carousel .carousel-item').length + ''); if ($('.bs_carousel').length) { $('.bs_carousel').on('slide.bs.carousel', function (carousel) { $('.bs_carousel_prices').removeClass('pprty-first-time'); $('.bs_carousel_prices').carousel(carousel.to); }); } if ($('.bs_carousel').length) { $('.bs_carousel').on('slid.bs.carousel', function (carousel) { var tickerPos = (carousel.to) * 25; $('.bs_carousel_prices .property-carousel-ticker-counter > span').css('transform', 'translateY(-' + tickerPos + 'px)'); }); } if ($('.bs_carousel .property-carousel-control-next').length) { $('.bs_carousel .property-carousel-control-next').on('click', function (e) { $('.bs_carousel').carousel('next'); }); } if ($('.bs_carousel .property-carousel-control-prev').length) { $('.bs_carousel .property-carousel-control-prev').on('click', function (e) { $('.bs_carousel').carousel('prev'); }); } if ($('.bs_carousel').length) { $('.bs_carousel').carousel({interval: 6000, pause: "true"}); } $(window).on("load", function() { if($(".js-eqbox-immobili-evidenza").length && $(window).width()>575) { e=0; $(".js-eqbox-immobili-evidenza").each(function() { $(this).height()>e&&(e=$(this).height()) } ), $(".js-eqbox-immobili-evidenza").height(e) } if($(".js-eqbox-immobili-vendita").length && $(window).width()>575) { e=0; $(".js-eqbox-immobili-vendita").each(function() { $(this).height()>e&&(e=$(this).height()) } ), $(".js-eqbox-immobili-vendita").height(e) } if($(".js-eqbox-immobili-affitto").length && $(window).width()>575) { e=0; $(".js-eqbox-immobili-affitto").each(function() { $(this).height()>e&&(e=$(this).height()) } ), $(".js-eqbox-immobili-affitto").height(e) } if($(".js-eqbox-annuncio").length && $(window).width()>575) { e=0; $(".js-eqbox-annuncio").each(function() { $(this).height()>e&&(e=$(this).height()) } ), $(".js-eqbox-annuncio").height(e) } if($(".js-eqbox-servizio").length && $(window).width()>767) { e=0; $(".js-eqbox-servizio").each(function() { $(this).height()>e&&(e=$(this).height()) } ), $(".js-eqbox-servizio").height(e) } if($(".js-eqbox-news").length && $(window).width()>768) { e=0; $(".js-eqbox-news").each(function() { $(this).height()>e&&(e=$(this).height()) } ), $(".js-eqbox-news").height(e) } });