// 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 = { "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; \ } \ } \ ', }, "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", } }, "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.2", "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(); param["posturl"] = getParamValue('posturl'); param["decodedURI"] = decodeURIComponent(param["posturl"]); param["user_context"] = getParamValue('user_context', param["decodedURI"]); param["pid"] = getParamValue('pid', param["decodedURI"]); if (config['DEBUG']) console.log("posturl: " + param["posturl"]); if (config['DEBUG']) console.log("decodedURI: " + param["decodedURI"]); if (config['DEBUG']) console.log("user_context: " + param["user_context"]); if (config['DEBUG']) console.log("pid: " + param["pid"]); seatmapWorkflow(param["decodedURI"]); } // 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( '' ); } 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 = "/)[1]; console.log(errorMsg); if (errorMsg === '') { // if (errorMsg == '') { successful = true; ProductManager.clearProduct(); $cartBadge.text(ProductManager.getTotalQuantity()); $("#" + idCartModal).modal("hide"); // REDIRECT TO TICKET PURCHASE window.location.replace(checkoutURL); // window.location.replace(proxyCheckoutURL); } else { successful = false; errorMsg = errorMsg.replace(/\/g, ' '); new jBox('Notice', { content: errorMsg, color: 'red', width: '100vw', responsiveWidth: true, position: { x: 'center', y: 'top' }, autoClose: 10000, closeButton: 'box', }); } } }); return successful; } function untickSeat(id) { if (config['DEBUG']) console.log(getFuncName()); console.log(id); document.getElementById(id).click(); // Click on the checkbox } function selectRefreshPrice(select) { if (config['DEBUG']) console.log(getFuncName()); if (config['DEBUG']) console.log(select); var $sel = $(select); var value = $sel.val(); var text = $("option:selected", $sel).text(); var idSelect = $sel[0].id; var id = idSelect.replace("select", ""); ProductManager.updatePrice(id, value); selectOptionSelected[idSelect] = { selected: text }; // Remember Select Option Value for redraw in drawTable() // drawTable(); } function setSelectedIndex() { if (config['DEBUG']) console.log(getFuncName()); for (var idSelect in selectOptionSelected) { if (selectOptionSelected.hasOwnProperty(idSelect)) { var s = document.getElementById(idSelect); var v = selectOptionSelected[idSelect].selected; if (s == null) { delete selectOptionSelected[idSelect]; continue; } else { for (var i = 0; i < s.options.length; i++) { if (s.options[i].text === v) { if (config['DEBUG']) console.log(s.options[i].text + ' matches ' + v); if (config['DEBUG']) console.log(v); if (config['DEBUG']) console.log(s); s.options[i].selected = true; selectRefreshPrice(s); // FIX RIGHT PRICE OPTION DROPDOWN } } } } } } function generateSeatmap(DATA) { if (config['DEBUG']) console.log(getFuncName()); var returnArr = generateMapMatrix(DATA); var map1d = returnArr[0]; var seatsUnavailable = returnArr[1]; var mappingPricescalesSections = returnArr[2]; var rows = returnArr[3]; var seats = generateSeats(DATA, mappingPricescalesSections); var legend = generateLegend(DATA, 'legend'); var firstSeatLabel = 1; // CHANGE HTML TITLE document.title = DATA.EVENT.DESC + ' | Saalplanbuchung by Tickets.com'; // SEAT MAP sc = $('#seat-map').seatCharts({ map: map1d, seats: seats, naming: { top: false, left: true, // rows: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '1', '2', '3', '4', '5', '6', '7', '8', '9'], rows: rows, // columns: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y'], getLabel: function(character, row, column) { return firstSeatLabel++; }, }, legend: legend, click: function() { if (this.status() == 'available') { if ((ProductManager.getTotalQuantity() + 1) > config[DATA.VENUE.CODE]["MAX_TICKETS_PER_USER"]) { var errorMsg = 'Maximale Ticketantahl erreicht: Sie können nicht mehr als ' + config[DATA.VENUE.CODE]["MAX_TICKETS_PER_USER"] + ' Tickets buchen.'; new jBox('Notice', { content: errorMsg, color: 'red', width: '100vw', responsiveWidth: true, position: { x: 'center', y: 'top' }, closeButton: 'box', autoClose: 10000, }); return; } // ADD PRODUCT TO CART fillSeatObjData(this.settings.id); myCartAddWrapper(this.settings.id, this.settings.data.product, this.settings.data.color, this.settings.data.price, 1, '', this); return 'selected'; } else if (this.status() == 'selected') { myCartRemoveWrapper(this.settings.id); return 'available'; } else if (this.status() == 'unavailable') { //seat has been already booked console.log('unavailable'); return 'unavailable'; } else { return this.style(); } } }); // INIT JBOX TOOLTIP var jbox = new jBox('Tooltip', { attach: '.available', trigger: 'mouseenter', onCreated: function() { if (config['DEBUG']) console.log("onCreated"); }, onOpen: function() { // GET SEAT ID AND OBJECT var seatID = this.source.context.id; var seatObj = sc.get(seatID); // console.log(seatObj); if (seatID == '' || seatObj.settings.status == 'unavailable') { if (config['DEBUG']) console.log("Not a real seat or seat unavailable -> Return."); return; } // FILL SEAT OBJECT IF NOT ALREADY fillSeatObjData(seatID); // SET JBOX CONTENT this.setContent(seatObj.settings.data.productJBox); }, onClose: function() {} }); // DETACH JBOX FROM LEGEND AND UNAVAILABLE SEATS for (var i = 0; i < jbox.attachedElements.length; i++) { if (jbox.attachedElements[i].id == "") { jbox.detach($(jbox.attachedElements[i])); i = -1; continue; } } for (var j = 0; j < seatsUnavailable.length; j++) { jbox.detach($('#' + seatsUnavailable[j])); } // MYCART $(function() { var goToCartIcon = function($addTocartBtn) { var $cartIcon = $(".my-cart-icon"); var $image = $('').css({ "position": "fixed", "z-index": "999" }); $addTocartBtn.prepend($image); var position = $cartIcon.position(); $image.animate({ top: position.top, left: position.left }, 500, "linear", function() { $image.remove(); }); }; }); // RUN POST GENERATION HOOKS sc.status(seatsUnavailable, 'unavailable'); // seatsUnavailable RECEIVED FROM SERVER seperateSeatmapsCSS(DATA); // CSS CHANGES AFTER GENERATE venueSpecificCSS(DATA); $(window).trigger('resize'); } function venueSpecificCSS(DATA) { if (config['DEBUG']) console.log(getFuncName()); // VENUE SPECIFIC WIDTH TO CENTER FRONT INDICATORS var paddingLeft = config[DATA.VENUE.CODE]["PADDING-LEFT"]; $(".front-indicator").css({ "padding-left": paddingLeft }); var paddingLeftStage = config[DATA.VENUE.CODE]["PADDING-LEFT-STAGE"]; $(".stage-indicator").css({ "padding-left": paddingLeftStage }); // STAATSOPERETTE DRESDEN SPECIFIC if (DATA.VENUE.CODE == "SAAL KKM" || DATA.VENUE.CODE == "GSP KKM") { $("#seat-map").append(config[DATA.VENUE.CODE]["Tonpult"]); } // VENUE SPECIFIC CSS if (config['DEBUG']) console.log('Applying venue specific CSS for ' + config[DATA.VENUE.CODE]); var styleSheet = document.createElement("style"); styleSheet.type = "text/css"; styleSheet.innerText = config[DATA.VENUE.CODE]["CSS"]; document.head.appendChild(styleSheet); }