console.info("--- STORE -----------------------------------------------"); console.info($ == undefined); console.info($); store = { debug: (window.location.origin == "http://bs" && true), ok: function () { var _ok = $("#store-" + this._conf._eventKey).length !== 0; console.warn("##########################################################################################################"); console.warn("### EMBED STORE #store-" + this._conf._eventKey + " :: INIT-OK :: " + (_ok ? "OK" : "NOT OK ")); console.warn("##########################################################################################################"); return _ok; }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ init: function () { console.warn("##########################################################################################################"); console.warn("### EMBED STORE :: INIT :: IN ############################################################################"); console.info("#store-" + this._conf._eventKey + " :: " + $("#store-" + this._conf._eventKey).length); console.info(this._conf); console.info(this._eventInfo); this.initialize(); console.warn("### EMBED STORE :: INIT :: OUT ###########################################################################"); console.warn("##########################################################################################################"); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ initialize: function () { console.info("--- initialize :: -------------------------------------------------------"); $("head").append(""); $.each(this, function (k, v) { if (k.indexOf("_") == 0) { v["_root"] = "$store"; v["_eventKey"] = $store._conf._eventKey; } }); this._form._css_prefix_ = "str-"; this.css(); this._store.init(this._eventInfo); this._comm._initialize(); this.renderStore(); this.next(true) //------------------------------------------------------------ //--- DEBUG //------------------------------------------------------------ if (this.debug) { //this.renderCode(); var div = "
" var html = ""; var completedCodes = {"P01": false}; html += JSON.stringify(this._eventInfo, null, 2); $("#atbta-debug-atbta").html(html); } //------------------------------------------------------------ //--- DEBUG //------------------------------------------------------------ }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ canNext: function (visible) { switch (visible) { case "tickets": $store._store.update(); var ret = $store._store.hasQuantity(); if (!ret) { this.renderError("Choose a quantity to purchase"); } return ret; case "info": $store._store.update(); } return true; }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ next: function (initial) { console.info("--- next" + (initial ? " :: " + initial : "")); this.renderError(); var visible = $(".str-section:visible"); if (this.canNext(visible.data("store-section"))) { var show = null; var title = ""; console.info("--- next :: -" + visible.data("store-section") + "- :: " + (visible.data("store-section") == "completed")); if ((visible.data("store-section") + "") == "completed" && initial != true) { return; } switch (visible.data("store-section")) { case "tickets": if ($store._store.infos() == null) { show = "cart"; title = "Checkout"; this.renderCart(); } else { show = "info"; title = "Provide Needed Info(s)"; this.renderInfo(); } break; case "info": console.info("infos") let _valid = this._form.validateUnique(); console.info(_valid); if (_valid != "uniqueCheck") { if (_valid == 1) { show = "cart"; title = "Checkout"; this.renderCart(); } else { show = "info"; title = "Provide Needed Info(s)"; console.info(typeof _valid); this.renderError(typeof _valid == "string" ? _valid : "Provide all required information before continuing."); } } else { return; } break; case "cart": title = "Thank You"; show = "completed"; this.renderCompleted(); break; default: show = "tickets"; title = $store._eventInfo.eventStoreButton; break; } $("#str-navigation-title").html(title); if ($(".str-section:visible").data("storeSection") != show) { $(".str-section:visible").hide(); $("[data-store-section='" + show + "']").show(); if (initial !== true) { this.scrollUp(); } } } }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ nextTo: function (show, title) { $("#str-navigation-title").html(title); if ($(".str-section:visible").data("storeSection") != show) { $(".str-section:visible").hide(); $("[data-store-section='" + show + "']").show(); this.scrollUp(); } }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ back: function (from) { console.info("back" + (from ? " :: " + from : "")); this.renderError(); var visible = $(".str-section:visible"); var show = null; var back = false; var title = ""; var current = visible.data("store-section"); switch (from ? from : current) { case "info": case "code": $store._store.update(); title = $store._eventInfo.eventStoreButton; show = "tickets"; break; case "cart": if ($store._store.infos() == null) { title = $store._eventInfo.eventStoreButton; show = "tickets"; } else { show = "info"; title = "Provide Needed Info(s)"; back = true; } break; case "payment": show = "cart"; title = "Cart"; back = true; break; case "completed": show = "payment"; title = "Payment"; back = true; break; default: break; } if (show == "tickets") { $store.renderTickets(); } $("#str-navigation-title").html(title); console.info(current + " :: " + show); $(".str-section:visible").hide(); $("[data-store-section='" + show + "']").show(); this.scrollUp(); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderStore: function () { console.info("--- renderStore -------------------------------------------------------"); var html = ""; html += this.renderEvent(); html += this.renderNav(); html += this.renderTickets(); html += this.renderCode(); html += this.renderInfo(); html += this.renderCart(); html += this.renderCompleted(); this.content(html); this.renderTickets(); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderEvent: function () { return "
" + this._eventInfo.event.name + " Store
" + this._eventInfo.event.startDate + "
"; }, renderNav: function () { return "" + "" + "" + "" + "
" + "
"; }, renderError: function (msg) { $("#str-error").hide(); if (msg) { console.info(msg); $("#str-error").html(msg); $("#str-error").show(); this.scrollUp(); } }, scrollUp: function () { $([document.documentElement, document.body]).animate({ scrollTop: $(".str-navigation").offset().top - 75 }, 500); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderTickets: function () { if ($("[data-store-section='tickets']").length == 0) { return "
"; } var isLocalhost = window.location.hostname == "localhost"; var innerHtml = ""; $.each(this._eventInfo.products, function (i, ticket) { innerHtml += $store.renderStoreTicket(ticket, (isLocalhost ? 2 : 0)); }); var discountCodes = $store._store.codes(); $.each(discountCodes, function (key, discountCode) { var code = undefined; $.each($store._eventInfo.codes, function (i, c) { if (c.code.toUpperCase() == key.toUpperCase()) { code = c; } }); if (code) { innerHtml += $store.renderStoreCode(discountCode); } else { delete discountCodes[key]; } }); $store._store.codes(discountCodes); html = "
"; html += ($store._eventInfo.hasOwnProperty("codes") && $store._eventInfo.codes.length != 0 ? "" : ""); html += "
choose quantity for each ticket and press continue
"; html += "
" + innerHtml + "
"; html += "
"; html += $store.renderFbPixel("PageView"); html += "
"; $("[data-store-section='tickets']").html(html); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderStoreTicket: function (ticket, index) { console.info("--- renderStoreTicket :: " + ticket.name + " -------------------------------------------------------"); var html = ""; var symbol = $store._eventInfo.currency.symbol; var max = ticket.maxPurchaseQuantity; var price = ticket.price; if (price == undefined) { var different = false; $.each(ticket.variations, function (v, variation) { if (price != undefined) { different |= price != variation.price; } price = (price == undefined || parseFloat(price) > parseFloat(variation.price) ? variation.price : price); if (variation.hasOwnProperty("maxPurchaseQuantity")) { if (max == undefined || max > variation.maxPurchaseQuantity) { max = variation.maxPurchaseQuantity; } } }); price = (different ? "from " : "") + symbol + price; } else { price = symbol + price; } html += ""; html += " "; html += " "; html += " "; html += " "; html += " "; html += " "; html += "
" + ticket.name + "" + price + "
" + this._store.inputs.number(ticket.eventProductId, index + "", "str-item-quantity str-override", max) + "
" + ticket.description + "
"; return html; }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderStoreCode: function (code) { console.clear(); console.info("--- renderCode ----------------------------------------"); var symbol = $store._eventInfo.currency.symbol; var html = ""; var price = 0.00; var discount = 0.00; $.each(code.groups, function (g, group) { if (group.hasOwnProperty("count") && group.count > 0) { if (group.hasOwnProperty("priceEach")) { price += group.count * group.priceEach; discount += group.count * group.discountAmountEach; } else { $.each(group.products, function (p, product) { if (product.hasOwnProperty("count")) { price += group.count * product.count * product.priceEach; discount += group.count * product.count * product.discountAmountEach; } }); } } }); var discountedPrice = ""; if (!code.haveProducts) { var isAmount = code.discountCodeAmountType == "AMOUNT"; discountedPrice = (isAmount ? symbol : "") + code.price + (!isAmount ? "%" : "") + " OFF"; } else { discountedPrice = symbol + parseFloat(price - discount).toFixed(2); } html += ""; html += " "; html += " "; html += " "; html += " "; html += " "; html += ""; html += "
PROMO CODE:" + code.code + (code.exclusive == "EXCLUSIVE" ? "
( Exclusive promo code, cannot be used with any other offer )
" : "") + "
"; html += " " + (code.haveProducts ? symbol + parseFloat(price).toFixed(2) : "") + "" + discountedPrice; html += "
"; html += "
"; html += ""; html += "
"; $.each(code.groups, function (g, group) { if (group.count > 0) { html += "
    "; $.each(group.products, function (p, product) { if (product.count > 0) { console.info(product); $.each($store._eventInfo.products, function (j, eventProduct) { if (eventProduct.eventProductId == product.eventProductId) { html += "
  • " + eventProduct.name + (product.hasOwnProperty("priceEach") ? "@ " + symbol + product.priceEach + " ea." : "") + " (count " + (product.count * group.count) + ") " + "
  • "; } }); } }); html += "
"; } }); html += "
"; html += "
"; html += "
"; //------------------------------------------------------------ //--- DEBUG //------------------------------------------------------------ if (this.debug) { html += "
"; html += " " + code.exclusive + " :: "; html += " " + code.discountCodeAmountType + " :: "; html += " " + code.applyTo + " :: "; html += " " + code.applyToType + ""; html += "
"; html += "
" + JSON.stringify(code, null, 2) + "
"; } //------------------------------------------------------------ //--- DEBUG //------------------------------------------------------------ return html; }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderCode: function (code) { var codeInput = (this.debug && true ? "SAMPLE" : ""); if ($("[data-store-section='code']").length == 0) { return "
"; } var html = ""; if (code) { console.clear(); console.info("--- renderCode ----------------------------------------"); console.info(code); code.price = parseFloat(code.price); var symbol = $store._eventInfo.currency.symbol; var isAmount = code.discountCodeAmountType == "AMOUNT"; var isPercentage = code.discountCodeAmountType == "PERCENTAGE"; var isExclusive = code.exclusive == "EXCLUSIVE"; var isEach = code.applyTo == "EACH"; var isCollection = code.applyTo == "COLLECTION"; var isDefault = code.applyToType == "DEFAULT"; var isGroups = code.applyToType == "GROUPS"; var discountCodes = $store._store.codes(); var haveCodes = false; var haveExclusiveCode = false; $.each(discountCodes, function (c, _code) { haveCodes = true; haveExclusiveCode |= _code.exclusive == "EXCLUSIVE" }); var canAddDiscountCode = !haveCodes || (isExclusive && !haveExclusiveCode) || (!haveExclusiveCode && !isExclusive); code["haveProducts"] = false; $.each(code.groups, function (g, group) { code.haveProducts |= group.products.length != 0; }); var discount = parseFloat(code.price); html += "
"; html += (!canAddDiscountCode ? "
Promo code \"" + code.code + "\" cannot be used with other promo codes in the cart.
" : "") html += ""; html += " "; html += " "; html += " "; html += " "; html += " "; // ############################################################################################################################## // ############################################################################################################################## // ############################################################################################################################## // ############################################################################################################################## // ############################################################################################################################## // ############################################################################################################################## if (code.haveProducts) { html += " "; html += "
" + code.code.toUpperCase() + (code.exclusive == "EXCLUSIVE" ? "
( Exclusive promo code, cannot be used with any other offer )
" : "") + "
" + (isAmount ? symbol : "") + discount + (isPercentage ? "%" : "") + (!isExclusive ? "
OFF EACH
" : " OFF") + "
" + (code.description ? code.description : "") + "
"; $.each(code.groups, function (g, group) { html += (g != 0 && isCollection ? "
- OR -
" : ""); html += "
"; var totalGroupPrice = 0.0; $.each(group.products, function (p, product) { $.each($store._eventInfo.products, function (j, eventProduct) { if (eventProduct.eventProductId == product.eventProductId) { totalGroupPrice += $store.productPrice(eventProduct) * product.quantity; } }); }); // ########################################################################################################################## // ########################################################################################################################## // ########################################################################################################################## if (isGroups || isCollection) { var discountAmount = (isPercentage ? totalGroupPrice * code.price / 100 : code.price); var discountPrice = totalGroupPrice - discountAmount; group["priceEach"] = totalGroupPrice; group["discountAmountEach"] = discountAmount; html += ""; $.each(group.products, function (p, product) { $.each($store._eventInfo.products, function (j, eventProduct) { if (eventProduct.eventProductId == product.eventProductId) { html += " "; html += " "; if (p == 0) { html += ""; } html += " "; html += " "; } }); }); html += "
" + eventProduct.name + " (" + product.quantity + " count)"; html += "" + symbol + parseFloat(totalGroupPrice).toFixed(2) + "" + symbol + parseFloat(discountPrice).toFixed(2); html += "
"; html += (isExclusive && isGroups && canAddDiscountCode ? "
" : ""); html += $store._store.inputs.number("g-" + group.eventDiscountCodeGroupId, (isExclusive && isCollection ? 1 : 0) + "", "str-item-quantity str-override " + (isExclusive ? "str-hidden" : ""), (group.hasOwnProperty("maxQuantity") ? group.maxQuantity : undefined)); html += "
"; html += "
" + eventProduct.description + "
"; } // ########################################################################################################################## // ########################################################################################################################## // ########################################################################################################################## else { $.each(group.products, function (p, product) { $.each($store._eventInfo.products, function (j, eventProduct) { if (eventProduct.eventProductId == product.eventProductId) { var price = parseFloat($store.productPrice(eventProduct)); var discountAmount = (isPercentage ? price * code.price / 100 : code.price); var discountPrice = price - discountAmount; product["priceEach"] = price; product["discountAmountEach"] = discountAmount; html += ""; html += " "; html += " "; html += " "; html += " "; html += " "; html += "
" + eventProduct.name + " (" + (product.hasOwnProperty("maxQuantity") ? "up to " + product.maxQuantity : product.quantity + " count") + ")" + ""; html += (!isCollection ? "" + symbol + parseFloat(price).toFixed(2) + "" + symbol + parseFloat(discountPrice).toFixed(2) : ""); html += "
"; html += $store._store.inputs.number("p-" + product.eventProductId, 0 + "", "str-item-quantity str-override", (product.hasOwnProperty("maxQuantity") ? product.maxQuantity : undefined)); html += "
"; html += "
" + eventProduct.description + "
"; } }); }); } // ########################################################################################################################## // ########################################################################################################################## // ########################################################################################################################## html += "
"; }); } // ############################################################################################################################## // ############################################################################################################################## // ############################################################################################################################## // ############################################################################################################################## // ############################################################################################################################## // ############################################################################################################################## html += "
"; html += "
"; html += "
"; html += ""; html += ((isExclusive && isGroups) || !canAddDiscountCode ? "" : ""); html += "
"; //------------------------------------------------------------ //--- DEBUG //------------------------------------------------------------ if (this.debug) { html += "
"; html += " " + code.exclusive + " :: "; html += " " + code.discountCodeAmountType + " :: "; html += " " + code.applyTo + " :: "; html += " " + code.applyToType + ""; html += "
"; html += "
HAVE CODES: " + haveCodes + " :: HAVE EXCLUSIVE CODES: " + haveExclusiveCode + " :: IS EXCLUSIVE: " + isExclusive + " :: CAN ADD DISCOUNT: " + canAddDiscountCode + "
"; html += "
" + JSON.stringify(code, null, 2) + "
"; } //------------------------------------------------------------ //--- DEBUG //------------------------------------------------------------ $("#str-navigation-title").html("Promo Code - " + code.code.toUpperCase()); $("[data-store-section='code']").html(html); } else { html += "
enter your promo code below and press continue
"; html += "
"; html += "
"; $("#str-navigation-title").html("Promo Code"); $("[data-store-section='code']").html(html); $(".str-section:visible").hide(); $("[data-store-section='code']").show(); $("#str-code").focus(); if (codeInput.length > 0) { $store.processCode(); } } }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ productPrice: function (product) { var different = false; var symbol = $store._eventInfo.currency.symbol; var price = product.price; if (price == undefined) { $.each(product.variations, function (v, variation) { if (price != undefined) { different |= price != variation.price; } price = (price == undefined || parseFloat(price) > parseFloat(variation.price) ? variation.price : price); }); } return price; }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ processCode: function (_code, _groupid) { this.renderError(); // ########################################################################################################################## // ########################################################################################################################## if (_code) { console.clear(); console.info("--- processCode :: CODE ----------------------------------------"); console.info(_code); console.info(_groupid); $.each($store._eventInfo.codes, function (i, __code) { if (__code.code == _code) { var code = JSON.parse(JSON.stringify(__code)); var discountCodes = $store._store.codes(); console.info(discountCodes); console.info(code); var isAmount = code.discountCodeAmountType == "AMOUNT"; var isPercentage = code.discountCodeAmountType == "PERCENTAGE"; var isExclusive = code.exclusive == "EXCLUSIVE"; var isEach = code.applyTo == "EACH"; var isCollection = code.applyTo == "COLLECTION"; var isDefault = code.applyToType == "DEFAULT"; var isGroups = code.applyToType == "GROUPS"; discountCodes[_code] = code; if (isExclusive) { $.each(code.groups, function (g, group) { if (_groupid == undefined || _groupid == group.eventDiscountCodeGroupId) { group["count"] = 1; $.each(group.products, function (p, product) { product["count"] = product.quantity; }); } else { delete group["count"]; } }); } else { console.info(code.exclusive); $.each(code.groups, function (g, group) { console.info("--- GROUP " + g + "-----------------------"); var groupCount = $("[data-form-item-id='g-" + group.eventDiscountCodeGroupId + "']").val(); if (!isNaN(groupCount)) { groupCount = parseInt(groupCount); group["count"] = parseInt(groupCount); } var groupHasCount = group.hasOwnProperty("count"); $.each(group.products, function (p, product) { console.info("--- PRODUCT " + product.eventProductId + "-----------------------"); if (groupHasCount) { product["count"] = product.quantity; } else { var productCount = $("[data-form-item-id='p-" + product.eventProductId + "']").val(); if (!isNaN(productCount)) { productCount = parseInt(productCount); if (productCount > 0) { product["count"] = (product.hasOwnProperty("maxQuantity") && product.maxQuantity < productCount ? product.maxQuantity : productCount); } } } if (product.hasOwnProperty("count") && !group.hasOwnProperty("count")) { group["count"] = 1; } }); }); } $store._store.codes(discountCodes); } }); $("[data-store-section='code']").html(""); $store.back("code"); } // ########################################################################################################################## // ########################################################################################################################## else { console.info("--- processCode :: INPUT ----------------------------------------"); var val = $("#str-code").val().toUpperCase(); var code = null; $.each($store._eventInfo.codes, function (i, c) { if (c.code.toUpperCase() == val) { code = c; } }); if (code != null) { $store.renderCode(code); return; } this.renderError("The promo code you entered is not valid."); } // ########################################################################################################################## // ########################################################################################################################## }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ clearCode: function (code) { var codes = $store._store.codes(); delete codes[code]; $store._store.codes(codes); $("[data-store-section='code']").html(""); $store.back("code"); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderInfo: function () { if ($("[data-store-section='info']").length == 0) { return "
"; } console.info("--- renderInfo ----------------------------------------"); var symbol = $store._eventInfo.currency.symbol; var accountInfos = this._storage.store("accountInfos"); var infos = this._store.infos(); var html = "
specify information for each ticket below
"; html += "
" + this._form.required() + "
"; html += "
"; $.each(infos, function (ii, info) { for (var i = 0; i < info.quantity; i++) { var price = info.price; var different = false; var accountInfo = accountInfos[info.eventProductId]; accountInfo = (accountInfo && accountInfo.length > i ? accountInfo = accountInfo[i] : null); if (info.variations) { $.each(info.variations, function (v, variation) { if (variation.price) { if (price != undefined) { different |= price != variation.price; } else { price = variation.price; } } }); $.each(info.variations, function (v, variation) { price = (price == undefined || price > variation.price ? variation.price : price); }); } price = (different ? "from " : "") + symbol + price; html += ""; html += " "; html += " "; html += " "; html += " "; html += ""; if (info.variations) { var options = null; var value = (accountInfo && accountInfo["variation"] ? accountInfo["variation"] : ""); $.each(info.variations, function (v, variation) { options += ""; }); html += ""; html += ""; } if (info.form) { $.each(info.form.parts, function (pi, part) { part["product"] = info.name; var datas = undefined; if (info.uniqueAccount && part.key == "emailAddress") { datas = { "unique": "emailAddress" }; } html += ""; html += ""; }); } if (info.options) { $.each(info.options, function (oi, eventProductOption) { html += ""; if (eventProductOption.productType == "Option") { var price = eventProductOption.price; var different = false; $.each(eventProductOption.variations, function (v, variation) { if (variation.price) { if (price != undefined) { different |= price != variation.price; } else { price = variation.price; } } }); var value = (accountInfo && accountInfo[eventProductOption.eventProductId] ? accountInfo[eventProductOption.eventProductId] : ""); var options = null; if (eventProductOption.requireResponse != true) { options += ""; } $.each(eventProductOption.variations, function (v, variation) { options += ""; }); html += ""; } }); } if (i == 0 && info.quantity > 1) { html += ""; } html += "
" + info.name + (info.quantity > 1 ? " #" + (i + 1) : "") + (info.uniqueAccount ? "(one per email address)" : "") + "" + price + "
" + (info.variationLabel ? info.variationLabel : "Choose a ticket").toLowerCase() + "
" + $store._store.inputs.choice(info.eventProductId, i + 1, options) + "
" + part.name.toLowerCase() + "
" + $store._form.render(info.eventProductId, i + 1, part, (accountInfo && accountInfo[part.key] ? accountInfo[part.key] : ""), datas) + "
" + (eventProductOption.variationLabel ? eventProductOption.variationLabel : eventProductOption.name).toLowerCase() + "
" + $store._store.inputs.choice(info.eventProductId, i + 1, options, undefined, eventProductOption.eventProductId) + "
"; } html += "
" }); html += "
"; html += $store.renderFbPixel("AddToCart"); $("[data-store-section='info']").html(html); setTimeout($store._form.validate, 500); }, renderGGEvent: function (event, price, comment) { if (event == "PurchaseComplete") { if ($store._eventInfo.hasOwnProperty("attributes") && $store._eventInfo.attributes.hasOwnProperty("ggGTMPurchaseComplete")) { var ggGTMPurchaseComplete = $store._eventInfo.attributes.ggGTMPurchaseComplete; console.info("renderGGEvent :: " + event + " :: " + ggGTMPurchaseComplete); /*************** GTM -- Google Tag Manager ***************/ (function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'}); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', ggGTMPurchaseComplete); /*************** GTM -- Google Tag Manager ***************/ } } }, renderFbPixel: function (event, price, comment) { if (comment == undefined) { comment = ""; } console.info("renderFbPixel :: " + event + " :: " + comment); if (event != "AddToCart" || (event == "AddToCart" && comment != "")) { $store._store.activity.record(event, comment); } if ($store._eventInfo.hasOwnProperty("attributes") && $store._eventInfo.attributes.hasOwnProperty("fbPixel")) { var args = "&dl=" + encodeURIComponent(window.location.href); if (event == "Purchase" && price != undefined) { args = "&cd[currency]=" + encodeURIComponent($store._eventInfo.currency.code.toUpperCase()) + "&cd[value]=" + encodeURIComponent(price); } return ""; } return ""; }, copyInfos: function (id, quantity) { $("[data-form-item-id='" + id + "'][data-form-item-index='1']").each(function () { for (var index = 2; index < quantity + 1; index++) { $("[data-form-item-id='" + id + "'][data-form-item-index='" + index + "'][data-form-item-name='" + $(this).data("formItemName") + "']").val($(this).val()); } }); $store._form.validate(); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderCart: function () { //console.clear(); console.info("--- renderCart ----------------------------------------"); if ($("[data-store-section='cart']").length == 0) { return "
"; } var cart = this._store.cart(); var codes = $store._store.codes(); var html = ""; var symbol = "$"; var subtotal = 0.0; var discount = 0.0; var fee = 0.0; var tax = 0.0; var total = 0.0; var cartItemInfo = {}; var billingName = undefined; var billingEmail = undefined; var billingPhone = undefined; html += "
Cart
"; html += ""; $.each(cart, function (i, item) { $store.renderFbPixel("AddToCart", undefined, item.name); if (item.hasOwnProperty("accountInfo")) { if (billingName == undefined && item.accountInfo.hasOwnProperty("name") && item.accountInfo.name != null && item.accountInfo.name.trim().length > 0) { billingName = item.accountInfo.name; } if (billingEmail == undefined && item.accountInfo.hasOwnProperty("emailAddress") && item.accountInfo.emailAddress != null && item.accountInfo.emailAddress.trim().length > 0) { billingEmail = item.accountInfo.emailAddress; } if (billingPhone == undefined && item.accountInfo.hasOwnProperty("phoneNumber") && item.accountInfo.phoneNumber != null && item.accountInfo.phoneNumber.trim().length > 0) { billingPhone = item.accountInfo.phoneNumber; } } if (!cartItemInfo.hasOwnProperty(item.eventProductId)) { cartItemInfo[item.eventProductId] = { quantity: 0, price: 0.0 }; } cartItemInfo[item.eventProductId].quantity++; cartItemInfo[item.eventProductId].price += parseFloat(item.price); cartItemInfo[item.eventProductId].unitPrice = parseFloat(item.price); symbol = item.symbol; subtotal += item.price; fee += item.fee; var eventProductOptionsHtml = ""; if (item.productOptionsInfos) { eventProductOptionsHtml += "
"; $.each(item.productOptionsInfos, function (j, productOptionsInfo) { eventProductOptionsHtml += "
" + productOptionsInfo.label + "
"; }); eventProductOptionsHtml += "
" } html += "" + "" + "" + ""; }); $.each($store._store.codes(), function (c, code) { if (code.haveProducts) { $.each(code.groups, function (g, group) { if (group.hasOwnProperty("count") && group.count > 0) { if (group.hasOwnProperty("priceEach")) { discount += group.count * group.discountAmountEach; } else { $.each(group.products, function (p, product) { if (product.hasOwnProperty("count")) { discount += group.count * product.count * product.discountAmountEach; } }); } } }); } else { discount += (code.discountCodeAmountType == "AMOUNT" ? code.price : subtotal * code.price / 100); } }); storeInfo = $store._storage.store("store-info"); var haveBalance = parseFloat(subtotal - discount) > 0.00; subtotal = parseFloat(subtotal).toFixed(2); discount = parseFloat(discount).toFixed(2); fee = (haveBalance ? parseFloat(fee).toFixed(2) : "0.00"); tax = parseFloat((parseFloat(subtotal) - parseFloat(discount) + parseFloat(fee)) * (parseFloat(storeInfo.salesTax) / 100)).toFixed(2); total = parseFloat(parseFloat(subtotal) - parseFloat(discount) + parseFloat(fee) + parseFloat(tax)).toFixed(2); html += ""; html += ""; html += (discount > 0.0 ? "" : ""); html += (fee > 0.0 ? "" : ""); html += (tax > 0.0 ? "" : ""); html += ""; html += ""; html += "
" + item.name + eventProductOptionsHtml + "" + symbol + " " + parseFloat(item.price).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "
SUBTOTAL" + symbol + " " + subtotal.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "
DISCOUNT" + symbol + " " + parseFloat(discount * -1).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "
CONVENIENCE FEE" + symbol + " " + fee.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "
TAX" + symbol + " " + tax.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "
TOTAL" + symbol + " " + total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "
"; html += $store.renderFbPixel("InitiateCheckout"); $store._storage.store("store-totals", { subtotal: subtotal, discount: discount, fee: fee, tax: tax, total: total }); $("[data-store-section='cart']").html("
" + html + "" + this.renderPayment(billingName, billingEmail, billingPhone) + "
"); if (haveBalance) { $store._store.paymentService.populate(); } setTimeout($store._form.validate, 500); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ _paymentFields: [{ "ordering": 1, "formPartType": "text", "name": "Name on Credit Card", "choices": [], "required": true, "key": "name" }, { "ordering": 2, "formPartType": "email", "name": "e-mail address", "choices": [], "required": true, "key": "emailAddress" }, { "ordering": 3, "formPartType": "phone", "name": "cellphone number", "choices": [], "required": true, "key": "phoneNumber" }], _purchaseFields: [{ "ordering": 1, "formPartType": "text", "name": "full name", "choices": [], "required": true, "key": "name" }, { "ordering": 2, "formPartType": "email", "name": "e-mail address", "choices": [], "required": true, "key": "emailAddress" }, { "ordering": 3, "formPartType": "phone", "name": "cellphone number", "choices": [], "required": true, "key": "phoneNumber" }], renderPayment: function (billingName, billingEmail, billingPhone) { $store.processingPayment = false; var html = ""; var haveBalance = parseFloat($store._storage.store("store-totals").total) > 0.00; $.each((haveBalance ? this._paymentFields : this._purchaseFields), function (pi, part) { var val = ""; switch (part.key) { case "name": val = (billingName != undefined ? billingName : ""); break; case "emailAddress": val = (billingEmail != undefined ? billingEmail : ""); break; case "phoneNumber": val = (billingPhone != undefined ? billingPhone : ""); break; } html += "" + part.name.toLowerCase() + ""; html += "" + $store._form.render("paymentInfo-" + part.key, 0, part, val) + ""; }); if (haveBalance) { html += "credit card information"; /*html += "
";*/ html += "" + $store._store.paymentService.render() + ""; } $store._store.processPurchase("-bob-"); return "
" + (haveBalance ? "Payment Information" : "Purchase Information") + "
" + "
" + this._form.required() + "
" + "" + html + "
" + "
" + "
- processing purchase -
"; }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ processPayment: function () { if ($store._form.validate()) { console.warn("--- processPayment :: IN -------------------------------------------------------"); var haveBalance = parseFloat($store._storage.store("store-totals").total) > 0.00; $("#str-buttons-payment").hide(); $("#str-message-payment").show(); if (haveBalance) { console.info(haveBalance); $store._store.paymentService.token(); } else { $store._store.processPurchase(); } console.warn("--- processPayment :: OUT -------------------------------------------------------"); } else { this.renderError("Provide all required payment information."); } }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderCompleted: function () { if ($("[data-store-section='cart']").length == 0) { return "
"; } var html = ""; html += "
"; html += "
Thank you for your purchase!
"; html += "
Your order has been successfully processed.
"; html += "
Your order number is " + $store._eventInfo.receipt.id + ".
"; html += "
View/Print Your Receipt
"; html += "
You should receive an email with your event check-in details and purchase receipt within the next 5 minutes. If you do not, please check your Spam folder! Mark the email as safe if it landed there so your check-in details are easily accessible in your inbox for the event.
"; html += "
If you do not receive an email from us, please email info@bridescan.com for assistance.
"; html += "
We hope you enjoy the event!
"; html += "
"; html += "
"; html += $store.renderFbPixel("Purchase", $store._storage.store("store-totals").total); $("[data-store-section='completed']").html(html); $store.renderGGEvent("PurchaseComplete"); $store._storage.store("store", {}); $store._storage.store("accountInfos", {}); $store._store.codes({}); }, formatDates: function (json, which, pre) { if (json) { var start = (json.hasOwnProperty("availableStartDate") && (which == null || which == "availableStartDate") && json.availableStartDate != null ? json.availableStartDate : (json.hasOwnProperty("startDate") && json.startDate != null ? json.startDate : null)); var end = (json.hasOwnProperty("availableEndDate") && (which == null || which == "availableStartDate") && json.availableEndDate != null ? json.availableEndDate : (json.hasOwnProperty("endDate") && json.endDate != null ? json.endDate : null)); if (start == null && which != undefined) { start = json[which]; end = json[which]; } if ((start != null && !start.hasOwnProperty("year")) || (end != null && !end.hasOwnProperty("year"))) { return ""; } if (start != null && end != null) { if (start.year.name == end.year.name) { if (start.month.id == end.month.id) { if (start.day.id == end.day.id) { return "" + start.month.short + " " + start.day.name + ", " + start.year.name + ""; } else { return "" + start.month.short + " " + start.day.name + "-" + end.day.name + ", " + start.year.name + ""; } } else { return "" + start.month.short + " " + start.day.name + " - " + end.month.short + " " + end.day.name + ", " + end.year.name + ""; } } else { return "" + start.month.short + " " + start.day.name + ", " + start.year.name + " - " + end.month.short + " " + end.day.name + ", " + end.year.name + ""; } } else if (start != null) { return "" + (pre != undefined ? pre : "from") + " " + start.month.short + " " + start.day.name + ", " + start.year.name + "" } else if (end != null) { return "" + (pre != undefined ? pre : "until") + " " + end.month.short + " " + end.day.name + ", " + end.year.name + "" } return "no dates available"; } }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ render: function (type) { console.info("--- render :: " + type); switch (type) { //--------------------------------------------------------------------------------------------------- case "receipt": this.next(); $("#str-message-payment").hide(); $("#str-buttons-payment").show(); break; case "error": this.renderError("Error occurred processing payment. " + $store._eventInfo.error.error); $("#str-message-payment").hide(); $("#str-buttons-payment").show(); break; case "uniqueCheck": if ($store._eventInfo.uniqueCheck.status != "success") { this.renderError($store._eventInfo.uniqueCheck.status); } else { $store.nextTo("cart", "Checkout"); $store.renderCart(); } break; } }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ content: function (html) { $("#store-" + $store._conf._eventKey).html("
" + html + "
"); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ data: function (type, data) { console.info("--- data :: " + type); console.info(data); this._eventInfo[type] = data; this.render(type); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ // @formatter:off style: { ".str": "max-width: 98%;width: 800px;margin:1% auto;border: 2px solid #aaa;border-radius: 7px;padding: 20px;background-color:#fff;color:#333;", ".str, .str *": "font:12pt Arial;", ".str a": "color:inherit !important;font-size:inherit !important;", ".str table": "border-spacing: 0px;border-collapse: separate;width:100%;", ".str table tr td": "border:0px;padding:2px;text-align:left;", ".str img": "max-width:98%;margin:1px 1%;border-radius:4px;", ".str .fa": "font-size:120%;margin-right:7px;width:15px;text-align:center;", ".str button": "text-align:center;color:inherit;border:1px solid #aaa;background-color:#eee;font-size:90%;border-radius:3px;padding:1px 10px;cursor:pointer;", ".str input, .str select": "padding:10px 2%;width:96% !important;border:1px solid #bbb;border-radius:3px;color:#333", ".str .str-hidden": "display:none;", ".str .str-buttons": "text-align:center;padding-top:10px;", ".str .str-buttons button,.str .str-buttons-button": "padding:10px 30px;margin:5px 3px;", ".str .str-buttons button.str-back": "border:1px solid #ccc;background-color:#fff;", ".str .str-buttons-remove button": "padding:10px 20px;margin:10px;color:#900;background-color:rgba(200,0,0,.08);", ".str .str-message": "display:none;text-align:center;padding:20px;font-style:italic;color:rgb(200,0,0);font-size:90%;", ".str .str-event-info": "text-align:center;background-color:#999;color:#fff;margin:auto;margin-top:-21px;margin-bottom:10px;max-width:85%;font-size:70%;padding:5px; border-radius:0 0 7px 7px;", ".str .str-event-info>div": "text-align:center;font-size:70%;font-style:italic;margin-top:3px;display:none;", ".str .str-navigation": "width:100%;border-bottom:1px solid #999;margin-bottom:10px;padding-bottom:5px;", ".str .str-navigation tr td": "text-align:center;padding:4px;", ".str .str-navigation tr td.str-title": "font-size:120%;", ".str .str-navigation tr td:first-child, .str .str-navigation tr td:last-child": "width:30px;", ".str .str-error": "text-align:center;border:1px solid rgba(200,0,0,.1);border-radius:5px;background-color:rgba(200,0,0,.05);color:rgb(200,0,0);padding:5px;font-style:italic;font-size:85%;margin-bottom:5px;display:none;", ".str .str-instructions": "font-size:75%;text-align:center;font-style:italic;color:#aaa;padding:5px;", ".str .str-item-exclusive": "color:#900;background-color:rgba(200,0,0,.08);margin:5px 15px;padding:5px 10px;font-style:italic;font-size:65%;display:inline-block;border-radius:5px;", ".str .str-item-exclusive.full": "font-size:90%;display:block;text-align:center;padding:10px;", ".str .str-section": "display:none", ".str .str-section-heading": "font-size:120%;margin:20px 2px 2px 2px;", ".str .str-section-heading:first-child": "margin-top:2px", ".str .str-tickets": "border:1px solid #ccc;border-radius:5px;", ".str .str-ticket": "border-width:0px;border-top:1px solid #ccc;width:98%;cursor:pointer;margin:5px;padding:5px;", ".str .str-ticket:first-child": "border-top:none;", ".str .str-ticket:hover": "background-color:#f8f8f8;", ".str .str-ticket-group": "border: 1px solid #ccc;padding: 5px;border-radius: 5px;margin:20px 0;", ".str .str-ticket .str-item-name": "font-size:130%;padding:10px;", ".str .str-ticket .str-item-count": "font-size:70%;padding-left:10px;opacity:.8;font-style:italic;", ".str .str-ticket .str-item-unique": "font-size:75%;margin-left:5px;font-style:italic;", ".str .str-ticket .str-item-price": "white-space:nowrap;text-align:right;font-size:130%;padding:10px;vertical-align:top;width:1%;", ".str .str-ticket .str-item-price span": "font-size:70%;color:#999;", ".str .str-ticket .str-item-price div": "font-size:70%;color:#555;", ".str .str-ticket .str-item-price-discount": "white-space:nowrap;text-align:right;font-size:150%;padding:10px;vertical-align:top;width:1%;", ".str .str-ticket .str-item-price-discount > *": "opacity:.7", ".str .str-ticket .str-item-description": "padding:5px 15px 0 15px;font-size:85%;font-style:italic;color:#777;", ".str .str-ticket .str-item-description *": "font-size:inherit;font-style:inherit;", ".str .str-ticket .str-item-description > *": "max-width:98%;", ".str .str-ticket .str-item-description .str-item-quantity": "text-align:center;max-width:80px;font-size:120%;", ".str .str-ticket .str-item-heading": "padding:5px 15px 0 15px;font-size:85%;font-style:italic;color:#777;", ".str .str-item-items": "padding:10px 0 10px 15px;", ".str .str-item-items>div": "font-weight:bold;", ".str .str-item-items>div>span": "font-weight:normal;font-size:70%;margin-left:10px;font-style:italic;", ".str .str-item-items>div>div": "font-weight:normal;color:#777", ".str .str-item-items>div>div>p": "margin:0px 10px;font-size:85%;", ".str .str-code-link": "text-align:right;cursor:pointer;", ".str .str-code": "padding:10px;text-align:center;", ".str .str-code input": "text-align:center;", ".str .str-item-label": "width:100%;font-size:85%;font-style:italic;padding:7px 7px 3px 7px;color:#999;", ".str .str-item-text": "width:100%;", ".str .str-item-full>*": "width:100%;", ".str .str-item-shaded": "background-color:#f0f0f0;", ".str .str-divider": "border-top:1px solid #aaa;padding:0px;", ".str .str-cart": "font-size:90%;font-weight:normal;border:1px solid #ccc;border-radius:5px;padding:10px;", ".str .str-sub-heading": "font-size:120%;border-bottom:1px solid #aaa;padding:5px;background-color:#eee;text-align:center;margin-top:15px;", ".str .str-sub-heading:first-child": "margin-top:0px;", ".str .str-cart .str-cart-item-first .str-cart-item": ";border-top:none;", ".str .str-cart .str-cart-item": "padding:3px;border-top:1px solid #ccc;", ".str .str-cart .str-cart-item-name": "", ".str .str-cart .str-cart-item-price": "text-align:right;white-space:nowrap;width:1%;padding-right:3px;", ".str .str-cart .str-cart-total": "white-space:nowrap;width:1%;font-size:90%;text-align:right;padding-right:5px;padding-left:25px;font-size:70%;color:#999;", ".str .str-completed div": "margin:10px 0;", ".str .str-completed .str-completed-thankyou": "font-size:120%;", ".str .str-completed .str-completed-order-number": "font-size:120%;font-weight:bolder;", ".str .str-completed .str-completed-receipt": "border:1px solid #aaa;padding:10px;display:inline-block;text-decoration: none;margin:15px;", ".str .str-completed .str-completed-instruction": "font-size:85%;", ".str .str-completed .str-completed-enjoy": "font-size:120%;font-weight:bold;color:#111;text-align:center;", ".str .str-form-item-required": "background-color:rgba(221, 119, 0, .05);border:1px solid #aaa;", ".str-card-elements > div": "border:1px solid #999;border-radius: 4px;background-color: white;box-shadow: none;width:15% !important;display:inline-block;margin:1px;", "#pay-theory-credit-card-number": "width:50% !important;", ".str-card-elements > div .field-wrapper > iframe": "height:35px;", ".str .StripeElement ": "box-sizing: border-box;padding: 13px;border: 1px solid #999;border-radius: 4px;background-color: white;box-shadow: none;-webkit-transition: box-shadow 150ms ease;transition: box-shadow 150ms ease;", ".str .StripeElement--focus ": "box-shadow: none", ".str .StripeElement--invalid ": "border-color: #fa755a;", ".str .StripeElement--webkit-autofill ": " background-color: #fefde5 !important;", }, css: function () { var css = ""; $.each(this.style, function (k, v) { css += k + "{" + v + "} "; }); $("").appendTo("head"); }, // @formatter:on //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ // @formatter:off _eventInfo: { "codes": [], "paymentService": { "uid": "acct_1ODWNsHRkPYOQOvl", "jsApiUrl": "https://js.stripe.com/v3/", "name": "Stripe", "active": false, "serviceInstanceId": 23, "publicKey": "pk_live_7nlSMNC5CczWf6uwLsZ6Khhs", "serviceId": 21 }, "currency": { "symbol": "$", "code": "usd", "dollarAmount": "0.00", "name": "USD ($)", "id": 1, "percentageAmount": "0.000" }, "attributes": { "mapsAllowed": "false", "fbPixel": "577895697795985", "makeAuthApiKey": "mamwSmjQ9mb8wfCE1Fj4zrqO2ujGmeWYozke" }, "salesTax": "0.000", "storeProductOrdering": "priceDescendingNameAscending", "event": { "eventId": 1704, "name": "The Tulsa Wedding Show Jan 3, 2026", "producer": { "phone": "+1 (918) 810-7097", "name": "The Tulsa Wedding Show", "email": "hello@thetulsaweddingshow.com" }, "startDate": "January 3, 2026 @ 4:00PM" }, "eventStoreFee": "Processing Fee", "enabled": true, "eventStoreButton": "buy tickets", "products": [ { "variationLabel": "", "maxPurchaseQuantity": 0, "ordering": 1, "requireResponse": false, "description": "

The <\/strong>VIB Elite Preview Event<\/strong><\/a> includes all of the benefits of The Tulsa Wedding Show, PLUS:<\/u><\/em><\/strong><\/p>