`;
}
$('#pci_results').html(html);
$('#modalPCI').modal('hide');
}
// If you encode the message in JSON before sending them,
// then decode here
// const decoded = JSON.parse(data);
});
}
window.AA_CONFIG = {
animationLength: 1500,
easingFunction: 'easeOutCirc',
readyEvent: 'aa-ready',
scrollOffset: 400
};
$(function(){
$(this).trigger(window.AA_CONFIG.readyEvent);
if (strCmd != '') {
$.notify({
icon: "ti-check",
message: strCmd
}, {
type: "success",
placement: {
from: "bottom",
align: "center"
},
allow_dismiss: false,
newest_on_top: true,
delay: 5000,
icon_type: "class",
template: `
`
});
}
$('.selectpicker').selectpicker();
$('.buttonRiepilogoPrenotazione').click(function() {
const timestamp = getCustomTimestamp();
var idriga = $(this).data('idriga') ?? '';
const xParams = "action=get_condizioni"
+ "&cart=" + idriga
+ "&type=" + getConParamType
+ "&key=" + getConParamKey
+ "&lang_current=" + LANG_CURRENT;
var data;
$.ajax({
type: "POST",
async: true,
dataType: "json",
url: getTPLUrl + "assets/ajax/get_condizioni.php?v=" + timestamp,
data: xParams,
success: function(data) {
if (data.status == 'ok') {
$.simpleDialog({
modalContent: `
${data.html_riepilogo_con_totale}
`,
confirmBtnText: LNG_CHIUDI,
closeButton: false
});
} else {
swal("Oops!", LNG_QUALCOSA_STORTO, "error");
}
},
error: function(data) {
swal("Oops!", LNG_QUALCOSA_STORTO, "error");
}
});
});
$('#pci_button').click(function() {
pciAddCart();
});
$("#completa-ordine").click(function() {
if (parseInt($('#ordine_acquistabile').val() ?? 0) > 0) {
if(fCheckObbligatori()) {
if (countVillages > 1 || countGrimaldi > 1) {
swal({
title: "Oops!",
text: LNG_PACCHETTO_ALLA_VOLTA,
imageUrl: getTPLImmaginiUrl + "sorry-male.png",
confirmButtonText: "Ok",
closeOnConfirm: true
});
} else if (countGrimaldi == 1) {
$('.quoteStep').addClass('hide');
$('#labelCartComplete, #modalCartComplete .modal-loader-grimaldi, #labelCartCompleteVerifica, #logoBoxGrimaldi').removeClass('hide');
$('#modalCartComplete').modal('show');
const xParams = "action=firstCheck"
+ "&cart=" + grimaldiCart
+ "&langCurrent=" + LANG_CURRENT;
const timestamp = getCustomTimestamp();
$.ajax({
type: "POST",
async: true,
dataType: "json",
url: getTPLUrl + "assets/ajax/grimaldiProgress.php?v=" + timestamp,
data: xParams,
success: function(data) {
if (data.status == 'done') {
if (countVillages == 1) {
// Option Grimaldi già creata
$('.quoteStep').addClass('hide');
$('#modalCartComplete .modal-loader-grimaldi, #logoBoxGrimaldi').addClass('hide');
$('#labelCartComplete').text('').removeClass('hide');
$('#modalCartComplete .modal-loader, #labelCartCompleteVerifica, #logoBoxNicolaus').removeClass('hide');
$('#modalCartComplete').modal('show');
const xParams = "action=firstCheck"
+ "&id=" + villageID
+ "&code=" + villageCode
+ "&cart=" + villageCart
+ "&langCurrent=" + LANG_CURRENT;
const timestamp = getCustomTimestamp();
$.ajax({
type: "POST",
async: true,
dataType: "json",
url: getTPLUrl + "assets/ajax/nicolausProgress.php?v=" + timestamp,
data: xParams,
success: function(data) {
if (data.status == 'ok') {
/*if (data.rq && parseInt(data.rq) > 0) {
swal({
title: LNG_SWEET_ATTENZIONE,
text: "Almeno uno dei servizi di questo preventivo è ON REQUEST: disponibilità soggetta a riconferma da parte del fornitore. Procedendo con l'ordine effettui una Richiesta Impegnativa a seguito della quale Valtur verificherà tale disponibilità ed eventualmente procederà con la conferma.",
confirmButtonText: "Ok",
closeOnConfirm: true
});
}*/
$('#modalCartComplete .modal-loader').addClass('hide');
stepCall('extra');
} else {
$('#modalCartComplete').modal('hide');
}
},
error: function(data) {
swal("Oops!", LNG_QUALCOSA_STORTO, "error");
$('#modalCartComplete').modal('hide');
}
});
} else {
fSaveData();
}
} else if (true || data.status == 'ok') {
stepCallGrimaldi('guests');
$('#modalCartComplete .modal-loader-grimaldi').addClass('hide');
} else if (data.status == 'token_off') {
$('#modalCartComplete').modal('hide');
swal({
title: "Oops!",
text: LNG_PRENOTAZIONE_NON_DISPONIBILE,
imageUrl: getTPLImmaginiUrl + "sorry-male.png",
confirmButtonText: "Ok",
closeOnConfirm: true
});
} else if (data.status == 'error') {
$('#modalCartComplete').modal('hide');
swal({
title: "Oops!",
text: LNG_STORTO_RIPROVA,
imageUrl: getTPLImmaginiUrl + "sorry-male.png",
confirmButtonText: "Ok",
closeOnConfirm: true
});
} else {
$('#modalCartComplete').modal('hide');
}
},
error: function(data) {
swal("Oops!", LNG_QUALCOSA_STORTO, "error");
$('#modalCartComplete').modal('hide');
}
});
} else if (countVillages == 1) {
$('.quoteStep').addClass('hide');
$('#labelCartComplete').text('').removeClass('hide');
$('#modalCartComplete .modal-loader, #labelCartCompleteVerifica, #logoBoxNicolaus').removeClass('hide');
$('#modalCartComplete').modal('show');
const xParams = "action=firstCheck"
+ "&id=" + villageID
+ "&code=" + villageCode
+ "&cart=" + villageCart
+ "&langCurrent=" + LANG_CURRENT;
const timestamp = getCustomTimestamp();
$.ajax({
type: "POST",
async: true,
dataType: "json",
url: getTPLUrl + "assets/ajax/nicolausProgress.php?v=" + timestamp,
data: xParams,
success: function(data) {
if (data.status == 'ok') {
/*if (data.rq && parseInt(data.rq) > 0) {
swal({
title: LNG_SWEET_ATTENZIONE,
text: "Almeno uno dei servizi di questo preventivo è ON REQUEST: disponibilità soggetta a riconferma da parte del fornitore. Procedendo con l'ordine effettui una Richiesta Impegnativa a seguito della quale Valtur verificherà tale disponibilità ed eventualmente procederà con la conferma.",
confirmButtonText: "Ok",
closeOnConfirm: true
});
}*/
$('#modalCartComplete .modal-loader').addClass('hide');
stepCall('extra');
} else {
$('#modalCartComplete').modal('hide');
}
},
error: function(data) {
swal("Oops!", LNG_QUALCOSA_STORTO, "error");
$('#modalCartComplete').modal('hide');
}
});
} else {
fSaveData();
}
}
} else {
swal(LNG_SWEET_ATTENZIONE, LNG_CARRELLO_ORDINENONDISPONIBILE, "error");
}
});
$('#txtEmail').change(function()
{
$('.loader-txtEmail').removeClass('hide');
$('#lbltxtEmail-login').addClass('hide');
$('#lbltxtEmail, #lbltxtEmail-login').html('');
$(".fg-txtEmail").removeClass("has-error");
if ($(this).val() && $(this).val() != '')
{
const xParams = "action=checkEmailCarrello"
+ "&pstrEmail=" + $('#txtEmail').val();
window.requestAnimationFrame(() => {
$.ajax({
type: "POST",
async: true,
dataType: "json",
url: getTPLUrl + "assets/ajax/checkContatto.php",
data: xParams,
success: function(data) {
if (data.email_check == 0)
{
// Email non corretta
if (data.email_errore == 2)
{
// ERRORE : email NON esiste
$('#lbltxtEmail').html(fHTMLErrore(LNG_FORM_EMAILNONESISTE));
$(".fg-txtEmail").addClass("has-error");
}
else if (data.email_errore == 1)
{
// ERRORE : email NON corretta
$('#lbltxtEmail').html(fHTMLErrore(LNG_FORM_EMAILNONCORRETTA));
$(".fg-txtEmail").addClass("has-error");
}
}
else if ($('#id_cliente').val() == '')
{
// Email corretta
if (data.email_exists == 1)
{
// AVVISO : email già in archivio
let text1 = LNG_CIAO_EMAIL_GIA_ISCRITTA;
text1 = text1.replace(`{name}`, `