JEMBOT MAWOT Bypass Shell
{*
*
* Sell Tickets module for Prestashop by Avellana Digital
*
* @author Avellana Digital SL
* @copyright Copyright (c) 2019 Avellana Digital - www.avellanadigital.com
* @license Commercial license
* @version 4.0.0
*}
<!-- selltickets -->
{if $tickets_customer}
{literal}
<script type="text/javascript">
var seti_lang = {
seatsselected : "{/literal}{l s='Seats selected' mod='selltickets'}{literal}",
selectseatsbefore : "{/literal}{l s='You must select your seats before saving' mod='selltickets'}{literal}",
unknownerrorseats : "{/literal}{l s='Unknown error saving your seat' mod='selltickets'}{literal}",
cannotcontinue : "{/literal}{l s='Error: You cannot continue without tickets info' mod='selltickets'}{literal}",
timeisover : "{/literal}{l s='Your time is over.' mod='selltickets'}{literal}",
selectagain : "{/literal}{l s='Select again' mod='selltickets'}{literal}",
seatreserved : "{/literal}{l s='This seat is already reserved' mod='selltickets'}{literal}",
maxseatquantity : "{/literal}{l s='Maximum quantity, deselect one to select new' mod='selltickets'}{literal}",
seatmapnotavailable : "{/literal}{l s='Seat map selector not available' mod='selltickets'}{literal}",
errorloadingseatmap : "{/literal}{l s='Error loading seat map selector' mod='selltickets'}{literal}",
errorcontinue : "{/literal}{l s='Error: You cannot continue without tickets info' mod='selltickets'}{literal}"
}
var seti_config = {
ajaxurl : "{/literal}{$link->getModuleLink('selltickets', 'ajax', [], true)|escape:'htmlall':'UTF-8'}{literal}",
token : "{/literal}{$ajax_token_front|escape:'htmlall':'UTF-8'}{literal}",
total_tickets_nominal : {/literal}{if $total_tickets_nominal}{$total_tickets_nominal|escape:'htmlall':'UTF-8'}{else}0{/if}{literal},
total_tickets_seats : {/literal}{if $total_tickets_seats}{$total_tickets_seats|escape:'htmlall':'UTF-8'}{else}0{/if}{literal}
}
var continueorder = false;
function viewTicketInfo()
{
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: { haveinfo : true, setitoken : seti_config.token },
dataType: "json",
success: function(data, textStatus, jqXHR) {
if (data.result) {
continueorder = true;
}
},
error: function(jqXHR, textStatus, errorThrown) {
continueorder = false;
}
});
}
if (typeof confirmFreeOrder === "function") {
var _confirmFreeOrder = confirmFreeOrder;
confirmFreeOrder = function() {
if (!continueorder)
{
$('#HOOK_PAYMENT .warning').remove();
$('#HOOK_PAYMENT').prepend("<p class='warning'>"+seti_lang.errorcontinue+"</p>");
return false;
}
else {
return _confirmFreeOrder();
}
}
}
$(document).ready(function() {
if (parseInt(seti_config.total_tickets_seats) > 0) {
$('#submitSeatsTickets').click(function(){
var formData = {};
$('#seat_distribution').find("input[name]").each(function (index, node)
{
formData[node.name] = node.value;
});
formData['setitoken'] = seti_config.token;
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: formData,
dataType: "json",
success: function(data, textStatus, jqXHR)
{
if (data.result) {
$('#select_seat_'+data.id_product+'_'+data.id_product_attribute+'_'+data.id_ticket_seats).removeClass('btn-primary btn-warning').removeAttr('onClick').addClass('btn-default').html(seti_lang.seatsselected);
$('#backgroundseatmap').fadeToggle();
$('#seats_selected_'+data.id_product+'_'+data.id_product_attribute+'_'+data.id_ticket_seats).val();
$('#sellticketmapseat').html('');
$('#closeSeatMap').removeAttr('onClick');
timer(data.id_product+"_"+data.id_product_attribute+'_'+data.id_ticket_seats, data.sec);
viewTicketInfo();
} else {
$('#sellticketsseatinfo').html('<div class="alert alert-'+(data.stat ? data.stat : 'warning')+'">'+(data.msg ? data.msg : seti_lang.selectseatsbefore)+'</div>');
}
},
error: function(jqXHR, textStatus, errorThrown)
{
$('#sellticketsseatinfo').html("<div class='alert alert-warning'>"+seti_lang.unknownerrorseats+"</div>");
}
});
});
}
if (parseInt(seti_config.total_tickets_nominal) > 0) {
$('#submitCustomerTickets').click(function(){
$('#selltickets_form #submitCustomerTickets').hide();
$('#selltickets_form #sellticketsload').show();
var formData = {};
$('#selltickets_form').find("input[name]").each(function (index, node)
{
formData[node.name] = node.value;
});
formData['setitoken'] = seti_config.token;
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: formData,
dataType: "json",
success: function(data, textStatus, jqXHR)
{
$('#selltickets_form #sellticketsload').hide();
$('#selltickets_form #submitCustomerTickets').show();
if(data.result) {
viewTicketInfo();
$('#sellticketsinfo').html('<div class="alert alert-'+data.stat+'">'+data.msg+'</div>');
}
else {
$('#sellticketsinfo').html('<div class="alert alert-'+data.stat+'">'+data.msg+'</div>');
}
},
error: function(jqXHR, textStatus, errorThrown)
{
$('#selltickets_form #sellticketsload').hide();
$('#selltickets_form #submitCustomerTickets').show();
$('#sellticketsinfo').html('<div class="alert alert-warning">Error</div>');
}
});
});
/*$('#cart .checkout a').click(function(e) {
if (!continueorder)
{
e.preventDefault;
$('#HOOK_PAYMENT .warning').remove();
$('#HOOK_PAYMENT').prepend("<p class='warning'>seti_lang.errorcontinue</p>");
return false;
}
}*/
}
$('#HOOK_PAYMENT').on('click', '.payment_module a', function(e) {
if (!continueorder)
{
e.preventDefault;
$('#HOOK_PAYMENT .warning').remove();
$('#HOOK_PAYMENT').prepend("<p class='warning'>"+seti_lang.errorcontinue+"</p>");
return false;
}
});
$('.cart_navigation').on('click', 'a.standard-checkout', function(e) {
if (!continueorder)
{
e.preventDefault;
$('#HOOK_SHOPPING_CART .alert-warning').remove();
$('#HOOK_SHOPPING_CART').append("<p class='alert alert-warning'>"+seti_lang.errorcontinue+"</p>");
return false;
}
});
viewTicketInfo();
if (parseInt(seti_config.total_tickets_seats) > 0) {
viewSeatInfo();
}
});
if (parseInt(seti_config.total_tickets_seats) > 0) {
var dataTime = [];
function timerGo(id) {
var sec = dataTime[id].remaining;
var min = Math.round((sec - 30) / 60);
var secRemain = sec % 60;
if (secRemain < 10) {
secRemain = "0" + secRemain;
}
$('#timeseat_'+id+' span').html(min + ":" + secRemain);
if (sec === 0) {
clearInterval(dataTime[id].timerId);
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: { cleanSeatTimeOut : 1 , infoprod : id, setitoken : seti_config.token },
dataType: "json",
success: function(data, textStatus, jqXHR)
{
$('#select_seat_'+data.id_product+'_'+data.id_product_attribute+'_'+data.id_ticket_seats).attr('onClick', 'openSelectSeat('+data.id_product+', '+data.id_product_attribute+', '+data.id_ticket_seats+');').removeClass('btn-primary btn-default').addClass('btn-warning').html(seti_lang.timeisover+'<br/>'+seti_lang.selectagain);
$('#timeseat_'+data.id_product+"_"+data.id_product_attribute+'_'+data.id_ticket_seats).fadeOut();
$('#timeseat_'+data.id_product+"_"+data.id_product_attribute+'_'+data.id_ticket_seats+' span').html('');
},
error: function(jqXHR, textStatus, errorThrown)
{
}
});
} else {
sec--;
}
dataTime[id].remaining = sec;
}
function timer(id, sec) {
$('#timeseat_'+id).fadeIn();
dataTime[id] = {remaining: sec, timerId: setInterval(function () { timerGo(id); }, 1000)};
var sec = dataTime[id].timerId;
}
function viewSeatInfo()
{
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: { haveseat : true, setitoken : seti_config.token },
dataType: "json",
success: function(data, textStatus, jqXHR) {
if (data.result) {
$.each(data.seatinfo, function (i, seati) {
timer(seati.id_product+"_"+seati.id_product_attribute+"_"+seati.id_ticket_seats, seati.seconds);
$('#select_seat_'+seati.id_product+'_'+seati.id_product_attribute+"_"+seati.id_ticket_seats).removeClass('btn-primary btn-warning').removeAttr('onClick').addClass('btn-default').html(seti_lang.seatsselected);
});
}
},
error: function(jqXHR, textStatus, errorThrown) {
}
});
}
function openSelectSeat(id_product, id_product_attribute, id_ticket_seats) {
$('#sellticketsseatinfo').html('');
$('#backgroundseatmap').fadeToggle();
createMapSelect(id_product, id_product_attribute, id_ticket_seats);
}
function cancelSelectSeat(id_product, id_product_attribute, id_ticket_seats) {
$('#sellticketsseatinfo').html('');
$('#backgroundseatmap').fadeToggle();
$("#seats_selected_"+id_product+"_"+id_product_attribute+"_"+id_ticket_seats).val();
$('#sellticketmapseat').html('');
$('#closeSeatMap').removeAttr('onClick');
}
function createMapSelect(id_product, id_product_attribute, id_ticket_seats) {
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: { seatselector : 1, id_product : id_product, id_product_attribute : id_product_attribute, id_ticket_seats : id_ticket_seats, setitoken : seti_config.token },
dataType: "json",
success: function(data, textStatus, jqXHR) {
$('#closeSeatMap').attr('onClick', 'cancelSelectSeat('+id_product+', '+id_product_attribute+', '+id_ticket_seats+')');
if (data.result) {
var number_seats = [];
if (data.seat.numbers) {
$.each(data.seat.numbers, function (x, value) {
number_seats[x] = value;
});
}
var opseat = {rowprefix:"r-",colprefix:"c-",seatw:(parseInt($(document).width()) < 767 ? 12 : 25),seath:(parseInt($(document).width()) < 767 ? 12 : 25),rows:parseInt(data.seat.row),cols:parseInt(data.seat.col),seatnormal:"sellticketseat",seatreserved:"sellticket_sreserved",seatnot:"sellticket_snot",seatotherattrs:"sellticket_attrnotselect",seatselecting:"sellticket_sselect",seatselectingsaved:"sellticket_sselects",seatavailable:parseInt(data.seat.qty),seatselectedqty:parseInt(data.seat.selectqty),seatselectedsaved:data.seat.select}
var setupMapSelect = function (seatav, reservedseat, realseatnav) {
var seatdistri = [], classtring, seatbut;
var aux_seatbut = 0;
for (i = 0; i < opseat.rows; i++) {
for (j = 0; j < opseat.cols; j++) {
//seatbut = (i + j * opseat.rows + 1);
aux_seatbut++;
seatbut = aux_seatbut;
classtring = opseat.seatnormal + ' ' + opseat.rowprefix + i.toString() + ' ' + opseat.colprefix + j.toString();
if ($.isArray(seatav) && $.inArray(seatbut, seatav) == -1) {
classtring += ' ' + opseat.seatnot;
if($.isArray(realseatnav) && $.inArray(seatbut, realseatnav) != -1) {
classtring += ' ' + opseat.seatotherattrs;
}
} /*else if ($.isArray(realseatnav) && $.inArray(seatbut, realseatnav) != -1) {
classtring += ' ' + opseat.seatattr;
}*/ else if ($.isArray(reservedseat) && $.inArray(seatbut, reservedseat) != -1) {
classtring += ' ' + opseat.seatreserved;
} else if ($.isArray(opseat.seatselectedsaved) && $.inArray(seatbut, opseat.seatselectedsaved) != -1) {
classtring += ' ' + opseat.seatselectingsaved;
}
seatdistri.push('<li class="'+classtring+'" style="top:'+(i * opseat.seath).toString()+'px; left:'+(j * opseat.seatw).toString()+'px"><a data-seat="'+seatbut+'">'+(number_seats[seatbut] ? number_seats[seatbut] : seatbut)+'</a></li>');
}
}
$('#sellticketmapseat').html(seatdistri.join(''));
var height = (parseInt(screen.height) > (opseat.seath * opseat.rows + $('#seatselectormap').height()) ? 'auto' : (screen.height - (opseat.seath == 12?0:(screen.height/4))+'px'));
//var width = (parseInt($(document).width()) > (opseat.seatw * opseat.cols)+200 ? (opseat.seatw * opseat.cols)+200 : $(document).width()-200);
if(parseInt($(document).width()) > (opseat.seatw * opseat.cols)+200) {
var width = (opseat.seatw * opseat.cols)+200;
var left = "50%";
}
else {
var width = $(document).width()-200;
var left = (((opseat.seatw * opseat.cols)+2)/2)+"px";
}
width = width < 300 ? "300px" : width + "px";
$('#seatselectormap').css({'width' : width, 'height' : height, 'overflow': 'auto' });
$('#sellticketmapseat').css({'width' : ((opseat.seatw * opseat.cols)+2)+'px', 'height' : ((opseat.seath * opseat.rows)+2)+'px', 'left':left});
//$('#seatselectormap').css({'width' : ((opseat.seatw * opseat.cols)*2 < 300 ? 300 : (opseat.seatw * opseat.cols)*2)+'px', 'height' : 'auto'});
//$('#sellticketmapseat').css({'width' : ((opseat.seatw * opseat.cols)+2)+'px', 'height' : ((opseat.seath * opseat.rows)+2)+'px'});
};
$('#seatselectormap h3 span').html((opseat.seatselectedqty >= opseat.seatavailable ? 0 : opseat.seatavailable));
setupMapSelect(data.seat.available, data.seat.notavailable, data.seat.available_total);
$('.' + opseat.seatnormal).click(function () {
$('#sellticketsseatinfo').html('');
if ($(this).hasClass(opseat.seatnot)) {
/* nope*/
} else {
if ($(this).hasClass(opseat.seatreserved) || $(this).hasClass(opseat.seatselectingsaved)) {
$('#sellticketsseatinfo').html("<div class='alert alert-warning'>"+seti_lang.seatreserved+"</div>");
} else {
if ($(this).hasClass(opseat.seatselecting)) {
$(this).toggleClass(opseat.seatselecting);
opseat.seatselectedqty--;
} else {
if (opseat.seatselectedqty >= opseat.seatavailable) {
$('#sellticketsseatinfo').html("<div class='alert alert-warning'>"+seti_lang.maxseatquantity+"</div>");
} else {
$(this).toggleClass(opseat.seatselecting);
opseat.seatselectedqty++;
}
}
var seatdistri = [];
$.each($('#sellticketmapseat li.'+opseat.seatselecting+' a'), function (index, value) {
seatdistri.push($(this).attr('data-seat'));
});
$("#seats_selected_"+id_product+"_"+id_product_attribute+"_"+id_ticket_seats).val(seatdistri.join(','));
}
}
$('#seatselectormap h3 span').text(opseat.seatavailable-opseat.seatselectedqty);
});
} else {
$('#sellticketsseatinfo').html("<div class='alert alert-warning'>"+seti_lang.seatmapnotavailable+"</div>");
}
},
error: function(jqXHR, textStatus, errorThrown) {
$('#sellticketsseatinfo').html("<div class='alert alert-warning'>"+seti_lang.errorloadingseatmap+"</div>");
}
});
}
}
</script>
{/literal}
{if $total_tickets_seats > 0}
<div id="backgroundseatmap">
<div id="seatselectormap">
<h3 class="page-subheading">{l s='Select your seats' mod='selltickets'} <small>(<span>-</span> {l s='left' mod='selltickets'})</small></h3>
<ul id="sellticketmapseat"></ul>
<div class="submit text-xs-center col-xs-12">
<div id="sellticketsseatinfo"></div>
<button type="button" name="closeSeatMap" id="closeSeatMap" onClick="" class="button btn btn-default button-medium exclusive col-xs-12 col-md-6"><span>{l s='Cancel' mod='selltickets'}</span></button>
<button type="button" name="submitSeatsTickets" id="submitSeatsTickets" class="button btn btn-default button-medium col-xs-12 col-md-6"><span>{l s='Save' mod='selltickets'}</span></button>
<p class="infoseats">{l s='By clicking on Save you will have your seats reserved for 5min until the end of the purchase. You cannot make changes until the time is over or creating again the cart.' mod='selltickets'}</p>
</div>
</div>
</div>
{/if}
{if $total_tickets_nominal > 0}
<div class="col-xs-12 col-md-12 selltickets_customers">
<form action="" method="post" class="contact-form-box" id="selltickets_form">
<fieldset>
<h3 class="page-subheading">{l s='Add info customer tickets' mod='selltickets'}</h3>
{foreach from=$tickets_customer item=tick}
{if $tick.nominal}
<div class="clearfix">
<div class="col-xs-12 col-md-12">
<h4 class="page-subheading">{$tick.name|escape:'htmlall':'UTF-8'}{if $tick.attributes} <small>{$tick.attributes|escape:'htmlall':'UTF-8'}</small>{/if}</h4>
</div>
{for $numticket=1 to $tick.num}
<div class="clearfix col-xs-12 col-md-12 customertickets">
<span>{l s='Ticket' mod='selltickets'} #{$numticket|escape:'htmlall':'UTF-8'}</span>
<div class="clearfix customerinfo">
<div class="col-xs-12 col-md-6">
<div class="form-group">
<label for="customer_name_ticket">{l s='Customer Name' mod='selltickets'} </label>
<input type="text" class="form-control" id="customer_name_ticket" name="infoticket[{$tick.id_product|escape:'htmlall':'UTF-8'}][{$tick.id_product_attribute|escape:'htmlall':'UTF-8'}][{$numticket|escape:'htmlall':'UTF-8'}][name]" value="{if isset($tick.info[$numticket].customer_name)|escape:'htmlall':'UTF-8'}{$tick.info[$numticket].customer_name|escape:'htmlall':'UTF-8'}{/if}" />
</div>
<div class="form-group">
<label for="customer_firstname_ticket">{l s='Customer First Name' mod='selltickets'} </label>
<input type="text" class="form-control" id="customer_firstname_ticket" name="infoticket[{$tick.id_product|escape:'htmlall':'UTF-8'}][{$tick.id_product_attribute|escape:'htmlall':'UTF-8'}][{$numticket|escape:'htmlall':'UTF-8'}][firstname]" value="{if isset($tick.info[$numticket].customer_firstname)|escape:'htmlall':'UTF-8'}{$tick.info[$numticket].customer_firstname|escape:'htmlall':'UTF-8'}{/if}" />
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<label for="customer_phone_ticket">{l s='Phone number' mod='selltickets'}</label>
<input type="text" class="form-control" id="customer_phone_ticket" name="infoticket[{$tick.id_product|escape:'htmlall':'UTF-8'}][{$tick.id_product_attribute|escape:'htmlall':'UTF-8'}][{$numticket|escape:'htmlall':'UTF-8'}][phone]" value="{if isset($tick.info[$numticket].customer_phone)|escape:'htmlall':'UTF-8'}{$tick.info[$numticket].customer_phone|escape:'htmlall':'UTF-8'}{/if}" />
</div>
</div>
</div>
</div>
<div class="clearfix">
<div class="col-xs-12 col-md-12">
<hr/>
</div>
</div>
{/for}
</div>
{/if}
{/foreach}
<div class="clearfix">
<div class="col-xs-12 col-md-12">
<div id="sellticketsinfo">
</div>
<div id="sellticketsload">
</div>
<div class="submit text-center">
<button type="button" name="submitCustomerTickets" id="submitCustomerTickets" class="btn button button-medium exclusive"><span>{l s='Save' mod='selltickets'}</span></button>
</div>
</div>
</div>
</fieldset>
</form>
</div>
{/if}
{if $total_tickets_seats > 0}
<div id="selectionseat" class="col-xs-12 col-md-12 selltickets_customers">
<fieldset>
<h3 class="page-subheading">{l s='Select your seat(s)' mod='selltickets'}</h3>
<div class="clearfix">
<div id="seat_distribution" class="col-xs-12 col-md-12">
{foreach from=$tickets_customer item=tick}
{if $is_product_seat[{$tick.id_product}][{$tick.id_product_attribute}]}
<div class="item_seats">
<h4 class="page-subheading">{$tick.name|escape:'htmlall':'UTF-8'}{if $tick.attributes} <small>{$tick.attributes|escape:'htmlall':'UTF-8'}</small>{/if}</h4>
{foreach from=$tick.assoc_seats item=assoc_seat}
<input type="hidden" id="seats_selected_{$tick.id_product|escape:'htmlall':'UTF-8'}_{$tick.id_product_attribute|escape:'htmlall':'UTF-8'}_{$assoc_seat|escape:'htmlall':'UTF-8'}" value="" name="seats[{$tick.id_product|escape:'htmlall':'UTF-8'}][{$tick.id_product_attribute|escape:'htmlall':'UTF-8'}][{$assoc_seat|escape:'htmlall':'UTF-8'}][selected]" />
<button type="button" name="selectSeat" id="select_seat_{$tick.id_product|escape:'htmlall':'UTF-8'}_{$tick.id_product_attribute|escape:'htmlall':'UTF-8'}_{$assoc_seat|escape:'htmlall':'UTF-8'}" onClick="openSelectSeat({$tick.id_product|escape:'htmlall':'UTF-8'}, {$tick.id_product_attribute|escape:'htmlall':'UTF-8'}, {$assoc_seat|escape:'htmlall':'UTF-8'});" class="btn btn-primary col-xs-12">{l s='Open seat map' mod='selltickets'} </button>
<div class="timeseat" id="timeseat_{$tick.id_product|escape:'htmlall':'UTF-8'}_{$tick.id_product_attribute|escape:'htmlall':'UTF-8'}_{$assoc_seat|escape:'htmlall':'UTF-8'}">{l s='Reservation time limit:' mod='selltickets'} <span></span></div>
{/foreach}
</div>
{/if}
{/foreach}
</div>
</div>
</fieldset>
</div>
{/if}
{else}
<script type="text/javascript">
var seti_config = {
}
</script>
{/if}
<!-- /selltickets -->
xxxxx1.0, XXX xxxx