// GLOBAL
var $cartBadge;
var options;
var drawTable;
var jqxhr;
var selectOptionSelected = {};
var sc;
var inputsWithValue = [];
var showModal;
var param = new Object;
var idCartModal;
var ProductManager;
var seatmapWorkflowURL;
var branch = 'seatmap_main';
var config = {
"TAD": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "49%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"LEFT_NAMING": false,
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 0.8vw; \
width: 0.8vw; \
line-height: 1.5vw; \
} \
@media (min-width: 628px) and (max-width: 766px) { \
div.seatCharts-cell { \
height: 0.794vw; \
width: 0.794vw; \
} \
} \
@media (min-width: 498px) and (max-width: 627px) { \
div.seatCharts-cell { \
height: 0.786vw; \
width: 0.786vw; \
} \
} \
@media (min-width: 477px) and (max-width: 497px) { \
div.seatCharts-cell { \
height: 0.78vw; \
width: 0.78vw; \
} \
} \
@media (min-width: 400px) and (max-width: 476px) { \
div.seatCharts-cell { \
height: 0.77vw; \
width: 0.77vw; \
} \
} \
',
},
"KLEINER": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "49%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"CUSTOM_PRICESCALES_COLOR": {
1824661: "228B22",
2542349: "8B4513",
2542350:"4682B4",
},
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 1.43vw; \
width: 1.43vw; \
line-height: 1.5vw; \
} \
@media (min-width: 400px) and (max-width: 540px) { \
div.seatCharts-cell { \
height: 1.398vw; \
width: 1.398vw; \
} \
.glyphicon { \
display: none; \
} \
} \
',
},
"INT_TH_3": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "49%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"CUSTOM_PRICESCALES_COLOR": {
5273153: "228B22",
},
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 2.6vw; \
width: 2.6vw; \
line-height: 2.5vw; \
max-width: 30px; \
max-height: 30px; \
} \
@media (min-width: 400px) and (max-width: 700px) { \
div.seatCharts-cell { \
height: 2.52vw; \
width: 2.52vw; \
} \
.glyphicon { \
display: none; \
} \
} \
',
},
"GRO_SAAL": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "49%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 0.9vw; \
width: 0.9vw; \
line-height: 1.4vw; \
} \
',
},
"STADTHAL": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "49%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "BOTTOM",
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 1.85vw; \
width: 1.85vw; \
line-height: 1.4vw; \
} \
@media (min-width: 400px) and (max-width: 480px) { \
div.seatCharts-cell { \
height: 1.81vw; \
width: 1.81vw; \
} \
.glyphicon { \
display: none; \
} \
} \
',
},
"STUDIONU": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "49%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "BOTTOM",
"CUSTOM_PRICESCALES_COLOR": {
2447833: "B9DEA0",
},
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 1.85vw; \
width: 1.85vw; \
line-height: 1.4vw; \
} \
@media (min-width: 400px) and (max-width: 480px) { \
div.seatCharts-cell { \
height: 1.81vw; \
width: 1.81vw; \
} \
.glyphicon { \
display: none; \
} \
} \
',
},
"GR.SAAL": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "49%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "BOTTOM",
"CUSTOM_PRICESCALES_COLOR": {
152965: "FFFF00",
152966: "FF0000",
152967: "74DF00",
152968: "0080FF",
},
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 1.19vw; \
width: 1.19vw; \
line-height: 1.4vw; \
} \
@media (min-width: 445px) and (max-width: 555px) { \
div.seatCharts-cell { \
height: 1.17vw; \
width: 1.17vw; \
} \
.glyphicon { \
display: none; \
} \
} \
@media (min-width: 400px) and (max-width: 444px) { \
div.seatCharts-cell { \
height: 1.15vw; \
width: 1.15vw; \
} \
.glyphicon { \
display: none; \
} \
} \
',
},
"THEATHOF": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "50%",
"PADDING-LEFT-STAGE": "50%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "BOTTOM",
"CUSTOM_PRICESCALES_COLOR": {
2446505: "FFFF00",
2446506: "FF0000",
2446507: "74DF00",
2446508: "0080FF",
},
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 1.2vw; \
width: 1.2vw; \
line-height: 1.4vw; \
} \
@media (min-width: 530px) and (max-width:768px) { \
div.seatCharts-cell { \
height: 1.24vw; \
width: 1.24vw; \
} \
} \
@media (min-width: 405px) and (max-width:529px) { \
div.seatCharts-cell { \
height: 1.215vw; \
width: 1.215vw; \
} \
} \
@media (min-width: 400px) and (max-width: 768px) { \
.glyphicon { \
display: none; \
} \
} \
',
},
"THEATER": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "60%",
"PADDING-LEFT-STAGE": "47%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 1.54vw; \
width: 1.54vw; \
line-height: 1.4vw; \
} \
@media (min-width: 400px) and (max-width:530px) { \
div.seatCharts-cell { \
height: 1.505vw; \
width: 1.505vw; \
} \
.glyphicon { \
display: none; \
} \
} \
',
},
"NEUES TH": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "50%",
"PADDING-LEFT-STAGE": "50%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"CSS": '\
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 3.47vw !important; \
width: 3.47vw !important; \
max-width: 27px; \
max-height: 27px; \
line-height: 1.4vw; \
} \
@media all and (-ms-high-contrast: none), \
(-ms-high-contrast: active) { \
div.seatCharts-cell { \
height: 3.55vw !important; \
width: 3.55vw !important; \
} \
} \
',
},
"SAAL KKM": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "47%",
"Tonpult": "
Tonpult
",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"CSS": ' \
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 1.3vw; \
width: 1.3vw; \
line-height: 1.4vw; \
} \
@media (min-width: 411px) and (max-width:539px) { \
div.seatCharts-cell { \
height: 1.275vw; \
width: 1.275vw; \
} \
.glyphicon { \
display: none; \
} \
} \
@media (min-width: 400px) and (max-width:410px) { \
div.seatCharts-cell { \
height: 1.25vw; \
width: 1.25vw; \
} \
.glyphicon { \
display: none; \
} \
} \
',
},
"GSP KKM": {
"FRONT-INDICATOR-WIDTH": "90%",
"PADDING-LEFT": "47%",
"PADDING-LEFT-STAGE": "47%",
"Tonpult": "Tonpult
",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"CSS": ' \
.booking-details p,li { \
font-size: 1vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1vw; \
} \
div.seatCharts-cell { \
height: 1.39vw; \
width: 1.39vw; \
line-height: 1.4vw; \
} \
@media (min-width: 400px) and (max-width:504px) { \
div.seatCharts-cell { \
height: 1.36vw; \
width: 1.36vw; \
} \
.glyphicon { \
display: none; \
} \
} \
',
},
'KOM├ÛDIE': {
"PADDING-LEFT": "47%",
"MAX_TICKETS_PER_USER": 9,
"BUEHNE": "TOP",
"CSS": ' \
.booking-details p,li { \
font-size: 1.0vw; \
} \
.seatCharts-container h4, div.seatCharts-cell { \
font-size: 1.0vw; \
} \
div.seatCharts-cell { \
height: 2.72vw; \
width: 2.72vw; \
line-height: 1.4vw; \
max-height: 25px; \
max-width: 25px; \
} \
@media (min-width: 400px) and (max-width:405px) { \
div.seatCharts-cell { \
height: 2.7vw; \
width: 2.7vw; \
} \
.glyphicon { \
display: none; \
} \
} \
@media (min-width: 406px) and (max-width:768px) { \
div.seatCharts-cell { \
height: 2.72vw; \
width: 2.72vw; \
} \
} \
',
},
"THEATER AM DOM": {
"AGENCY": "TADK",
"BUYER_TYPES": {
"Z1": "Vollzahler",
}
},
"GRO├ƑER SAAL": {
"AGENCY": "GMB1",
"BUYER_TYPES": {
"01": "Vollzahler",
}
},
"KLEINER SAAL": {
"AGENCY": "GMB1",
"BUYER_TYPES": {
"01": "Vollzahler",
}
},
"INTIMES THEATER BESTUHLT": {
"AGENCY": "GMB1",
"BUYER_TYPES": {
"01": "Vollzahler",
}
},
"THEATER HOF": {
"AGENCY": "THOF",
"BUYER_TYPES": {
"I1": "Vollzahler",
"I3": "Behinderte mit Ausweis",
"I2": "Schüler",
"IE": "Erwachsener",
"IK": "Kind",
}
},
"STUDIO NUMMERIERT": {
"AGENCY": "THOF",
"BUYER_TYPES": {
"I1": "Vollzahler",
"I3": "Behinderte mit Ausweis",
"I2": "Schüler",
"IE": "Erwachsener",
"IK": "Kind",
}
},
"KOMÖDIE BRAUNSCHWEIG": {
"AGENCY": "KOMB",
"BUYER_TYPES": {
"IV": "Vollzahler",
"IE": "Ermäßigt",
"IG": "Gutschein",
"ME": "Vollzahler",
"MK": "Ermäßigt",
"NI": "Ermäßigt",
"NN": "Vollzahler",
}
},
"THEATER IM RATHAUS": {
"AGENCY": "TIRE",
"BUYER_TYPES": {
"I1": "Vollzahler",
"I2": "Ermäßigt",
"FR": "Freitag_13",
}
},
"NEUES THEATER HANNOVER": {
"AGENCY": "NTHH",
"BUYER_TYPES": {
"WW": "Vollzahler",
}
},
"STAATSOPERETTE DRESDEN": {
"AGENCY": "SOPD",
"BUYER_TYPES": {
"97": "Vollzahler",
"A0": "Ermäßigt",
"A5": "Online-Aktion",
"95": "Aktionspreis",
"09": "Schüler",
"A6": "Kind bis 18 J.",
"86": "Buch",
"85": "CD",
"00": "Tagespreis",
"03": "Tagespreis ermäßigt",
"98": "Aktionspreis",
"31": "Studenten/Azubis bis 27 J.",
"23": "Andere Gäste",
}
},
"SEATMAP-SERVER": {
"ROOT_URL": "https://zinomedia.de/" + branch + "/seatmap-server/seatmap-server.pl",
},
"CORS-ANYWHERE": {
"ROOT_URL": "https://cors.zinomedia.de/",
},
"DEBUG": true,
"SEATMAP_VERSION": "0.9.6",
"CURRENCY_SYMBOL": "€",
};
if (branch === 'seatmap_testing') config["SEATMAP_VERSION"] = config["SEATMAP_VERSION"] + ' (testing)';
var checkoutParam = [
'request_type', 'trxstate', 'request_action', 'agency', 'etpgcode', 'parent_offer_id', 'flashDetected', 'recapToken', 'age_consent_is_checked', 'jcarousel_auto_off_val', 'selected_seat_indexes', 'ism_map_current_state_json_data', 'is_availability_switch_from_map', 'map_coupon_code', 'is_ticket_exchange_request', 'prevtrxstate', 'user_context', 'gid', 'target_trxstate', 'target_prev_trxstate', 'target_url', 'target_name_value', 'orgid', 'p_orgid', 'pid', 'redeem_voucher_data_event_mapping', 'supplier_code', 'valid_coupon_code_message', 'replay_request', 'inventory_filtering_action', 'inventory_month', 'inventory_year', 'upsell_selected', 'listing_type', 'invalid_seats', 'package_pids', 's_mem_tkt_ren_retrieval', 'mlbamsp', 'pay_pal_token', 'dpa_selection', 'timeout_seconds', 'APPTE', 'schedule', 'hbx_discounts', 'hbx_discount_prices', 'hbx_selected_tixx', 'hbx_requested_pg', 'hbx_offered_pg', 'hbx_pids', 'hbx_perf_codes', 'hbx_perf_sub_codes', 'hbx_upsell_flag', 'selected_upsell_option', 'cancelAndRedirectTrxState', 'secure_trxn_enabled', 'isCapEnabled', 'mainEventPID', 'discountdesc=A=97', 'discountprice=A=97', 'discountfees=A=97', 'discount=A=97', 'discountdesc=A=A0', 'discountprice=A=A0', 'discountfees=A=A0', 'discount=A=A0', 'supplierCode',
];
// POLYPHILL repeat()
if (!String.prototype.repeat) {
String.prototype.repeat = function(count) {
'use strict';
if (this == null)
throw new TypeError('can\'t convert ' + this + ' to object');
var str = '' + this;
// To convert string to integer.
count = +count;
// Check NaN
if (count != count)
count = 0;
if (count < 0)
throw new RangeError('repeat count must be non-negative');
if (count == Infinity)
throw new RangeError('repeat count must be less than infinity');
count = Math.floor(count);
if (str.length == 0 || count == 0)
return '';
// Ensuring count is a 31-bit integer allows us to heavily optimize the
// main part. But anyway, most current (August 2014) browsers can't handle
// strings 1 << 28 chars or longer, so:
if (str.length * count >= 1 << 28)
throw new RangeError('repeat count must not overflow maximum string size');
var maxCount = str.length * count;
count = Math.floor(Math.log(count) / Math.log(2));
while (count) {
str += str;
count--;
}
str += str.substring(0, maxCount - str.length);
return str;
}
}
// EVENT DOMCONTENTLOADED
document.addEventListener("DOMContentLoaded", ready);
window.onload = function() {
if (config['DEBUG']) console.log(getFuncName());
checkDebug();
};
// EVENT CONTAINER VISIBLE
if ($('.container-fluid').is(':visible')) {
if (config['DEBUG']) console.log("Visible");
var IEdetected = detectIE();
if (config['DEBUG']) console.log("IE " + IEdetected);
if (parseInt(IEdetected) < 12) {
$('#IEdetected').show();
throw new Error("IE " + IEDetected + " not supported.");
}
init();
var decoded_uri = decodeURIComponent(getParamValue('posturl'));
getParamsFromPosturl(decoded_uri);
if (config['DEBUG']) console.log(param);
seatmapWorkflow(decoded_uri);
}
function getParamsFromPosturl(decoded_uri) {
if (config['DEBUG']) console.log(getFuncName());
console.log(decoded_uri);
var checkoutParam = [
'APPTE', 'age_consent_is_checked', 'agency', 'cancelAndRedirectTrxState', 'cogid', 'coids', 'discount=A=IE', 'discount=A=IV', 'discountdesc=A=IE', 'discountdesc=A=IV', 'discountfees=A=IE', 'discountfees=A=IV', 'discountprice=A=IE', 'discountprice=A=IV', 'dpa_selection', 'etpgcode', 'flashDetected', 'gid', 'hbx_discount_prices', 'hbx_discounts', 'hbx_offered_pg', 'hbx_perf_codes', 'hbx_perf_sub_codes', 'hbx_pids', 'hbx_requested_pg', 'hbx_selected_tixx', 'hbx_upsell_flag', 'request_type', 'invalid_seats', 'inventory_filtering_action', 'inventory_month', 'inventory_year', 'isCapEnabled', 'is_availability_switch_from_map', 'is_ticket_exchange_request', 'ism_map_current_state_json_data', 'jcarousel_auto_off_val', 'listing_type', 'mainEventPID', 'map_coupon_code', 'mlbamsp', 'oid', 'ooids', 'orderkey', 'orgid', 'p_orgid', 'package_pids', 'parent_offer_id', 'pay_pal_token', 'pid', 'prevtrxstate', 'recapToken', 'redeem_voucher_data_event_mapping', 'replay_request', 'request_action', 's_mem_tkt_ren_retrieval', 'schedule', 'secure_trxn_enabled', 'selected_seat_indexes', 'selected_upsell_option', 'supplierCode', 'supplier_code', 'target_name_value', 'target_prev_trxstate', 'target_trxstate', 'target_url', 'timeout_seconds', 'trxstate', 'upsell_selected', 'user_context', 'valid_coupon_code_message'
];
for (var i = 0; i < checkoutParam.length; i++) {
var value = getParamValue(checkoutParam[i], decoded_uri);
if (value !== undefined) {
param[checkoutParam[i]] = getParamValue(checkoutParam[i], decoded_uri);
}
}
}
// EVENT RESIZE
$(window).resize(function() {
if ($(window).width() < 400) {
$('.container-fluid').hide();
$('#screenTooSmall').show();
}
else {
$('.container-fluid').show();
$('#screenTooSmall').hide();
}
});
function detectIE () {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
if (msie > 0) {
// IE 10 or older => return version number
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
}
var trident = ua.indexOf('Trident/');
if (trident > 0) {
// IE 11 => return version number
var rv = ua.indexOf('rv:');
return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
}
var edge = ua.indexOf('Edge/');
if (edge > 0) {
// Edge (IE 12+) => return version number
return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
}
// other browser
return false;
}
function init() {
if (config['DEBUG']) console.log(getFuncName());
/*
* jQuery myCart - v1.7 - 2018-03-07
* http://asraf-uddin-ahmed.github.io/
* Copyright (c) 2017 Asraf Uddin Ahmed; Licensed None
*/
(function($) {
"use strict";
var OptionManager = (function() {
var objToReturn = {};
var _options = null;
var DEFAULT_OPTIONS = {
currencySymbol: config["CURRENCY_SYMBOL"],
classCartIcon: 'my-cart-icon',
classCartBadge: 'my-cart-badge',
classProductQuantity: 'my-product-quantity',
classProductRemove: 'my-product-remove',
classCheckoutCart: 'my-cart-checkout',
affixCartIcon: true,
showCheckoutModal: true,
numberOfDecimals: 2,
cartItems: null,
clickOnAddToCart: function($addTocart) {},
afterAddOnCart: function(products, totalPrice, totalQuantity) {},
clickOnCartIcon: function($cartIcon, products, totalPrice, totalQuantity) {},
checkoutCart: function(products, totalPrice, totalQuantity) {
if (config['DEBUG']) console.log("checkoutCart");
return false;
},
getDiscountPrice: function(products, totalPrice, totalQuantity) {
return null;
}
};
var loadOptions = function(customOptions) {
_options = $.extend({}, DEFAULT_OPTIONS);
if (typeof customOptions === 'object') {
$.extend(_options, customOptions);
}
};
var getOptions = function() {
return _options;
};
objToReturn.loadOptions = loadOptions;
objToReturn.getOptions = getOptions;
return objToReturn;
}());
var MathHelper = (function() {
var objToReturn = {};
var getRoundedNumber = function(number) {
if (isNaN(number)) {
throw new Error('Parameter is not a Number');
}
number = number * 1;
options = OptionManager.getOptions();
return number.toFixed(options.numberOfDecimals);
};
objToReturn.getRoundedNumber = getRoundedNumber;
return objToReturn;
}());
ProductManager = (function() {
var objToReturn = {};
var localStorage = {};
/*
PRIVATE
*/
// localStorage.products = localStorage.products ? localStorage.products : "";
if (typeof localStorage.products !== "undefined") {
if (config['DEBUG']) console.log("localStorage defined");
localStorage.products = "";
}
else {
if (config['DEBUG']) console.log("localStorage undefined");
}
var getIndexOfProduct = function(id) {
var productIndex = -1;
var products = getAllProducts();
$.each(products, function(index, value) {
if (value.id == id) {
productIndex = index;
return;
}
});
return productIndex;
};
var setAllProducts = function(products) {
localStorage.products = JSON.stringify(products);
};
var addProduct = function(id, name, summary, price, quantity, image, seatObj) {
var products = getAllProducts();
products.push({
id: id,
name: name,
summary: summary,
price: price,
quantity: quantity,
image: image,
seatObj: seatObj,
});
setAllProducts(products);
};
/*
PUBLIC
*/
var getAllProducts = function() {
try {
var products = JSON.parse(localStorage.products);
return products;
}
catch (e) {
return [];
}
};
var updatePoduct = function(id, quantity) {
var productIndex = getIndexOfProduct(id);
if (productIndex < 0) {
return false;
}
var products = getAllProducts();
products[productIndex].quantity = typeof quantity === "undefined" ? products[productIndex].quantity * 1 + 1 : quantity;
setAllProducts(products);
return true;
};
var updatePrice = function(id, price) {
var productIndex = getIndexOfProduct(id);
if (productIndex < 0) {
return false;
}
var products = getAllProducts();
// products[productIndex].quantity = typeof quantity === "undefined" ? products[productIndex].quantity * 1 + 1 : quantity;
products[productIndex].price = price;
setAllProducts(products);
return true;
};
var setProduct = function(id, name, summary, price, quantity, image, seatObj) {
if (typeof id === "undefined") {
console.error("id required");
return false;
}
if (typeof name === "undefined") {
console.error("name required");
return false;
}
if (typeof image === "undefined") {
console.error("image required");
return false;
}
if (!$.isNumeric(price)) {
console.error("price is not a number");
return false;
}
if (!$.isNumeric(quantity)) {
console.error("quantity is not a number");
return false;
}
if (typeof seatObj === "undefined") {
console.error("seatObj required");
return false;
}
summary = typeof summary === "undefined" ? "" : summary;
if (!updatePoduct(id)) {
addProduct(id, name, summary, price, quantity, image, seatObj);
}
};
var clearProduct = function() {
setAllProducts([]);
};
var removeProduct = function(id) {
var products = getAllProducts();
products = $.grep(products, function(value, index) {
return value.id != id;
});
setAllProducts(products);
};
var getTotalQuantity = function() {
var total = 0;
var products = getAllProducts();
$.each(products, function(index, value) {
total += value.quantity * 1;
});
return total;
};
var getTotalPrice = function() {
var products = getAllProducts();
var total = 0;
$.each(products, function(index, value) {
total += value.quantity * value.price;
total = MathHelper.getRoundedNumber(total) * 1;
});
return total;
};
objToReturn.getAllProducts = getAllProducts;
objToReturn.updatePoduct = updatePoduct;
objToReturn.updatePrice = updatePrice;
objToReturn.setProduct = setProduct;
objToReturn.clearProduct = clearProduct;
objToReturn.removeProduct = removeProduct;
objToReturn.getTotalQuantity = getTotalQuantity;
objToReturn.getTotalPrice = getTotalPrice;
return objToReturn;
}());
var loadMyCartEvent = function(targetSelector) {
var options = OptionManager.getOptions();
var $cartIcon = $("." + options.classCartIcon);
$cartBadge = $("." + options.classCartBadge);
var classProductQuantity = options.classProductQuantity;
var classProductRemove = options.classProductRemove;
var classCheckoutCart = options.classCheckoutCart;
idCartModal = 'my-cart-modal';
var idCartTable = 'my-cart-table';
var idGrandTotal = 'my-cart-grand-total';
var idEmptyCartMessage = 'my-cart-empty-message';
var idDiscountPrice = 'my-cart-discount-price';
var classProductTotal = 'my-product-total';
var classAffixMyCartIcon = 'my-cart-icon-affix';
if (options.cartItems && options.cartItems.constructor === Array) {
ProductManager.clearProduct();
$.each(options.cartItems, function() {
ProductManager.setProduct(this.id, this.name, this.summary, this.price, this.quantity, this.image);
});
}
$cartBadge.text(ProductManager.getTotalQuantity());
if (!$("#" + idCartModal).length) {
$('body').append(
'' +
'
' +
'
' +
'' +
'
Bitte überprüfen Sie Ihre Plätze. Dies ist die letze Möglichkeit, um ggfs. die Ermäßigung zu ändern.
' +
'
' +
'' +
'
' +
'
' +
'
'
);
}
drawTable = function() {
var DATA = jqxhr.responseJSON;
var $cartTable = $("#" + idCartTable);
$cartTable.empty();
var products = ProductManager.getAllProducts();
$.each(products, function() {
var total = this.quantity * this.price;
// OPTION DROPDOWN
var selectID = 'select' + this.id;
var select = "