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
*/
function viewNumeration() {
if (!$('#configseat_selltickets #sellticketmapseat #seatselectormap li.sellticket_sselect').hasClass('edition_number')) {
$('#configseat_selltickets #sellticketmapseat #seatselectormap li.sellticket_sselect').addClass('edition_number');
$('#configseat_selltickets #sellticketmapseat #seatselectormap li.sellticket_sselect a').hide();
} else {
$('#configseat_selltickets #sellticketmapseat #seatselectormap li.sellticket_sselect').removeClass('edition_number');
$.each($('#seatselectormap li.sellticket_sselect input'), function (index, value) {
$('#configseat_selltickets #sellticketmapseat #seatselectormap li.sellticket_sselect a.'+$(this).attr('id')).html($(this).val());
});
$('#configseat_selltickets #sellticketmapseat #seatselectormap li.sellticket_sselect a').show();
}
}
function createMapSelect(number_seats = false, bookedSeats = false, assocMap = false) {
if (parseInt($('#seat_row').val()) == 0 || parseInt($('#seat_col').val()) == 0) {
alert(seti_lang.gridnotzero);
} else {
$('#seat_distribution').val('');
if ($('#ticket_combination option').length > 0) {
$('#select_ticket_combination').show();
} else {
$('#select_ticket_combination').hide();
}
$('.adviceseats').hide();
var opseat = {rowprefix:"r-",colprefix:"c-",seatw:25,seath:25,rows:parseInt($('#seat_row').val()),cols:parseInt($('#seat_col').val()),seatnormal:"sellticketseat",seatreserved:"sellticket_sreserved",seatnot:"sellticket_snot",seatselecting:"sellticket_sselect",seatselectingsaved:"sellticket_sselects"}
//var number_seats = seti_config.number_seats;
var setupMapSelect = function (seatav, reservedseat) {
var seatdistri = [], classtring, seatbut;
var aux_seatbut = 0;
for (i = 0; i < opseat.rows; i++) {
for (j = 0; j < opseat.cols; j++) {
aux_seatbut++;
seatbut = aux_seatbut;
//seatbut = (i + j * opseat.rows + 1);
classtring = opseat.seatnormal + ' ' + opseat.rowprefix + i.toString() + ' ' + opseat.colprefix + j.toString();
if ($.isArray(seatav) && $.inArray(seatbut, seatav) == -1) {
classtring += ' ' + opseat.seatnot;
} else if ($.isArray(reservedseat) && $.inArray(seatbut, reservedseat) != -1) {
classtring += ' ' + opseat.seatreserved;
} else if ($.isArray(opseat.seatselectedsaved) && $.inArray(seatbut, opseat.seatselectedsaved) != -1) {
classtring += ' ' + opseat.seatselectingsaved;
}
if (assocMap) {
seatdistri.push('<li class="'+classtring+'" style="top:'+(i * opseat.seath).toString()+'px; left:'+(j * opseat.seatw).toString()+'px"><a data-seat="'+seatbut+'" data-combination="0" class="seat_'+seatbut+'">'+(number_seats[seatbut] ? number_seats[seatbut] : seatbut)+'</a></li>');
} else {
//seatdistri.push('<li class="'+classtring+'" style="top:'+(i * opseat.seath).toString()+'px; left:'+(j * opseat.seatw).toString()+'px"><a data-seat="'+seatbut+'" class="seat_'+seatbut+'">'+(seti_config.ed_seats ? (number_seats[seatbut] ? number_seats[seatbut] : seatbut) : seatbut)+'</a></li>');
seatdistri.push('<li class="'+classtring+'" style="top:'+(i * opseat.seath).toString()+'px; left:'+(j * opseat.seatw).toString()+'px"><a data-seat="'+seatbut+'" data-combination="0" class="seat_'+seatbut+'">'+seatbut+'</a></li>');
}
}
}
$('#seatselectormap').html(seatdistri.join(''));
$('#seatselectormap').css({'width' : ((opseat.seatw * opseat.cols)+2)+'px', 'height' : ((opseat.seath * opseat.rows)+2)+'px'});
$('#sellticketmapseat').css({'width' : ((opseat.seatw * opseat.cols)+2)+'px', 'height' : ((opseat.seath * opseat.rows)+2)+'px'});
$('#configseat_selltickets').css({'height' : ((opseat.seath * opseat.rows)+30)+'px'});
if (assocMap) {
$.each($('#seatselectormap li.sellticketseat a'), function (index, elem) {
var classstr = $(elem).attr('class');
var id_seat = classstr.split('seat_').join('');
if (!$(elem).parent().hasClass(opseat.seatnot)) {
$(elem).parent().append('<input type="text" id="seat_'+id_seat+'" name="seatnum['+id_seat+']" value="'+number_seats[id_seat]+'"/>');
}
});
} /*else {
$.each($('#seatselectormap li.sellticketseat a'), function (index, elem) {
var classstr = $(elem).attr('class');
var id_seat = classstr.split('seat_').join('');
if (!$(elem).parent().hasClass(opseat.seatnot)) {
//$(elem).parent().append('<input type="text" id="seat_'+id_seat+'" name="seatnum['+id_seat+']" value="'+(seti_config.ed_seats ? number_seats[id_seat] : id_seat)+'"/>');
$(elem).parent().append('<input type="text" id="seat_'+id_seat+'" name="seatnum['+id_seat+']" value="'+id_seat+'"/>');
}
});
}*/
};
/*if (seti_config.ed_seats) {
var bookedSeats = [seti_config.ed_seats_op.seat_available];
setupMapSelect(bookedSeats, '');
} else {
*/
if (assocMap) {
var bookedSeats_aux = JSON.parse('[' + bookedSeats + ']');
setupMapSelect(bookedSeats_aux, '');
} else {
setupMapSelect();
}
//}
if (!seti_config.edit) {
//if (!assocMap) {
$( "#seatselectormap" ).selectable({
stop: function( event, ui ) {
//$('.' + opseat.seatnormal).
$('a.ui-selected').each(function (index, value) {
var id_seat = $(this).data('seat');
var ele = $('.' + opseat.seatnormal);
$(this).parent().toggleClass(opseat.seatselecting);
if ($(this).parent().hasClass(opseat.seatselecting)) {
$('#seatselectormap a.seat_'+id_seat).attr('data-combination', $('#ticket_combination').val());
if (($("#seat_"+id_seat)).length == 0){
$(this).parent().append('<input type="text" id="seat_'+id_seat+'" name="seatnum['+id_seat+']" value="'+id_seat+'"/>');
}
} else {
$('#seatselectormap a.seat_'+id_seat).css('background-color', '');
$('#seatselectormap a.seat_'+id_seat).attr('data-combination', 0);
$('#seat_'+id_seat).remove();
}
});
setTimeout(function(){
var str = [];
$.each($('#seatselectormap li input'), function (index, value) {
var seatid = $(this).attr('id');
seatid = seatid.split('_');
var combinationid = $('a.seat_'+seatid[1]).attr('data-combination');
str.push(combinationid+'_'+seatid[1]);
});
$('#seat_distribution').val(str.join(','));
}, 1500);
}
});
/*$('.' + opseat.seatnormal).click(function () {
if (!$(this).hasClass('edition_number')){
if ($(this).hasClass(opseat.seatreserved)) {
alert('This seat is already reserved');
} else {
$(this).toggleClass(opseat.seatselecting);
if ($(this).hasClass(opseat.seatselecting)) {
$(this).append('<input type="text" id="seat_'+$(this).find('a').attr('data-seat')+'" name="seatnum['+$(this).find('a').attr('data-seat')+']" value="'+$(this).find('a').attr('data-seat')+'"/>');
} else {
$('#seat_'+$(this).find('a').attr('data-seat')).remove();
}
var str = [];
$.each($('#seatselectormap li.selectedSeat a, #seatselectormap li.'+opseat.seatselecting+' a'), function (index, value) {
str.push($(this).attr('data-seat'));
});
$('#seat_distribution').val(str.join(','));
}
}
});*/
//} // if assocmap
}
}
}
function cleanMapConfiguration() {
$('#seat_distribution').val('');
$('#seat_col').val(0);
$('#seat_row').val(0);
$('#seatselectormap').html('');
$('#seatselectormap').css({'width' : 'auto', 'height' : 'auto'});
$('#sellticketmapseat').css({'width' : 'auto', 'height' : 'auto'});
$('#configseat_selltickets').css({'width' : 'auto', 'height' : 'auto'});
$('.adviceseats').show();
}
function getSeatMap(id, onlyview = false) {
if (onlyview) {
$('.getseatmap').removeClass('viewseatmap');
$('.seatmap_'+id).addClass('viewseatmap');
}
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: { getSeatMap : true, id_ticket_seats : id, setitoken : seti_config.token },
dataType: "json",
success: function(data, textStatus, jqXHR)
{
//$('#seat_col, #seat_row, #createmapselector, #changenumeration').attr('disabled', true);
//$('#createmapselector, #changenumeration').hide();
$('#seat_col').val(data.seat_col);
$('#seat_row').val(data.seat_row);
createMapSelect(data.seats_numbers, data.seat_available, true);
},
error: function(jqXHR, textStatus, errorThrown)
{
alert('Error');
}
});
if (onlyview) {
$('#layerconfigmap').show();
}
}
function getCombinationsFromProduct(id) {
$('#select_ticket_combination').hide();
$('#ticket_combination').html('');
if (seti_config.overrides == 1) {
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: { getCombinations : true, id_product : id, setitoken : seti_config.token },
dataType: "json",
success: function(data, textStatus, jqXHR)
{
if (data.result) {
$.each(data.combinations, function (index, value) {
$('#ticket_combination').append('<option value="'+value.id+'">'+value.combination+'</option>');
});
if (parseInt($('#seat_row').val()) != 0 && parseInt($('#seat_col').val()) != 0) {
$('#select_ticket_combination').show();
}
} else {
$('#select_ticket_combination').hide();
$('#ticket_combination').html('');
}
},
error: function(jqXHR, textStatus, errorThrown)
{
alert('Error');
$('#select_ticket_combination').hide();
$('#ticket_combination').html('');
}
});
}
}
$(document).ready(function() {
$('form#selltickets_form_principal').on('submit', function(e){
if (parseInt($('#selltickets select[name="id_product"]').val()) == 0) {
e.preventDefault();
alert(seti_lang.selectproduct);
}
if($("#seats").is(':checked') && !$("#added_seatmap ul li").length) {
if (($('#seat_row').is(':disabled') || $('#seat_col').is(':disabled')) && $('#selected_seatmaps').val() == '') {
e.preventDefault();
alert(seti_lang.associateclickbefore);
}
if ($('#seat_distribution').val() == '') {
e.preventDefault();
alert(seti_lang.clicksquares);
}
if ($('#selected_seatmaps').val() == '') {
if (parseInt($('#seat_row').val()) == 0 || parseInt($('#seat_col').val()) == 0) {
e.preventDefault();
alert(seti_lang.gridnotzero);
} else {
if (parseInt($("#configseat_selltickets").find($("input")).length) == 0) {
e.preventDefault();
alert(seti_lang.clicksquares);
}
}
}
}
});
if (seti_config.id_order && seti_config.t) {
openTicketOrders('ticket_'+seti_config.t);
}
$('#id_ticket_seats').change(function() {
if ($(this).val() == 0) {
cleanMapConfiguration();
} else {
if ($('#selltickets select[name="id_product"]').val() == 0) {
alert(seti_lang.selectproduct);
$('#id_ticket_seats').val(0);
} else {
getSeatMap($(this).val());
getCombinationsFromProduct($('#selltickets select[name="id_product"]').val());
}
}
});
$('#ignore_attributes').change(function() {
if(this.checked) {
//$('#select_ticket_combination').hide();
$('#ticket_combination').html('');
} else {
getSeatMap($(this).val());
getCombinationsFromProduct($('#selltickets select[name="id_product"]').val());
}
});
$('#seats').change(function() {
if(this.checked) {
$('.control-seat').fadeIn();
} else {
$('.control-seat').fadeOut();
}
});
/*if (seti_config.ed_seats) {
createMapSelect();
}*/
$('#selltickets select[name="id_product"]').change(function() {
cleanMapConfiguration();
if ($(this).val() == 0) {
$('#ticket_combination').html('<option value="0">-</option>');
} else {
getCombinationsFromProduct($(this).val());
}
});
$('#ticket_combination').change(function() {
var id_combi = $(this).val();
$.each($('#sellticketmapseat a'), function (index, value) {
console.log($(this));
if ($(this).attr('data-combination') != 0) {
if ($(this).attr('data-combination') == id_combi) {
$(this).css('background-color', '#2fb5d2');
} else {
$(this).css('background-color', '#666666');
}
}
});
});
getCombinationsFromProduct($('#selltickets select[name="id_product"]').val());
});
function installOverrides() {
var yesInstall = confirm(seti_lang.overrides);
if (yesInstall){
window.location = seti_config.urlbase+"&overrides=1";
}
}
function newTicket() {
$('#butnewticket').hide();
$('.layer-selltickets').fadeIn();
}
function seeExplanation() {
$('#explanation').fadeToggle();
}
function openTicketOrders(id_ticket) {
$('.'+id_ticket).fadeToggle();
}
function deleteTicket(id_ticket) {
var delTicket = confirm(seti_lang.deleteticket);
if (delTicket){
window.location = seti_config.urlbase+"&del_id_ticket="+id_ticket;
}
}
function deleteTicketOrder(id_order, id_product, id_product_attribute) {
var delTicketOrder = confirm(seti_lang.canceldeleteticketorder);
if (delTicketOrder){
window.location = seti_config.urlbase+"&del_order="+id_order+"-"+id_product+"-"+id_product_attribute;
}
}
function validateTicketOrder(id_customer_ticket) {
var yesValidateTicketOrder = confirm(seti_lang.validateticket);
if (yesValidateTicketOrder){
$.ajax({
type: "POST",
url: seti_config.ajaxurl,
data: { valticketfromBO : true, id_customer_ticket : id_customer_ticket, setitoken : seti_config.token },
dataType: "json",
success: function(data, textStatus, jqXHR)
{
$('.valid_'+id_customer_ticket).html( '<span class="msg '+(data.validated == 1 ? 'validated' : '')+'">'+(data.validated == 1 ? seti_lang.validated : seti_lang.notvalidated)+'</span>' ).fadeIn();
if (data.validated == 1) {
$('.but_'+id_customer_ticket+' .butvalidinfotick').addClass('innactive');
} else {
$('.but_'+id_customer_ticket+' .butvalidinfotick').removeClass('innactive');
}
},
error: function(jqXHR, textStatus, errorThrown)
{
alert('Error');
}
});
}
}
function editTicketOrder(id_customer_ticket) {
$('.opt_edition, .butsaveinfotick, .infostatus').hide();
$('.str_edition').show();
$('.inf_'+id_customer_ticket+' .str_edition').hide();
$('.inf_'+id_customer_ticket+' .opt_edition, .but_'+id_customer_ticket+' .butsaveinfotick').show();
}
function saveTicketOrder(id_customer_ticket) {
var formData = {};
$('.inf_'+id_customer_ticket).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) {
$('.opt_edition, .butsaveinfotick, .infostatus').hide();
$('.str_edition').show();
$('.but_'+id_customer_ticket+' div.infostatus').html( '<div class="alert alert-'+data.stat+'">'+data.msg+'</div>' ).fadeIn();
$('.inf_'+id_customer_ticket+' .str_edition.customer_info_name').text( data.customer.complete_name );
$('.inf_'+id_customer_ticket+' .str_edition.customer_info_phone').text( data.customer.phone );
}
else {
$('.but_'+id_customer_ticket+' div.infostatus').html('<div class="alert alert-'+data.stat+'">'+data.msg+'</div>');
}
setTimeout(function(){
$('.but_'+id_customer_ticket+' div.infostatus').fadeOut();
}, 3000);
},
error: function(jqXHR, textStatus, errorThrown)
{
$('.but_'+id_customer_ticket+' div.infostatus').html('<div class="alert alert-warning">Error</div>').fadeIn();
setTimeout(function(){
$('.but_'+id_customer_ticket+' div.infostatus').fadeOut();
}, 3000);
}
});
}
xxxxx1.0, XXX xxxx