store = { init: function () { this.initialize(); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ 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").html(JSON.stringify(this._eventInfo, null, 2)); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ 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 = ""; 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.renderPayment(); html += this.renderCompleted(); this.content(html); html += this.renderTickets(); }, //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ renderEvent: function () { return "
" + " |
" + ticket.name + " | "; html += "" + price + " | "; html += "
" + this._store.inputs.number(ticket.eventProductId, index + "", "str-item-quantity str-override") + " | |
" + ticket.description + " |
" + code.code.toUpperCase() + " | "; html += "" + discount + (info ? "" : "") + " | "; html += "
" + this._store.inputs.number(code.code, (info ? info.quantity : 1), "str-item-quantity str-override") + " | |
" + code.description + " | |
" + (each ? "applies to" : "includes") + ": | |
";
$.each(code.eventProducts, function (i, ep) {
$.each($store._eventInfo.products, function (j, p) {
if (p.eventProductId == ep.eventProductId) {
html += " " + p.name + (ep.hasOwnProperty("quantity") ? "(" + (each ? "up to " + ep.quantity : ep.quantity + " count") + ")" : "") + " ";
}
});
});
html += "" + p.description + " |
" + info.name + (info.quantity > 1 ? " #" + (i + 1) : "") + (info.uniqueAccount ? "(one per email address)" : "") + " | "; html += "" + price + " | "; html += "
" + (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) + " | |
Not sure if you can attend? <\/strong><\/p> Come meet with area's top wedding professionals ready to help you plan the day of your dreams!<\/strong><\/p>", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "0.00", "dollarAmountOther": "1.50", "name": "(1.50)", "percentageAmount": "0.000", "percentageAmountOtherType": "default" }, "productType": "Ticket" }, { "variationLabel": "", "maxPurchaseQuantity": 0, "requirePhone": true, "requireEmail": true, "price": "7.00", "variations": [], "eventProductId": 5483, "name": "Guest Ticket", "description": " Wedding Expo: General Exhibitor Admission from 11:00 AM to 3:00 PM. Meet with area's top wedding professionals ready to help you plan the day of your dreams!<\/strong><\/p>", "requireName": true, "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "0.00", "dollarAmountOther": "1.50", "name": "(1.50)", "percentageAmount": "0.000", "percentageAmountOtherType": "default" }, "productType": "Ticket" }, { "variationLabel": "", "maxPurchaseQuantity": 0, "form": { "code": "dbd054aaa69ae", "stage": "", "formTypeId": 1, "parts": [ { "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": "email", "name": "e-Mail Address Verify", "choices": [], "required": true, "key": "emailAddressVerify" }, { "ordering": 4, "formPartType": "phone", "name": "Phone Number", "choices": [], "required": true, "key": "phoneNumber" }, { "ordering": 5, "formPartType": "choice", "name": "Have Wedding Date?", "choices": [ { "aux1": "", "ordering": 1, "label": "Yes", "value": "true" }, { "aux1": "", "ordering": 2, "label": "No", "value": "false" } ], "required": true, "key": "weddingDateProvided" }, { "parentKey": "weddingDateProvided", "ordering": 6, "formPartType": "date", "name": "Wedding Date", "choices": [], "parentChoiceKey": "true", "required": true, "key": "weddingDate" } ], "name": "Store Default", "key": "storeAttendeeInfo" }, "price": "22.00", "variations": [], "formName": "storeAttendeeInfo", "eventProductId": 5482, "name": "VIP Bride, Groom or Partner Ticket", "description": " First in line entry. Premium seating at our Fashion Show - Doors open at 9:15. Fashion Show starts at 10:00. Enjoy Bottomless mimosas [21 years and older, bring ID] Proudly wear your <\/strong>VIP<\/em><\/strong> <\/strong>Engaged<\/em><\/strong> sash or lanyard through the show! There will be Fashion Inspiration, VIP Specials, Giveaways + Swag Bag for each couple! Then we will have a <\/strong>VIP<\/em><\/strong> <\/strong>Parade<\/em><\/strong> into the exhibitor area where you can be the first to mingle & plan your wedding with top wedding professionals and more!<\/strong> <\/strong><\/p>", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "0.00", "dollarAmountOther": "1.50", "name": "(1.50)", "percentageAmount": "0.000", "percentageAmountOtherType": "default" }, "productType": "Ticket" }, { "variationLabel": "", "maxPurchaseQuantity": 0, "form": { "code": "f15aa76edfaa0", "stage": "", "formTypeId": 1, "parts": [ { "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": 4, "formPartType": "phone", "name": "Phone Number", "choices": [], "required": true, "key": "phoneNumber" } ], "name": "Store Default Inline", "key": "storeAttendeeInfoInline" }, "price": "22.00", "variations": [], "formName": "storeAttendeeInfoInline", "eventProductId": 5484, "name": "VIP Guest Ticket", "description": " First in line entry. Premium seating at our Fashion Show - Doors open at 9:15. Fashion Show starts at 10:00. Enjoy Bottomless mimosas [21 years and older, bring ID] Proudly wear your <\/strong>VIP<\/em><\/strong> <\/strong>Engaged<\/em><\/strong> sash or lanyard through the show! There will be Fashion Inspiration, VIP Specials, Giveaways + Swag Bag for each couple! Then we will have a <\/strong>VIP<\/em><\/strong> <\/strong>Parade<\/em><\/strong> into the exhibitor area where you can be the first to mingle & plan your wedding with top wedding professionals and more!<\/strong> <\/strong><\/p>", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "0.00", "dollarAmountOther": "1.50", "name": "(1.50)", "percentageAmount": "0.000", "percentageAmountOtherType": "default" }, "productType": "Ticket" } ] },
_conf: { _uri:"https://www.bridescan.com", _authKey:"mwe", _eventKey:"springfield" },
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
_store: { init: function (storeInfo) { if (!this.initialized) { console.info("### STORE :: init"); $("head").append(""); $.each(storeInfo.products, function (i, p) { if (p.hasOwnProperty("variations") && p.variations.length == 0) { delete p.variations; } }); $store._storage.store("store-info", storeInfo); $store._storage.store("store", {}); this["initialized"] = true; setTimeout(this.stripe.init, 2000); } }, update: function () { console.clear(); console.info("### STORE :: update :: " + this._eventKey); var store = $store._storage.store("store"); var codes = $store._store.codes(); $("[data-store='" + this._eventKey + "']").each(function () { var id = $(this).data("formItemId"); var index = $(this).data("formItemIndex"); var name = $(this).data("formItemName"); var val = $(this).val(); if (!codes.hasOwnProperty(id)) { if (val != 0 && val.length == 0) val = null; if (!store.hasOwnProperty(id)) { store[id] = {id: id}; } if (index) { if (!store[id].hasOwnProperty("infos")) { store[id]["infos"] = {}; } if (!store[id].infos.hasOwnProperty(index)) { store[id].infos[index] = {}; } if (val) store[id].infos[index][name] = val; else delete store[id].infos[index][name]; } else { if (val) store[id][name] = val; else delete store[id][name]; } } }); $("[data-store='" + this._eventKey + "']").each(function () { var id = $(this).data("formItemId"); var val = $(this).val(); if (codes.hasOwnProperty(id)) { codes[id].quantity = parseInt(val); if (codes[id].quantity == 0) { delete codes[id]; } else { var code = undefined; $.each($store._eventInfo.codes, function (i, c) { if (id == c.code) code = c; }); if (code && code.applyTo == "COLLECTION") { $.each(code.eventProducts, function (i, p) { if (!store.hasOwnProperty(p.eventProductId)) { store[p.eventProductId] = {id: p.eventProductId, quantity: 0}; } store[p.eventProductId].quantity = parseInt(store[p.eventProductId].quantity) + (parseInt(val) * parseInt(p.quantity)); }); } } $store._store.codes(codes) } }); $store._storage.store("store", store); accountInfos = {}; $.each(store, function (i, item) { if (item.hasOwnProperty("infos")) { $.each(item.infos, function (i, info) { var accountInfo = JSON.parse(JSON.stringify(info)); if (!accountInfos.hasOwnProperty(item.id)) { accountInfos[item.id] = []; } accountInfos[item.id].push(accountInfo); }); } }); if (Object.keys(accountInfos).length > 0) { $store._storage.store("accountInfos", accountInfos); } }, infos: function () { var products = []; var storeInfo = $store._storage.store("store-info"); var store = $store._storage.store("store"); $.each(store, function (id, item) { if (item.quantity > 0) { var product = null; $.each(storeInfo.products, function (ip, p) { if (p.eventProductId == id) product = p; }); if (product && (product.hasOwnProperty("form") || product.hasOwnProperty("variations"))) { console.info(product); var p = {eventProductId: product.eventProductId, variationLabel: product.variationLabel, name: product.name, price: product.price, quantity: item.quantity, form: product.form}; if (product.hasOwnProperty("variations")) { p["variations"] = product.variations; } if (product.hasOwnProperty("uniqueAccount")) { p["uniqueAccount"] = product.uniqueAccount; } products.push(p); } } }); return (products.length != 0 ? products : null) }, codes: function (codes) { if (codes) $store._storage.store("store-codes", codes); return $store._storage.store("store-codes"); }, cart: function () { console.info("### STORE :: cart"); var cart = []; var storeInfo = $store._storage.store("store-info"); var store = $store._storage.store("store"); $.each(store, function (id, item) { var product = null; $.each(storeInfo.products, function (ip, p) { if (p.eventProductId == id) product = p; }); if (product) { for (var i = 0; i < item.quantity; i++) { var variation = null; var info = null; if (item.hasOwnProperty("infos") && item.infos.hasOwnProperty(i + 1)) { info = item.infos[i + 1]; if (product.variations) { $.each(product.variations, function (iv, v) { if (v.eventProductVariationId == info.variation) { variation = v; } }); } } var price = parseFloat(variation ? variation.price : product.price); var cartItem = {id: "p" + id + "-" + i, eventProductId: id, name: product.name + (variation ? " - " + variation.name : ""), price: price, symbol: storeInfo.currency.symbol, quantity: 1, fee: (parseFloat(product.feeType.dollarAmount) + (price * parseFloat(product.feeType.percentageAmount))),}; if (info) { var accountFields = ",name,companyName,contactName,emailAddress,phoneNumber,mobilePhoneNumber,streetAddress1,streetAddress2,city,state,country,zip,"; var attributes = {}; $.each(info,function(field,value){ if(accountFields.indexOf(","+field+",") == -1){ attributes[field] = value; } }); if (Object.keys(attributes).length != 0) { info["attributes"] = attributes; } cartItem["accountInfo"] = info; if (info.hasOwnProperty("variation")) { cartItem["eventProductVariationId"] = info.variation; cartItem.fee = (parseFloat(variation.feeType?variation.feeType.dollarAmount:product.feeType.dollarAmount) + (price * parseFloat(variation.feeType?variation.feeType.percentageAmount:product.feeType.percentageAmount))); delete info.variation; } } cart.push(cartItem); } } }); console.info(cart); return cart; }, processPurchase: function (token) { console.info("### STORE :: processPurchase :: " + token); var subtotal = 0.0; var fee = 0.0; var cart = $store._store.cart(); var json = {eventId: $store._eventInfo.event.eventId, name: $("[data-form-item-id='paymentInfo-name']").val(), emailAddress: $("[data-form-item-id='paymentInfo-emailAddress']").val(), phoneNumber: $("[data-form-item-id='paymentInfo-phoneNumber']").val(), paymentType: 1, products: [], eventDiscountCodes: []}; if (token) { json["stripeToken"] = token; } var codes = {}; $.each($store._store.codes(), function (c, storeCode) { codes[storeCode.eventDiscountCodeId] = {eventDiscountCodeId: storeCode.eventDiscountCodeId, eventDiscountCodeCount: 0, code: null}; if (storeCode.hasOwnProperty("quantity")) { codes[storeCode.eventDiscountCodeId].eventDiscountCodeCount = storeCode.quantity; } $.each($store._eventInfo.codes, function (i, c) { if (c.eventDiscountCodeId == storeCode.eventDiscountCodeId) codes[storeCode.eventDiscountCodeId].code = c; }); }); $.each(cart, function (index, item) { var product = JSON.parse(JSON.stringify(item)); delete product.fee; delete product.id; delete product.name; delete product.price; delete product.symbol; json.products.push(product); subtotal += item.price; fee += item.fee; }); $.each(codes, function (c, code) { if (code.code.amountType == "AMOUNT") { var eventDiscountCodeProductCount = 1; if (code.code.applyTo == "COLLECTION") { eventDiscountCodeProductCount = 0; $.each(code.code.eventProducts, function (cp, codeProduct) { eventDiscountCodeProductCount += codeProduct.quantity; }); } $.each(code.code.eventProducts, function (cp, codeProduct) { var avail = 0; var used = 0; if (code.code.applyTo == "EACH") { avail = (codeProduct.hasOwnProperty("quantity") ? parseInt(codeProduct.quantity) : 9999); } else { avail = codeProduct.quantity * code.eventDiscountCodeCount; } $.each(json.products, function (p, cart_product) { if (used < avail && codeProduct.eventProductId == cart_product.eventProductId && !cart_product.hasOwnProperty("eventDiscountCodeId")) { used++; cart_product["eventDiscountCodeId"] = code.eventDiscountCodeId; cart_product["eventDiscountCodeProductCount"] = eventDiscountCodeProductCount; if (code.code.applyTo == "EACH") { code.eventDiscountCodeCount++; } } }); }); } else { $.each(json.products, function (p, product) { product["eventDiscountCodeId"] = code.eventDiscountCodeId; product["eventDiscountCodeProductCount"] = 1; code.eventDiscountCodeCount++; }); } }); $.each(codes, function (c, code) { if (code.eventDiscountCodeCount > 0) { json.eventDiscountCodes.push({eventDiscountCodeId: code.eventDiscountCodeId, eventDiscountCodeCount: code.eventDiscountCodeCount}); } }); json["total"] = parseFloat($store._storage.store("store-totals").total).toFixed(2); console.info(json); $store._comm._post("/api/embedPurchase", json); }, hasQuantity: function () { var store = $store._storage.store("store"); var ret = false; $.each(store, function (key, item) { ret |= item.quantity > 0; }); return ret; }, inputs: { number: function (id, val, cls) { return ""; }, choice: function (id, index, options, cls) { return ""; } }, stripe: { init: function () { try { if ($store._storage.store("store-info").hasOwnProperty("stripeConnectedAccount")) { $store["stripe"] = Stripe($store._storage.store("store-info").stripePublishableKey, {"stripeAccount": $store._storage.store("store-info").stripeConnectedAccount}); } else { $store["stripe"] = Stripe($store._storage.store("store-info").stripePublishableKey); } } catch (e) { setTimeout(this.initStripe, 1000); } }, populate: function () { if ($store.stripe) { if ($store.stripe.elements()) { var style = {base: {color: '#32325d', fontFamily: '"Helvetica Neue", Helvetica, sans-serif', fontSmoothing: 'antialiased', fontSize: '14px', '::placeholder': {color: '#aab7c4'}}, invalid: {color: '#fa755a', iconColor: '#fa755a'}}; var elements = $store.stripe.elements(); $store["card"] = elements.create('card', {style: style}); $store.card.mount('#card-element'); $store.card.addEventListener('change', function (event) { if (event.error) { $store.renderError(event.error.message); } }); } } }, token: function () { var name = $("[data-store-item-id='name']").val(); var emailAddress = $("[data-store-item-id='email']").val(); var phoneNumber = $("[data-store-item-id='phoneNumber']").val(); $store.stripe.createPaymentMethod({type: "card", card: $store.card, billing_details: {name: name, email: emailAddress, phone: phoneNumber}}).then(function (result) { if (result.error) { $("#str-message-payment").hide(); $("#str-buttons-payment").show(); $store.renderError(result.error.message); } else { $store._store.processPurchase(result.paymentMethod.id); } }); }, } } ,
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
_form: { _css_prefix_: "", render: function (id, index, field, value, datas) { return this[field.formPartType](id, index, field, value, datas); }, text: function (id, index, field, value, datas) { return ""; }, email: function (id, index, field, value, datas) { return ""; }, phone: function (id, index, field, value, datas) { return ""; }, hidden: function (id, index, field, value, datas) { return ""; }, date: function (id, index, field, value, datas) { return ""; }, choice: function (id, index, field, value, datas) { var choices = ""; $.each(field.choices, function (i, c) { choices += ""; }); return ""; }, required: function () { return "required "; }, datas: function (id, index, field, datas) { var additionalDatas = ""; if (datas) { $.each(datas, function (k, v) { additionalDatas += "data-" + k + "='" + v + "' "; }) } return additionalDatas + "data-store='" + this._eventKey + "' " + "data-form-item-id='" + id + "' " + "data-form-item-lbl-id='" + id + "-" + (index ? index + "-" : "") + field.key + "' " + (index ? "data-form-item-index='" + index + "' " : "") + "data-form-item-name='" + field.key + "' data-form-item-product='" + field.product + "' data-form-item-lbl='" + field.name + "' data-form-item-type='" + field.formPartType + "' " + "data-form-item-required='" + field.required + "' " + "data-form-item-required-css='" + this._css_prefix_ + "form-item-required' " + (field.parentKey ? "data-form-item-parent='" + field.parentKey + "' " : "") + (field.parentChoiceKey ? "data-form-item-parent-value='" + field.parentChoiceKey + "' " : "") + "onkeyup=\"" + this._root + "._form.validate('" + id + "')\" " + "onchange=\"" + this._root + "._form.validate('" + id + "')\""; }, lbldatas: function (id, index, field) { return " data-form-lbl-id='" + id + "-" + (index ? index + "-" : "") + field.key + "' "; }, validate: function (iid) { var _valid = true; $("[data-store='" + $store._form._eventKey + "']").each(function () { var parentKey = $(this).data("formItemParent"); var parentValue = $(this).data("formItemParentValue") + ""; var index = $(this).data("formItemIndex"); if (parentKey != null) { var parent = $("[data-store='" + $store._form._eventKey + "'][data-form-item-name='" + parentKey + "']" + (index ? "[data-form-item-index='" + index + "']" : "") + ":visible"); var value = parent.val() + ""; if (parent.length == 0 || value != parentValue) { $(this).hide(); $("[data-form-lbl-id='" + $(this).data("formItemLblId") + "']").hide(); } else { $(this).show(); $("[data-form-lbl-id='" + $(this).data("formItemLblId") + "']").show(); } } }); $("[data-store='" + $store._form._eventKey + "']:visible").each(function () { var id = $(this).data("formItemId"); var val = $(this).val(); var name = $(this).data("formItemName"); var type = $(this).data("formItemType"); var required = $(this).data("formItemRequired"); var requiredCss = $(this).data("formItemRequiredCss"); if (iid == undefined || (iid != undefined && (iid == id))) { $(this).removeClass(requiredCss); valid = true; if (id && required && !val) { valid = false; } if (val) { switch (type) { case "email": valid = $store._form.validateEmailAddress(val); break; case "phone": valid = $store._form.validatePhone(val); break; } switch (name) { case "state": valid = $store._form.validateState(val); break; case "zip": valid = $store._form.validateZip(val); break; } } _valid &= valid; if (!valid) $(this).addClass(requiredCss); } }); return _valid; }, validateUnique: function (iid) { var _valid = this.validate(); if (_valid) { var uniques = {}; var duplicates = false; $("[data-unique]").each(function () { console.info($(this).data()); if (!uniques.hasOwnProperty($(this).val())) { uniques[$(this).val()] = $(this).data("formItemId"); } else { duplicates = true; _valid = "Only one " + $(this).data("formItemProduct") + " per " + $(this).data("formItemLbl") + " can be purchased."; } }); if (!duplicates) { var emailsProducts = []; $.each(uniques, function (email, eventProductId) { emailsProducts.push({emailAddress: email, eventProductId: eventProductId}); }); if (emailsProducts.length != 0) { $store._comm._post("/api/purchasedProductCheck", emailsProducts); return "uniqueCheck"; } } } return _valid; }, validateEmailAddress: function (value) { return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value); }, validatePhone: function (value) { return /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im.test(value); }, validateState: function (value) { return /^(A[BLKSZRAEP]|BC|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ABDEHINOPST]|N[BCDEHJLMVSY]|O[NHKR]|P[AERW]|QC|RI|S[CDK]|T[NX]|UT|V[AIT]|W[AIVY])$/.test(value); }, validateZip: function (value) { return /^[0-9A-Z -]{1,10}$/.test(value); } } ,
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
_storage: { store: function (key, value) { if (window.localStorage) { if (key !== undefined) { if (value !== undefined) { if (value != null) { value = JSON.stringify(value); window.localStorage[this._eventKey + "-" + key] = value; if (window.localStorage[this._eventKey + "-" + key] != value) alert("SYSTEM ERROR: Unable to store local data!!!"); return window.localStorage[this._eventKey + "-" + key] == value; } else { delete window.localStorage[this._eventKey + "-" + key]; } } else { if (window.localStorage[this._eventKey + "-" + key]) { return JSON.parse(window.localStorage[this._eventKey + "-" + key]); } return {}; } } } } } ,
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
_comm: { _uri: "https://www.bridescan.com", _initialize: function () { $("body") .append("") .append("") .append(""); }, _get: function (url) { url = this._uri + (url.indexOf("/") == 0 ? "" : "/") + url; $("#comm-" + this._eventKey.toLowerCase() + "-form-get").attr("action", url); $("#comm-" + this._eventKey.toLowerCase() + "-form-get").submit(); }, _post: function (url, json) { url = this._uri + (url.indexOf("/") == 0 ? "" : "/") + url; var ljson = JSON.stringify(json); $("#comm-" + this._eventKey.toLowerCase() + "-form-post").attr("action", url); $("#comm-" + this._eventKey.toLowerCase() + "-form-post-json").val(ljson); $("#comm-" + this._eventKey.toLowerCase() + "-form-post").submit(); } } ,
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
_xyz: {}
};
$(function () {
eval("window.$store = store").init();
});
window.addEventListener("message", function (event) {
if (typeof event.data === "string") {
var parts = event.data.split("::");
if (parts.length == 2) {
var type = parts[0];
var data = JSON.parse(parts[1]);
$store.data(type, data);
}
}
});
That's okay we have great stuff for you as well! Pre-Registration will get you entered in the $1000 drawing for a gift certificate to Gracie's Bridal, and get weekly wedding day countdown emails plus valuable specials sent to your inbox! This is not a ticket or entry to Metropolitan Weddings. Pre-Registration only. <\/strong><\/h4>", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "0.00", "dollarAmountOther": "0.00", "name": "No Fee Under $0.01", "percentageAmount": "0.000", "percentageAmountOtherType": "default" }, "productType": "Ticket" }, { "variationLabel": "", "maxPurchaseQuantity": 0, "form": { "code": "dbd054aaa69ae", "stage": "", "formTypeId": 1, "parts": [ { "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": "email", "name": "e-Mail Address Verify", "choices": [], "required": true, "key": "emailAddressVerify" }, { "ordering": 4, "formPartType": "phone", "name": "Phone Number", "choices": [], "required": true, "key": "phoneNumber" }, { "ordering": 5, "formPartType": "choice", "name": "Have Wedding Date?", "choices": [ { "aux1": "", "ordering": 1, "label": "Yes", "value": "true" }, { "aux1": "", "ordering": 2, "label": "No", "value": "false" } ], "required": true, "key": "weddingDateProvided" }, { "parentKey": "weddingDateProvided", "ordering": 6, "formPartType": "date", "name": "Wedding Date", "choices": [], "parentChoiceKey": "true", "required": true, "key": "weddingDate" } ], "name": "Store Default", "key": "storeAttendeeInfo" }, "price": "7.00", "variations": [], "formName": "storeAttendeeInfo", "eventProductId": 5486, "name": "Bride, Groom or Partner Ticket", "description": "
Wedding Expo: General Exhibitor Admission from 10:00 AM to 3:00 PM. Ticket purchase <\/strong>will get you entered in the $1000 drawing for a gift certificate to Gracie's Bridal, and get weekly wedding day countdown emails plus valuable specials sent to your inbox!<\/strong><\/h4>