let removedIdPurchase = null;
let urlTokenParameters = null;
initializeCountriesLang(idioma);
$(document).foundation({
reveal: {
close_on_background_click: true,
close_on_esc: true
}
});
dayjs.extend(dayjs_plugin_localeData);
dayjs.extend(dayjs_plugin_timezone);
dayjs.extend(dayjs_plugin_updateLocale);
dayjs.extend(dayjs_plugin_localizedFormat);
dayjs.extend(dayjs_plugin_utc);
dayjs.extend(dayjs_plugin_weekOfYear);
dayjs.extend(dayjs_plugin_weekYear);
dayjs.extend(dayjs_plugin_customParseFormat);
dayjs.extend(dayjs_plugin_duration);
dayjs.extend(dayjs_plugin_isoWeek);
if (idioma == 'in_ID')
{
dayjs.locale('id');
}
else if(idioma == 'da_DK')
{
dayjs.locale('da');
}
else
{
dayjs.locale(idioma.replace("_", "-").toLowerCase());
}
//Funciones para redimendionar cuerpo y establecer pie
$(document).ready(function()
{
try
{
// Textos legales
$("#divContenidoPoliticaCookies").html(PoliticaCookies);
$("#divContenidoCondicionesLegales").html(CondicionesLegales);
$("#divContenidoPoliticaPrivacidad").html(PoliticaPrivacidad);
}
catch (err)
{
}
let p4Timezone = localStorage.getItem('timezone');
if (p4Timezone == null)
{
p4Timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
}
if (userTimezone == null || userTimezone == "" || userTimezone != p4Timezone)
{
EntradasAjax.changeUserTimezone(p4Timezone, (storedTimezone) => localStorage.setItem('timezone', storedTimezone) );
}
asignarAltura();
inicializarCarrito();
let defaultGAaccount = CONFIG_GA4[0];
if (defaultGAaccount.value != null && defaultGAaccount.value != "")
{
gtag('get', defaultGAaccount.value, 'client_id', function(clientId){dataLayerP4.guestId = clientId})
}
if( typeof customCompanyScript === 'function' )
{
customCompanyScript();
}
initializeLanguageSelector();
initializeCurrencySelector();
$('.alert-box a.close').on("click", function(){
$(this).parent().hide();
});
buildTokenParametersForUrl();
});
$(window).on("resize", function()
{
//asignarAltura();
});
function asignarAltura()
{
asignarAlturaCuerpo(0);
}
var diffTimeClientServer = new Date().getTime() - tServer;
if (Math.abs(diffTimeClientServer) < 60000)
{
diffTimeClientServer = 0;
}
function getDateCorrectedServer()
{
if (diffTimeClientServer == 0)
{
return new Date();
}
return new Date(new Date().getTime() - diffTimeClientServer);
}
/**
* Establece el evento en los cambios de idioma, para componer la url con el nuevo idioma y recargar la página
*/
function initializeLanguageSelector()
{
//footer
$(".ctrl-change-lng").each(function() {
var url = window.location.href;
var str_url_post = url.substring(url.lastIndexOf("/")+1, url.length);
if (dataLayerP4.action == "purchase" || dataLayerP4.action == "checkout")
{
var bookingNumberSetted = $("#localizador").val();
if(bookingNumberSetted && bookingNumberSetted != "" && str_url_post.indexOf("localizador=") < 0)
{
if(str_url_post.indexOf("?") >= 0)
{
str_url_post = str_url_post.replace("?", "?localizador="+bookingNumberSetted+"&");
}
else
{
str_url_post += "?localizador=" + bookingNumberSetted;
}
}
}
//data-value para el onChange
$(this).parent().attr('data-value', $(this).attr('href')+""+str_url_post);
$(this).attr('href', $(this).attr('href')+""+str_url_post);
});
$('#language-selector').dropdown({
on: 'click',
onChange: function(val) {
window.location.href = val;
}
});
}
var first_load_currency = false;
function initializeCurrencySelector()
{
$('#currency-selector').dropdown({
on: 'click',
onChange: function(val) {
if(finalCurrency != null && finalCurrency != val && first_load_currency == false){
changeCurrency(val);
setTimeout(function(){
var title = $("#tooltip-currency-info.tooltip").html();
swal({
title: '',
type: 'info',
html:title,
showCloseButton: true,
showCancelButton: false,
focusConfirm: true,
confirmButtonText:
polyglot.t("OK"),
confirmButtonAriaLabel: 'Ok',
});
}, 500);
}
if(first_load_currency)
{
first_load_currency = false;
}
}
});
if (localStorage.currency && localStorage.currency != baseCurrency)
{
first_load_currency = true;
$('#currency-selector').dropdown('set selected', localStorage.currency);
changeCurrency(localStorage.currency);
}
}
function asignarAlturaCuerpo(indiceNegativo)
{
var h_window = $(window).height();
var h_footer = $("footer").outerHeight();
var h_header_dummy = $("#header-dummy").outerHeight();
var h_header = 0;
if($("#header-desktop").is(':visible'))
{
h_header = $("#header-desktop").outerHeight();
}
else if($("#header-mobile").is(':visible'))
{ h_header = $("#header-mobile").outerHeight();
}
var h_rest = h_header + h_footer;
var h_final = h_window - h_rest;
if(iframeMode == false){
$("#cont-body-element-global").css("min-height", h_final + "px");
}
}
function asignarAlturaContenido(indiceNegativo)
{
var alturaPantalla = $(window).height();
var alturaPie = $(".footer").height();
var alturaCabecera = $("#cabecera").height();
var alturaContenedor = 0;
var alturaRestable = alturaCabecera + alturaPie;
alturaContenedor = (alturaPantalla - alturaRestable);
$(".cuerpoSeccion").css("min-height", (alturaContenedor + em(1.8)) + "px");
}
function px(input)
{
var emSize = parseFloat($("body").css("font-size"));
return (input / emSize);
}
function em(input)
{
var emSize = parseFloat($("body").css("font-size"));
return (emSize * input);
}
$(function() {
if(iframeSeamless == null || iframeSeamless == false)
{
/*funcionalidad carrito movil*/
if( $(".barra-carrito-tiempo").length )
{
var top = $('.barra-carrito-tiempo').offset().top - parseFloat($('.barra-carrito-tiempo').css('marginTop').replace(/auto/, 0));
if($('.footer-mobile').length > 0 )
{
var footTop = $('.footer-mobile').offset().top - parseFloat($('.footer-mobile').css('marginTop').replace(/auto/, 0));
}
else
{
var footTop = 0;
}
var maxY = footTop - $('.barra-carrito-tiempo').outerHeight();
$(window).scroll(function(evt){
if(arrayVentasEnCarrito != null && arrayVentasEnCarrito.length > 0){
var y = $(this).scrollTop();
if(y > top)
{
if(y < maxY)
{
$('.barra-carrito-tiempo').addClass('fixed').removeAttr('style');
}
else
{
$('.barra-carrito-tiempo').removeClass('fixed').css({
position: 'absolute',
top: (maxY - top) + 'px'
});
}
}
else
{
$('.barra-carrito-tiempo').removeClass('fixed');
}
}
});
/*FIN funcionalidad carrito movil*/
}
}
});
function objTiempoArray(id, fecha){
this.id = id;
this.fecha = fecha;
}
var arrayTiemposVenta = new Array();
var salesInTimeCounter = new Array();
function inicializarCarrito()
{
//clearing
$("#dropdownCarrito").hide();
$("#icono-carrito-movil").hide();
$("#listaVentasCarritoWidget").html("");
//Si hay numVentaFinalizadaCompra ==> el flujo está en la página de confirmacion de venta o reserva y por tanto no debera aparecer el carrito si tiene ese producto.
//en ese caso se reescribe el array arrayVentasEncarrito sustituyendo el anterior sin la venta que acaba de ser confirmada.
if(numVentaFinalizadaCompra != null)
{
var arrayVentasEnCarritoTemp = new Array();
for(let u in arrayVentasEnCarrito)
{
var objVenta = arrayVentasEnCarrito[u];
if(objVenta.idVenta != numVentaFinalizadaCompra)
{
arrayVentasEnCarritoTemp.push(objVenta);
}
}
arrayVentasEnCarrito = arrayVentasEnCarritoTemp;
}
var enPago = false;
if ((typeof selecionandoPago !== "undefined") && selecionandoPago)
{
enPago = true;
}
arrayTiemposVenta = new Array();
var codigoCarrito = "";
var codigoPagarTodo = "";
var filteredCart = [];
if(arrayVentasEnCarrito != null && arrayVentasEnCarrito.length > 0)
{
for(let i = 0; i < arrayVentasEnCarrito.length; i++)
{
let venta = arrayVentasEnCarrito[i];
if(venta.importePagado == 0)
{
filteredCart.push(venta);
}
}
}
if(filteredCart != null && filteredCart.length > 0)
{
codigoCarrito += '
';
codigoPagarTodo += '
';
var id_venta_ant = null;
var visiblePayallButton = true;
var a;
for(a in filteredCart)
{
var objventa = filteredCart[a];
//Si el anterior objventa == null || este id_venta es distinto del id_venta anterior
if(id_venta_ant == null || (id_venta_ant != null && objventa.idVenta != id_venta_ant.idVenta))
{
var codigoObjetoVentaCarrito = '';
var codigoProductosVenta = '';
var importeProductosVenta = '';
if (objventa.idGroupPromotion != null)
{
visiblePayallButton = false;
}
if (objventa.numTarjetaFidelizacion != null && objventa.numTarjetaFidelizacion.length > 0)
{
shoppinCartEnabled = false;
}
var detalle_ant = null;
var arrayDetalles = filterDetailWithPromoGitf(objventa.detalle);
var e;
var hideTotalPrice = false;
if (arrayDetalles.length > 0)
{
for(e in arrayDetalles)
{
var objDetalle = arrayDetalles[e];
var horaFin = objDetalle.fechaLiberacionReservaMillis;
if (objDetalle.esAbono)
{
shoppinCartEnabled = false;
}
if (!hideTotalPrice && (objDetalle.esAbono || objDetalle.esEntradaAbono))
{
hideTotalPrice = true;
}
//If minHiddenInTimePurchase != null then substract time to end time
if(minHiddenInTimePurchase != null && minHiddenInTimePurchase != "")
{
var minutesSubstract = parseInt(minHiddenInTimePurchase) * 60000;
horaFin = horaFin - minutesSubstract;
}
var tiempo = new objTiempoArray(objventa.idVenta, horaFin);
arrayTiemposVenta.push(tiempo);
//establece un contador para desktop y si solo hay una venta y está en el flujo de compra tambien para movil
CountDownTimer(horaFin, objventa.idVenta);
//Is expired
var now = getDateCorrectedServer();
var distance = horaFin - now.getTime();
if(distance >= 0)
{
//if it is not caducated and this event it is not included in array then push in array
if(salesInTimeCounter.indexOf(objventa.idVenta) == -1)
{
salesInTimeCounter.push(objventa.idVenta);
}
}
//si es el primero generamos cabecera o es el mismo id_venta que el anterior y distinto evento
if(e == 0 || (detalle_ant != null && objDetalle.idVenta == detalle_ant.idVenta && objDetalle.idEvento != detalle_ant.idEvento))
{
if(e > 0)
{
codigoObjetoVentaCarrito += '
';
codigoProductosVenta = '';
importeProductosVenta = 0;
if(detalle_next != null)
{
//codigoObjetoVentaCarrito += '';
}
}
detalle_ant = objDetalle;
}
//si este object venta es abono y hay uno siguiente que tambien lo es ==> no se pinta el resumen
// o este id_venta y el siguiente son iguales
codigoObjetoVentaCarrito += '
';
//Se añade el codigo al widget carrito desktop
$("#listaVentasCarritoWidget").html(codigoCarrito);
if (enPago && salesInTimeCounter != null && salesInTimeCounter.length >= 2)
{
$("#listaVentasCarritoWidget").html(codigoPagarTodo);
$("#alternativePaymentButton").html(codigoPagarTodo);
}
//BUSQUEDA DE RELOJ PARA WIDGET DESKTOP
var tiempoBuscado = null;
//Si se encuentra en un flujo de compra se muestra ese.
if(numVentaProcesoDeCompra != null)
{
if(arrayTiemposVenta != null && arrayTiemposVenta.length > 1)
{
for(var i = 0; i < arrayTiemposVenta.length; i++)
{
if(numVentaProcesoDeCompra == arrayTiemposVenta[i].id)
{
tiempoBuscado = arrayTiemposVenta[i];
}
}
}
else
{
tiempoBuscado = arrayTiemposVenta[0];
}
}
else
{
//Si no se encuentra en ningun flujo de compra se busca el que caducará antes
if(arrayTiemposVenta != null && arrayTiemposVenta.length > 1)
{
arrayTiemposVenta.sort(function(a,b){
return new Date(a.fecha) - new Date(b.fecha);
});
}
tiempoBuscado = arrayTiemposVenta[0];
}
//Se establece la cuenta atrás en el reloj del widget desktop
if(tiempoBuscado != null)
{
CountDownTimer(tiempoBuscado.fecha, null);
}
//mostramos carrito desktop
setTimeout(function(){$("#dropdownCarrito").show()}, 100);
/////////////////////
// movil ///
/////////////////////
//Si estamos en el flujo de compra mostramos el contador,
//y en todo caso mostraremos el icono de carrito con el número de productos y acceso a la página carrito
if(arrayVentasEnCarrito!= null && arrayVentasEnCarrito.length > 0)
{
$("#icono-carrito-movil").show();
}
else
{
$("#icono-carrito-movil").hide();
}
//Si estamos en flujo de compra mostramos barra con contador y establecemos id a objeto reloj movil
if(numVentaProcesoDeCompra != null){
$(".contador-carrito-mobile").attr("id","contador-info-desplegable-movil-"+numVentaProcesoDeCompra);
//mostramos reloj movil
setTimeout(function(){$("#carrito-contenedor-movil").show()}, 100);
}
/////////////////////
/// fin movil ///
/////////////////////
}
else
{
var codigo = '
'+
'
'+polyglot.t("No_products_in_the_cart")+'
'+
'
';
$("#listaProductosCarrito").html(codigo);
}
}
var countItemsArray = new Array();
function addCountItem(item)
{
countItemsArray.push(item);
}
function clearCountItemsArray()
{
for(var t= 0; t < countItemsArray.length; t++)
{
clearInterval(countItemsArray[t]);
}
countItemsArray = new Array();
}
function generarCabeceraProductoCarrito(idventa, idEmpresa, idRecinto, idEvento, litEvento){
var urlImagen = "img_web/"+ idEmpresa +"/"+ idRecinto +"/"+ idEvento +"/s_banner.jpg";
var codigo = "
";
return codigo;
}
var mostrarDialogoTiempo = true;
function CountDownTimer(end, id_elem)
{
var _second = 1000;
var _minute = _second * 60;
var _hour = _minute * 60;
var _day = _hour * 24;
var timer;
function showRemaining(id_elem)
{
var now = getDateCorrectedServer();
var distance = end - now.getTime();
if (distance < 120000 && distance > 0)
{
protoAnimarVibracion(id_elem, false);
}
else if (distance < 0)
{
protoAnimarVibracion(id_elem, true);
// si está en la página de pago mostrar mensaje de error y redireccionar a la página de compra o definir lógica.
// si está en otro proceso de compra de otra compra mostrar mensaje de información de perdida de la reserva y ocultar carrito.
protoTiempoAgotado(id_elem);
return;
}
var days = Math.floor(distance / _day);
var hours = Math.floor((distance % _day) / _hour);
var minutes = Math.floor((distance % _hour) / _minute);
var seconds = Math.floor((distance % _minute) / _second);
if (seconds < 10)
{
seconds = "0" + seconds;
}
if (id_elem != null)
{
// desktop
$('#contador-info-desplegable-' + id_elem).html(minutes + ':' + seconds);
// movil
$('#contador-info-desplegable-movil-' + id_elem).html(minutes + ':' + seconds);
// cart page
$('#timeleft-cart-page-' + id_elem).html(minutes + ':' + seconds);
}
else
{
// contador del widget desktop
$('#temporizador-compra').html(minutes + ':' + seconds);
}
}
timer = setInterval(function() { showRemaining(id_elem) }, 1000);
addCountItem(timer);
}
var vibracionesIniciadas = new Array();
var vibracionesParadas = new Array();
function protoAnimarVibracion(id, acabado)
{
if(id != null)
{
if(acabado == false)
{
var existe = false;
//Si no se ha iniciado
if(vibracionesIniciadas.length > 0)
{
for(var a = 0; a < vibracionesIniciadas.length; a++)
{
if(vibracionesIniciadas[a] == id)
{
existe = true;
}
}
}
if(existe == false)
{
vibracionesIniciadas.push(id);
$("#obj-carrito-cabecera").addClass("animated pulse infinite");
}
}
else
{
//quitamos animacion
$("#obj-carrito-cabecera").removeClass("pulse infinite");
//buscamos si ya ha vibrado el aviso
var animacionEjecutada = localStorage.getItem('venta_caducada_aviso-'+id);
if(animacionEjecutada != null && animacionEjecutada != true)
{
localStorage.setItem('venta_caducada_aviso-'+id, true);
//Si está en flujo de compra no vibrar si no es la compra actual
if(numVentaProcesoDeCompra != null)
{
if(numVentaProcesoDeCompra == id)
{
$("#obj-carrito-cabecera").addClass("shake animated").one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',
function() {
setTimeout(function(){
$("#obj-carrito-cabecera").removeClass("shake animated");
}, 1000)
});
}
}
}
}
}
}
var alarmasParadas = new Array();
var alarmaParadaMovil = false;
function protoTiempoAgotado(id)
{
if (id != null)
{
var existe = false;
if (alarmasParadas.length > 0)
{
for(var a = 0; a < alarmasParadas.length; a++)
{
if(alarmasParadas[a] == id)
{
existe = true;
}
}
}
if(!existe)
{
alarmasParadas.push(id);
tiempoAgotado(id);
}
}
else
{
//movil
if(!alarmaParadaMovil)
{
alarmaParadaMovil = true;
tiempoAgotado(null);
}
}
}
function tiempoAgotado(id)
{
if(id != null)
{
//evaluamos si tiene mas de un proceso de compra en el carrito
//si es que sí ==> evaluamos si se encuentra en pleno proceso de compra o ha iniciado otro
//si es que no ==> mostramos mensaje bloqueante para que empieze el proceso de compra desde el principio
//Evaluamos si se encuentra en el proceso de compra caducado
//Si es así bloqueamos y enviamos al usuario al inicio del proceso de compra
//Si la variable numVentaProcesoCompra el usuario se encuentra en la página de compra de productos, en la de login/registro o en el pago
if(numVentaProcesoDeCompra != null)
{
//evaluamos que el contador que ha terminado tiene el mismo id_venta que el del proceso de compra en el cual nos encontramos
//en cuyo caso lanzamos a la pagina de compra al usuario
if(numVentaProcesoDeCompra == id)
{
lanzarDialogoCompraCaducada(id, true);
}
else
{
//Se ha caducado una venta del carrito diferente al proceso de compra en el que nos encontramos
//mostrar mensaje en pantalla y desactivar los productos del carrito
//Cart header
$(".lista-productos-venta-"+id).css("opacity","0.5");
$("#precio-total-productos-venta-"+id).css("opacity","0.5");
$("#acciones-productos-venta-"+id).html(polyglot.t("Booking_expired"));
$("#btn-venta-carrito-"+id).html(polyglot.t("Start"));
$("#contenedor-contador-productos-"+id).css("opacity","0.5");
$("#btn-venta-carrito-"+id).attr('onclick', "relanzarProcesoCompra('" +id + "')");
//Cart page
$("#total-price-cart-"+id).css("opacity","0.5");
$("#btn-call-action-cart-"+id).html(polyglot.t("Start"));
$("#timeleft-sale-cart-"+id).html(polyglot.t("Booking_expired"));
//remove this SaleId of the array "salesInTimeCounter"
decrementSaleForPayAll(id);
}
}
else
{
//El usuario no se encuentra en una pagina del proceso de compra desde la que debamos expulsarle
//Evaluamos si hay mas de un proceso de compra y si es así avisamos y desactivamos en el carrito esa venta
if(arrayVentasEnCarrito != null && arrayVentasEnCarrito.length >= 1)
{
//Se ha caducado una venta del carrito diferente al proceso de compra en el que nos encontramos
//mostrar mensaje en pantalla y desactivar los productos del carrito
if (arrayVentasEnCarrito.length > 1)
{
removeOfCart(id);
$("#lista-separador-venta-"+id).hide();
$(".lista-productos-venta-"+id).hide();
$("#precio-total-productos-venta-"+id).hide();
$("#btns-action-venta-"+id).hide();
$("#contenedor-contador-productos-"+id).hide();
$("#lista-cabecera-venta-"+id).hide();
}
else
{
//Cart header
$(".lista-productos-venta-"+id).css("opacity","0.5");
$("#precio-total-productos-venta-"+id).css("opacity","0.5");
$("#acciones-productos-venta-"+id).html(polyglot.t("Booking_expired"));
$("#btn-venta-carrito-"+id).html(polyglot.t("Start"));
$("#contenedor-contador-productos-"+id).css("opacity","0.5");
$("#btn-venta-carrito-"+id).attr('onclick', "relanzarProcesoCompra('" +id + "')");
//Cart page
$("#total-price-cart-"+id).css("opacity","0.5");
$("#btn-call-action-cart-"+id).html(polyglot.t("Start"));
$("#timeleft-sale-cart-"+id).html(polyglot.t("Booking_expired"));
lanzarDialogoCompraCaducada(id, false);
//remove this SaleId of the array "salesInTimeCounter"
decrementSaleForPayAll(id);
}
}
}
//inicializamos un nuevo contador principal, para ello obtenenos la siguiente compra cuya caducidad sea la mas proxima
var arrayTiemposVentaTemp = new Array();
for(var e=0; e= 1){
arrayTiemposVenta.sort(function(a,b){
return new Date(a.fecha) - new Date(b.fecha);
});
var tiempoMenor = arrayTiemposVenta[0];
var horaFin = tiempoMenor.fecha;
if(minHiddenInTimePurchase != null && minHiddenInTimePurchase != "")
{
var minutesSubstract = parseInt(minHiddenInTimePurchase) * 60000;
horaFin = horaFin - minutesSubstract;
}
//establecemos el contador de la barra menu con la siguiente venta
CountDownTimer(horaFin, null);
}
}
else //movil
{
//Si se encuentra en flujo de compra movil ==> mostrar alert para volver a iniciar la compra
//si no, mostrar alert informando de que la compra del carrito ha caducado
lanzarDialogoCompraCaducada(id, numVentaProcesoDeCompra != null);
}
}
function decrementSaleForPayAll(id)
{
if(salesInTimeCounter.indexOf(id) > -1)
{
//remove
var index = salesInTimeCounter.indexOf(id);
if (index > -1) {
salesInTimeCounter.splice(index, 1);
}
//have 2 or more elements?
if(salesInTimeCounter.length < 2)
{
$("#button-pay-all-wrapper").hide();
}
}
}
function lanzarDialogoCompraCaducada(idCompra, bloquear)
{
var avisar = true;
//si no hay idCompra porque se trata del contador movil: lo buscamos según lógica
if(idCompra == undefined || idCompra == null)
{
//Si hay numVentaProcesoDeCompra y idCompra es null ==> se encuentra en el proceso de compra movil
if(numVentaProcesoDeCompra != null)
{
var objventa = arrayVentasEnCarrito[0];
idCompra = objventa.idVenta;
avisar = true;
}
else
{
//Si se encuentra fuera del flujo de compra no avisamos al usuario.
avisar = false;
//TODO si hay solo una venta en el carrito lo ocultamos
}
}
if(avisar)
{
var seLanzoMsg = localStorage.getItem('msgCompraCaducada'+idCompra);
if(seLanzoMsg != undefined && seLanzoMsg != null && seLanzoMsg == "true")
{
}
else
{
localStorage.setItem('msgCompraCaducada'+idCompra, 'true');
//TODO cambiar y mejorar el comportamiento. Estamos evitando mostrar el mensaje si hay una pasarela de pago en ventana modal
if(modalSaleInitiated != null && modalSaleInitiated)
{
// verificar si se ha completado el pago ya y si no mostrar alert de tiempo caducado
}
else
{
if(bloquear)
{
swal({
title: polyglot.t("cart.Time_out"),
text: polyglot.t("cart.Exceeded_max_time_description"),
type: 'info',
showCancelButton: false,
confirmButtonColor: '#3085d6',
allowOutsideClick: false,
confirmButtonText: polyglot.t("Accept")
}).then(function(isConfirm) {
if (isConfirm) {
//TODO borrar idVenta de las ventas temporales del usuario
relanzarProcesoCompra(idCompra);
}
});
gtmTrackEvent("popup_time_out");
}
else
{
swal(polyglot.t("cart.One_items_has_expired"));
}
}
}
}
}
function relanzarProcesoCompra(id)
{
var idEvento = null;
//Si id == null es un contador movil, en ese caso obtenemos el primero según lógica
if(id == null)
{
var objVenta = arrayVentasEnCarrito[0];
var detalle = objVenta.detalle[0];
idEvento = detalle.idEvento;
}
else
{
//obtengo el id evento de la venta
for(let a in arrayVentasEnCarrito){
var objVenta = arrayVentasEnCarrito[a];
var detalle = objVenta.detalle[0];
if(objVenta.idVenta == id){
idEvento = detalle.idEvento
break;
}
}
}
var formAction = $("#formProcesoCompra").attr('action');
//$('#formProcesoCompra').attr('action', formAction+"?idEvento="+idEvento);
//$("#idEventoForm").val(idEvento);
//$("#formProcesoCompra").submit();
var strIframeParams = "";
//Iframe?
if(iframeMode != null && iframeMode == true)
{
strIframeParams += "&iframe_mode=true";
if(iframeAutoHeight != null)
{
strIframeParams += "&auto_height=" + iframeAutoHeight;
}
if(iframeMaxHeight != null)
{
strIframeParams += "&max_height=" + iframeMaxHeight;
}
if(iframeSeamless != null)
{
strIframeParams += "&seamless=" + iframeSeamless;
}
if(iframeSelectTicketMode != undefined)
{
strIframeParams += "&only_buy=" + iframeSelectTicketMode;
}
if(iframeTargetBlankCTA != undefined)
{
strIframeParams += "&target_blank_cta=" + iframeTargetBlankCTA;
}
if(iframeVisualMode != null)
{
strIframeParams += "&iframe_visual_mode=" + iframeVisualMode;
}
if(iframeHeightParent != undefined)
{
strIframeParams += "&height_parent=" + iframeHeightParent;
}
strIframeParams += "&childId=palco_widget_iframe_tag";
strIframeParams += "&parentUrl=" + formAction+"?idEvento="+idEvento;
}
var strUrlFormer = "?"
if(formAction.indexOf("?") !== -1)
{
strUrlFormer = "&";
}
window.location = formAction+""+strUrlFormer+"idEvento="+idEvento + strIframeParams;
}
function payPurchase(localizador)
{
if (localizador != null)
{
$.cookie("purchase_id", localizador, { expires: 1/144, path: pathCookies, domain: dominioCookies });
$("#localizador").val(localizador);
$("#pay_booking_reference").val(localizador);
EntradasAjax.getPrepaymentSurveyIdFromPurchaseRef(localizador, paySaleRedirection);
}
}
function paySaleRedirection(surveyId)
{
if(originalRequest != null && originalRequest.length > 0)
{
$('#checkoutForm').attr('action', decodeURI(originalRequest.replace(/&/g, "&")));
}
else
{
if (surveyId != null)
{
$('#checkoutForm').attr('action', 'survey?surveyId=' + surveyId + "&whereIsShown=1");
}
}
$("#checkoutForm").submit();
}
function pagarCompraRedirection(surveyId)
{
if (surveyId != null)
{
$('#formAddToCart').attr('action', 'survey?surveyId=' + surveyId + "&whereIsShown=1");
}
$("#formAddToCart").submit();
}
/**
* Genera el html del formulario para pedir datos extra de la transacción.
* @param detalle Lista de detalles de la compra
* @param recogerTitularNif Indica si hay que recoger el NIF del titular de cada entrada
* @param recogerTitularNombre Indica si hay que recoger en nombre y apellidos del titular de cada entrada
* @param preguntaDato1
* @param preguntaDato2
* @returns Código html
*/
function generaFormularioDatosExtra(detalle, recogerTitularNif, recogerTitularNombre, preguntaDato1, preguntaDato2, questionDataType1, questionDataType2)
{
var htmlDatosAdicionales = "";
var p = 1;
for (var i=0; i 1)
htmlDatosAdicionales += "";
htmlDatosAdicionales += "