function inviaFormRicercaCatalogo(ref_from){
if(ref_from!=null){
try{ref_from.idParent0.value=ref_from.categoriaRicerca.value;}catch(err){}
try{ref_from.categoria.value=ref_from.categoriaRicerca.value;}catch(err){}
// Se il valore nel campo ricerca � diverso da "Cerca Prodotto" allora passa effettivamente la parola da cercare inserita dall'utente
// Controlla anche che esista nomeRicerca
try{
if(ref_from.nomeRicerca!=null&ref_from.nomeRicerca.value!="Cerca Prodotto")
ref_from.nome.value=ref_from.nomeRicerca.value;
}catch(err){}
try{ref_from.dittaProduttrice.value=ref_from.dittaProduttriceSelect.value;}catch(err){}
}
}
function inviaFormRicercaCatalogoRewrite(ref_from){
if(ref_from!=null){
var url = '/catalogo';
if(ref_from.categoriaRicerca.value!=''){
var idCat = ref_from.categoriaRicerca.value;
url+='/c/'+idCat+'/csrc/'+idCat+'/'+ref_from.categoriaRicerca[ref_from.categoriaRicerca.selectedIndex].text;
}
if(ref_from.dittaProduttriceSelect.value!='')
url+='/dit/'+ref_from.dittaProduttriceSelect.value;
if(ref_from.nomeRicerca.value!='')
url+='/no/'+ref_from.nomeRicerca.value;
url+='.html';
// alert(url);
ref_from.idParent0.disabled=true;
ref_from.categoriaRicerca.disabled=true;;
ref_from.categoria.disabled=true;
ref_from.categoriaRicerca.disabled=true;;
ref_from.nome.disabled=true;
ref_from.nomeRicerca.disabled=true;;
ref_from.dittaProduttrice.disabled=true;
ref_from.dittaProduttriceSelect.disabled=true;;
ref_from.action=url;
}
}
function cambiaOrdinamento(selectSorgente){
tendino = selectSorgente;
valore = "";
if(tendino!=null){
valore =tendino.value;
}
urlToGo = '/ChangeOrdinamentoCatalogo.do?'+document.getElementById('requestParams').value+'&ordinamentoProdottiSelect='+valore;
document.location=urlToGo;
}
function cambiaNumeroProdotti(selectSorgente){
tendino = selectSorgente;
valore = "";
if(tendino!=null){
valore =tendino.value;
}
urlToGo = '/UpdateNumeroProdottiCatalogo.do?'+document.getElementById('numProd-requestParams').value+'&numeroProdottiSelect='+valore;
document.location=urlToGo;
}
function inoltraOrdine(msg){
return inoltraOrdine(msg,true);
}
function inoltraOrdine(msg,mostroConfirm){
return inoltraOrdine(msg,mostroConfirm,false);
}
function inoltraOrdine(msg,mostroConfirm,mostraWaitMask, areServletPagamentoSecondarie){
var formInoltro = document.getElementById('InoltraOrdine');
var accettoCondizioniVendita = document.getElementById('accettoCondizioniVendita');
var accettoCondizioniPrivacy = document.getElementById('accettoCondizioniPrivacy');
var continua = true;
realjq=recuperaJquery($);
if(realjq==null)
realjq=recuperaJquery(Jq);
var msgErrore = 'Attenzione!\nPer procedere con l\'ordine occorre accettare le condizioni di vendita e dare il consenso al trattamento dei dati.';
if(accettoCondizioniVendita!=null){
if(accettoCondizioniVendita.checked==false){
continua = false;
accettoCondizioniVendita.style.borderStyle = 'solid';
accettoCondizioniVendita.style.borderWidth = '3px';
accettoCondizioniVendita.style.borderColor = '#cc0000';
alert(msgErrore);
}else{
accettoCondizioniVendita.style.borderWidth = '0';
}
}
if(continua&&accettoCondizioniPrivacy!=null){
if(accettoCondizioniPrivacy.checked==false){
continua = false;
accettoCondizioniPrivacy.style.borderStyle = 'solid';
accettoCondizioniPrivacy.style.borderWidth = '3px';
accettoCondizioniPrivacy.style.borderColor = '#cc0000';
alert(msgErrore);
}else{
accettoCondizioniPrivacy.style.borderWidth = '0';
}
}
if(continua){
var tastoInoltroOrdine = document.getElementById('tastoInoltroOrdine');
var tastoInoltroOrdine2 = document.getElementById('tastoInoltroOrdine2');
var tastoCaricamentoOrdine = document.getElementById('tastoCaricamentoOrdine');
var immagineCaricamentoOrdine = document.getElementById('immagineCaricamentoOrdine');
var maskLoading = document.getElementById('dialog-mask-ordine');
var msgLoading = document.getElementById('loading-ordine');
if(formInoltro!=null){
continuo = false;
if(mostroConfirm!=null&&mostroConfirm==false){
continuo = true;
}else{
continuo = confirm(msg);
}
if(continuo){
if(mostraWaitMask){
if(maskLoading!=null&&msgLoading!=null){
maskLoading.style.display='block';
msgLoading.style.display='block';
}
}
if(tastoInoltroOrdine!=null){
realjq('#'+tastoInoltroOrdine.id).addClass("disabled");
realjq('#'+tastoInoltroOrdine.id).prop('disabled', true);
realjq('#'+tastoInoltroOrdine.id).attr('disabled', true);
}
if(tastoInoltroOrdine2!=null)
tastoInoltroOrdine2.style.display='none';
if(tastoCaricamentoOrdine!=null)
tastoCaricamentoOrdine.style.display='';
if(immagineCaricamentoOrdine!=null)
immagineCaricamentoOrdine.style.display='';
// note ordine
var testo = document.getElementById("notaOrdine");
if(testo!=null){
var valoreTesto=testo.value;
if(valoreTesto!=null&&(valoreTesto.replace(/\s/g,"") != "")){
var nof = document.getElementById("notaOrdineForm");
if(nof!=null){
nof.value=(valoreTesto);
}
}
}
// note spedizione
var testo = document.getElementById("notaSpedizione");
if(testo!=null){
var valoreTesto=testo.value;
if(valoreTesto!=null&&(valoreTesto.replace(/\s/g,"") != "")){
var nsf = document.getElementById("notaSpedizioneForm");
if(nsf!=null){
nsf.value=(valoreTesto);
}
}
}
// flag per il consenso al salvataggio dei dati della carta di credito
var valoreFlag = document.getElementById("flagSalvaDatiCarta");
if(valoreFlag!=null){
var valorePerForm=valoreFlag.value;
if(valorePerForm!=null){
var flagForm = document.getElementById("flagSalvaDatiCartaForm");
if(flagForm!=null){
flagForm.value=(valorePerForm);
}
}
}
var valoreFlag2 = document.getElementById("flagSalvaDatiCartaSoloCliente");
if(valoreFlag2!=null){
var valorePerForm=valoreFlag2.value;
if(valorePerForm!=null){
var flagForm = document.getElementById("flagSalvaDatiCartaSoloClienteForm");
if(flagForm!=null){
flagForm.value=(valorePerForm);
}
}
}
/*
vecchia gestione newsletter
var newsletterAttivaForm = document.getElementById("newsletterAttivaForm");
var newsletterAttiva = document.getElementById("newsletterAttiva");
if(newsletterAttiva!=null&&newsletterAttivaForm!=null){
newsletterAttivaForm.checked =newsletterAttiva.checked;
}*/
var partecipaValutazioneForm = document.getElementById("partecipaValutazioneForm");
var partecipaValutazione = document.getElementById("partecipaValutazione");
if(partecipaValutazione != null && partecipaValutazioneForm != null){
partecipaValutazioneForm.checked = partecipaValutazione.checked;
}
var areServletPagamentoSecondarieInput = document.getElementById("areServletPagamentoSecondarie");
if (areServletPagamentoSecondarie != undefined && areServletPagamentoSecondarie == true && areServletPagamentoSecondarieInput != null && areServletPagamentoSecondarieInput != undefined){
document.getElementById("areServletPagamentoSecondarie").value = 'true';
}
realjq(".btn.btn-procedi.btn-acquista").addClass("disabled");
realjq(".btn.btn-procedi.btn-acquista").prop('disabled', true);
realjq(".btn.btn-procedi.btn-acquista").attr('disabled', true);
formInoltro.submit();
}
}
}
return false;
}
function copyCheck(targetId,check){
var elC = document.getElementById(targetId);
if(elC!=null){
elC.checked = check;
}
}
function scopriDiv(idElemento){
var idElemento = document.getElementById(idElemento);
if(idElemento!=null){
if(idElemento.style.display=='none')
idElemento.style.display = '';
else
idElemento.style.display = 'none';
}
}
function inviaForm(idForm,msg){
var formInoltro = document.getElementById(idForm);
if(formInoltro!=null){
if(confirm(msg))
formInoltro.submit();
}
}
function nascondi(id){
var elemento=document.getElementById(id);
if(elemento!=null){
elemento.style.display='none';
elemento.style.visibility='hidden';
}
}
function mostra(id){
var elemento=document.getElementById(id);
if(elemento!=null){
elemento.style.display='';
elemento.style.visibility='';
}
}
function mostraNota(){
mostra('nota');
nascondi('tastoMostraNota');
mostra('tastoChiudiNota');
nascondi('TestoScritto');
}
function chiudiNota(){
nascondi('nota');
mostra('tastoMostraNota');
var testo = document.getElementById("nota");
if(testo!=null){
var valoreTesto=testo.value;
if(valoreTesto!=null&&(valoreTesto.replace(/\s/g,"") != "")){
var x=document.getElementById("TestoScritto");
if(x!=null){
x.innerHTML=encodeMyHtml(valoreTesto);
mostra('TestoScritto');
}
}
}
nascondi('tastoChiudiNota');
}
function encodeMyHtml(stringa) {
if(stringa==null)
return "";
encodedHtml = stringa;
encodedHtml= encodedHtml.replace(/&/g, "&");
encodedHtml= encodedHtml.replace(//g, ">");
return encodedHtml;
}
function PopupCentrata(nomeFile,nomefinestra,wid,heigh,resiz,scroll) {
var w = wid;
var h = heigh;
var l = Math.floor((screen.width-w)/2);
var t = Math.floor((screen.height-h)/2);
if(nomefinestra!=null)
nomefinestra=nomefinestra.replace(/ /g, "");
pop = window.open(nomeFile,nomefinestra,"width=" + w + ",height=" + h + ",top=" + t + ",left=" + l+",resizable="+resiz+",scrollbars="+scroll);
pop.focus();
}
function recuperaJquery(o) {
if (o.fn) {
return o;
}
return null;
}
function caricaDisponibilita(dataIniziale,dataFinale){
divContenutoDisponibilita = 'disponibilita_contenuto';
divCaricamento = 'disponibilita_loading';
divErrore = 'disponibilita_errore';
realjq=recuperaJquery($);
if(realjq==null)
realjq=recuperaJquery(Jq);
realjq('#'+divErrore).hide();
realjq('#'+divContenutoDisponibilita).hide();
realjq('#'+divCaricamento).show();
var qs='dataIniziale='+dataIniziale+'&dataFinale='+dataFinale;
realjq.ajax
({
type: "POST",
url: "/include/responsive/disponibilita/logicaDisponibilita.jsp",
data: qs,
dataType: "html",
cache: false,
success: function(htmlContent)
{
if(htmlContent!=null){
realjq('#'+divContenutoDisponibilita).html(htmlContent);
realjq('#'+divCaricamento).hide();
realjq('#'+divContenutoDisponibilita).show();
}else{
realjq('#'+divContenutoDisponibilita).html('');
realjq('#'+divCaricamento).hide();
realjq('#'+divContenutoDisponibilita).hide();
realjq('#'+divErrore).show();
}
},
error: function(htmlContent)
{
realjq('#'+divContenutoDisponibilita).html('');
realjq('#'+divCaricamento).hide();
realjq('#'+divContenutoDisponibilita).hide();
realjq('#'+divErrore).show();
}
}); //FINE CHIAMATA AJAX
}
function setSceltaDisponibilita(prefisso,id_div,data,ora,risorsa,servizio){
divErrore = 'disponibilita_radio_errore';
divOk = 'disponibilita_radio_errore';
divCaricamento = 'disponibilita_radio_loading_'+id_div;
classeCssFasciaSelezionata='spedSelezionata';
prosegui='bottone_prosegui';
realjq=recuperaJquery($);
if(realjq==null)
realjq=recuperaJquery(Jq);
//nascondo il tasto prosegui
realjq('#'+prosegui).hide();
//rimuovo tutte le classi di selezione
realjq('tr[id^="'+prefisso+'"]').removeClass(classeCssFasciaSelezionata);
//nascondo l'eventuale errore
realjq('#'+divErrore).hide();
//nascondo l'eventuale OK
realjq('#'+divOk).hide();
//mostro il loader
realjq('#'+divCaricamento).show();
var qs='data='+data+'&ora='+ora+'&risorsa='+risorsa+'&servizio='+servizio;
realjq.ajax
({
type: "POST",
url: "/UpdateDatiPrenotazioneRisorsa.do",
data: qs,
dataType: "xml",
cache: false,
success: function(xml)
{
if(xml!=null){
try{
realjqxml = realjq( xml );
esito = realjqxml.find( "esito" );
esito = realjq( esito ).text();
//nascondo il loader
realjq('#'+divCaricamento).hide();
if(esito=='1'){
//mostro l'eventuale OK
realjq('#'+divOk).show();
//mostro il tasto prosegui
realjq('#'+prosegui).show();
//metto la classe css
realjq('#'+prefisso+id_div).addClass(classeCssFasciaSelezionata);
}else{
realjq('#'+divErrore).show();
realjq('#'+prosegui).hide();
}
}catch(err){
//nascondo il loader
realjq('#'+divCaricamento).hide();
realjq('#'+prosegui).hide();
//mostro l'eventuale errore
realjq('#'+divErrore).show();
}
}else{
//nascondo il loader
realjq('#'+divCaricamento).hide();
//mostro l'eventuale errore
realjq('#'+divErrore).show();
realjq('#'+prosegui).hide();
}
},
error: function(xml)
{
//nascondo il loader
realjq('#'+divCaricamento).hide();
//mostro l'eventuale OK
realjq('#'+divErrore).show();
realjq('#'+prosegui).hide();
}
}); //FINE CHIAMATA AJAX
}
function caricaPuntiVendita(stepDistanza){
divContenutoPuntiVendita = 'punti_vendita_contenuto';
divPuntiVendita = 'punti_vendita_loading';
divErrore = 'punti_vendita_errore';
realjq=recuperaJquery($);
if(realjq==null)
realjq=recuperaJquery(Jq);
realjq('#'+divErrore).hide();
realjq('#'+divContenutoPuntiVendita).hide();
realjq('#'+divPuntiVendita).show();
var qs='stepDistanza='+stepDistanza;
realjq.ajax
({
type: "POST",
url: "/include/responsive/puntiVendita/logicaPuntoVendita.jsp",
data: qs,
dataType: "html",
cache: false,
success: function(htmlContent)
{
if(htmlContent!=null){
realjq('#'+divContenutoPuntiVendita).html(htmlContent);
realjq('#'+divPuntiVendita).hide();
realjq('#'+divContenutoPuntiVendita).show();
}else{
realjq('#'+divContenutoPuntiVendita).html('');
realjq('#'+divPuntiVendita).hide();
realjq('#'+divContenutoPuntiVendita).hide();
realjq('#'+divErrore).show();
}
},
error: function(htmlContent)
{
realjq('#'+divContenutoPuntiVendita).html('');
realjq('#'+divPuntiVendita).hide();
realjq('#'+divContenutoPuntiVendita).hide();
realjq('#'+divErrore).show();
}
}); //FINE CHIAMATA AJAX
}
function setSceltaPuntoVenditaVoid(prefisso,id_div,id_pdv,iniziale){
realjq=recuperaJquery($);
if(realjq==null)
realjq=recuperaJquery(Jq);
prosegui='bottone_prosegui';
var qs="id="+id_pdv+"&soloSet=true";
realjq.ajax
({
type: "POST",
url: "/UpdateDatiRitiroPuntoVendita.do",
data: qs,
dataType: "xml",
cache: false,
success: function(xml){
realjq('#'+prosegui).show();
},
error: function(xml)
{
realjq('#'+prosegui).show();
}
}); //FINE CHIAMATA AJAX
}
function setSceltaPuntoVendita(prefisso,id_div,id_pdv,iniziale){
var funzioneDopoSuccesso = function(datiExtra) {
return function(xml) {
if(xml!=null){
try{
realjqxml = realjq( xml );
esito = realjqxml.find( "esito" );
descrizione = realjqxml.find( "descrizione" );
esito = realjq( esito ).text();
if(datiExtra.iniziale){
//nascondo il tasto prosegui
realjq('#'+datiExtra.inputRadio).show();
}
//nascondo il loader
realjq('#'+datiExtra.divCaricamento).hide();
if(esito=='1'){
//mostro l'eventuale OK
realjq('#'+datiExtra.divOk).show();
//mostro il tasto prosegui
if(!datiExtra.iniziale){
realjq('#'+datiExtra.prosegui).show();
}
//metto la classe css
realjq('#'+datiExtra.prefisso+datiExtra.id_div).addClass(datiExtra.classeCssFasciaSelezionata);
//modifico l'onclick
try{
te = realjq('#'+datiExtra.inputRadio).attr('onclick');
te = te.replace('setSceltaPuntoVendita(','setSceltaPuntoVenditaVoid(');
realjq('#'+datiExtra.inputRadio).attr('onclick',te);
te = realjq('#'+datiExtra.inputRadio).attr('onclick');
}catch(err){}
}else{
title = realjq(descrizione).html().replace("", "");
//controllo se ci sono mancanti
tot='';
mancanti = realjqxml.find( "prodotto" );
realjq.each(mancanti , function() {
tot+=formattaProdottoMancante(realjq,this);
});
if(tot!=null&&tot!=''){
title+="
";
}
realjq('#'+datiExtra.prefisso+datiExtra.id_div+'_td_add').html(title);
realjq('#'+datiExtra.prefisso+datiExtra.id_div+'_tr_add').show();
realjq('#'+datiExtra.divErrore).show();
realjq('#'+datiExtra.prosegui).hide();
}
}catch(err){
//nascondo il loader
realjq('#'+datiExtra.divCaricamento).hide();
realjq('#'+datiExtra.prosegui).hide();
//mostro l'eventuale errore
realjq('#'+datiExtra.divErrore).show();
}
}else{
//nascondo il loader
realjq('#'+datiExtra.divCaricamento).hide();
//mostro l'eventuale errore
realjq('#'+datiExtra.divErrore).show();
realjq('#'+datiExtra.prosegui).hide();
}
if(finitoDiCaricareElementi()){
realjq('#div_attesa_ricerca').hide();
}
};
};
inputRadio = 'punto_vendita_radio_'+id_div;
divErrore = 'punto_vendita_radio_errore';
divOk = 'punto_vendita_radio_errore';
divCaricamento = 'punto_vendita_radio_loading_'+id_div;
classeCssFasciaSelezionata='punto_vendita_selezionato';
prosegui='bottone_prosegui';
realjq=recuperaJquery($);
if(realjq==null)
realjq=recuperaJquery(Jq);
if(iniziale){
//nascondo il tasto prosegui
realjq('#'+inputRadio).hide();
}else{
realjq('#'+inputRadio).prop('checked',true);
}
//nascondo il tasto prosegui
realjq('#'+prosegui).hide();
//rimuovo tutte le classi di selezione
realjq('tr[id^="'+prefisso+'"]').removeClass(classeCssFasciaSelezionata);
//nascondo l'eventuale errore
realjq('#'+divErrore).hide();
//nascondo l'eventuale OK
realjq('#'+divOk).hide();
//mostro il loader
realjq('#'+divCaricamento).show();
realjq('#'+prefisso+id_div+'_td_add').html();
realjq('#'+prefisso+id_div+'_tr_add').hide();
var qs="id="+id_pdv+"&iniziale="+iniziale;
realjq.ajax
({
type: "POST",
url: "/UpdateDatiRitiroPuntoVendita.do",
data: qs,
dataType: "xml",
cache: false,
success: funzioneDopoSuccesso({"divCaricamento":divCaricamento,"divOk":divOk,"prosegui":prosegui,"prefisso":prefisso,"id_div":id_div,"classeCssFasciaSelezionata":classeCssFasciaSelezionata,"divErrore":divErrore,"inputRadio":inputRadio,"iniziale":iniziale}),
error: function(xml)
{
//nascondo il loader
realjq('#'+divCaricamento).hide();
//mostro l'eventuale OK
realjq('#'+divErrore).show();
realjq('#'+prosegui).hide();
if(finitoDiCaricareElementi()){
realjq('#div_attesa_ricerca').hide();
}
}
}); //FINE CHIAMATA AJAX
}
function finitoDiCaricareElementi(){
a=realjq("[id^='punto_vendita_radio_loading_']:visible");
a=realjq("[id^='punto_vendita_radio_loading_']:visible").length;
if(a==0){
//alert('Nascondo');
return true;
}else{
//alert('Non Nascondo');
return false;
}
}
function formattaProdottoMancante(realjq,bloccoProdotto){
elemento="";
t=realjq( bloccoProdotto )
nome=t.find( "nome" );
if(nome!=null)
nome=nome.html().replace("", "");
idProdotto=t.find( "idProdotto" );
if(idProdotto!=null)
idProdotto=idProdotto.html();
minsan=t.find( "minsan" );
if(minsan!=null)
minsan=minsan.html();
codice=t.find( "codice" );
if(codice!=null)
codice=codice.html();
elemento+=""+minsan+" "+nome+" Elimina dal carrello
";
elemento=""+elemento+"";
return elemento;
}
function setStepDistanza(stepDistanza){
document.getElementById('stepDistanza').value=stepDistanza;
document.getElementById('UpdateModalitaSpedizioneCarrello').submit()
}
function cancellaArticoloProdotto(idProdotto){
if(confirm('Vuoi Davvero rimuovere il prodotto dal carrello?')){
realjq=recuperaJquery($);
if(realjq==null)
realjq=recuperaJquery(Jq);
//realjq('#elimina_'+idProdotto).hide();
idProdottoReale=idProdotto
try{
idProdottoReale=idProdottoReale.substring(idProdottoReale.indexOf("_")+1)
}catch (e) {}
//lo faccio per tutti i prodotti
//realjq('#elimina_'+idProdotto).hide();
realjq("a[id^='elimina_'][id$='_"+idProdottoReale+"']").hide();
//realjq("img[id^='load_del_'][id$='_'"+idProdottoReale+"]").hide();
realjq('#load_del_'+idProdotto).show();
var qs="id="+idProdottoReale+"&delete=true&redirect=null";
realjq.ajax
({
type: "POST",
url: "/UpdateProdottoCarrello.do",
data: qs,
dataType: "xml",
cache: false,
success: function(xml)
{
if(xml!=null){
try{
realjqxml = realjq( xml );
esito = realjqxml.find( "esito" ).text();;
if(esito=='1'){
if(realjq('#carrello_mini_refresh').is(':visible')) {
realjq.ajax
({
type: "POST",
url: "/include/responsive/carrello/carrelloMini.jsp",
data: qs,
cache: false,
contentType: "charset=UTF-8",
success: function(html)
{
realjq('#carrello_mini_refresh').html(html);
}
});
}
if(realjq('#carrello_mini_ruby_refresh').is(':visible')) {
realjq.ajax
({
type: "POST",
url: "/include/responsive/carrello/carrelloMiniRuby.jsp",
data: qs,
cache: false,
contentType: "charset=UTF-8",
success: function(html)
{
realjq('#carrello_mini_ruby_refresh').html(html);
}
});
}
if(realjq('#carrello_mini_smart_refresh').is(':visible')) {
realjq.ajax
({
type: "POST",
url: "/include/responsive/carrello/carrelloMiniSmart.jsp",
data: qs,
cache: false,
contentType: "charset=UTF-8",
success: function(html)
{
realjq('#carrello_mini_smart_refresh').html(html);
}
});
}
if(realjq('#carrello_mini_noprodotti_refresh').is(':visible')) {
realjq.ajax
({
type: "POST",
url: "/include/responsive/carrello/carrelloMiniNoProdotti.jsp",
data: qs,
cache: false,
contentType: "charset=UTF-8",
success: function(html)
{
realjq('#carrello_mini_noprodotti_refresh').html(html);
}
});
}
if(realjq('#carrello_mini_elegance_refresh').is(':visible')) {
realjq.ajax
({
type: "POST",
url: "/include/responsive/carrello/carrelloMiniElegance.jsp",
data: qs,
cache: false,
contentType: "charset=UTF-8",
success: function(html)
{
realjq('#carrello_mini_elegance_refresh').html(html);
}
});
}
//lo faccio per tutti i prodotti
realjq("li[id^='li_'][id$='_"+idProdottoReale+"']").html('Prodotto eliminato dal carrello');
//realjq('#li_'+idProdotto).html('Prodotto eliminato dal carrello');
//realjq('#li_'+idProdotto).attr('ok','1');
realjq("li[id^='li_'][id$='_"+idProdottoReale+"']").attr('ok','1');
tuttiOk=true;
realjq.each(realjq('#li_'+idProdotto).parent().children("li") , function() {
tuttiOk=tuttiOk && realjq(this).attr("ok")==1
});
if(tuttiOk){
te =realjq('#li_'+idProdotto)
te=realjq(te).parents("tr")
realjq('#li_'+idProdotto).parents("td").html("Ricalcolo Disponibilita' in corso
")
te=realjq(te).prev();
te =realjq(te).find('input[id^="punto_vendita_radio_"]')
te = realjq(te).attr('onclick');
eval(te);
}
}else{
realjq('#li_'+idProdotto).html('Impossibile eliminare il prodotto');
}
}catch(err){
realjq('#li_'+idProdotto).html('Impossibile eliminare il prodotto');
}
}else{
realjq('#li_'+idProdotto).html('Impossibile eliminare il prodotto');
}
},
error: function(xml)
{
//nascondo il loader
realjq('#li_'+idProdotto).html('Impossibile eliminare il prodotto');
}
});
}
}
function scegliSpedizione(nome,perRitiro){
if(perRitiro==null||(perRitiro!=true&&perRitiro!='true')){
document.getElementById('stepDistanza').value='0';
}
document.getElementById(nome).submit();
}
function goToPaginaPagamento(nomeForm){
var formSpediziome = document.getElementById(nomeForm);
if(formSpediziome!=null){
formSpediziome.action='/GoToModalitaPagamentoCarrello.do';
formSpediziome.submit();
}
}
//(titolo,testo,tipoPopup,classePopup, idOrdine)
function inoltraOrdineMobileWithSwal(titolo,testo,tipoPopup,classePopup, idOrdine,mostroConfirm,mostraWaitMask, areServletPagamentoSecondarie){
realjq=recuperaJquery($);
if(realjq==null)
realjq=recuperaJquery(Jq);
var formInoltro = document.getElementById('InoltraOrdine');
var accettoCondizioniVendita = document.getElementById('accettoCondizioniVendita');
var accettoCondizioniPrivacy = document.getElementById('accettoCondizioniPrivacy');
var continua = true;
var msgErrore = 'Per procedere con l\'ordine occorre accettare le condizioni di vendita e dare il consenso al trattamento dei dati.';
if(accettoCondizioniVendita!=null){
if(accettoCondizioniVendita.checked==false){
continua = false;
accettoCondizioniVendita.style.borderStyle = 'solid';
accettoCondizioniVendita.style.borderWidth = '3px';
accettoCondizioniVendita.style.borderColor = '#cc0000';
msgErrore = 'Per procedere con l\'ordine occorre accettare le condizioni di vendita.';
Swal.fire({ title: 'Attenzione', text: msgErrore, type: 'error', confirmButtonText: 'Ok',buttonsStyling: false, customClass: classePopup,focusConfirm:false,onBeforeOpen: () => {Jq(".swal2-confirm").blur()},onOpen: () => {Jq(".swal2-confirm").blur()},onClose: () => {Jq("#tastoInoltroOrdine").children("button").blur();},onAfterClose: () => {Jq("#tastoInoltroOrdine").children("button").blur();} }).then((result) => {Jq("#tastoInoltroOrdine").children("button").blur();});
}else{
accettoCondizioniVendita.style.borderWidth = '0';
}
}
if(continua&&accettoCondizioniPrivacy!=null){
if(accettoCondizioniPrivacy.checked==false){
continua = false;
accettoCondizioniPrivacy.style.borderStyle = 'solid';
accettoCondizioniPrivacy.style.borderWidth = '3px';
accettoCondizioniPrivacy.style.borderColor = '#cc0000';
msgErrore = 'Per procedere con l\'ordine occorre accettare prestare il consenso al trattamento dei dati.';
Swal.fire({ title: 'Attenzione', text: msgErrore, type: 'error', confirmButtonText: 'Ok',buttonsStyling: false, customClass: classePopup,focusConfirm:false,onBeforeOpen: () => {Jq(".swal2-confirm").blur()},onOpen: () => {Jq(".swal2-confirm").blur()},onClose: () => {Jq("#tastoInoltroOrdine").children("button").blur();},onAfterClose: () => {Jq("#tastoInoltroOrdine").children("button").blur();} }).then((result) => {Jq("#tastoInoltroOrdine").children("button").blur();});
}else{
accettoCondizioniPrivacy.style.borderWidth = '0';
}
}
if(continua){
var tastoInoltroOrdine = document.getElementById('tastoInoltroOrdine');
var tastoInoltroOrdine2 = document.getElementById('tastoInoltroOrdine2');
var tastoCaricamentoOrdine = document.getElementById('tastoCaricamentoOrdine');
var immagineCaricamentoOrdine = document.getElementById('immagineCaricamentoOrdine');
var maskLoading = document.getElementById('dialog-mask-ordine');
var msgLoading = document.getElementById('loading-ordine');
if(formInoltro!=null){
continuo = false;
if(mostroConfirm!=null&&mostroConfirm==false){
if(mostraWaitMask){
if(maskLoading!=null&&msgLoading!=null){
maskLoading.style.display='block';
msgLoading.style.display='block';
}
}
if(tastoInoltroOrdine!=null)
tastoInoltroOrdine.style.display='none';
if(tastoInoltroOrdine2!=null)
tastoInoltroOrdine2.style.display='none';
if(tastoCaricamentoOrdine!=null)
tastoCaricamentoOrdine.style.display='';
if(immagineCaricamentoOrdine!=null)
immagineCaricamentoOrdine.style.display='';
// note ordine
var testo = document.getElementById("notaOrdine");
if(testo!=null){
var valoreTesto=testo.value;
if(valoreTesto!=null&&(valoreTesto.replace(/\s/g,"") != "")){
var nof = document.getElementById("notaOrdineForm");
if(nof!=null){
nof.value=(valoreTesto);
}
}
}
// note spedizione
var testo = document.getElementById("notaSpedizione");
if(testo!=null){
var valoreTesto=testo.value;
if(valoreTesto!=null&&(valoreTesto.replace(/\s/g,"") != "")){
var nsf = document.getElementById("notaSpedizioneForm");
if(nsf!=null){
nsf.value=(valoreTesto);
}
}
}
// flag per il consenso al salvataggio dei dati della carta di credito
var valoreFlag = document.getElementById("flagSalvaDatiCarta");
if(valoreFlag!=null){
var valorePerForm=valoreFlag.value;
if(valorePerForm!=null){
var flagForm = document.getElementById("flagSalvaDatiCartaForm");
if(flagForm!=null){
flagForm.value=(valorePerForm);
}
}
}
var valoreFlag2 = document.getElementById("flagSalvaDatiCartaSoloCliente");
if(valoreFlag2!=null){
var valorePerForm=valoreFlag2.value;
if(valorePerForm!=null){
var flagForm = document.getElementById("flagSalvaDatiCartaSoloClienteForm");
if(flagForm!=null){
flagForm.value=(valorePerForm);
}
}
}
var partecipaValutazioneForm = document.getElementById("partecipaValutazioneForm");
var partecipaValutazione = document.getElementById("partecipaValutazione");
if(partecipaValutazione != null && partecipaValutazioneForm != null){
partecipaValutazioneForm.checked = partecipaValutazione.checked;
}
formInoltro.submit();
}else{
Swal.fire({
title: titolo,
text: testo,
type: tipoPopup,
reverseButtons: true,
focusConfirm: false,
showCancelButton: true,
cancelButtonText: 'Annulla',
buttonsStyling: false,
customClass: classePopup,
focusConfirm:false,
onBeforeOpen: () => {Jq(".swal2-confirm").blur(); Jq(".swal2-cancel").blur()},
onOpen: () => {Jq(".swal2-confirm").blur(); Jq(".swal2-cancel").blur()},
onClose: () => {Jq("#tastoInoltroOrdine").children("button").blur();},
onAfterClose: () => {Jq("#tastoInoltroOrdine").children("button").blur();}
}).then((result) => {
document.activeElement.blur();
if (result.value) {
if(mostraWaitMask){
Swal.fire({
html:
'Stiamo elaborando il tuo ordine',
timer: 10000,
onBeforeOpen: () => {
Swal.showLoading()
}
})
}
if(tastoInoltroOrdine!=null){
realjq('#'+tastoInoltroOrdine.id).addClass("disabled");
realjq('#'+tastoInoltroOrdine.id).prop('disabled', true);
realjq('#'+tastoInoltroOrdine.id).attr('disabled', true);
}
if(tastoInoltroOrdine2!=null)
tastoInoltroOrdine2.style.display='none';
if(tastoCaricamentoOrdine!=null)
tastoCaricamentoOrdine.style.display='';
if(immagineCaricamentoOrdine!=null)
immagineCaricamentoOrdine.style.display='';
// note ordine
var testo = document.getElementById("notaOrdine");
if(testo!=null){
var valoreTesto=testo.value;
if(valoreTesto!=null&&(valoreTesto.replace(/\s/g,"") != "")){
var nof = document.getElementById("notaOrdineForm");
if(nof!=null){
nof.value=(valoreTesto);
}
}
}
// note spedizione
var testo = document.getElementById("notaSpedizione");
if(testo!=null){
var valoreTesto=testo.value;
if(valoreTesto!=null&&(valoreTesto.replace(/\s/g,"") != "")){
var nsf = document.getElementById("notaSpedizioneForm");
if(nsf!=null){
nsf.value=(valoreTesto);
}
}
}
// flag per il consenso al salvataggio dei dati della carta di credito
var valoreFlag = document.getElementById("flagSalvaDatiCarta");
if(valoreFlag!=null){
var valorePerForm=valoreFlag.value;
if(valorePerForm!=null){
var flagForm = document.getElementById("flagSalvaDatiCartaForm");
if(flagForm!=null){
flagForm.value=(valorePerForm);
}
}
}
var valoreFlag2 = document.getElementById("flagSalvaDatiCartaSoloCliente");
if(valoreFlag2!=null){
var valorePerForm=valoreFlag2.value;
if(valorePerForm!=null){
var flagForm = document.getElementById("flagSalvaDatiCartaSoloClienteForm");
if(flagForm!=null){
flagForm.value=(valorePerForm);
}
}
}
var partecipaValutazioneForm = document.getElementById("partecipaValutazioneForm");
var partecipaValutazione = document.getElementById("partecipaValutazione");
if(partecipaValutazione != null && partecipaValutazioneForm != null){
partecipaValutazioneForm.checked = partecipaValutazione.checked;
}
var areServletPagamentoSecondarieInput = document.getElementById("areServletPagamentoSecondarie");
if (areServletPagamentoSecondarie != undefined && areServletPagamentoSecondarie == true && areServletPagamentoSecondarieInput != null && areServletPagamentoSecondarieInput != undefined){
document.getElementById("areServletPagamentoSecondarie").value = 'true';
}
realjq(".btn.btn-procedi.btn-acquista").addClass("disabled");
realjq(".btn.btn-procedi.btn-acquista").prop('disabled', true);
realjq(".btn.btn-procedi.btn-acquista").attr('disabled', true);
formInoltro.submit();
}
})
}
}
}
return false;
}
function vaiAUrl(url){
try{
if(url){
document.location.href=(url);
}
}catch(e){
console.log("URL errato")
}
}