/* global jQuery */ /* global intervista */ jQuery('.selectintervista').on('change', function(){ var v=jQuery(this).val(); var html='

Loading

'; jQuery('body').html(html); var url='/intervista?loc=' +v; location.href= url; }); function allAboutIntervista() { if(jQuery('.thecounter').length > 0) { messaggiLivello0Intervista(""); } jQuery('#intervista .bottoneparent').on('click',function(){ var k=jQuery(this).data('parent'); var ref=jQuery('#intervista .containercat.'+k); jQuery('#intervista .containercat').removeClass('xs-dn').addClass('xs-dn'); ref.removeClass('xs-dn'); // jQuery('#intervista .bottoneparent .arroworizzontale').removeClass('arroworizzontale').addClass('arroworizzontale'); jQuery('#intervista .bottoneparent .arrowverticale').removeClass('arrowverticale').addClass('arroworizzontale'); jQuery(this).parent().find('.arroworizzontale').addClass('arrowverticale'); jQuery(this).parent().find('.arroworizzontale').removeClass('arroworizzontale'); jQuery('#intervista .bottoneparent .arroworizzontale.ribaltatadisabled').removeClass('ribaltatadisabled').addClass('ribaltata'); jQuery(this).parent().find('.arrowverticale.ribaltata').removeClass('ribaltata').addClass('ribaltatadisabled'); // jQuery('#intervista').find('.' + jQuery(this).data('parent')).removeClass('dn'); }); jQuery('#intervista .bottonechild').on('click',function(){ jQuery(this).toggleClass('active'); messaggiLivello0Intervista(this); // jQuery('#intervista .bottonechild').removeClass('dn').addClass('dn'); // jQuery('#intervista').find('.' + jQuery(this).data('parent')).removeClass('dn'); }); openDatePicker('datamatrimonio'); jQuery('#proseguiintervista').on('click',function(){ if(jQuery('.laststep').length >0) { intervistaLastStep(); } else { intervistaFirstStep(); } return false; }); if(jQuery('#proseguiintervista').length >0 && jQuery('.laststep').length >0 ) { if( jQuery('#nome').val()!=="" && jQuery('#cognnome').val()!=="" && jQuery('#email').val()!=="" && jQuery('#cellulare').val()!=="" && jQuery('#datamatrimonio').val()!=="") { intervistaLastStep(); } else { jQuery('.laststep.dn').removeClass('dn'); } } if(jQuery('.followintervista').length > 1) { jQuery('.followintervista').on('click',function(){ var step=jQuery(this).data('step'); var previous=jQuery(this).data('previous'); if(step==="fdatamatrimonio") { fdatamatrimonio(step, previous); } if(step==="fnomecognome") { fnomecognome(step,previous); } if(step==="fconferma") { fconferma(); } }); } jQuery('.resetintervista').on('click',function(event){ event.preventDefault(); event.stopPropagation(); jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', reset: 1 }, beforeSend: function(xhr, opts){ } , success: function(html) { location.href='/intervista'; } }); }); jQuery('.informazioni').on('click', function() { informazioniClick(); }); jQuery('.obbligatori').on('click', function() { obbligatoriClick(); }); jQuery('.categorytest').on('click',function(){ var id=jQuery(this).data('id'); buildIntervista(id); jQuery('.categorytest').removeClass('active'); jQuery(this).addClass('active'); jQuery('.categorytest').removeClass('fucsia'); jQuery(this).addClass('fucsia'); jQuery('.obbligatori').addClass('cwhite active'); jQuery('.informazioni').removeClass('cwhite active'); checkObbligatoriFacoltativi(); }); if(jQuery('.categorytest').length > 0) { categorytestCheck(); }; jQuery('#conclusionequiz').on('click',function(){ var html='

Stiamo cercando gli operatori che corrispondono alle tue richieste...

'; jQuery('body').html(html); jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 'end', }, beforeSend: function(xhr, opts){ } , success: function(html) { var html='

Ancora qualche istante...

'; jQuery('body').html(html); jQuery('body').removeClass('dn'); location.href='/intervista?send=1'; } }); // location.href='/intervista?end=1'; }); /* if(jQuery('.gotoend2').length >0) { jQuery('.altrioperatoricontainer').on('click',function(){ if(jQuery(this).find('.checkon').hasClass('dn')){ jQuery(this).find('.checkon').removeClass('dn'); jQuery(this).find('.checkoff').addClass('dn'); } else { jQuery(this).find('.checkoff').removeClass('dn'); jQuery(this).find('.checkon').addClass('dn'); } }); jQuery('.gotoend2').on('click',function() { var datas=[]; jQuery('.fa-check-circle').not('.dn').each(function(){ datas.push([jQuery(this).data('id'),jQuery(this).data('catid'),'contact']); }) jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 'recordm', datas: datas }, beforeSend: function(xhr, opts){ } , success: function(html) { // jQuery('body').html('

Ancora qualche istante...

'); // jQuery('body').removeClass('dn'); // location.href='/intervista?send=1'; } }); }); jQuery('.gotoend2:eq(0)').click(); } */ if(jQuery('.gotoprevious').length >0) { jQuery('body').removeClass('dn'); jQuery('.gotoprevious').on('click',function(){ location.href='/intervista?livello=1'; }); } if(jQuery('#proseguiintervistacon').length >0) { statusProsegui(); } if(jQuery('.messaggihostess').length >0 ) { var wto; jQuery('#emailintervista').on('keydown',function(){ clearTimeout(wto); jQuery('.messaggihostess').html('Controllo Utente'); wto = setTimeout(function() { var t=jQuery('#emailintervista').val(); jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 'controlloutente', valore: t }, beforeSend: function () { }, success: function (html) { jQuery('.messaggihostess').html(html); } }); }, 1000); }); } if(jQuery('.buttonstandard.backcategorie').length>0) { jQuery('.buttonstandard.backcategorie').on('click',function(){ location.href='/intervista?livello=0'; }) } // jQuery('.contmultibutton .buttonchild').on('click',aggiornaStatusIntervista()); // jQuery('.contradio .buttonchild').on('click',aggiornaStatusIntervista()); } function statusProsegui() { jQuery('#proseguiintervistacon').unbind('click'); jQuery('#proseguiintervistacon').on('click',function(event){ event.preventDefault(); event.stopPropagation(); // click on first category if(jQuery('.categorytest.active').hasClass('opzionali')) { // console.log('trovato opzionali da completare'); jQuery('.informazioni').click(); return false; } jQuery('.categorytest').not( ".alldone" ).each(function() { // console.log('proseguo con altra categoria'); jQuery(this).click(); return false; }); }); } function checkObbligatoriFacoltativi() { if(jQuery('.obbligatori').hasClass('active')===false && jQuery('.informazioni').hasClass('active')===false) { jQuery('.obbligatori').addClass('active'); } if(jQuery('.obbligatori.active').length > 0 ) { jQuery('.boxobbligatori').removeClass('dn'); jQuery('.boxopzionali').addClass('dn'); jQuery('.obbligatori').click(); } if(jQuery('.informazioni.active').length > 0 ) { jQuery('.boxobbligatori').addClass('dn'); jQuery('.boxopzionali').removeClass('dn'); jQuery('.informazioni').click(); } } function categorytestCheck() { // jQuery('.categorytest:eq(0)').click(); var test = 0; jQuery('.categorytest').each(function () { if (!jQuery(this).hasClass('alldone')) { if (test === 0) { jQuery(this).click(); } test = 1; } }); if (test === 0) { jQuery('.categorytest:last').click(); } } function informazioniClick() { jQuery('.obbligatori').removeClass('bgfucsia'); jQuery('.informazioni').removeClass('bgrigiolight'); jQuery('.obbligatori').addClass('bgrigiolight'); jQuery('.informazioni').addClass('bgfucsia'); jQuery('.boxobbligatori').addClass('dn'); jQuery('.boxopzionali').removeClass('dn'); } function obbligatoriClick() { jQuery('.obbligatori').removeClass('bgrigiolight'); jQuery('.informazioni').removeClass('bgfucsia'); jQuery('.obbligatori').addClass('bgfucsia'); jQuery('.informazioni').addClass('bgrigiolight'); jQuery('.boxobbligatori').removeClass('dn'); jQuery('.boxopzionali').addClass('dn'); } function confermaCategorie() { jQuery('.thecounter .confermacategorie').on('click',function() { var arrintervista=[]; var count=0; jQuery('#intervista .active').each(function(){ var id=jQuery(this).data('id'); arrintervista[count]=id; count=count +1; }); jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', valori: JSON.stringify(arrintervista), step: 1 }, beforeSend: function(xhr, opts){ } , success: function(html) { location.href='/intervista?livello=1'; }, error: function() { } }); }); } function intervistaFirstStep(){ var e=jQuery.trim(jQuery('#emailintervista').val()); var arr={}; arr.action= 'intervista'; arr.email= e; arr.step = 0; if(jQuery('.datigeo span.dn[data-geo="administrative_area_level_1"]').length >0 ) { arr.regione= jQuery('.datigeo span.dn[data-geo="administrative_area_level_1"]').html(); } if(jQuery('.datigeo span.dn[data-geo="country_short"]').length >0 ) { arr.stato= jQuery('.datigeo span.dn[data-geo="country_short"]').html(); } if(jQuery('.datigeo span.dn[data-geo="formatted_address"]').length >0 ) { arr.indirizzo= jQuery('.datigeo span.dn[data-geo="formatted_address"]').html(); } if(jQuery('.datigeo span.dn[data-geo="lng"]').length >0 ) { arr.lng= jQuery('.datigeo span.dn[data-geo="lng"]').html(); } if(jQuery('.datigeo span.dn[data-geo="lat"]').length >0 ) { arr.lat= jQuery('.datigeo span.dn[data-geo="lat"]').html(); } if(jQuery('.datigeo span.dn[data-geo="postal_code"]').length >0 ) { arr.cap= jQuery('.datigeo span.dn[data-geo="postal_code"]').html(); } if(jQuery('.datigeo span.dn[data-geo="locality"]').length >0 ) { arr.citta= jQuery('.datigeo span.dn[data-geo="locality"]').html(); } if(jQuery('.datigeo span.dn[data-geo="administrative_area_level_2_short"]').length >0 ) { arr.provincia= jQuery('.datigeo span.dn[data-geo="administrative_area_level_2_short"]').html(); } if(jQuery('.datigeo span.dn[data-geo="administrative_area_level_2"]').length >0 ) { arr.provinciaext= jQuery('.datigeo span.dn[data-geo="administrative_area_level_2"]').html(); } jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: arr, beforeSend: function(xhr){ jQuery('#intervista .errorbox').html(""); if(!isValidEmailAddress(e)) { jQuery('#intervista .errorbox').html("Controllare l'indirizzo e-mail inserito"); xhr.abort(); } if(jQuery('#dovetisposi').val()==="") { var msg=jQuery('#intervista .errorbox').html(); if(msg!=="") { msg = msg + "
";} jQuery('#intervista .errorbox').html(msg + "Inserire un indirizzo corretto"); xhr.abort(); } } , success: function() { var html='

Loading

'; jQuery('body').html(html); location.href='/intervista?livello=0'; } }); } function messaggiLivello0Intervista(that){ var voce=""; var t2=""; if(jQuery('#intervista .active').length > 0) { // t2=""; t2=""; t2=t2 + ""; t2=t2 + ""; t2=t2 + ""; } else { t2=""; } var t=""; if(jQuery('#intervista .active').length <1) { t2=""; voce=""; jQuery('#intervista .thecounter').addClass('dn').html(t); jQuery('#intervista #controlbox').removeClass('dn'); } else { jQuery('#intervista .thecounter').removeClass('dn'); jQuery('#intervista #controlbox').addClass('dn'); // if(jQuery('#intervista .active').length > 1) { // voce="categorie"; // } else { // voce="categoria"; // } if(jQuery('#intervista .active').length > 3) { jQuery('.ierror').html('È possibile selezionare un massimo di tre categorie.
(questo messaggio si chiude automaticamente)'); jQuery('.ierror').removeClass('dn'); setTimeout( function() { jQuery('.ierror').addClass('dn'); } ,3000 ); if(that !=="") { jQuery(that).toggleClass('active'); } } var cat=""; jQuery('#intervista .active').each(function(){ if(cat!=="") { cat=cat+", "; } cat=cat + jQuery(this).text(); }) t = ''; t= t + '
Hai selezionato: '; t=t+cat; // t= t + jQuery('#intervista .active').length + ' ' + voce ; t= t + ''; t= t + '
Puoi modificare la tua selezione o proseguire.
'; t= t + t2; jQuery('#intervista .thecounter').html(t); var h=jQuery('#intervista .thecounter').height(); h=(h*1)+10; console.log('h:'+h); jQuery('#intervista').attr("style","margin-bottom:" + h + "px!important;"); confermaCategorie(); } } function aggiornaStatusIntervista() { // return; var datas=[]; if(jQuery('input[type="range"]').length >0){ jQuery('input[type="range"]').each(function(){ datas.push([jQuery(this).data('catid'), jQuery(this).data('name') , jQuery(this).val()]); }); } if(jQuery('span[data-type="range"]').length >0){ jQuery('span[data-type="range"]').each(function(){ datas.push([jQuery(this).data('catid'), jQuery(this).data('name') , jQuery(this).data('value')]); }); } if(jQuery('input[type="text"]').length >0){ jQuery('input[type="text"]').each(function(){ datas.push([jQuery(this).data('catid'), jQuery(this).data('name') , jQuery(this).val()]); }); } if(jQuery('.contthree').length >0){ jQuery('.contthree .selected').each(function(){ datas.push([jQuery(this).data('catid'), jQuery(this).data('name') , jQuery(this).data('value')]); }); } if(jQuery('.contmultiselect').length >0){ jQuery('.contmultiselect .active').each(function(){ datas.push([jQuery(this).data('catid'), jQuery(this).data('name') , jQuery(this).data('value')]); }); } if(jQuery('.selectsintervista').length >0){ jQuery('.selectsintervista').each(function(){ datas.push([jQuery(this).data('catid'), jQuery(this).data('name') , jQuery(this).val()]); }); } if(jQuery('textarea[data-name="note"]').length >0){ jQuery('textarea[data-name="note"]').each(function(){ datas.push([jQuery(this).data('catid'), jQuery(this).data('name') , jQuery(this).val()]); }); } jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 3, datas: datas, catid: jQuery('.categorytest.active').data('id') }, beforeSend: function(xhr, opts){ }, success: function(html) { if(html === "1") { aggiornaStatusIntervistaGrafica(html); } else if(html ==="0 1" ) { aggiornaStatusIntervistaGrafica(html); } else if(html ==="1 0" ) { aggiornaStatusIntervistaGrafica(html); } else { aggiornaStatusIntervistaGrafica(0); } // location.href='/intervista'; } }); } function aggiornaStatusIntervistaGrafica(stato) { var cta=jQuery('.categorytest.active'); // console.log("stato: " + stato); jQuery('#completaquiz').removeClass('dn').addClass('dn'); if(stato === "1") { // console.log('a'); jQuery(cta).removeClass('alldone').addClass('alldone'); jQuery(cta).removeClass('opzionali'); } else if( stato === "1 0") { // jQuery('.informazioni').click(); console.log('b'); jQuery('#completaquiz').removeClass('dn'); jQuery('#completaquiz').html('Fornisci almeno un "Dettaglio" per aiutarci ad individuare i fornitori migliori'); jQuery(cta).removeClass('alldone'); jQuery(cta).addClass('opzionali'); } else if(stato === "0 1") { jQuery('#completaquiz').removeClass('dn'); // console.log('c'); jQuery('#completaquiz').html('Assegna un "Budget" alla categoria selezionata'); jQuery(cta).removeClass('opzionali'); jQuery(cta).removeClass('alldone'); } else if( stato === "0") { // console.log('d'); jQuery('#completaquiz').removeClass('dn'); jQuery('#completaquiz').html('Assegna un "Budget" alla categoria selezionata'); jQuery(cta).removeClass('opzionali'); jQuery(cta).removeClass('alldone'); } else { // console.log('d2'); jQuery('#completaquiz').removeClass('dn'); jQuery('#completaquiz').html('Assegna un "Budget" alla categoria selezionata'); jQuery(cta).removeClass('opzionali'); jQuery(cta).removeClass('alldone'); } statusProsegui(); var categorieselezionate=jQuery('.categorytest').length; var categoriecompletate=jQuery('.categorytest.alldone').length; var categoriedacompletare=categorieselezionate-categoriecompletate; if(jQuery('.categorieselezionate').length>0) { jQuery('.categorieselezionate').html(categorieselezionate); } /* if(categoriedacompletare===0) { jQuery('.conclusioneintervista').removeClass('dn'); jQuery('.proseguireintervista').removeClass('dn').addClass('dn'); } else { jQuery('.proseguireintervista').removeClass('dn'); jQuery('.conclusioneintervista').removeClass('dn').addClass('dn'); } */ if(jQuery('#categoriedacompletare').length>0) { jQuery('#categoriedacompletare').html(categoriedacompletare); } jQuery('#proseguiintervistacon').removeClass('dn').addClass('dn'); jQuery('#conclusionequiz').removeClass('dn').addClass('dn'); if(categoriedacompletare > 0) { if(jQuery('.categorytest.active').hasClass('alldone')) { jQuery('#proseguiintervistacon').removeClass('dn'); } if(jQuery('.categorytest.opzionali').length > 0) { jQuery('#proseguiintervistacon').removeClass('dn'); } } else { jQuery('#conclusionequiz').removeClass('dn'); } var testo=""; if(categoriedacompletare === 1) { testo = "Categorie scelte " + categorieselezionate + " - Per proseguire ne rimane una da completare"; } else if (categoriedacompletare >1) { testo = "Categorie scelte " + categorieselezionate + " - Per proseguire ne rimangono " + categoriedacompletare + " da completare"; } else { testo = ""; } var html="" + testo + ""; jQuery('.messaggiodistato').html(html); } function buildIntervista(id) { jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 2, category: id }, beforeSend: function(xhr, opts){ } , success: function(html) { jQuery('#actualtest').addClass('vh fl fw'); jQuery('#footerBottom').remove(); var hControlBox=jQuery('#controlbox').height(); hControlBox=(hControlBox*1) + 60; jQuery('#actualtest').css({'margin-bottom':hControlBox+'px'}); jQuery('#actualtest').html(html); jQuery('#actualtest').removeClass('vh'); sensitiveSliders(); threestateWidget(); multiSelectWidget(); selectWidget(); textareaWidget(); rangesWidget(); aggiornaStatusIntervista(); aggiornaBackgroundLaterale(); checkObbligatoriFacoltativi(); controlbox(); } }); } function controlbox() { var h=jQuery('#controlbox').height(); jQuery('#footerBottom').css({'margin-bottom':h+'px'}); jQuery('#footerBottom').css({'margin-top':h+'px'}); } function rangesWidget() { var step=1; var ranges=jQuery('.intervistaranges'); if(jQuery(ranges).length>0) { jQuery(ranges).each(function(i, val){ var min=0; var max=0; var value=0; if(jQuery(val).data('min') ==="") { min=0; } else { min= jQuery(val).data('min') ; } if(jQuery(val).data('max') ==="") { max=0; } else { max= jQuery(val).data('max') ; } if(jQuery(val).data('step') ==="") { step=1; } else { step= jQuery(val).data('step') ; } if(jQuery(val).data('value')==="") { value=min; } else { value= jQuery(val).data('value'); } var slider=noUiSlider.create(ranges[i], { connect: true, behaviour: 'tap', start: value, range: { 'min': [ min ], 'max': [ max ] }, step: step, format: wNumb({ decimals: 0 }), tooltips: [wNumb({decimals: 0})] }); ranges[i].noUiSlider.on('change', function(values, handle) { // jQuery(val).siblings('output').html(values[0]); jQuery(val).data({'value':values[0]}); aggiornaStatusIntervista(); }); }); } } function aggiornaBackgroundLaterale() { var c=jQuery('.categorytest.active').text().replace(/ /g , ''); var percorso="url('/wp-content/themes/responsive-child/images/" + c.toLowerCase() + "_web.jpg')"; jQuery('.bkgcategory').css({'background':percorso + ' no-repeat center center','height': '375px'}); } function textareaWidget() { if(jQuery('textarea[data-name="note"]').length>0) { jQuery('textarea[data-name="note"]').on('blur', function () { aggiornaStatusIntervista(); }); } } function selectWidget() { if(jQuery('.selectsintervista').length>0) { jQuery('.selectsintervista').on('change', function () { aggiornaStatusIntervista(); }); } } function multiSelectWidget() { if(jQuery('.contmultiselect .buttonchild').length>0) { jQuery('.contmultiselect .buttonchild').on('click', function () { jQuery(this).parent().find('.buttonchild').removeClass('active'); jQuery(this).addClass('active'); aggiornaStatusIntervista(); }); } } function threestateWidget(){ jQuery('.contthree .buttonchild').on('click',function(){ jQuery(this).parent().find('.buttonchild').removeClass('selected'); jQuery(this).addClass('selected'); aggiornaStatusIntervista(); }); } function sensitiveSliders() { if(jQuery('input[type="range"]').length > 0 && jQuery('body').hasClass('crop_is_mobile')) { jQuery('input[type="range"]').each(function() { // jQuery(this).attr({'type':'text'}); if( jQuery(this).val()!=="0" || jQuery(this).val()!=="" || jQuery(this).val()!==0){ jQuery(this).val(jQuery(this).data('min')); } }); var timeout = null; jQuery('input[type="text"]').on('input',function(){ clearTimeout(timeout); timeout = setTimeout(aggiornaStatusIntervista, 500); }); } else { jQuery('input[type="range"]').each(function () { jQuery(this).next().html(jQuery(this).val()); }); var timeout = null; jQuery('input[type="range"]').on('input', function () { jQuery(this).next().html(jQuery(this).val()); clearTimeout(timeout); timeout = setTimeout(aggiornaStatusIntervista, 500); }); /* jQuery( ".sliderlayer" ).each(function(){ jQuery(this).slider({ slide:function( event, ui ) { jQuery(this).parent().find('input').val(ui.value); jQuery(this).parent().find('output').html(ui.value) } }); min=jQuery(this).parent().find('input').attr('min')*1; max=jQuery(this).parent().find('input').attr('max')*1; step=jQuery(this).parent().find('input').attr('step')*1; jQuery(this).slider('option','min',min); jQuery(this).slider('option','max',max); jQuery(this).slider('option','step',step); }) */ } } function intervistaLastStep(){ var nome=jQuery('#nome').val(); var cognome=jQuery('#cognome').val(); var cellulare=jQuery('#cellulare').val(); var datamatrimonio=jQuery('#datamatrimonio').val(); var email=jQuery('#email').val(); var oldemail=""; if(jQuery('#oldemail').length >0) { oldemail = jQuery('#oldemail').val(); } else { oldemail=""; } var consenso=jQuery('#consenso').prop('checked'); var introerrore="
Gli operatori che hai scelto devono riconoscerti, inserisci:
"; var errore=""; if(jQuery.trim(email)==="") { errore=errore + "la tua mail"; } else { if(!isValidEmailAddress(email)) { errore=errore + "un indirizzo di posta elettronica valido"; } } if(jQuery.trim(nome)==="") { if(errore !== "") { errore = errore + ", ";} errore=errore + "il tuo nome"; } if(jQuery.trim(cognome)==="") { if(errore !== "") { errore = errore + ", ";} errore=errore + "il tuo cognome"; } if(jQuery.trim(cellulare)==="") { if(errore !== "") { errore = errore + ", ";} errore=errore + "il tuo numero di cellulare"; } if(jQuery.trim(datamatrimonio)==="") { if(errore!=="") { errore = errore + ", ";} errore=errore + "la data delle tue nozze"; } if(consenso===false) { if(errore!=="") { errore = errore + ", ";} errore=errore + "accettare il consenso alla privacy"; } if(errore!=="") { jQuery('.errorbox').html(""); jQuery('.errorbox').html(introerrore + errore); return false; } jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 'last', nome: nome, cognome: cognome, cellulare: cellulare, datamatrimonio: datamatrimonio, email: email, oldemail: oldemail, consenso: consenso, u: 1 }, beforeSend: function(xhr, opts){ ret=controlliLastStep(nome, cognome,cellulare,datamatrimonio,consenso); if(ret===false) { xhr.abort(); } } , success: function(html) { // jQuery('body').html('

Loading

'); // location.href='/intervista?grazie=1'; } }); return false; } function controlliLastStep(nome,cognome,cellulare,datamatrimonio,consenso){ var msg=""; jQuery('#intervista .errorbox').html(""); if(nome.length < 2) { msg=jQuery('#intervista .errorbox').html(); if(msg!=="") { msg = msg + "
";} jQuery('#intervista .errorbox').html(msg + "Inserire un nome."); } if(cognome.length < 2) { msg=jQuery('#intervista .errorbox').html(); if(msg!=="") { msg = msg + "
";} jQuery('#intervista .errorbox').html(msg + "Inserire un cognome."); } if(cellulare.length < 2) { msg=jQuery('#intervista .errorbox').html(); if(msg!=="") { msg = msg + "
";} jQuery('#intervista .errorbox').html(msg + "Inserire un numero di cellulare."); } jQuery('#containerdatamatrimonio').on('click',function() { }) if(datamatrimonio.length < 2) { msg=jQuery('#intervista .errorbox').html(); if(msg!=="") { msg = msg + "
";} jQuery('#intervista .errorbox').html(msg + "Inserire la data prevista delle nozze."); } if(consenso !==true) { msg=jQuery('#intervista .errorbox').html(); if(msg!=="") { msg = msg + "
";} jQuery('#intervista .errorbox').html(msg + "È necessario accettare le norme sulla privacy per poter fruire dei servizi richiesti"); } if(jQuery('#intervista .errorbox').html() !== "") { return false; } else { return true; } } function fdatamatrimonio(step, previous) { var consenso=jQuery('#consenso').prop('checked'); var email = jQuery('#email').val(); var oldemail = ""; if (jQuery('#oldemail').length > 0) { oldemail = jQuery('#oldemail').val(); } else { oldemail = ""; } var introerrore = "
Per ricontattarti gli operatori che hai scelto devono poterti riconoscere, per favore inserisci:
"; var errore = ""; if (jQuery.trim(email) === "") { errore = errore + "la tua mail"; } else { if (!isValidEmailAddress(email)) { errore = errore + "un indirizzo di posta elettronica valido"; } } if(consenso===false) { if(errore!=="") { errore = errore + ", ";} errore=errore + "accetta il consenso alla privacy"; } if(errore!=="") { jQuery('.errorbox').html(""); jQuery('.errorbox').html(introerrore + errore); return false; } else { jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 'last', u :1, email: email, oldemail: oldemail }, success: function () { jQuery('.fnomecognome.dn').removeClass('dn'); jQuery('.fdatamatrimonio.dn').removeClass('dn'); jQuery('.fcampoemail').addClass('dn'); jQuery('.sottotitolo2').addClass('dn'); jQuery('.titolosend').html("Ottieni il meglio!"); jQuery('.sottotitolosend').addClass("fl fw xs-mb30"); jQuery('.sottotitolosend').html("Per migliorare il contatto, se vuoi, puoi lasciarci i seguenti dati (non obbligatori)"); /* jQuery('.rowlightgray').html('I fornitori che corrispondono alle tue esigenze di budget potrebbero non essere disponibili nel tuo giorno di matrimonio.

Indica la data che hai scelto'); jQuery('.sottotitolo2').addClass('dn'); jQuery('.' + step).removeClass('dn'); jQuery('.' + previous).addClass('dn'); jQuery('.errorbox').html(""); */ } }); } } function fnomecognome(step, previous) { var email = jQuery('#email').val(); var oldemail = ""; if (jQuery('#oldemail').length > 0) { oldemail = jQuery('#oldemail').val(); } else { oldemail = ""; } var datamatrimonio=jQuery('#datamatrimonio').val(); var consenso=jQuery('#consenso').prop('checked'); var introerrore = "
Per poterti ricontattare gli operatori che hai scelto devono poterti riconoscere, per favore inserisci:
"; var errore = ""; if(jQuery.trim(datamatrimonio)==="") { if(errore!=="") { errore = errore + ", ";} errore=errore + "la data delle tue nozze"; } if(errore!=="") { jQuery('.errorbox').html(""); jQuery('.errorbox').html(introerrore + errore); return false; } else { jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 'last', u : 0, datamatrimonio: datamatrimonio, email: email, oldemail: oldemail, consenso: consenso }, success: function () { jQuery('.rowlightgray').html('Vuoi velocizzare i tempi per prendere appuntamenti o per chiarire i dettagli delle tue richieste?

Completa i tuoi dati di contatto'); jQuery('.sottotitolo2').addClass('dn'); jQuery('.' + step).removeClass('dn'); jQuery('.' + previous).addClass('dn'); jQuery('.errorbox').html(""); } }); } } function fconferma() { var email = jQuery('#email').val(); var oldemail = ""; if (jQuery('#oldemail').length > 0) { oldemail = jQuery('#oldemail').val(); } else { oldemail = ""; } var datamatrimonio=jQuery('#datamatrimonio').val(); var consenso=jQuery('#consenso').prop('checked'); var nome=jQuery('#nome').val(); var cognome=jQuery('#cognome').val(); var cellulare=jQuery('#cellulare').val(); var introerrore = "
Per poterti ricontattare gli operatori che hai scelto devono poterti riconoscere, per favore inserisci:
"; var errore = ""; /* if(jQuery.trim(nome)==="") { errore=errore + "il tuo nome"; } if(jQuery.trim(cognome)==="") { errore=errore + "il tuo cognome"; } if(jQuery.trim(cellulare)==="") { if(errore!=="") { errore = errore + ", ";} errore=errore + "il tuo numero di cellulare"; } */ if(errore!=="") { jQuery('.errorbox').html(""); jQuery('.errorbox').html(introerrore + errore); return false; } else { jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'intervista', step: 'last', nome: nome, cognome: cognome, cellulare: cellulare, datamatrimonio: datamatrimonio, email: email, u : 0, oldemail: oldemail, consenso: consenso }, success: function(html) { var html='

Loading

'; jQuery('body').html(html); location.href='/intervista?grazie=1'; } }); } }