1//bundle 2var BUNDLE_ADDTOCART_LINK = "/bundle1/addtocart/"; 3var BUNDLE_GET_PURCHASE_CE_PRICE_POPUP = '/bundle1/getbundlepurchasecepricepopup'; 4var BUNDLE_ADD_CECREDITTOCART_URL = "/bundle1/addbundlececredit"; 5 6// Account 7var ACCOUNT_REGISTER_COMPANY_AUTOCOMPLETE = "/account/autocomplete/"; 8var ACCOUNT_REGISTER_COMPANY_DROPDOWN_AUTOCOMPLETE = "/account/AutocompleteCompany/"; 9var EMAIL_IN_USED_ACCOUNT_REGISTER = "/account/emailcheck"; 10var EMAIL_IS_MATCH_WITH_COMPANY_DOMAIN = "/account/emailmatchwithcompanydomain" 11var GENERATE_NEW_GIFTCARD_URL = "/account/generatenewgiftcard"; 12var DELETE_SAVED_ITEM_URL = "/account/deletesaveditem"; 13var CHECK_REGISTRANT_EMAIL_URL = "/account/checkregistrantemail"; 14var UPLOAD_AVATAR_URL = "/account/uploadavatar"; 15var GET_STATE_URL = '/account/getstate/'; 16var GET_CONTACT_INFO_URL = '/account/getcontactinfo'; 17var GET_SHIPPING_INFO_URL = '/account/getshippinginfo/'; 18var CANCELLED_GIFT_CARD_URL = '/account/cancelledgiftcard'; 19var PENDING_SEMINAR = '/account/pendingseminar'; 20var COMPLETED_SEMINAR = '/account/completedseminar'; 21var SAVED_ITEMS = '/account/customersaveditem'; 22var GET_COMPARE_PRODUCT_URL = '/account/compareitemsview'; 23var GET_County_URL = '/account/getcounty/'; 24var CHECK_CUSTOMER_SICCODE = "/account/checkcustomersiccodes"; 25var GET_ORDERITEM_EVENTDATE = "/account/getorderitemeventdate"; 26var GET_CUSTOMER_LINKEDTENANTS = "/base/getlinkedtenants"; 27var CUSTOMER_CANCELMEMBERSHIP = "/account/cancelcustomermembership"; 28var CHECK_MARKETINGCONSENT_CUSTOMER = "/account/checkmarketingconsentcustomer"; 29var GET_CUSTOMER_ACCOUNT_MESSAGE_URL = "/account/getcustomeraccountmessage"; 30var GET_PREREQUSITE_PRODUCTS = "/account/getprerequsiteproducts"; 31 32var GET_CUSTOMER_GET_CUSTOMER_ADDRESS_LIST = "/account/getcustomeraddresslist"; 33var GET_CUSTOMER_CUSTOMER_GET_EXISTING_ADDRESSES = "/account/getcustomerexistingaddresses"; 34var IS_PAID_TRANSACTION_URL = '/account/ispaidtransaction'; 35 36// QuestionAnswer 37var DELETE_MESSAGE_URL = "/questionanswer/deletemessage/"; 38var MARK_AS_UNREAD_URL = "/questionanswer/markasunread/"; 39var COMPOSE_MESSAGE_URL = '/questionanswer/composemessage'; 40var QUESTION_ANSWER_LIST_URL = "/questionanswer/questionanswerlist"; 41 42// ShoppingCart 43var SHOPPING_CART_HOME = "/shoppingcart/index"; 44var UPDATE_PRODUCT_QUANTITY_URL = "/shoppingcart/updateproductquantity"; 45var REMOVE_PROGRAM_REGISTRANT_URL = "/shoppingcart/removeprogramregistrant"; 46var REMOVE_REGISTRANT_URL = "/registrant/removeregistrants"; 47var UPDATE_PRODUCT_ITEM_AND_REGISTRANT_QTY = "/registrant/updateproductitemandregistrantqty"; 48var GET_REGISTRANT_DETAIL = "/registrant/getregistrantdetail"; 49var GET_REGISTRANT_PRODUCT_DETAIL = "/registrant/getregistrantproductdetail"; 50 51var REMOVE_ASSIGNLATER_REGISTRANTS = "/account/deleteprogramregforassignlater"; 52var UPDATE_BUNDLE_QAUNTITY_URL = "/shoppingcart/updatebundleqauntity"; 53var UPDATE_ORDER_EVENTDATE_URL = "/shoppingcart/updateordereventdate"; 54var MY_CART_URL = "/shoppingcart/mycart"; 55var REMOVE_ITEM_URL = "/shoppingcart/removeitem"; 56var UPDATE_OR_REMOVE_PRODUCT_BY_PARENTORDERITEM = "/shoppingcart/updateorremoveproductbyparentorderitem"; //#12528 57var GET_ADDON_PRODUCT_IN_CART = "/shoppingcart/getaddonproductincart"; //#12528 58var REMOVE_ITEM_FROM_BUNDLE_URL = "/shoppingcart/removeitemfrombundle"; 59var CHECK_GIFT_CARD_CODE_URL = "/shoppingcart/checkgiftcardcode"; 60var CHECK_GIFT_CARD_CODE_ALERDAY_APPLIED_URL = "/shoppingcart/checkgiftcardcodealerdayapplied"; 61var CHECK_COUPON_CODE_URL = "/shoppingcart/checkcouponcode"; 62var GET_CURRENT_DISCOUNT_DETAIL = "/shoppingcart/getcurrentdiscountdetail"; 63var REMOVE_COUPN_CODE_URL = "/shoppingcart/removecoupncode"; 64var SET_SHIPPING_METHOD_URL = "/shoppingcart/setshippingmethod"; 65var GET_SHIPPING_METHOD_URL = "/account/getshippingmethod"; 66var SAVE_SHIPPING_INFO_URL = "/account/shippinginfo"; 67var GET_SHIPPING_METHOD_BY_ADDRESS = "/account/getshippingmethodbyaddress"; 68var REMOVE_GIFT_CARD_CODE_URL = "/shoppingcart/removegiftcardcode"; 69var GET_CART_URL = '/shoppingcart/getcart'; 70var GET_RECEIPT = '/shoppingcart/receiptpart'; 71var GET_COMPAREPRODUCTCART_URL = '/shoppingcart/getcompareproductcart'; 72var APPLY_GLOBAL_AUTO_DISCOUNT_URL = '/shoppingcart/applyglobalautodiscount'; 73var SET_BILLING_ZIPCODE_URL = "/shoppingcart/setbillingzipcode"; 74var GET_MULTIPAYMENTS_ITEMS = '/items/multipayment'; 75var POST_MULTIPAYMENTS_ITEMS = "/items/savemultipayment"; 76var GET_PAYMENTINFO_ADDRESS_DETAIL = "/account/paymentinfoaddressdetail"; 77var UPDATE_CHANGED_PRICE_CART_ITEMS = "/shoppingcart/updatechangedpricecartitems"; //#17693 78var REWARD_POINTS_NOTIFICATION_URL = '/shoppingcart/rewardpointsnotification';
79var MINICART_MY_CART_URL = "/minicart/mycart"; 80 81// Items 82var SAVE_PARTICIPATION_CODE_URL = "/items/saveparticipationcode"; 83var AUTO_SAVE_PARTICIPATION_CODE_URL = "/items/autosaveparticipationcode"; 84var SAVE_EVALUATION_URL = "/items/saveevaluation"; 85var SAVE_AFFIDAVIT_URL = "/items/saveaffidavit"; 86var ADD_TO_CART_URL = "/items/addtocart"; 87var SAVE_TO_CALENDAR_URL = "/items/savetocalendar"; 88var GET_EVALUATION_URL = '/items/getevaluation'; 89var GET_PARTICIPATION_CODE_URL = '/items/getparticipationcode'; 90var GET_AFFIDAVIT_URL = '/items/getaffidavit'; 91var GET_QUIZES_URL = '/items/getquizehistory'; 92var COMPLETED_CERT_REQUIREMENT = '/items/completedcertrequirement'; 93var COMPLETED_MOVE_REQUIREMENT = '/items/movetocompleted'; 94var ADD_COMPAREPRODUCT_URL = "/items/addcompareproduct"; 95var ADD_PURCHASEEXTENSION_URL = "/items/addtocartextension"; 96var ADD_CECREDITTOCART_URL = "/items/addcecredit"; 97var ADD_SAVE_SINGLE_PRODUCT_URL = "/items/savesingleproduct"; 98var GET_PRODUCT_AGENDATAB = "/items/getproductagenda"; 99var AGENDA_PRODUCT_POPUP = "/items/productagenda"; 100var AGENDA_CUSTOMER_ATTEDANCE = "/items/getcustomerattedanceconfirmation"; 101var CHECK_DISCOUNTPRODUCT_ELIGIBLITY = "/items/checkdiscountproducteligiblity"; 102var GET_ATTENDANCE_HISTORY = "/items/getattendancehistory"; 103var UPDATE_EXPIRED_DISCOUNTINCART = "/items/updateexpireddiscountincart"; 104var GET_LOGGEDINCUSTOMERID = '/items/getloggedincustomerid'; 105var GET_PURCHASECECREDIT_STATUS = '/items/getpurchasececreditstatus'; 106var GET_PRODUCTS_INFO = '/items/getproductsinfo'; 107var GET_PURCHASECE_PRICE_POPUP = '/items/getpurchasecepricepopup'; 108var CHECK_ADDON_OR_RELATEDPRODUCT_EXIST = '/items/checkaddonorrelatedproductexist'; 109var GET_ACKNOWLEDGE_PREREQUISITE_PRODUCTS = "/items/getacknowledgeprerequisiteproducts"; 110var GET_PRODUCTCERT_REQ = "/items/getproductcertreq"; 111 112// Support 113var ARTICLE_LIKED_URL = "/support/articleliked"; 114var ARTICLE_DISLIKED_URL = "/support/articledisliked"; 115 116// Additioal participant 117var ADDITIONAL_PARTICIPANT_URL = "/search/additionalparticipantce"; 118var ADDITIONAL_PARTICIPANT_ADDTOCARTURL = "/search/addtocartadditionalpriceitem"; 119 120var Subscription_List_URL = "/search/subscriptionlist"; 121var Docreadyeventid = 1; 122var DdlChangeid = 2; 123 124//Bundle 125var GET_BUNDLEDETAIL_URL = "/bundle2/bundledetail"; 126var GET_BUNDLETYPEFIVE_DATEPOPUP = "/items/bundletypefivemultidates"; 127 128// Company Catalog(Learning Management System) URL 129var GET_CATALOG_USER_TAB_URL = "/companycatalog/getcatalogusertab"; 130var GET_CATALOG_COURSE_TAB_URL = "/companycatalog/catalogcoursestab"; 131var GET_CATALOG_COURSE_LIST_URL = "/companycatalog/getcatalogcourses"; 132var GET_CATALOG_SETTING_TAB_URL = "/companycatalog/getcatalogsetting"; 133var SAVE_CATALOG_SETTING_TAB_URL = "/companycatalog/updatecompanycatalogsetting"; 134var POST_HIDE_SHOW_COURSE_URL = "/companycatalog/showhidecourse"; 135var CATALOG_MESSAGE_URL = "/companycatalog/messageuser"; 136var CATALOG_DELETE_NOTES = "/companycatalog/deletenote"; 137var CATALOG_LOAD_NOTES = "/companycatalog/getallnotesbyentityidntype"; 138var CATALOG_SEND_CUSTOMER_ACCOUNTLINK = "/companycatalog/sendcustomeraccountlink"; 139var CATALOG_LOAD_CUSTOMER_USERDETAIL = "/companycatalog/cataloguserdetail"; 140var CATALOG_COURSE_LISTINGS_SEND_REQUEST_URL = "/companycatalog/sendcourserequest"; 141var CATALOG_COURSE_REQUEST_TAB_URL = "/companycatalog/catalogcourserequesttab"; 142var CATALOG_COURSE_ALLOW_DENY_URL = "/companycatalog/allowdenyaccess"; 143var CATALOG_LMS_USERTAB_USERLIST = "/companycatalog/getusers"; 144var CATALOG_LMS_ENROLUSER_URL = "/companycatalog/enrollusers/"; 145var CATALOG_LMS_ENROL_COURSE_URL = "/companycatalog/enrollcourses/" 146var CATALOG_LMS_REMOVEUSERFROMENROL = "/companycatalog/removeusers"; 147var CATALOG_LMS_REMOVE_USER_FROM_COURSE = "/companycatalog/removecourse"; 148var CATALOG_ADD_COURSE_MY_ACCOUNT_URL = "/companycatalog/addcoursetomyaccount"; 149var CATALOG_USER_MESSAGE_TAB_URL = "/companycatalog/getmessagetab"; 150var CATALOG_USER_HISTORY_TAB_URL = "/companycatalog/getlmshistory"; 151 152//Speaker Portal 153var SPEAKER_PORTAL_DELETEDOCUMENT_URL = "/documents/deletedocument"; 154var SPEAKER_PORTAL_DOCUMENT_TAB_URL = "/documents/getalldocumentsbyentityidntype"; 155var SPEAKER_PORTAL_PROFILEINFO_TAB_URL = "/speakerprofileinformation/getprofileinformation"; 156var SPEAKER_PORTAL_PRODUCT_TAB_URL = "/speakerproducts/getspeakerproducts"; 157 158//BUNDLE TYPE 4 ADD TO CART 159var ADD_BUNDLE_TYPE_4_ADD_TO_CART_URL = "/bundletype4product/getproductlist"; 160var REMOVE_REWARDPOINT = "/shoppingcart/removerewardpoints"; 161 162//BUNDLE TYPE 5 Add Product by customer 163var BUNDLE_TYPE_5_List_CUSTOMER_PRODUCT = "/bundletype5product/getcustomerbundleproductlist"; 164var BUNDLE_TYPE_5_ADD_CUSTOMER_PRODUCT = "/bundletype5product/addcustomerbundleproduct"; 165var BUNDLE_TYPE_5_ADD_CECREDITTOCART_URL = "/bundletype5product/addbundlefivececredit"; 166 167var GET_PURCHASEALERTMESSSAGE = "/items/getpurchasealertmesssage"; 168var GET_MULTIPLE_PURCHASEALERTMESSSAGE = "/items/getmultiplepurchasealertmesssageforbundle"; 169 170var LAUNCH_FREE_VIEWER_URL = "/LaunchFreeViewer"; 171var COMPLETE_FREE_ORDER_URL = "/CompleteFreeOrder"; 172var CLASSROOM_LOGIN_URL = '/sq/lg/LoginView'; 173 174//Banner Click Count 175var BANNER_CLICK_COUNT = "/home/updateclickcountforbanneradvert"; 176var BANNER_SHOWN_COUNT = "/home/updatebannershowncount"; 177var CENCEL_PURCHASECE = "/items/cancelpurchaseforpurchasece"; 178 179//Group 180var ADD_OUT_STANDING_INVOICE_IN_CART = "/group/addoutstandinginvoiceincart"; 181var RETRY_PENDING_INVOICE_PAYMENTS = "/group/retrypendinginvoicepayments"; //#19014 182var DEACTIVATE_MEMBERSHIP_PAYMENT_PROFILE = "/group/deactivatemembershippaymentprofile";//#19014 183 184//GuestBook 185var CHECK_GBOOKCUSTOMER = "/guestbook/checkforguestbookcustomer"; 186var GET_GUESTBOOK_ORDER_SUMMARY = "/guestbook/getordersummary"; 187 188 189//Classified Ads 190var ADD_TO_CART_CLASSIFIED_URL = "/ClassifiedAds/AddToCart"; 191 192var MediaTypes = { 193 nonLiveTypes: [4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15], 194 liveTypes: [1, 2, 3, 8], 195 isLiveType: function (val) { 196 return MediaTypes.liveTypes.indexOf(val) > -1 197 } 198} 199 200var ISRELOADPAGE = false; 201 202// Disable caching of AJAX responses 203if (typeof ($.ajaxSetup) == "function") { 204 $.ajaxSetup({ cache: false }); 205} 206 207var width; 208$(document).ready(function () { 209 width = $(window).width(); 210 toggleSidebarToHamburger(); 211 loadAlertToolTip();
212 updateCartCount(); 213 getComparelist(); 214 getCartItems(); 215 NoOfImg(); 216 updateProductNameWithoutDiscount($("#hdnProductNameWithNoDiscount").val()); 217 218 // #22137 - Remove Placeholder from SignUp Page 219 $("#SignUp-form .socialmedia").attr("placeholder", ""); 220 221 222 // Hide blank message of validation summery 223 if ($(".validation-summary-errors").length > 0 && $(".validation-summary-errors ul li:visible").length == 0) { 224 $(".validation-summary-errors").hide(); 225 } 226 227 $('[data-toggle="popover"]').popover({ 228 trigger: "hover", 229 placement: 'auto top', 230 html: true 231 }); 232 233 $('.scheduleAtGlance').popover({ trigger: 'hover', placement: 'top' }) 234 .on("show.bs.popover", function () { 235 return $(this).data("bs.popover").tip().css({ "width": "fit-content", "max-width": "500px" }); 236 }); 237 238 239 $(".clsCalenderTooltip").tooltip(); 240 241 if ($(".PendingPaymentPopOver").length > 0) { 242 showPendingPaymentPopup(); 243 } 244 245 if (document.getElementById("myCarousel") != null) { 246 $("#myCarousel").carousel({ 247 interval: 10000 248 }); 249 } 250 //for ADA Requirement 251 if ($("#DivADARequirement").length > 0) { 252 if ($("#ADARequirementNote").val() != "" && $("#ADARequirementNote") != undefined) { 253 $("#ADARequirement").prop("checked", true); 254 } 255 if ($("#ADARequirement").prop("checked") == true) { 256 $("#ADARequirementNote").attr("required", "required"); 257 $("#ADARequirementNote").closest("div").find("span.field-validation-error").show().html(''); 258 } 259 } 260 261 $('.recentcarousel').each(function () { 262 var next = $(this).next(); 263 if (!next.length) { 264 next = $(this).siblings(':first'); 265 } 266 next.children(':first-child').clone().appendTo($(this)); 267 268 if (next.next().length > 0) { 269 next.next().children(':first-child').clone().appendTo($(this)); 270 } 271 else { 272 $(this).siblings(':first').children(':first-child').clone().appendTo($(this)); 273 } 274 }); 275 if (document.getElementById("myCarousel1") != null) { 276 $("#myCarousel1").carousel({ 277 interval: 10000 278 }); 279 } 280 281 //Sticky navbar 282 function affixChange() { 283 $('#cartbar').affix({ 284 offset: { 285 top: ($(".headersection").outerHeight(true) + 25), 286 bottom: null 287 } 288 }); 289 } 290 affixChange(); 291 292 var offset = 250; 293 var duration = 300; 294 $(window).scroll(function () { 295 affixChange(); 296 if (jQuery(this).scrollTop() > offset) { 297 jQuery('.back-to-top').fadeIn(duration); 298 } else { 299 jQuery('.back-to-top').fadeOut(duration); 300 } 301 }); 302 303 $('.back-to-top').click(function (event) { 304 event.preventDefault(); 305 jQuery('html, body').animate({ scrollTop: 0 }, duration); 306 return false; 307 }); 308 309 //$("#txtProductSearch").val(getParameterByName('search')); 310 311 $(document).on('change', '.checkroundradiolbl input', function () { 312 $('.divRadioAddress').removeClass('selected-address'); 313 if ($(this).is(':checked')) { 314 $(this).closest('.divRadioAddress').addClass('selected-address'); 315 } 316 }); 317 318 $("body").on('click', '.popAddtoCart', function () { 319 320 if ($(this).hasClass("linkChangePrice")) { 321 var arr = []; 322 var productId = $(this).attr("data-productId"); 323 var swapProducts = localStorage.getItem('SwapProducts'); 324 325 if (swapProducts) { 326 arr = JSON.parse(swapProducts); 327 } 328 329 if (arr.indexOf(productId) == -1) { 330 arr.push(productId); 331 } 332 localStorage.setItem('SwapProducts', JSON.stringify(arr)); 333 334 if (typeof setRegistrantLocalStorage === "function") { 335 setRegistrantLocalStorage(); 336 } 337 } 338 339 var url = $(this).attr("href"); 340 openAddToCartPopupModal(url); 341 return false; 342 });
343 344 $("body").on('click', '.popAddtoCartFeePlan', function () { 345 346 if ($(this).hasClass("linkChangePrice")) { 347 var arr = []; 348 var productId = $(this).attr("data-productId"); 349 var swapProducts = localStorage.getItem('SwapProducts'); 350 351 if (swapProducts) { 352 arr = JSON.parse(swapProducts); 353 } 354 355 if (arr.indexOf(productId) == -1) { 356 arr.push(productId); 357 } 358 localStorage.setItem('SwapProducts', JSON.stringify(arr)); 359 } 360 361 var url = $(this).attr("href"); 362 if ($(this).attr("data-purchasealertid") > 0 && !$(this).hasClass("customerAlert")) { 363 if ($("#divGeneralPurchaseAlert").length === 0) { 364 $.get("/ClassifiedAds/GetPurchaseAlertMesssage", { purchaseAlertId: $(this).attr("data-purchasealertid"), btyType: $(this).attr("data-btnType"), classifiedFeePlanId: $(this).attr('data-searchproduct') }, 365 (data) => { 366 if (data?.includes("divGeneralPurchaseAlert")) { 367 $(data).modal(); 368 $(this).addClass("customerAlert"); 369 } else { 370 openAddToCartFeePlanPopupModal(url); 371 } 372 } 373 ); 374 } else { 375 $("#divGeneralPurchaseAlert").modal(); 376 $(this).addClass("customerAlert"); 377 } 378 } else { 379 openAddToCartFeePlanPopupModal(url); 380 } 381 382 return false; 383 }); 384 385 $(".container").on('click', '.calendar_nav', function () { 386 var calContainer = $(this).attr("data-rel"); 387 $.get($(this).attr("href"), function (data, status) { 388 $("#" + calContainer).html(data); 389 $(".clsCalenderTooltip").tooltip(); 390 }); 391 return false; 392 }); 393 394 $("body").on('click', '.popUploadImage', function () { 395 $.magnificPopup.open({ 396 items: { 397 src: $(this).attr("href") 398 }, 399 type: 'iframe', 400 closeOnBgClick: false, 401 enableEscapeKey: false, 402 mainClass: 'popUploadImageMainClass ' + ($(this).hasClass('CE21_MyAccount_UnassignedProdTab_AssignBtn') ? 'UnassignedProdTab' : '') 403 }); 404 $('.mfp-iframe-scaler iframe').each(function () { 405 this.style.setProperty('background-image', 'none', 'important'); 406 }); 407 return false; 408 }); 409 410 $("body").on('click', '.popCourseDescription', function () { 411 $.magnificPopup.open({ 412 items: { 413 src: $(this).attr("href") 414 }, 415 type: 'iframe', 416 closeOnBgClick: false, 417 mainClass: 'popCourseDescriptionMainClass' 418 }); 419 return false; 420 }); 421 422 $("body").on('click', '.pop400', function () { 423 $.magnificPopup.open({ 424 items: { 425 src: $(this).attr("href") 426 }, 427 type: 'iframe', 428 closeOnBgClick: true, 429 mainClass: 'pop400' 430 }); 431 return false; 432 }); 433 434 $("#tabDocuments").on('click', '.popDocumentUpload', function () { 435 $.magnificPopup.open({ 436 items: { 437 src: $(this).attr("href") 438 }, 439 type: 'iframe', 440 closeOnBgClick: false, 441 mainClass: 'pop700MainClass' 442 }); 443 return false; 444 }); 445 446 $("body").on('click', '.popRequiredInfo', function () { 447 $.magnificPopup.open({ 448 items: { 449 src: $(this).attr("href") 450 }, 451 type: 'iframe', 452 closeOnBgClick: false, 453 mainClass: 'popRequiredInfoMainClass' 454 }); 455 return false; 456 }); 457 $("body").on('click', '.pop850', function () { 458 $.magnificPopup.open({ 459 items: { 460 src: $(this).attr("href") 461 }, 462 type: 'iframe', 463 closeOnBgClick: false, 464 mainClass: 'pop850mainClass' 465 }); 466 return false; 467 });
468 469 $("body").on('click', '.popReactivate', function () { 470 openPopup($(this).attr("href")); 471 return false; 472 }); 473 474 $("body").on('click', '.clsChangeGroupPopup', function () { 475 var customerMembershipId = $(this).attr("data-customerMembershipId"); 476 var membershipTypeId = $(this).attr("data-membershipTypeId"); 477 var upgradeGroupPopupURL = "/Group/UpgradeGroupPopupMessage"; 478 var upgradeGroupURL = "/Group/UpgradeGroup?customerMembershipId=" + customerMembershipId + "&membershipTypeId=" + membershipTypeId; 479 $.ajax({ 480 type: "GET", 481 url: upgradeGroupPopupURL, 482 dataType: "json", 483 data: { 484 'customerMembershipId': customerMembershipId, 485 'membershipTypeId': membershipTypeId 486 }, 487 success: function (data) { 488 if (data && data.message) { 489 $.confirm({ 490 title: "Membership Upgraded", 491 boxWidth: '550px', 492 useBootstrap: false, 493 type: 'green', 494 content: data.message, 495 buttons: { 496 ok: { 497 text: 'Ok', 498 btnClass: 'btn-success', 499 action: function () { 500 } 501 } 502 } 503 }); 504 } else { 505 $.magnificPopup.open({ 506 items: { 507 src: upgradeGroupURL 508 }, 509 type: 'iframe', 510 closeOnBgClick: false, 511 mainClass: 'pop1200MainClass' 512 }); 513 return false; 514 } 515 }, 516 error: function (data) { 517 alert('Error! Please try again later.'); 518 } 519 }); 520 }); 521 522 /* 523 //START: Two searchbox in _Header, both below #0008719 524 $("#btnProductSearch").on("click", function () { 525 //var prvSearch = getParameterByName('search'); 526 var search = $("#txtProductSearch").val(); 527 if (search.trim().length > 0) { 528 search = encodeURIComponent(search); 529 //if (prvSearch != null && prvSearch != '') { 530 // search = prvSearch + "~" + search; 531 //} 532 533 window.location.href = '/search?search=' + search; 534 } 535 }); 536 537 $("#btnProductSearchOutside").on("click", function () { 538 //var prvSearch = getParameterByName('search'); 539 var search = $("#txtProductSearchOutside").val(); 540 if (search.trim().length > 0) { 541 search = encodeURIComponent(search); 542 //if (prvSearch != null && prvSearch != '') { 543 // search = prvSearch + "~" + search; 544 //} 545 546 window.location.href = '/search?search=' + search; 547 } 548 }); 549 //END: Two searchbox in _Header, both above 550 */ 551 552 //START: #18359 553 $(".toggle-password").on("click", function () { 554 $(this).toggleClass("fa-eye fa-eye-slash"); 555 var passwordinput = $($(this).attr("data-toggleid")); 556 if (!passwordinput) return false; 557 if ((passwordinput.attr("type") || '') === "password") { 558 passwordinput.attr("type", "text"); 559 } else { 560 passwordinput.attr("type", "password"); 561 } 562 }); 563 //END: #18359 564 565 if ($(".topWishlistMessage").length > 0) { 566 setTimeout(function () { 567 $(".topWishlistMessage").remove(); 568 }, 5000); 569 } 570 571 if ($(".topSubscriptionsMessage").length > 0) { 572 setTimeout(function () { 573 $(".topSubscriptionsMessage").remove(); 574 }, 5000); 575 } 576 577 $("#content").on('click', '.pop700', function () { 578 $.magnificPopup.open({ 579 items: { 580 src: $(this).attr("href") 581 }, 582 type: 'iframe', 583 closeOnBgClick: true, 584 mainClass: 'pop700' 585 }); 586 return false; 587 });
588 589 $(document).ajaxStart(function () { 590 $("#divProgress").show(); 591 }); 592 $(document).ajaxComplete(function () { 593 $("#divProgress").hide(); 594 setTimeout(function () { updateCartCount(); }, 200); 595 596 preventViewerLaunchInNewTab(); 597 }); 598 $(document).ready(function () { 599 $("#divProgress").hide(); 600 }); 601 //form related jquery 602 try { 603 var IsContryExists = $("#IsContryExists").val(); 604 if (IsContryExists == "true") { 605 //var formCountryId = $("#formCountryId").val(); 606 var formCountryId = $(".clsformCountryId").val(); 607 // if (formCountryId > 0) { 608 frmGetAllState(formCountryId, Docreadyeventid); 609 // } 610 } 611 } catch (e) { 612 } 613 //$('#formCountryId').change(function () { 614 // $('#divProgress').show(); 615 // var formCountryId = $("#formCountryId").val(); 616 // frmGetAllState(formCountryId); 617 //}); 618 $('body').on('change', '.clsformCountryId', function () { 619 $('#divProgress').show(); 620 var formCountryId = $(this).val(); 621 frmGetAllState(formCountryId, DdlChangeid); 622 }); 623 624 setTimeout(function () { LoadCustomerBundleProductList(); }, 100); 625 626 //DateTime Formate validation Start 627 if (typeof (dateFormate) == "string" && dateFormate == 'ddMMyyyy' && $.validator) { 628 $.validator.addMethod('date', function (value, element) { 629 if (this.optional(element)) { 630 return true; 631 } var valid = true; 632 try { 633 $.datepicker.parseDate('dd/mm/yy', value); 634 } catch (err) { 635 valid = false; 636 } return valid; 637 }); 638 } 639 // DateTime Formate validation End 640 641 removeTableResponsiveCss(); 642 643 // Start - #10435 Collapse (+)(-) 644 $('.collapse').on('shown.bs.collapse', function (event) { 645 if (event.target.id == 'filtersSidebarmenuInToggle') 646 $(this).parent().find(".fa-chevron-down").removeClass("fa-chevron-down").addClass("fa-chevron-up"); 647 else 648 $('#' + event.target.id).parent().find(".glyphicon-plus").removeClass("glyphicon-plus").addClass("glyphicon-minus"); 649 }).on('hidden.bs.collapse', function (event) { 650 if (event.target.id == 'filtersSidebarmenuInToggle') 651 $(this).parent().find(".fa-chevron-up").removeClass("fa-chevron-up").addClass("fa-chevron-down"); 652 else 653 $('#' + event.target.id).parent().find(".glyphicon-minus").removeClass("glyphicon-minus").addClass("glyphicon-plus"); 654 }); 655 // End - #10435 Collapse (+)(-) 656 657 if (typeof SearchFiltersCollapse == "function") { 658 SearchFiltersCollapse(); 659 } 660 if ($('.datepicker').length > 0) { 661 $('.datepicker').datepicker(); 662 } 663 664 if ($('.DOBdatepicker').length > 0) { 665 666 $('.DOBdatepicker').datepicker({ 667 defaultDate: new Date(new Date().setYear(2019 - 30)), //set the default date 668 changeMonth: true, 669 changeYear: true, 670 yearRange: "1900:" + (new Date().getFullYear() - 10) //set the range of years 671 }); 672 673 $(".DOBdatepicker").on('blur', function () { 674 try { 675 var date = $.datepicker.parseDate(dateFormate == "ddMMyyyy" ? "dd/mm/yy" : "mm/dd/yy", $(this).val()); 676 if (date > new Date()) { 677 alert('Please select another date'); 678 $(this).val(''); 679 } 680 } 681 catch (ex) { 682 return false; 683 } 684 }); 685 686 } 687 688 689 preventViewerLaunchInNewTab(); 690 //#21323 691 $(".custom-mobileview #cartbar .navbar-toggle").click(function () { 692 $(".overlay-Mobileview").toggleClass("overlay-div"); 693 $(".custom-mobileview .nav__sub").removeClass("is-active"); 694 if ($(".overlay-Mobileview").hasClass("overlay-div")) { 695 $("body").css("overflow", "hidden"); 696 } 697 else { 698 $("body").css("overflow", ""); 699 } 700 });
701 702 if (window.location !== window.parent.location) { 703 console.log("I'm stuck in an iFrame!"); 704 705 if (window.frameElement && !window.frameElement.getAttribute('title')) { 706 var pageTitle = document.title + ' iFrame'; 707 708 if (pageTitle && pageTitle.trim() !== '') { 709 window.frameElement.setAttribute('title', pageTitle); 710 } 711 } 712 var pParse = document.createElement("a"); 713 pParse.href = document.referrer; 714 var p = pParse.hostname; 715 716 var cParse = document.createElement("a"); 717 cParse.href = document.URL; 718 var c = cParse.hostname; 719 720 if (p !== c) { 721 $.ajax({ 722 type: "POST", 723 url: "https://" + window.location.host + "/iframe", 724 data: { "url": encodeURIComponent(document.referrer) + "|" + encodeURIComponent(document.URL) } 725 }); 726 } 727 } 728 //#5633846136 729 $('#createFreeAds').on('click', function (event) { 730 event.preventDefault(); 731 var classifiedFeePlanId = $(this).data('searchproduct'); 732 if (!userIsAuthenticated()) { 733 redirectToLogin(); 734 } else { 735 createFreeClassifiedAd(classifiedFeePlanId); 736 } 737 }); 738 739 $('.carousel4item').each(function () { 740 var totalItem = $(this).attr('data-totalItem') || 1; 741 $(this).find('.carousel .item').each(function () { 742 var i = $(this).next(); 743 i.length || (i = $(this).siblings(":first")), 744 i.children(":first-child").clone().appendTo($(this)); 745 if (totalItem != 2 && totalItem != 3) { 746 for (var n = 0; n < 2; n++)(i = i.next()).length || 747 (i = $(this).siblings(":first")), 748 i.children(":first-child").clone().addClass('hidden-sm hidden-xs').appendTo($(this)) 749 } 750 else if (totalItem == 3) { 751 var j = i.next(); 752 j.length || (j = $(this).siblings(":first")), 753 j.children(":first-child").clone().addClass('hidden-sm hidden-xs').appendTo($(this)); 754 } 755 }) 756 }) 757 758 // Function call from company-change.js 759 if ($('.dropCompanyName').length > 0) { 760 bindCompanyNameDropdown('.dropCompanyName'); 761 } 762 763 ApplyNoTriggerGlobalDiscount(); 764}); 765$("body").on("click", ".btnAddtowishlist", function () { 766 var element = $(this); 767 var labelId = $(this).attr('data-value'); 768 var Value = labelId.split(','); 769 var eventTimeId = 0; 770 var ProductId = Value[0]; 771 var Type = Value[1]; 772 var MultipleEventTimeId = $('.EventDate').val(); 773 var pagetype = ''; 774 var pageno = 1; 775 var sortby = 11; 776 var eventDateId = $(this).attr('data-eventTimeId'); 777 778 if (parent.$("#pageType").val() != undefined) { 779 pagetype = parent.$("#pageType").val(); 780 } 781 782 if (parent.$("#pageno").val() != undefined) { 783 pageno = parent.$("#pageno").val(); 784 } 785 if (parent.$("#sortby").val() != undefined) { 786 sortby = parent.$("#sortby").val(); 787 } 788 789 if (Type == "ShoppingCart") { 790 eventTimeId = eventDateId; 791 } 792 else if (MultipleEventTimeId > 0) { 793 eventTimeId = MultipleEventTimeId; 794 } 795 796 $.ajax({
797 type: "POST", 798 url: "/Items/SaveToCalendar", 799 dataType: "json", 800 data: { 801 'ProductId': ProductId, 'eventDateId': eventTimeId, 'Type': Type 802 }, 803 success: function (data) { 804 if (data.WishlistCount > 0) { 805 parent.$("#Wishlistcount").html("(" + data.WishlistCount + ")"); 806 } 807 //compare Product item 808 if (data.isCompareProduct != undefined && data.isCompareProduct == true) { 809 parent.$("#compareProductcartspancount").html(data.compareProductCount); 810 parent.$("#compareProductcartItemList").load(GET_COMPAREPRODUCTCART_URL); 811 } 812 //compare Product item 813 if (pagetype == "CompareItem") { 814 parent.$("#grid-compareProduct").load(GET_COMPARE_PRODUCT_URL + '?page=' + pageno + '&sortby=' + sortby); 815 } 816 if (data.Message != null && data.Message != "") { 817 displayCartMessages(element, data, Type); //#16325 818 819 //ShoppingCart 820 if (data.Type != null && data.Type == 'ShoppingCart') { 821 //$("#grid-WishList").load('/Account/CustomerSavedItem'); 822 //updateWishList(); 823 824 var removeItem = $(element).prev().prev(); 825 if (removeItem != null && $(removeItem).hasClass('RemoveItemFromCart') && data.isAlreadyPurchase == false) { 826 isRefreshWishList = true; 827 $(removeItem).trigger('click'); 828 829 } 830 $("#spnMessage").html(data.Message); 831 $(".wishlistCart").show(); 832 } 833 } 834 835 }, 836 complete: function (data) { 837 }, 838 error: function (data) { 839 alert('Error! Please try again later.'); 840 } 841 }); 842}); 843 844function ChangeAlterMessageClass(className, data) { 845 if (className && data.Message) { 846 if (data.IsPurchaseLimitExceeded) { 847 $(className).find(".alert").removeClass('alert-success').addClass('alert-warning'); 848 $(className).find("i").removeClass('fa-check').addClass('fa-exclamation-circle'); 849 } 850 else { 851 $(className).find(".alert").removeClass('alert-warning').addClass('alert-success'); 852 $(className).find("i").removeClass('fa-exclamation-circle').addClass('fa-check'); 853 } 854 } 855} 856 857 858 859 860function beginPagingSingleCol(args) { 861 // Animate 862 //$('#grid-list').fadeOut('normal'); 863} 864 865function onRegisterSubmit() { 866 $("#Widget-form").submit(); 867} 868 869function successPagingSingleCol() { 870 $("#dt_basic_wrapper_singlecol").attr("action", $("#pagingFormAction").attr("href")); 871} 872 873function failurePagingSingleCol() { 874 alert("Could not retrieve list."); 875} 876 877function beginPagingTwoCol(args) { 878 // Animate 879 //$('#grid-list').fadeOut('normal'); 880} 881 882function successPagingTwoCol() { 883 $("#dt_basic_wrapper_twocol").attr("action", $("#pagingFormActiontwocol").attr("href")); 884} 885 886function failurePagingTwoCol() { 887 alert("Could not retrieve list."); 888} 889 890function beginPagingThreeCol(args) { 891 // Animate 892 //$('#grid-list').fadeOut('normal'); 893} 894 895function successPagingThreeCol() { 896 $("#dt_basic_wrapper_threecol").attr("action", $("#pagingFormActionthreecol").attr("href")); 897} 898 899function failurePagingThreeCol() { 900 alert("Could not retrieve list."); 901} 902 903function beginPagingSimpleProd(args) { 904 // Animate 905 //$('#grid-list').fadeOut('normal'); 906} 907 908function successPagingSimpleProd() { 909 $("#dt_basic_wrapper_simplepro").attr("action", $("#pagingFormActionsimplepro").attr("href")); 910} 911 912function failurePagingSimpleProd() { 913 alert("Could not retrieve list."); 914} 915 916function getParameterByName(name) { 917 name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); 918 var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), 919 results = regex.exec(location.search); 920 return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
921} 922 923function getParameterByNameForHref(hrefUrl, name) { 924 name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); 925 var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), 926 results = regex.exec(hrefUrl); 927 return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); 928} 929 930function closePopup() { 931 $.magnificPopup.close(); 932} 933 934function frmGetAllState(formCountryId, eventId) { 935 var frmStateId = $(".clsfrmStateId").val(); 936 var OtherState = $("#OtherState").val(); 937 var isOther = true; 938 $.getJSON('/Account/GetState/', { Id: formCountryId }, function (data) { 939 var items = ''; 940 if (data.length > 0) { 941 items += "<option value=''></option>"; 942 $.each(data, function (i, data) { 943 if (frmStateId == data.Text) { 944 isOther = false; 945 items += "<option selected='selected' value='" + data.Text + "'>" + data.Text + "</option>"; 946 } else { 947 isOther = false; 948 items += "<option value='" + data.Text + "'>" + data.Text + "</option>"; 949 } 950 }); 951 952 $('.clsfrmstateDrp').attr('style', 'display'); 953 $('.clsOtherState').attr('style', 'display:none'); 954 $('.clsfrmState').html(items); 955 if (isOther && eventId == 1) { 956 $(".clsfrmStateId").val(''); 957 if (OtherState == "") { 958 $(".clsOtherState").val(frmStateId); 959 } 960 else { 961 $(".clsOtherState").val(OtherState); 962 } 963 964 965 966 } else { 967 $(".clsOtherState").val(''); 968 } 969 } 970 else { 971 $('.clsfrmstateDrp').attr('style', 'display:none'); 972 $('.clsOtherState').attr('style', 'display'); 973 $('.clsfrmState').html(''); 974 if (isOther && eventId == 1) { 975 if (OtherState == "") { 976 $(".clsOtherState").val(frmStateId); 977 } 978 else { 979 $(".clsOtherState").val(OtherState); 980 } 981 } else { 982 $(".clsOtherState").val(''); 983 } 984 } 985 $('#divProgress').hide(); 986 }); 987 988} 989function frmGetAllStateLoad() { 990 var formCountryId = $(".clsformCountryId").val(); 991 992 var Id = $("#Customerid").val(); 993 if (Id < 0) { 994 formCountryId = "United States"; 995 $(".clsformCountryId").val('United States'); 996 } 997 jQuery.noConflict(); 998 if (formCountryId != undefined) { 999 frmGetAllState(formCountryId, 1); 1000 } 1001 //$('textarea.ce21ckeditor').ckeditor(); 1002 //window.location.reload(); 1003} 1004 1005function CloseMagnificPop() { 1006 //close any magnific popup in catalog 1007 $.magnificPopup.close(); 1008} 1009 1010$("body").on("click", ".btnAddCompareProduct", function () { 1011 var element = $(this); 1012 var ProductId = element.attr('data-value'); 1013 var Type = element.attr('data-widgetType'); 1014 var isViewerProduct = false; 1015 if (Type != undefined && Type == 'ViewerCompareProduct') { 1016 isViewerProduct = true; 1017 } 1018 $.ajax({
1019 type: "POST", 1020 url: ADD_COMPAREPRODUCT_URL, 1021 dataType: "json", 1022 data: { 1023 'ProductId': ProductId, 1024 'IsFromViewerProduct': isViewerProduct 1025 }, 1026 success: function (data) { 1027 if (data.CartCount != null && data.CartCount != "" && data.CartCount != "0") { 1028 parent.$("#compareProductcartspancount").html(data.CartCount); 1029 parent.$("#compareProductcartItemList").load(GET_COMPAREPRODUCTCART_URL); 1030 } 1031 //set wishlist count 1032 if (data.isChangeWishlist == true) { 1033 parent.$("#Wishlistcount").html("(" + data.wishlistCount + ")"); 1034 } 1035 if (data.Message != null && data.Message != "") { 1036 displayCartMessages(element, data, Type); //#16325 1037 } 1038 }, 1039 complete: function (data) { 1040 }, 1041 error: function (data) { 1042 alert('Error! Please try again later.'); 1043 } 1044 }); 1045}); 1046 1047// #region subscription 1048function subscriptionFailure() {
1049 alert('There is a problem to submit code. Please, try after some time'); 1050} 1051 1052function subscriptionSuccess(data) { 1053 if (data !== undefined && data != null && data.Message !== undefined && data.Message != null) { 1054 if (data.Message != "success" && data.Message.length > 0) { 1055 alert(data.Message); 1056 } 1057 } 1058 if (data != null && data != undefined && data.Url != null && data.Url != undefined) { 1059 window.location.href = data.Url; 1060 } 1061 $('.subscriptionCode').val(''); 1062 if ($.validator != undefined && $.validator.unobtrusive != undefined) { 1063 $.validator.unobtrusive.parse("form"); 1064 } 1065} 1066// #end region subscription 1067 1068//#region Order summary 1069 1070function UpdateOrderSummary(callback) { 1071 $("#divProgress").show(); 1072 var purchaserCustomerId = ''; 1073 if ($('#currentCartStage').val() == 'RegistrantConfirmation') { 1074 purchaserCustomerId = GetPurchaserCustomerId(); 1075 } 1076 var isDirectPaymentPage = ($("#isDirectPaymentPage").val() || "").toLowerCase() == 'true'; 1077 var cartId = isDirectPaymentPage ? $("#ShoppingCartId").val() : ""; 1078 1079 if ($('#div-order-summary').length > 0 || $('#div-bundle-information')) { 1080 var orderId = null; 1081 if ($('#OrderId').length > 0) { 1082 orderId = Number($('#OrderId').val()); 1083 } 1084 1085 $.ajax({
1086 url: isDirectPaymentPage ? MINICART_MY_CART_URL : MY_CART_URL, 1087 type: "POST", 1088 data: { 1089 'DisplayScreen': '_OrderSummary', 1090 'orderId': orderId, 1091 'currentStage': $("#CurrentStage").val(), 1092 'purchaserCustomerId': purchaserCustomerId, 1093 'paymentMethod': $("input[name=paymentMethod]:checked").val() || "", 1094 'cartId': cartId, 1095 }, 1096 cache: false, 1097 success: function (result) { 1098 $("#divProgress").show(); 1099 $('#div-order-summary').html(result); 1100 if ($("#hdnMessage").val() != null && $("#hdnMessage").val() != "") { 1101 alert($("#hdnMessage").val()); 1102 } 1103 if (typeof setDataAttributeToSubmitButton == "function") { 1104 setDataAttributeToSubmitButton(); 1105 } 1106 }, 1107 complete: function () { 1108 $("#divProgress").hide(); 1109 if (callback && typeof (callback) == "function") { callback(); } 1110 }, 1111 error: function () { 1112 $("#divProgress").hide(); 1113 } 1114 }); 1115 } 1116 else { 1117 $("#divProgress").hide(); 1118 } 1119} 1120 1121function updateWishList() { 1122 //if ($("#grid-WishList") !== undefined && $("#grid-WishList").length > 0 && $("#grid-WishList").html().trim().length == 0) { 1123 $("#grid-WishList").load('/Account/CustomerSavedItem', function () { 1124 loadAlertToolTip(); 1125 }).prepend("<p class='loaderTxt' >Please wait ...</p>"); 1126 //} 1127} 1128 1129// #22292 1130function CheckCode(appliedCode) { 1131 if (!appliedCode || !appliedCode.trim()) { 1132 alert("Please enter a valid code."); 1133 return false; 1134 } 1135 $.post("/shoppingcart/CheckGiftCardCodeAndCoupenCode", { 'discountCode': appliedCode }, function (data) { 1136 if (data.message == "DiscountCode") 1137 ApplyDiscountCode(appliedCode); 1138 else if (data.message == "GiftCard") { 1139 CheckGiftCardCodeAlerdayApplied(appliedCode); 1140 } 1141 else 1142 alert("Applied code is invalid"); 1143 }); 1144} 1145 1146//#region Discount 1147$("body").on("click", ".btnCouponShoppingCart", function () { 1148 CheckCode($(".txtCouponCodeShoppingCart").val()); 1149}); 1150 1151// #22292 1152function ApplyDiscountCode(couponCode) { 1153 var registrantEmails = GetRegistrantEmails(); 1154 var purchaserCustomerId = ''; 1155 if ($('#currentCartStage').val() == 'RegistrantConfirmation') { 1156 purchaserCustomerId = GetPurchaserCustomerId(); 1157 } 1158 if (couponCode && couponCode.trim() != '') { 1159 $.ajax({
1160 type: "POST", 1161 url: CHECK_COUPON_CODE_URL, 1162 dataType: "json", 1163 data: { 1164 'DiscountCode': couponCode, 1165 'registrantEmails': registrantEmails, 1166 'purchaserCustomerId': purchaserCustomerId, 1167 'isRegistrantConfirmation': ($('#currentCartStage').val().toLowerCase() == "registrantconfirmation") 1168 }, 1169 success: function (data) { 1170 if (data != "") { 1171 if (data.type == 1) { 1172 1173 if (data.isApplyOnlyToRegistrant && (data.inValidRegistrants || data.registrantsDiscountMessageType != 'Default') && data.message) {//#21994 1174 ConfirmRegistrantDiscount(couponCode, null, data.inValidRegistrants, data.message, data.registrantsDiscountMessageType); 1175 } 1176 else if (data.message != "") { 1177 if (data.ishareProduct) { 1178 updateProductNameWithoutDiscount(data.message) 1179 } 1180 else { 1181 alert(data.message); 1182 } 1183 1184 } 1185 if (ISRELOADPAGE) {//#21994 1186 ISRELOADPAGE = false; 1187 $('#divProgress').show(); 1188 location.reload(); 1189 } 1190 1191 UpdateOrderSummary(); 1192 if (typeof UpdateItemCart == 'function') { 1193 UpdateItemCart(0); 1194 } 1195 } 1196 else if (data.type == 3) { //3:Member Hours 1197 alert(data.message); 1198 } 1199 else { 1200 if (confirm(data.message)) { 1201 UpdateOrderSummary(); 1202 if (typeof UpdateItemCart == 'function') { 1203 UpdateItemCart(0); 1204 } 1205 } else { 1206 RemoveDisount(); 1207 } 1208 } 1209 1210 if (location.href && location.href.toLowerCase().indexOf('/account/shippinginfo') > -1) { 1211 ApplyFreeShipping(data.freeshipping, data); 1212 } 1213 } 1214 }, 1215 error: function (data) { 1216 alert('Error! Please try again later.'); 1217 } 1218 }); 1219 } else { 1220 RemoveDisount(); 1221 } 1222} 1223 1224//#end region Discount 1225 1226function ApplyGiftCard(GiftCardCode) { 1227 $.ajax({
1228 type: "POST", 1229 url: CHECK_GIFT_CARD_CODE_URL, 1230 dataType: "json", 1231 data: { 1232 'DiscountCode': GiftCardCode, 1233 }, 1234 success: function (data) { 1235 if (data != "") { 1236 alert(data); 1237 } 1238 }, 1239 complete: function (data) { 1240 UpdateItemCart(0); 1241 }, 1242 error: function (data) { 1243 alert('Error! Please try again later.'); 1244 } 1245 }); 1246} 1247 1248// #region discouunts 1249function UpdateItemCart(discountId) { 1250 var purchaserCustomerId = ''; 1251 if ($('#currentCartStage').val() == 'RegistrantConfirmation') { 1252 purchaserCustomerId = GetPurchaserCustomerId(); 1253 } 1254 $("#divProgress").show(); 1255 var orderId = null; 1256 var usedrewardAmount = $('#hdnRewardPoint').val(); 1257 var exchangeRate = $('#hdnExchangeRate').val(); 1258 if ($('#OrderId').length > 0) { 1259 orderId = Number($('#OrderId').val()); 1260 } 1261 1262 var isDirectPaymentPage = ($("#isDirectPaymentPage").val() || "").toLowerCase() == 'true'; 1263 var cartId = isDirectPaymentPage ? $("#ShoppingCartId").val() : ""; 1264 1265 $.ajax({
1266 url: isDirectPaymentPage ? MINICART_MY_CART_URL : MY_CART_URL, 1267 type: "POST", 1268 data: { 1269 'GroupDiscountId': discountId, 1270 'DisplayScreen': '_ConfirmPurchase', 1271 'orderId': orderId, 1272 'purchaserCustomerId': purchaserCustomerId, 1273 'cartId': cartId, 1274 }, 1275 cache: false, 1276 success: function (result) { 1277 UpdateOrderSummary(function () { 1278 var productWithNoDisocuntHtml = $('.clsAddProductCartMessage_discount').html() 1279 $('#grid-list').html(result); 1280 if (productWithNoDisocuntHtml != undefined && productWithNoDisocuntHtml.length > 0) { 1281 $('.clsAddProductCartMessage_discount').html(productWithNoDisocuntHtml) 1282 } 1283 //if ($("#hdnMessage").val() != null && $("#hdnMessage").val() != "") { 1284 // alert($("#hdnMessage").val()); 1285 //} 1286 var grandTotal = Number($("#hdnGrandTotal").val()); 1287 var subTotal = Number($("#hdnSubTotal").val()); 1288 var rewardTotal = Number($("#hdnRewardTotal").val()); 1289 if (grandTotal == 0 || (subTotal == rewardTotal)) { 1290 $("#rdbUseAll").attr('disabled', true); 1291 $("#rdbChooseAmount").attr('disabled', true); 1292 $("#txtRewardPoint").attr('disabled', true); 1293 } 1294 1295 var productNameWithNoDiscount = $("#hdnProductNameWithNoDiscount") != undefined ? $("#hdnProductNameWithNoDiscount").val() : ""; 1296 updateProductNameWithoutDiscount(productNameWithNoDiscount); 1297 validateCreditCard(); 1298 validateACH(); 1299 validateCashDiscount(); 1300 1301 var RBvalue = $("#rdbChooseAmount").prop('checked'); 1302 if (RBvalue == true) { 1303 $(".divCustomRewardPoint").show(); 1304 if (usedrewardAmount != undefined && usedrewardAmount != null) { 1305 $("#txtRewardPoint").val(usedrewardAmount); 1306 } 1307 } 1308 1309 var rpCheck = $("#rdbChooseRewardsPoint").prop('checked'); 1310 if (rpCheck == true) { 1311 $(".divAddRewardPoint").show(); 1312 if (usedrewardAmount != undefined && usedrewardAmount != null) { 1313 $("#txtAddRewardPoint").val(usedrewardAmount / exchangeRate); 1314 } 1315 } 1316 LoadOrderAttributeLists(); 1317 1318 loadAlertToolTip(); 1319 1320 if (typeof (hideShowPyamentAssignToCompanyPurchase) == "function") { 1321 hideShowPyamentAssignToCompanyPurchase(); 1322 } 1323 }); 1324 }, 1325 error: function () { 1326 UpdateOrderSummary(); 1327 if (typeof (hideShowPyamentAssignToCompanyPurchase) == "function") { 1328 hideShowPyamentAssignToCompanyPurchase(); 1329 } 1330 } 1331 }); 1332 1333} 1334 1335function validateCreditCard() { 1336 if ($("#hdnGrandTotal") != undefined && Number($("#hdnGrandTotal").val()) <= 0) { 1337 1338 if ($("#CCInfornation_CardHolderName").length > 0) { 1339 if ($("#CCInfornation_CardHolderName") != undefined && $("#CCInfornation_CardHolderName").length > 0) { 1340 $("#CCInfornation_CardHolderName").rules("remove", "required"); 1341 } 1342 if ($("#drpCardType") != undefined && $("#drpCardType").length > 0) { 1343 $("#drpCardType").rules("remove", "required"); 1344 $("#drpCardType").removeAttr("required"); 1345 } 1346 if ($("#CCInfornation_CardNumber") != undefined && $("#CCInfornation_CardNumber").length > 0) { 1347 $("#CCInfornation_CardNumber").rules("remove", "required"); 1348 } 1349 if ($("#CCInfornation_CVV") != undefined && $("#CCInfornation_CVV").length > 0) { 1350 $("#CCInfornation_CVV").rules("remove", "required"); 1351 } 1352 if ($("#CCInfornation_CardMonth") != undefined && $("#CCInfornation_CardMonth").length > 0) { 1353 $("#CCInfornation_CardMonth").rules("remove", "required"); 1354 } 1355 if ($("#CCInfornation_CardYear") != undefined && $("#CCInfornation_CardYear").length > 0) { 1356 $("#CCInfornation_CardYear").rules("remove", "required"); 1357 } 1358 if ($("select[name='CCInfornation.CardType']") != undefined && $("select[name='CCInfornation.CardType']").length > 0) { 1359 $("select[name='CCInfornation.CardType']").rules("remove", "required"); 1360 } 1361 } 1362 1363 1364 //hide credit card section and billing info section 1365 if ($(".clsCreditCardInformation") != undefined && $(".clsCreditCardInformation").length > 0) { 1366 $(".clsCreditCardInformation").hide(); 1367 } 1368 //remove rules for billing info section 1369 if ($("#CountryId") != undefined && $("#CountryId").length > 0) { 1370 $("#CountryId").rules("remove", "required"); 1371 $("#CountryId").removeAttr("required"); 1372 } 1373 if ($("select[name='BillCountry']") != undefined && $("select[name='BillCountry']").length > 0) { 1374 $("select[name='BillCountry']").rules("remove", "required"); 1375 } 1376 if ($("#BillAddress") != undefined && $("#BillAddress").length > 0) { 1377 $("#BillAddress").rules("remove", "required"); 1378 } 1379 if ($("#BillCity") != undefined && $("#BillCity").length > 0) { 1380 $("#BillCity").rules("remove", "required"); 1381 } 1382 if ($("#State") != undefined && $("#State").length > 0) { 1383 $("#State").rules("remove", "required"); 1384 $("#State").removeAttr("required"); 1385 } 1386 if ($("select[name='State']") != undefined && $("select[name='State']").length > 0) { 1387 $("select[name='State']").rules("remove", "required"); 1388 } 1389 if ($("#BillOtherState") != undefined && $("#BillOtherState").length > 0) { 1390 $("#BillOtherState").rules("remove", "required"); 1391 } 1392 if ($("#BillZipcode") != undefined && $("#BillZipcode").length > 0) { 1393 $("#BillZipcode").rules("remove", "required"); 1394 } 1395 1396 } 1397 else { 1398 1399 if ($("#CCInfornation_CardHolderName").length > 0) { 1400 if ($("#CCInfornation_CardHolderName") != undefined && $("#CCInfornation_CardHolderName").length > 0) { 1401 $("#CCInfornation_CardHolderName").rules("add", "required"); 1402 } 1403 if ($("#drpCardType") != undefined && $("#drpCardType").length > 0) { 1404 $("#drpCardType").rules("add", "required"); 1405 $("#drpCardType").attr("required", "required"); 1406 } 1407 if ($("#CCInfornation_CardNumber") != undefined && $("#CCInfornation_CardNumber").length > 0) { 1408 $("#CCInfornation_CardNumber").rules("add", "required"); 1409 } 1410 if ($("#CCInfornation_CVV") != undefined && $("#CCInfornation_CVV").length > 0) { 1411 $("#CCInfornation_CVV").rules("add", "required"); 1412 } 1413 if ($("#CCInfornation_CardMonth") != undefined && $("#CCInfornation_CardMonth").length > 0) { 1414 $("#CCInfornation_CardMonth").rules("add", "required"); 1415 } 1416 if ($("#CCInfornation_CardYear") != undefined && $("#CCInfornation_CardYear").length > 0) { 1417 $("#CCInfornation_CardYear").rules("add", "required"); 1418 } 1419 if ($("select[name='CCInfornation.CardType']") != undefined && $("select[name='CCInfornation.CardType']").length > 0) { 1420 $("select[name='CCInfornation.CardType']").rules("add", "required"); 1421 } 1422 if ($(".CCInfornation") != undefined && $(".CCInfornation").length > 0) { 1423 $(".CCInfornation").parent('.has-error').removeClass("has-error"); 1424 } 1425 } 1426 1427 //show credit card section and billing info section 1428 if ($(".clsCreditCardInformation") != undefined && $(".clsCreditCardInformation").length > 0) { 1429 $(".clsCreditCardInformation").show(); 1430 } 1431 //add rules for billing info section 1432 if ($("#CountryId") != undefined && $("#CountryId").length > 0) { 1433 $("#CountryId").rules("add", "required"); 1434 $("#CountryId").attr("required", "required"); 1435 } 1436 if ($("select[name='BillCountry']") != undefined && $("select[name='BillCountry']").length > 0) { 1437 $("select[name='BillCountry']").rules("add", "required"); 1438 } 1439 if ($("#BillAddress") != undefined && $("#BillAddress").length > 0) { 1440 $("#BillAddress").rules("add", "required"); 1441 } 1442 if ($("#BillCity") != undefined && $("#BillCity").length > 0) { 1443 $("#BillCity").rules("add", "required"); 1444 } 1445 if ($("#State") != undefined && $("#State").length > 0) { 1446 $("#State").rules("add", "required"); 1447 $("#State").attr("required", "required"); 1448 } 1449 if ($("select[name='State']") != undefined && $("select[name='State']").length > 0) { 1450 $("select[name='State']").rules("add", "required"); 1451 } 1452 if ($("#BillOtherState") != undefined && $("#BillOtherState").length > 0) { 1453 $("#BillOtherState").rules("add", "required"); 1454 } 1455 if ($("#BillZipcode") != undefined && $("#BillZipcode").length > 0) { 1456 $("#BillZipcode").rules("add", "required"); 1457 } 1458 } 1459} 1460 1461// load the order attribute list 1462function LoadOrderAttributeLists() { 1463 if ($("#divOrderAttributes").length > 0) { 1464 var url = '/Account/GetCartOrderAttribute'; 1465 if ($("#SessionId").length > 0) { 1466 url = url + '?SessionId=' + $("#SessionId").val(); 1467 } 1468 $("#divOrderAttributes").load(url, function () { 1469 $(".datepicker").datepicker(); 1470 }); 1471 } 1472} 1473// #endregion discouunts 1474 1475function validateACH() { 1476 if (Number($("#hdnGrandTotal").val()) <= 0) { 1477 if ($("#ACHInfornation_Name").length > 0) { 1478 $("#ACHInfornation_AccountHolderType").rules("remove", "required"); 1479 $("#ACHInfornation_Name").rules("remove", "required"); 1480 $("#ACHInfornation_FirstName").rules("remove", "required"); 1481 $("#ACHInfornation_LastName").rules("remove", "required"); 1482 $("#ACHInfornation_BankAccountNumber").rules("remove", "required"); 1483 $("#ACHInfornation_RoutingNumber").rules("remove", "required"); 1484 $("#ACHInfornation_AccountType").rules("remove", "required"); 1485 } 1486 } 1487 else { 1488 if ($("#ACHInfornation_Name").length > 0) { 1489 $("#ACHInfornation_AccountHolderType").rules("add", "required"); 1490 $("#ACHInfornation_Name").rules("add", "required"); 1491 $("#ACHInfornation_FirstName").rules("add", "required"); 1492 $("#ACHInfornation_LastName").rules("add", "required"); 1493 $("#ACHInfornation_BankAccountNumber").rules("add", "required"); 1494 $("#ACHInfornation_RoutingNumber").rules("add", "required"); 1495 $("#ACHInfornation_AccountType").rules("add", "required"); 1496 } 1497 } 1498} 1499 1500//$("body").on('click', ".clsGlobalDiscount", function () { 1501// var discountId = Number($(this).attr("data-priceId"));
1502// var isAdded = $(this).attr("data-isAdded"); 1503// var discountOffPrice = $("#discountOffPrice").val(); 1504// if ($('[name="discountOffPrice"]').length > 1) 1505// discountOffPrice = $('[name="discountOffPrice"]')[1].value; 1506// discountOffPrice = typeof (discountOffPrice) == "string" && discountOffPrice != undefined && discountOffPrice != "" ? discountOffPrice : ""; 1507// if (isAdded == 1) { 1508// if (typeof (RemoveDisount) == "function") { 1509// RemoveDisount(); 1510// } 1511// } 1512// else if (discountId > 0) { 1513// //customer have already discount and apply another discount then display confirmation 1514// $.ajax({ 1515// type: "POST", 1516// url: GET_CURRENT_DISCOUNT_DETAIL, 1517// dataType: "json", 1518// data: { 'newDiscountId': discountId, 'currentStage': $("#CurrentStage").val() }, 1519// success: function (data) { 1520// if (data != undefined && data != null && data.discountId != undefined && data.discountId != null && Number(data.discountId) > 0) { 1521// var newDiscountOffPrice = typeof (data.newDiscount) == "string" && data.newDiscount != undefined && data.newDiscount != "" ? data.newDiscount : ""; 1522// $.confirm({ 1523// title: '', 1524// boxWidth: '600px', 1525// useBootstrap: false, 1526// type: '',
1527// content: 'You currently have a discount in your cart that is saving you ' + discountOffPrice + '.<br/>If you apply this discount you will receive ' + newDiscountOffPrice + ' off of your purchase instead.<br/>Please choose one discount to apply.<br/><br/> Do you wish to continue? ', 1528// buttons: { 1529// cancel: { 1530// text: 'No, Keep the other discount', 1531// btnClass: 'btn-warning', 1532// action: function () { 1533// } 1534// }, 1535// ok: { 1536// text: 'Yes, Apply new discount', 1537// btnClass: 'btn-success', 1538// action: function () { 1539// applyGlobalDiscount(discountId); 1540// } 1541// } 1542 1543// } 1544// }); 1545 1546// } 1547// else { 1548// applyGlobalDiscount(discountId); 1549// } 1550 1551// }, 1552// complete: function (data) { 1553 1554// }, 1555// error: function (data) { 1556// alert('Error! Please try again later.'); 1557// } 1558// }); 1559// } 1560//}); 1561 1562// Global discount click handler 1563$("body").on('click', ".clsGlobalDiscount", function () { 1564 var discountId = Number($(this).attr("data-priceId")); 1565 var isAdded = $(this).attr("data-isAdded"); 1566 var discountOffPrice = $("#discountOffPrice").val() || $('[name="discountOffPrice"]').eq(1).val() || ""; 1567 1568 if (isAdded == 1) { 1569 if (typeof (RemoveDisount) === "function") { 1570 RemoveDisount(); 1571 } 1572 } 1573 else if (discountId > 0) { 1574 checkAndApplyDiscount(discountId, discountOffPrice, $("#CurrentStage").val(), function () { 1575 applyGlobalDiscount(discountId); 1576 }); 1577 } 1578}); 1579 1580// Reusable function to check for existing discounts and apply a new one 1581function checkAndApplyDiscount(discountId, discountOffPrice, currentStage, callback) { 1582 $.ajax({
1583 type: "POST", 1584 url: GET_CURRENT_DISCOUNT_DETAIL, 1585 dataType: "json", 1586 data: { 'newDiscountId': discountId, 'currentStage': currentStage }, 1587 success: function (data) { 1588 if (data && data.discountId && Number(data.discountId) > 0) { 1589 // Customer already has a discount, show confirmation 1590 var newDiscountOffPrice = typeof data.newDiscount === "string" && data.newDiscount ? data.newDiscount : ""; 1591 $.confirm({ 1592 title: '', 1593 boxWidth: '600px', 1594 useBootstrap: false, 1595 content: `You currently have a discount in your cart that is saving you ${discountOffPrice}.<br/>If you apply this discount, you will receive ${newDiscountOffPrice} off instead.<br/>Please choose one discount to apply.<br/><br/>Do you wish to continue?`, 1596 buttons: { 1597 cancel: { 1598 text: 'No, Keep the other discount', 1599 btnClass: 'btn-warning' 1600 }, 1601 ok: { 1602 text: 'Yes, Apply new discount', 1603 btnClass: 'btn-success', 1604 action: function () { 1605 callback(); 1606 } 1607 } 1608 } 1609 }); 1610 } else { 1611 // No existing discount, apply the new discount 1612 callback(); 1613 } 1614 }, 1615 error: function () { 1616 alert('Error! Please try again later.'); 1617 } 1618 }); 1619} 1620 1621function ApplyNoTriggerGlobalDiscount() { 1622 if ($('a.lnkRemoveDiscountShoppingCart').length > 0) { 1623 return; 1624 } 1625 1626 var allDiscountAnchors = $('a.clsGlobalDiscount'); 1627 var currentStage = $("#CurrentStage").val(); 1628 var discountOffPrice = $("#discountOffPrice").val() || $('[name="discountOffPrice"]').eq(1).val() || ""; 1629 1630 if (allDiscountAnchors.length === 1) { 1631 var discountTypeZeroAnchors = allDiscountAnchors.filter('[data-discountType="0"]'); 1632 if (discountTypeZeroAnchors.length > 0) { 1633 var discountId = Number(discountTypeZeroAnchors.eq(0).attr("data-priceId")); 1634 var isStackable = discountTypeZeroAnchors.eq(0).attr("data-isStackable") 1635 if (localStorage.getItem("IsAutoDiscount_" + discountId) === "true") { 1636 return; 1637 } 1638 1639 if ($('#ProductPriceId').val() > 0 && isStackable === 'False') { 1640 return; 1641 } 1642 checkAndApplyDiscount(discountId, discountOffPrice, currentStage, function () { 1643 applyGlobalDiscount(discountId); 1644 localStorage.setItem("IsAutoDiscount_" + discountId, "true"); // Mark as applied 1645 }); 1646 } 1647 } 1648} 1649//#region Discount 1650$("body").on('click', ".lnkRemoveDiscountShoppingCart", function () { 1651 RemoveDisount(); 1652}); 1653//#end region Discount 1654 1655function RemoveDisount() { 1656 $.ajax({
1657 type: "POST", 1658 url: REMOVE_COUPN_CODE_URL, 1659 dataType: "json", 1660 success: function (data) { 1661 $("#divShippingMethods").show(); 1662 if (data) { 1663 //if (window.location.pathname.indexOf("/registrantconfirmation") > -1 && data.IsApplyOnlyToRegistrant) { 1664 // $('#divProgress').show(); 1665 // location.reload(); 1666 //} 1667 if (data.IsFreeShippingType) { 1668 updateShippingOptionsByDiscount(); 1669 } 1670 } 1671 $(".clsAddProductCartMessage_discount").html("") 1672 UpdateOrderSummary(); 1673 if (typeof UpdateItemCart == 'function') { 1674 UpdateItemCart(0); 1675 } 1676 } 1677 }); 1678} 1679 1680function applyGlobalDiscount(discountId) { 1681 var registrantEmails = GetRegistrantEmails(); 1682 var purchaserCustomerId = ''; 1683 if ($('#currentCartStage').val() == 'RegistrantConfirmation') { 1684 purchaserCustomerId = GetPurchaserCustomerId(); 1685 } 1686 $.ajax({
1687 type: "POST", 1688 url: CHECK_COUPON_CODE_URL, 1689 dataType: "json", 1690 data: { 1691 'discountId': discountId, 1692 'registrantEmails': registrantEmails, 1693 'purchaserCustomerId': purchaserCustomerId, 1694 'isRegistrantConfirmation': ($('#currentCartStage').val().toLowerCase() == "registrantconfirmation") 1695 }, 1696 success: function (data) { 1697 if (data != "") { 1698 ApplyFreeShipping(data.freeshipping, data); 1699 if (data.type == 1) { 1700 1701 if (data.isApplyOnlyToRegistrant && (data.inValidRegistrants || data.registrantsDiscountMessageType != 'Default') && data.message) {//#21994 1702 ConfirmRegistrantDiscount(null, discountId, data.inValidRegistrants, data.message, data.registrantsDiscountMessageType); 1703 } 1704 else if (data.message != "") { 1705 if (data.ishareProduct) { 1706 updateProductNameWithoutDiscount(data.message) 1707 } 1708 else { 1709 alert(data.message); 1710 } 1711 } 1712 1713 if (ISRELOADPAGE) {//#21994 1714 ISRELOADPAGE = false; 1715 $('#divProgress').show(); 1716 location.reload(); 1717 } 1718 if (typeof UpdateItemCart == 'function') { 1719 UpdateItemCart(0); 1720 } 1721 //if (typeof UpdateOrderSummary == 'function') { 1722 // UpdateOrderSummary(0); 1723 //} 1724 1725 } else { 1726 if (confirm(data.message)) { 1727 if (typeof UpdateItemCart == 'function') { 1728 UpdateItemCart(0); 1729 } 1730 //if (typeof UpdateOrderSummary == 'function') { 1731 // UpdateOrderSummary(0); 1732 //} 1733 } else { 1734 if (typeof (RemoveDisount) == "function") { 1735 RemoveDisount(); 1736 } 1737 } 1738 } 1739 } 1740 }, 1741 complete: function (data) { 1742 1743 }, 1744 error: function (data) { 1745 alert('Error! Please try again later.'); 1746 } 1747 }); 1748} 1749function updateProductNameWithoutDiscount(data) { 1750 if (data != undefined && data != "") { 1751 $(".clsAddProductCartMessage_discount").html("") 1752 var ProductWithNoDiscount = data.split("^|^"); 1753 var appendDivHTML = '<div class="alert alert-danger fade in font-15 mt-10 CartMessage_discount" style="display: none; margin-top:10px;"><strong><button data-dismiss="alert" class="close">Ã</button><span id="CartMessage_discount">This discount is not eligible for one or more products in your cart.</span></strong></div >'; 1754 //$(".clsAddProductCartMessage_discount").append('<button data-dismiss="alert" class="close">Ã</button>'); 1755 $(".clsAddProductCartMessage_discount").append(appendDivHTML); 1756 $(".CartMessage_discount").show(); 1757 $("#CartMessage_discount").append('<ul class="ml-20"></ul>'); 1758 ProductWithNoDiscount.forEach(function (product) { 1759 $("#CartMessage_discount").find('ul').append('<li>' + product + '</li>'); 1760 }); 1761 } 1762} 1763//ScrollToFixed Order Summary 1764$(function () { 1765 1766 //if ($(".shoppingCartLayout .btnForHideShowSideBarShoppingCart").is(":visible")) { 1767 // $('.shoppingCartLayout .fixedSideBar').removeClass('fixedSideBar'); 1768 //} else { 1769 // $('.shoppingCartLayout .sidebar').removeClass('fixedSideBar'); 1770 //}&& !$(".btnForHideShowSideBarShoppingCart").is(":visible") 1771 1772 if ($('.shoppingCartLayout .fixedSideBar').length > 0) { 1773 $('.shoppingCartLayout .fixedSideBar').scrollToFixed({ 1774 marginTop: $(".custom-navbar.navbar").length > 0 ? 65 : 25, 1775 limit: function () { 1776 var limit = $('footer.footer').offset().top - $('.shoppingCartLayout .fixedSideBar').outerHeight(true) - 55; 1777 return limit; 1778 //var cartSideBarHeight = $('.fixedSideBar .panel.panel-default').outerHeight(true); 1779 //var limit = $('.ce21_shoppingcart_orrdersummary').closest('.row').outerHeight(true) + $('.ce21_shoppingcart_orrdersummary').closest('.row').offset().top; 1780 //console.log(limit - cartSideBarHeight); 1781 //return limit - cartSideBarHeight; 1782 1783 } 1784 }); 1785 } 1786}); 1787 1788//#end region 1789//$("body").on('submit', 'form[action*="Form"]', function () { 1790// var count = 0; 1791// var form = $(this); 1792// form.find('textarea[data-value="required"]').each(function () { 1793// if ($.trim($(this).val()) == '') { 1794// count += 1; 1795// var spanMsg = form.find('span[data-valmsg-for=' + $(this).attr('id') + ']'); 1796// spanMsg.html('This field is required.'); 1797// spanMsg.removeClass("field-validation-valid").addClass("field-validation-error"); 1798// $(this).closest(".form-group").addClass("has-error"); 1799// } else { 1800// var spanMsg = form.find('span[data-valmsg-for=' + $(this).attr('id') + ']'); 1801// spanMsg.html(''); 1802// spanMsg.removeClass("field-validation-error").addClass("field-validation-valid"); 1803// $(this).closest(".form-group").removeClass("has-error"); 1804// } 1805// });
1806// if (count > 0) { 1807// return false; 1808// } else { 1809// return true; 1810// } 1811//}); 1812 1813// Commented Due to resolve http://mantis.ce21.com/view.php?id=8177 issue 1814//$("body").on('click', ".clsGlobalDiscount", function () { 1815// var discountId = Number($(this).attr("data-priceId")); 1816// var isAdded = $(this).attr("data-isAdded"); 1817 1818// if (discountId > 0) { 1819// $.ajax({ 1820// type: "POST", 1821// url: APPLY_GLOBAL_AUTO_DISCOUNT_URL, 1822// dataType: "json", 1823// data: { 1824// 'discountId': discountId, 'IsRemove': isAdded 1825// }, 1826// success: function (data) { 1827// if (data !== undefined && data != null) { 1828// if (data.Message !== undefined && data.Message !== null && data.Message != "") { 1829// alert(data.Message); 1830// } 1831// } 1832// }, 1833// complete: function (data) { 1834// //if (isAdded == "1") { 1835// // UpdateItemCart(0); 1836// //} 1837// //check function exist then call 1838// if (typeof UpdateItemCart == 'function') { 1839// UpdateItemCart(0); 1840// } 1841// UpdateOrderSummary(); 1842// }, 1843// error: function (data) { 1844// alert('Error! Please try again later.'); 1845// } 1846// }); 1847// } 1848//}); 1849 1850// name your elements here 1851//var stickyElement = '.fixedSideBar', // the element you want to make sticky 1852//bottomElement = $('.clsbottomElement').val()//'footer'; // the bottom element where you want the sticky element to stop (usually the footer) 1853 1854//Function from Bluthemes, lets you add li elemants to affix object without having to alter and data attributes set out by bootstrap 1855//$(function () { 1856// if ($(window).width() < 767) {
1857// $('.fixedSideBar').addClass('disableAffix'); 1858// return; 1859// } 1860 1861// bottomElement = bottomElement != undefined && bottomElement != null ? bottomElement : 'footer'; 1862// var orderSummaryWidth = $('.fixedSideBar').width(); 1863// $('.fixedSideBar').css({ width: orderSummaryWidth + 'px' }); 1864 1865// // make sure the element exists on the page before trying to initalize 1866// if ($(stickyElement).length) { 1867// $(stickyElement).each(function () { 1868 1869// // let's save some messy code in clean variables 1870// // when should we start affixing? (the amount of pixels to the top from the element) 1871// var fromTop = $(this).offset().top, 1872// // where is the bottom of the element? 1873// fromBottom = $(document).height() - ($(this).offset().top + $(this).outerHeight()), 1874// // where should we stop? (the amount of pixels from the top where the bottom element is) 1875// // also add the outer height mismatch to the height of the element to account for padding and borders 1876// stopOn = $(document).height() - ($(bottomElement).offset().top) + ($(this).outerHeight() - $(this).height()); 1877 1878// // if the element doesn't need to get sticky, then skip it so it won't mess up your layout 1879// if ((fromBottom - stopOn) > 200) { 1880// // let's put a sticky width on the element and assign it to the top 1881// $(this).css('width', $(this).width()).css('top', 0).css('position', ''); 1882// // assign the affix to the element 1883// $(this).affix({ 1884// offset: { 1885// // make it stick where the top pixel of the element is 1886// top: fromTop + 65, 1887// // make it stop where the top pixel of the bottom element is 1888// bottom: stopOn 1889// } 1890// // when the affix get's called then make sure the position is the default (fixed) and it's at the top 1891// }).on('affix.bs.affix', function () { $(this).css('top', '70px').css('position', ''); }); 1892// } 1893// // trigger the scroll event so it always activates 1894// $(window).trigger('scroll'); 1895// }); 1896// } 1897 1898//}); 1899 1900$("body").on('click', '.pop500', function () { 1901 $.magnificPopup.open({ 1902 items: { 1903 src: $(this).attr("href") 1904 }, 1905 type: 'iframe', 1906 closeOnBgClick: false, 1907 callbacks: { 1908 close: function () { 1909 //do stuff 1910 } 1911 }, 1912 mainClass: 'pop500rMainClass' 1913 }); 1914 return false; 1915}); 1916 1917$("body").on("click", ".removeSavedItems", function () { 1918 var Id = $(this).attr('id'); 1919 var pId = Id.split('~')[0]; 1920 var dateId = Id.split('~')[1]; 1921 if (confirm('Are you sure you want to remove this item?')) { 1922 $.ajax({
1923 type: "POST", 1924 url: DELETE_SAVED_ITEM_URL, 1925 dataType: "json", 1926 data: { 1927 'productID': pId, 1928 'dateID': dateId 1929 }, 1930 success: function (data) { 1931 //$("#tabWishList").load('/Account/CustomerSavedItem'); 1932 if (data.WishlistCount >= 0) { 1933 parent.$("#Wishlistcount").html("(" + data.WishlistCount + ")"); 1934 $("#Wishcount").html(data.WishlistCount); 1935 } 1936 $("#divProgress").hide(); 1937 updateWishList(); 1938 }, 1939 error: function (data) { 1940 alert('Error Occured'); 1941 $("#divProgress").hide(); 1942 } 1943 }); 1944 $("#divProgress").show(); 1945 } 1946}); 1947 1948var cls_saveSingleProduct = ''; 1949 1950//Close Add to cart popup 1951function closeAddToCartPopup(productid, data, otype, baseProductId) { 1952 //cls_saveSingleProduct 1953 $.magnificPopup.close(); 1954 1955 if (data.Message) { 1956 1957 displayCartMessages(cls_saveSingleProduct, data, otype); //#16325 1958 1959 //Shoppingcart 1960 if (otype != null && otype == 'shoppingcart') { 1961 if (typeof UpdateItemCart == 'function') { 1962 UpdateItemCart(0); 1963 $("#spnMessage").html("The item was successfully added to your shopping cart"); 1964 $(".wishlistCart").show(); 1965 } 1966 } 1967 1968 } 1969 if (window.location.pathname == '/registrant/registrantconfirmation') 1970 { 1971 window.location.reload(); //reload the page to update the registrant details 1972 } 1973} 1974 1975//#16325 1976function displayCartMessages($this_element, data, pageType) { 1977 1978 if (!$this_element || $this_element == 0) { return }; 1979 1980 $this_element.closest(".divItemProductSection").find(".cartAlertMessage, .maxRegistrantAlertMessage, .compareProductAlertMessage").hide(); 1981 1982 var clsAlertMessage = ".cartAlertMessage"; 1983 var clsAlertMessageDiv = ".divAlertMessageSection"; 1984 1985 if (data.IsPurchaseLimitExceeded) { 1986 clsAlertMessage = ".maxRegistrantAlertMessage"; 1987 clsAlertMessageDiv = ".divMaxRegistrantLimitAlert"; 1988 } 1989 1990 if (data.isAddInComparedProduct) { 1991 clsAlertMessage = ".compareProductAlertMessage"; 1992 clsAlertMessageDiv = ".divCompareProductAlert"; 1993 } 1994 1995 var $existsAlertDiv = $this_element.closest(".divItemProductSection").find(clsAlertMessage); 1996 1997 //check div already exists 1998 if ($existsAlertDiv.length > 0) { 1999 $existsAlertDiv.show(); 2000 if (pageType && pageType.toLowerCase() === "bundlepage") { 2001 $existsAlertDiv.find('span').html(data.ErrorMessage); 2002 if (data.Message) { 2003 $existsAlertDiv.find('span').html(data.Message); 2004 } 2005 } 2006 else { 2007 $existsAlertDiv.find('span').html(data.Message); 2008 } 2009 } 2010 else { 2011 //append alert message 2012 var alertMessageDiv = $(clsAlertMessageDiv); 2013 2014 if (pageType && pageType.toLowerCase() === "bundlepage") { 2015 alertMessageDiv.find('span').html(data.ErrorMessage); 2016 if (data.Message) { 2017 alertMessageDiv.find('span').html(data.Message); 2018 } 2019 } 2020 else { 2021 alertMessageDiv.find('span').html(data.Message); 2022 } 2023 2024 if (pageType && pageType.toLowerCase() === "featuredscroll") { 2025 $this_element.closest(".divItemProductSection").prepend(alertMessageDiv.html()).css("margin-top", "8px"); 2026 } 2027 else if (pageType && (pageType.toLowerCase() === "threecolumn" || pageType.toLowerCase() === "threecolumnsimple" || pageType.toLowerCase() === "relatedproduct" || pageType.toLowerCase() === "productdetail" || pageType.toLowerCase() === "addtocart")) { 2028 //display message at top 2029 $this_element.closest(".divItemProductSection").prepend(alertMessageDiv.html()); 2030 } 2031 else { 2032 $this_element.closest(".divItemProductSection").append(alertMessageDiv.html()); 2033 } 2034 } 2035} 2036 2037$("body").on("click", ".btnPopAddToCart", function () { 2038 cls_saveSingleProduct = $(this); 2039}); 2040 2041//#16325 2042$("body").on("click", ".closeCartAlertMessage, .closeMaxRegistrantMessage, .closeCompareProductMessage", function () { 2043 $(this).closest(".cartAlertMessage").hide(); 2044 $(this).closest(".maxRegistrantAlertMessage").hide(); 2045 $(this).closest(".compareProductAlertMessage").hide(); 2046}); 2047 2048$(".btnClose").click(function () { 2049 $(this).closest("div.alert").hide(); 2050}); 2051 2052$(".btnCloseFromSearchList").click(function () { 2053 $(this).closest("div.alertMessage").hide(); 2054}); 2055 2056function backtoParentSingleCartItem($this_element, data, pageType) { 2057 $.magnificPopup.close(); 2058 displayCartMessages($this_element, data, pageType) 2059} 2060 2061$("body").on("click", ".clsSaveSingleProduct", function (e, displayPurchaseAlert, registrantTypeOrderItemId, displayDownPaymentAlert) { 2062 var element = $(this); 2063 cls_saveSingleProduct = element;
2064 var btnType = $(this).attr("data-btnType"); 2065 var purchaseAlertId = $(this).attr("data-purchasealertid"); 2066 var productAvailibityRuleId = $(this).attr("data-productAvailibityRuleId"); 2067 var productTypeId = $(this).attr("data-typeid"); 2068 var productId = $(this).attr("data-val"); 2069 var urlPopupAddToCart = $(this).attr("data-urlpopupaddtocart"); 2070 2071 var singleAddToCart = function () { 2072 2073 if (displayPurchaseAlert != "1") //((purchaseAlertId != undefined && purchaseAlertId != null && purchaseAlertId > 0) || (productAvailibityRuleId && productAvailibityRuleId > 0)) && 2074 { 2075 $.get(GET_PURCHASEALERTMESSSAGE + '?purchaseAlertId=' + purchaseAlertId + '&btyType=' + btnType + '&productAvailibityRuleId=' + productAvailibityRuleId + "&productTypeId=" + productTypeId + "&productId=" + productId, function (data) { 2076 if (data && data.indexOf("divGeneralPurchaseAlert") > -1) { 2077 $(data).modal(); 2078 return false; 2079 } else { 2080 saveSingleProduct(displayPurchaseAlert, element, registrantTypeOrderItemId, true); 2081 } 2082 }); 2083 } else { 2084 saveSingleProduct(displayPurchaseAlert, element, registrantTypeOrderItemId, displayDownPaymentAlert); 2085 } 2086 } 2087 2088 //check any add on or related product is available 2089 checkAddOnOrRelatedProductExist(productId, urlPopupAddToCart, singleAddToCart, element); 2090 2091}); 2092 2093function checkAddOnOrRelatedProductExist(productId, urlPopupAddToCart, callback, element) { 2094 $(element).attr('disabled', true); 2095 2096 //no popup url found then add product to cart 2097 if (!urlPopupAddToCart) { 2098 callback(); 2099 $(element).removeAttr('disabled'); 2100 return false; 2101 } 2102 2103 2104 $.get(CHECK_ADDON_OR_RELATEDPRODUCT_EXIST, { 'productId': productId }, function (data) { 2105 $(element).removeAttr('disabled'); 2106 if (data) { 2107 openAddToCartPopupModal(urlPopupAddToCart); 2108 return false; 2109 } else if (callback) { 2110 callback(); 2111 } 2112 }); 2113} 2114 2115function saveSingleProduct(displayPurchaseAlert, element, registrantTypeOrderItemId, displayDownPaymentAlert = false, _callback = '') { 2116 2117 if (displayPurchaseAlert == "1") { 2118 $(".btndismissAlert").trigger('click'); 2119 } 2120 2121 var productpriceId = $(element).attr("data-productpriceid"); 2122 if (displayDownPaymentAlert == true && productpriceId && Number(productpriceId) > 0) { 2123 $.ajax({
2124 type: "GET", 2125 url: "/Items/GetDiscountDetails", 2126 data: { "discountId": productpriceId }, 2127 dataType: "json", 2128 async: false, 2129 success: function (data) { 2130 data.DownPaymentAlertMessage = data.DownPaymentAlertMessage.replace(/{DownPaymentAmount}/g, currencySymbol + parseFloat(data.DownPaymentAmount).toFixed(2)); 2131 if (data != undefined && data.DownPaymentAmount != undefined && data.DownPaymentAmount != '' && data.DownPaymentAlertMessage != '') { 2132 $.confirm({ 2133 title: 'Alert', 2134 content: data.DownPaymentAlertMessage, 2135 boxWidth: '600px', 2136 type: 'green', 2137 buttons: { 2138 ok: { 2139 text: addToCartLabel, 2140 btnClass: 'btn-success', 2141 action: function () { 2142 if (_callback && typeof _c
2142allback == 'function') { 2143 _callback(); 2144 } 2145 else { 2146 saveSingleProductAfterAlert(element, registrantTypeOrderItemId); 2147 } 2148 } 2149 }, 2150 cancel: { 2151 text: 'Cancel', 2152 btnClass: 'btn-danger' 2153 } 2154 } 2155 }); 2156 } 2157 else { 2158 if (_callback && typeof _callback == 'function') { 2159 _callback(); 2160 } 2161 else { 2162 saveSingleProductAfterAlert(element, registrantTypeOrderItemId); 2163 } 2164 } 2165 }, 2166 error: function () { 2167 if (_callback && typeof _callback == 'function') { 2168 _callback(); 2169 } 2170 else { 2171 saveSingleProductAfterAlert(element, registrantTypeOrderItemId); 2172 } 2173 } 2174 }); 2175 } 2176 else {
2177 if (_callback && typeof _callback == 'function') { 2178 _callback(); 2179 } 2180 else { 2181 saveSingleProductAfterAlert(element, registrantTypeOrderItemId); 2182 } 2183 } 2184} 2185function saveSingleProductAfterAlert(element, registrantTypeOrderItemId) { 2186 2187 var productId = $(element).attr("data-val"); 2188 var btnType = $(element).attr("data-btnType"); 2189 var isAgendaAnwer = $(element).attr("data-isAgendaAnswer"); 2190 var isAgendacart = $(element).attr("data-isAgendacart"); 2191 var productpriceId = $(element).attr("data-productpriceid"); 2192 var discountEntityType = $(element).attr("data-productpricetype"); 2193 var event_TimeId = $(element).attr("data-eventid"); 2194 var product_typeId = $(element).attr("data-typeid"); 2195 var productregistranttypeId = $(element).attr("data-productregistranttypeid"); 2196 var chkPurchaserForRegistrant = $(element).attr("data-chkPurchaserForRegistrant") || false; 2197 var isRegistrantRequestInfo = $(element).attr("data-isRegistrantRequestInfo") || false; 2198 2199 //12842: Registration Types - Registration Question Sets. 2200 if (productpriceId && Number(productpriceId) > 0 && !registrantTypeOrderItemId && productregistranttypeId > 0) { 2201 var isQuestionExist = IsRegistrantTypeQuestionSetAvailable(productpriceId, event_TimeId, productId, product_typeId); 2202 if (isQuestionExist) { OpenRegistrantTypeQuestionSetPopup(productId, productpriceId); return false; } 2203 } 2204 2205 if (isAgendaAnwer != undefined && isAgendaAnwer == '0' && isAgendacart != undefined && isAgendacart == "1") { 2206 $.ajax({
2207 type: "POST", 2208 url: "/Items/IsOpenAgendaPopup", 2209 dataType: "json", 2210 data: { 2211 'productId': productId, 2212 'productPriceId': productpriceId, 2213 'entityType': discountEntityType 2214 }, 2215 success: function (data) { 2216 if (data != undefined && data == true) { 2217 openAgendaFormFromDiscount(productId, btnType, $(this).attr("data-price"), productpriceId, discountEntityType, registrantTypeOrderItemId, false, isRegistrantRequestInfo, chkPurchaserForRegistrant); 2218 return false; 2219 } 2220 else { 2221 AddSingleProductToCart(element, registrantTypeOrderItemId); 2222 } 2223 }, 2224 error: function (data) { 2225 $("#divProgress").hide(); 2226 alert('Error! Please try again later.'); 2227 } 2228 }); 2229 } 2230 else { 2231 AddSingleProductToCart(element, registrantTypeOrderItemId) 2232 } 2233} 2234 2235function AddSingleProductToCart(element, registrantTypeOrderItemId, agendaPrice) { 2236 var productId = $(element).attr("data-val") || $(element).attr("data-ProductId"); 2237 var pagetype = ''; 2238 var pageno = 1; 2239 var sortby = 11; 2240 var Type = $(element).attr("data-token"); 2241 var isViewerProduct = false; 2242 var marketingEntityId = $(element).attr("data-marketingEntityId"); 2243 var marketingEntityType = $(element).attr("data-marketingEntityType"); 2244 var relatedProductId = $(element).attr("data-relatedproductid"); 2245 var chkPurchaser = $(element).attr("data-chkPurchaser") || false; 2246 var isAgendaRequestInfo = $(element).attr("data-isAgendaRequestInfo") || false; 2247 var chkPurchaserForRegistrant = $(element).attr("data-chkPurchaserForRegistrant") || false; 2248 var isRegistrantRequestInfo = $(element).attr("data-isRegistrantRequestInfo") || false; 2249 2250 if (Type != undefined && Type == 'ViewerCartProduct') { 2251 isViewerProduct = true; 2252 } 2253 if (Type == undefined && $(element).hasClass('ce21FreeCourse')) { 2254 Type = $(element).closest(".ProductDetailPortion").length > 0 ? "productdetail" : "SearchProduct"; 2255 } 2256 2257 if (parent.$("#pageType").val() != undefined) { 2258 pagetype = parent.$("#pageType").val(); 2259 } 2260 if (parent.$("#pageno").val() != undefined) { 2261 pageno = parent.$("#pageno").val(); 2262 } 2263 if (parent.$("#sortby").val() != undefined) { 2264 sortby = parent.$("#sortby").val(); 2265 } 2266 2267 $.ajax({
2268 type: "POST", 2269 url: ADD_SAVE_SINGLE_PRODUCT_URL, 2270 dataType: "json", 2271 data: { 2272 "productId": productId, 2273 "quantity": 1, 2274 "EventTimeId": $(element).attr("data-eventid") || $(element).attr("data-eventtimeid"), 2275 "productTypeId": $(element).attr("data-typeid") || $(element).attr("data-producttypeid"), 2276 "productPrice": $(element).attr("data-price") || 0, 2277 "priceType": $(element).attr("data-pricetype"), 2278 "IsAddOnProduct": isViewerProduct, 2279 "productPriceId": $(element).attr("data-productpriceid"), 2280 "marketingEntityType": marketingEntityType, 2281 "marketingEntityId": marketingEntityId, 2282 "RelatedProductId": relatedProductId, 2283 "RegistrantTypeOrderItemId": (registrantTypeOrderItemId && !isNaN(registrantTypeOrderItemId) ? registrantTypeOrderItemId : 0), 2284 "chkPurchaser": chkPurchaser, 2285 "isAgendaRequestInfo": isAgendaRequestInfo, 2286 "chkPurchaserForRegistrant": chkPurchaserForRegistrant, 2287 "isRegistrantRequestInfo": isRegistrantRequestInfo 2288 }, 2289 success: function (data) { 2290 // 17507: Google Analytics -E-commerce Tracking 2291 if (data && data.productAddedInCartDetails) { 2292 googleAnalytics.addToCartEvent(data.productAddedInCartDetails); 2293 faceBookAnalytics.addToCartEvent(data.productAddedInCartDetails); 2294 } 2295 2296 if (data.cartId != '' && data.cartId != undefined && !data.IsCECreditPrice && $(element).attr("data-pricetype") == 'MemberHours') { 2297 memberHoursAdditionalPayments(0, data.cartId, 'MemberHours') 2298 return false; 2299 } 2300 2301 if (isViewerProduct == true) { 2302 var alertMessage = "The item is now in your shopping cart at the discounted price. You can go to your shopping cart now and check out or after the seminar is finished."; 2303 if (confirm(alertMessage)) { 2304 parent.$.magnificPopup.close(); 2305 } else { 2306 parent.$.magnificPopup.close(); 2307 } 2308 return false; 2309 } 2310 else { 2311 if (data.isSendCustomerToCart != undefined && data.isSendCustomerToCart == true && !data.IsCECreditPrice && !data.IsPurchaseLimitExceeded) { 2312 setTimeout(function () { 2313 window.parent.location.href = '/ShoppingCart'; 2314 }, 555); 2315 return false; 2316 } 2317 2318 } 2319 2320 if (typeof (parent.clearSessionStorageKeyForGroup) == 'function') { 2321 parent.clearSessionStorageKeyForGroup();//--0011726 2322 } 2323 2324 if (data.CartCount != null && data.CartCount != "" && data.CartCount != "0" && $(element).attr("data-pricetype") != 'MemberHours') { 2325 parent.$("#cartspancount").html(data.CartCount); 2326 parent.$("#cartItemList").load(GET_CART_URL); 2327 parent.$("#grid-WishList").load(SAVED_ITEMS); 2328 } 2329 //compare Product item 2330 if (data.isCompareProduct != undefined && data.isCompareProduct == true && $(element).attr("data-pricetype") != 'MemberHours') { 2331 parent.$("#compareProductcartspancount").html(data.compareProductCount); 2332 parent.$("#compareProductcartItemList").load(GET_COMPAREPRODUCTCART_URL); 2333 } 2334 //compare Product item 2335 if (pagetype == "CompareItem") { 2336 parent.$("#grid-compareProduct").load(GET_COMPARE_PRODUCT_URL + '?page=' + pageno + '&sortby=' + sortby); 2337 } 2338 2339 if (data.Message != null && data.Message != "") { 2340 displayCartMessages(element, data, Type); //#16325 2341 } 2342 2343 if (data.IsCECreditPrice) { 2344 $("#bundleType4AlertPopup").modal('hide'); 2345 cartMessage = ""; 2346 cartMessage = data.Message; 2347 //$("#cecreditpurchase" + productId).modal(); 2348 displayPurchaseCEMessage(productId, data.CECreditPrice, { 2349 promoCouponCodeType: $(element).attr("data-pricetype") == 'MemberHours' ? 'MemberHours' : '', 2350 cartId: data.cartId, 2351 isAgendaExists: true 2352 }); 2353 2354 } 2355 else { 2356 backtoParentSingleCartItem(element, data, Type); 2357 } 2358 }, 2359 complete: function (data) { 2360 }, 2361 error: function (data) { 2362 alert('Error! Please try again later.'); 2363 } 2364 });
2365} 2366 2367//display purchase CE popup modal 2368var displayPurchaseCEMessage = function (productId, cECreditPrice, { 2369 displayPageType = 0, 2370 customerBundleId = 0, 2371 isAcknowledge = false, 2372 promoCouponCodeType = '', 2373 cartId = '', 2374 isAgendaExists = false 2375} = {}) { 2376 $.get(GET_PURCHASECE_PRICE_POPUP + '?productId=' + productId + "&ceCreditPrice=" + cECreditPrice + "&displayPageType=" + displayPageType + "&customerBundleId=" + customerBundleId + "&isAcknowledge=" + isAcknowledge + "&promoCouponCodeType=" + promoCouponCodeType, "&cartId=" + cartId + "&isAgendaExists=" + isAgendaExists , 2377 function (dataPurchaseCEHtml) { 2378 if ($('#divPurchaseCECreditmodal').length > 0) { 2379 $('#div-list-purchaseCE').html(dataPurchaseCEHtml); 2380 $("#divPurchaseCECreditmodal").modal(); 2381 } 2382 else { 2383 $('body').append(dataPurchaseCEHtml); 2384 $("#divPurchaseCECreditmodal").modal(); 2385 } 2386 return false; 2387 }); 2388} 2389 2390//Start Add To cart discount 2391$("body").on("click", ".btnAddtocartDiscountProductFromSearch", function (e, displayPurchaseAlert, registrantTypeOrderItemId, displayDownPaymentAlert) { 2392 var element = $(this); 2393 cls_saveSingleProduct = element; 2394 var custoemrId = element.attr("data-customerid"); 2395 var excludeDiscount = element.attr("data-exclude-discount"); 2396 var productId = element.attr("data-productid"); 2397 var btnType = element.attr("data-btnType"); 2398 var purchaseAlertId = element.attr("data-purchasealertid"); 2399 var productAvailibityRuleId = element.attr("data-productAvailibityRuleId"); 2400 var productTypeId = element.attr("data-typeid"); 2401 var urlPopupAddToCart = element.attr("data-urlpopupaddtocart"); 2402 var productPriceEntityType = element.attr("data-productPriceEntityType"); 2403 var event_TimeId = $(element).attr("data-eventid"); 2404 var isAgendaAnwer = $(element).attr("data-isAgendaAnswer"); 2405 var isAgendacart = $(element).attr("data-isAgendacart"); 2406 var discountEntityType = $(element).attr("data-productpricetype"); 2407 var productpriceid = element.attr("data-productpriceid"); 2408 var productregistranttypeId = element.attr("data-productregistranttypeid"); 2409 2410 if (displayPurchaseAlert == "1" && $("#divGeneralPurchaseAlert.modal.fade.in:visible").length > 0) { 2411 $("#divGeneralPurchaseAlert.modal.fade.in:visible").modal('hide'); 2412 } 2413 2414 //check customer is log in or not 2415 if (parseInt(custoemrId) <= 0 && excludeDiscount == 1) { 2416 alert("You just need to Log In for purchase this product."); 2417 return false; 2418 } 2419 2420 if (displayPurchaseAlert != "1") { 2421 var singleAddToCart = function () { 2422 $.get(GET_PURCHASEALERTMESSSAGE + '?purchaseAlertId=' + purchaseAlertId + '&btyType=' + btnType + '&productAvailibityRuleId=' + productAvailibityRuleId + "&productTypeId=" + productTypeId + "&productId=" + productId, function (data) { 2423 if (data && data.indexOf("divGeneralPurchaseAlert") > -1) { 2424 $(data).modal(); 2425 return false; 2426 } else { 2427 saveSingleProduct(displayPurchaseAlert, element, registrantTypeOrderItemId, true, function () { 2428 addToCartFromDiscountAfterAlert(element, registrantTypeOrderItemId); 2429 }); 2430 2431 //addToCartFromDiscount(element, registrantTypeOrderItemId); 2432 //if (isAgendaAnwer != undefined && isAgendaAnwer == '0' && isAgendacart != undefined && isAgendacart == "1" && productPriceEntityType) { 2433 // $.ajax({
2434 // type: "POST", 2435 // url: "/Items/IsOpenAgendaPopup", 2436 // dataType: "json", 2437 // data: { 2438 // 'productId': productId, 2439 // 'productPriceId': productpriceid, 2440 // 'entityType': discountEntityType 2441 // }, 2442 // success: function (data) { 2443 // if (data != undefined && data == true) { 2444 // openAgendaFormFromDiscount(productId, btnType, element.attr("data-price"), productpriceid, discountEntityType, registrantTypeOrderItemId); 2445 // return false; 2446 // } 2447 // else { 2448 // addToCartFromDiscount(element, registrantTypeOrderItemId); 2449 // } 2450 // }, 2451 // error: function (data) { 2452 // $("#divProgress").hide(); 2453 // alert('Error! Please try again later.'); 2454 // } 2455 // }); 2456 //} 2457 //else { 2458 // addToCartFromDiscount(element, registrantTypeOrderItemId); 2459 //} 2460 } 2461 }); 2462 } 2463 } else { 2464 //addToCartFromDiscount(element, registrantTypeOrderItemId); 2465 saveSingleProduct(displayPurchaseAlert, element, registrantTypeOrderItemId, displayDownPaymentAlert, function () { 2466 addToCartFromDiscountAfterAlert(element, registrantTypeOrderItemId); 2467 }); 2468 2469 //if (productpriceid && Number(productpriceid) > 0 && !registrantTypeOrderItemId && productregistranttypeId > 0) { 2470 // var isQuestionExist = IsRegistrantTypeQuestionSetAvailable(productpriceid, event_TimeId, productId, productTypeId); 2471 // if (isQuestionExist) { OpenRegistrantTypeQuestionSetPopup(productId, productpriceid); return false; } 2472 //} 2473 2474 //if (isAgendaAnwer != undefined && isAgendaAnwer == '0' && isAgendacart != undefined && isAgendacart == "1" && productPriceEntityType) { 2475 // $.ajax({
2476 // type: "POST", 2477 // url: "/Items/IsOpenAgendaPopup", 2478 // dataType: "json", 2479 // data: { 2480 // 'productId': productId, 2481 // 'productPriceId': productpriceid, 2482 // 'entityType': productPriceEntityType 2483 // }, 2484 // success: function (data) { 2485 // if (data != undefined && data == true) { 2486 // openAgendaFormFromDiscount(productId, btnType, element.attr("data-price"), productpriceid, discountEntityType, registrantTypeOrderItemId); 2487 // return false; 2488 // } 2489 // else { 2490 // addToCartFromDiscount(element, registrantTypeOrderItemId); 2491 // } 2492 // }, 2493 // error: function (data) { 2494 // $("#divProgress").hide(); 2495 // alert('Error! Please try again later.'); 2496 // } 2497 // }); 2498 //} else { 2499 // addToCartFromDiscount(element, registrantTypeOrderItemId); 2500 //} 2501 } 2502 2503 checkAddOnOrRelatedProductExist(productId, urlPopupAddToCart, singleAddToCart, element); 2504 2505}); 2506//End Add To cart discount 2507 2508function addToCartFromDiscountAfterAlert(element, registrantTypeOrderItemId) { 2509 var productId = element.attr("data-productid"); 2510 var btnType = element.attr("data-btnType"); 2511 var productTypeId = element.attr("data-typeid"); 2512 var productPriceEntityType = element.attr("data-productPriceEntityType"); 2513 var event_TimeId = $(element).attr("data-eventid"); 2514 var isAgendaAnwer = $(element).attr("data-isAgendaAnswer"); 2515 var isAgendacart = $(element).attr("data-isAgendacart"); 2516 var productpriceid = element.attr("data-productpriceid"); 2517 var productregistranttypeId = element.attr("data-productregistranttypeid"); 2518 var chkPurchaserForRegistrant = $(element).attr("data-chkPurchaserForRegistrant") || false; 2519 var isRegistrantRequestInfo = $(element).attr("data-isRegistrantRequestInfo") || false; 2520 2521 if (productpriceid && Number(productpriceid) > 0 && !registrantTypeOrderItemId && productregistranttypeId > 0) { 2522 var isQuestionExist = IsRegistrantTypeQuestionSetAvailable(productpriceid, event_TimeId, productId, productTypeId); 2523 if (isQuestionExist) { OpenRegistrantTypeQuestionSetPopup(productId, productpriceid); return false; } 2524 } 2525 2526 if (isAgendaAnwer != undefined && isAgendaAnwer == '0' && isAgendacart != undefined && isAgendacart == "1" && productPriceEntityType) { 2527 $.ajax({
2528 type: "POST", 2529 url: "/Items/IsOpenAgendaPopup", 2530 dataType: "json", 2531 data: { 2532 'productId': productId, 2533 'productPriceId': productpriceid, 2534 'entityType': productPriceEntityType 2535 }, 2536 success: function (data) { 2537 if (data != undefined && data == true) { 2538 openAgendaFormFromDiscount(productId, btnType, element.attr("data-price"), productpriceid, productPriceEntityType, registrantTypeOrderItemId, null, isRegistrantRequestInfo, chkPurchaserForRegistrant); 2539 return false; 2540 } 2541 else { 2542 addToCartFromDiscount(element, registrantTypeOrderItemId); 2543 } 2544 }, 2545 error: function (data) { 2546 $("#divProgress").hide(); 2547 alert('Error! Please try again later.'); 2548 } 2549 }); 2550 } else { 2551 addToCartFromDiscount(element, registrantTypeOrderItemId); 2552 } 2553} 2554 2555function addToCartFromDiscount(element, registrantTypeOrderItemId) { 2556 //$(this) = element; 2557 var custoemrId = element.attr("data-customerid"); 2558 var excludeDiscount = element.attr("data-exclude-discount"); 2559 var productpriceid = element.attr("data-productpriceid"); 2560 var productregistranttypeId = element.attr("data-productregistranttypeid"); 2561 var productId = element.attr("data-productid"); 2562 var productTypeId = element.attr("data-typeid"); 2563 var event_TimeId = $(element).attr("data-eventid"); 2564 var chkPurchaserForRegistrant = $(element).attr("data-chkPurchaserForRegistrant") || false; 2565 var isRegistrantRequestInfo = $(element).attr("data-isRegistrantRequestInfo") || false; 2566 //check customer is log in or not 2567 if (parseInt(custoemrId) <= 0 && excludeDiscount == 1) { 2568 alert("You just need to Log In for purchase this product."); 2569 return false; 2570 } 2571 2572 if (productpriceid && Number(productpriceid) > 0 && !registrantTypeOrderItemId && productregistranttypeId > 0) { 2573 var isQuestionExist = IsRegistrantTypeQuestionSetAvailable(productpriceid, event_TimeId, productId, productTypeId); 2574 if (isQuestionExist) { OpenRegistrantTypeQuestionSetPopup(productId, productpriceid); return false; } 2575 } 2576 2577 var listCart = []; 2578 listCart.push({ 2579 "productId": element.attr("data-productid"), 2580 "EventTimeId": element.attr("data-eventtimeid"), 2581 "priceType": "DiscountPrice", 2582 "productPrice": element.attr("data-ProductPrice"), 2583 "quantity": 1, 2584 "productPriceId": element.attr("data-productpriceid"), 2585 "IsDiscountProduct": true, 2586 "ProductDiscountId": element.attr("data-product-discountid"), 2587 "RegistrantTypeOrderItemId": (registrantTypeOrderItemId && !isNaN(registrantTypeOrderItemId) ? registrantTypeOrderItemId : 0), 2588 "chkPurchaserForRegistrant": chkPurchaserForRegistrant, 2589 "isRegistrantRequestInfo": isRegistrantRequestInfo 2590 }); 2591 $.ajax({
2592 type: "POST", 2593 url: ADD_TO_CART_URL, 2594 dataType: "json", 2595 data: { "listCart": JSON.stringify(listCart) }, 2596 success: function (data) { 2597 2598 if (data.CartCount != null && data.CartCount != "" && data.CartCount != "0") { 2599 parent.$("#cartspancount").html(data.CartCount); 2600 parent.$("#cartItemList").load(GET_CART_URL); 2601 } 2602 if (data.Message != null && data.Message != "") { 2603 displayCartMessages(element, data, "SearchProduct"); 2604 } 2605 2606 if (data.isSendCustomerToCart != undefined && data.isSendCustomerToCart == true && !data.IsCECreditPrice && !data.IsPurchaseLimitExceeded) { 2607 setTimeout(function () { 2608 window.parent.location.href = '/ShoppingCart'; 2609 }, 555); 2610 return false; 2611 } 2612 backtoParentSingleCartItem(element, data, 'SearchProduct'); 2613 2614 if (productpriceid != undefined && productpriceid != null && Number(productpriceid) > 0) { 2615 $.ajax({
2616 type: "POST", 2617 url: CHECK_COUPON_CODE_URL, 2618 dataType: "json", 2619 data: { 2620 'discountId': productpriceid, 2621 }, 2622 success: function (data) { 2623 }, 2624 complete: function (data) { 2625 2626 }, 2627 error: function (data) { 2628 alert('Error! Please try again later.'); 2629 } 2630 }); 2631 } 2632 }, 2633 complete: function (data) { 2634 2635 }, 2636 error: function (data) { 2637 alert('Error! Please try again later.'); 2638 } 2639 }); 2640} 2641 2642function loadCharacterCount() { 2643 // load char count 2644 $('.charcount').after(function () { 2645 if ($('#char' + $(this).attr('id')).length == 0) { 2646 return '<div class="note" style="font-weight:normal;" id="char' + this.id + '">' + $(this).val().length + ' of ' + $(this).attr("data-val-maxlength-max") + ' characters maximum.</div>'; 2647 } 2648 }).keyup(function () { 2649 if ($(this).val().length > $(this).attr("data-val-maxlength-max")) { 2650 $(this).val($(this).val().substring(0, $(this).attr("data-val-maxlength-max"))); 2651 } 2652 $('#char' + $(this).attr('id')).html($(this).val().length + ' of ' + $(this).attr("data-val-maxlength-max") + ' characters maximum.'); 2653 }); 2654 2655} 2656 2657$("body").on("click", ".btnItemProductStock", function () { 2658 var saveLaterUrl = $(this).attr('data-saveLaterUrl'); 2659 var message = "We're sorry, but this product is out of stock."; 2660 var Type = $(this).attr('data-ItemType'); 2661 if (saveLaterUrl != undefined && saveLaterUrl != '' && saveLaterUrl != "") { 2662 message += " Click " + saveLaterUrl + " to save this for later" 2663 } 2664 var data = { 2665 Message: message 2666 }; 2667 displayCartMessages($(this), data, Type); //#16325 2668}); 2669 2670function CloseAgendamodal(isReloadWindow = false) { 2671 $.magnificPopup.close(); 2672 if (isReloadWindow) 2673 window.location.reload(); 2674} 2675 2676var isRegistrationComplete = false; 2677$('body').on('click', '.clsEditSelection', function () { 2678 var element = $(this); 2679 var isFromCompleteRegistration = ($('#IsCompleteRegistration').val() || '').toLowerCase() == 'true'; 2680 var isFromUnAssignedOrder = ($('#IsFromUnAssignedOrder').val() || '').toLowerCase() == 'true'; 2681 if (isFromCompleteRegistration && !isFromUnAssignedOrder) { 2682 parent.$.magnificPopup.close(); 2683 } 2684 else { 2685 editSelection(element) 2686 } 2687}); 2688 2689function editSelection(element, chkPurchaserForRegistrant = false, isRegistrantRequestInfo = false) { 2690 var productPriceId = element.attr("data-productPriceId"); 2691 var eventTimeId = element.attr("data-eventTimeId"); 2692 var productId = element.attr("data-productId"); 2693 var productTypeId = element.attr("data-productTypeId"); 2694 var productPrice = element.attr("data-productPrice"); 2695 var customerId = element.attr("data-customerId"); 2696 var orderItemId = element.attr("data-orderItemId"); 2697 var entityType = element.attr("data-entityType"); 2698 var isQuestionExist = IsRegistrantTypeQuestionSetAvailable(productPriceId, eventTimeId, productId, productTypeId, true, false, false, entityType); //EntityType = 9 for Member Hours 2699 var isAgendaExists = (productTypeId != undefined && Number(productTypeId) == 1) ? IsAgendaForProductAvailable(productPriceId, productId, entityType) : false; 2700 var isFromUnAssignedOrder = ($('#IsFromUnAssignedOrder').val() || '').toLowerCase() == 'true'; 2701 var orderId = $('#OrderId').val(); 2702 var url = '/search/registranttypequestionset?productId=' + productId + '&discountId=' + productPriceId + '&priceType=' + productPrice + '&orderItemId=' + orderItemId + "&customerId=" + customerId + "&isFetchAnswer=" + true + "&isForEditRegistrant=" + true + "&isAgendaExists=" + isAgendaExists + "&entityType=" + entityType; //EntityType = 9 for Member Hours 2703 if (isQuestionExist && !isRegistrationComplete && !isFromUnAssignedOrder) { 2704 $.magnificPopup.open({ 2705 items: { 2706 src: url 2707 }, 2708 type: 'iframe', 2709 closeOnBgClick: false, 2710 showCloseBtn: true, 2711 mainClass: 'CustomPop registrantType-popup', 2712 callbacks: { 2713 close: function () { 2714 } 2715 } 2716 }); 2717 return false; 2718 } 2719 else if (isAgendaExists && isAgendaExists.toString().toLocaleLowerCase() == 'true' && typeof OpenProductAgendaPopup == "function") { 2720 isRegistrationComplete = false; 2721 OpenProductAgendaPopup(productId, orderItemId, productPrice, entityType, productPriceId, false, false, 0, false, chkPurchaserForRegistrant, isRegistrantRequestInfo, isFromUnAssignedOrder, '', null, orderId, isFromUnAssignedOrder); 2722 return false; 2723 $('#divProgress').hide(); 2724 } 2725} 2726 2727$('body').on('click', '.cartAgenda', function () { 2728 var height = $(this).attr("data-height"); 2729 var width = $(this).attr("data-width"); 2730 $.magnificPopup.open({ 2731 items: { 2732 src: $(this).attr("href") 2733 }, 2734 type: 'iframe', 2735 closeOnBgClick: false, 2736 callbacks: { 2737 close: function () { 2738 } 2739 },
2740 mainClass: 'CustomPop cartAgenda-popup', 2741 }); 2742 $('.mfp-content').css('height', height); 2743 $('.mfp-content').css('width', width); 2744 $('.mfp-iframe-holder .mfp-content').css('max-height', height + 'px'); 2745 $('.mfp-iframe-holder .mfp-content').css('max-width', width + 'px'); 2746 return false; 2747}); 2748 2749//New Support Ticket Pop up 2750$('body').on('click', '.supportTicketPopUp', function () { 2751 $.magnificPopup.open({ 2752 items: { 2753 src: '/CreateSupportTicket' 2754 }, 2755 type: 'iframe', 2756 closeOnBgClick: false, 2757 mainClass: 'popCreateSupportTicket' 2758 }); 2759 2760 return false; 2761}); 2762 2763$("body").on('click', '.popEmailToFriend', function () { 2764 $.magnificPopup.open({ 2765 items: { 2766 src: $(this).attr("href") 2767 }, 2768 type: 'iframe', 2769 closeOnBgClick: false, 2770 mainClass: 'popCreateSupportTicket' 2771 }); 2772 return false; 2773}); 2774function closeEmailPopUp() { 2775 $.magnificPopup.close(); 2776} 2777 2778$('body').on('click', '.launchiosapp,.launchandroid', function () { 2779 2780 if ($(this).hasClass('launchandroid')) { 2781 setTimeout(function () { window.location = AndroidMarketLink; }, 500); 2782 2783 } else { 2784 setTimeout(function () { window.location = iOSStoreLink; }, 500); 2785 } 2786 window.location = DeepLinkingUrl; 2787 2788 return false; 2789}); 2790 2791$('body').on('click', '.launchvieweriosapp,.launchviewerandroid', function () { 2792 var registrantEncryptkey = $(this).attr("data-registrantencryptkey"); 2793 2794 if ($(this).hasClass('launchviewerandroid')) { 2795 setTimeout(function () { window.location = AndroidMarketLink; }, 500); 2796 registrantEncryptkey = encodeURIComponent(registrantEncryptkey); 2797 } else { 2798 setTimeout(function () { window.location = iOSStoreLink; }, 500); 2799 registrantEncryptkey = encodeURIComponent(registrantEncryptkey); 2800 } 2801 window.location = DeepLinkingUrl + registrantEncryptkey; 2802 2803 return false; 2804}); 2805 2806$('body').on('click', '.popNotificationOption', function () { 2807 $.magnificPopup.open({ 2808 items: { 2809 src: $(this).attr("href") 2810 }, 2811 type: 'iframe', 2812 closeOnBgClick: false, 2813 callbacks: { 2814 close: function () { 2815 //do stuff 2816 } 2817 }, 2818 mainClass: 'popNotificationOptionMainClass' 2819 }); 2820 return false; 2821}); 2822 2823// Open or Focus to particular tab of broswer 2824var popup; 2825var openedTab; 2826function OpenOrFocus(oLink, sTarget) { 2827 if (window.event.ctrlKey) { 2828 return true; 2829 } 2830 var nAgt = navigator.userAgent; 2831 oLink.href = oLink.href == "" || oLink.href == "javascript:void(0);" ? $(oLink).attr("data-href") : oLink.href; 2832 if (nAgt.indexOf("Firefox") > -1) { 2833 if (oLink.href.includes("launchfreeviewer")) { 2834 popup = window.open(oLink.href, sTarget) 2835 } 2836 else if (oLink.href == "" && oLink.classList.contains("CE21_Classroom_LaunchBtn") && !oLink.classList.contains("btnScheduletabsLaunchViewer")) { 2837 popup = window.open(oLink.getAttribute('data-href'), sTarget) 2838 } 2839 else { 2840 return true; 2841 } 2842 } 2843 else if (nAgt.indexOf("Chrome") > -1 || nAgt.indexOf("Safari") > -1) { 2844 if (!oLink.href.includes("launchfreeviewer") && (!oLink.href.includes("ClassroomTab") || !oLink.classList.contains("btnScheduletabsLaunchViewer"))) { 2845 if ((nAgt.indexOf("iPhone") > - 1 || nAgt.indexOf("iPad") > - 1) && openedTab && !openedTab.closed) { 2846 openedTab.close(); 2847 } 2848 openedTab = window.open(oLink.href, sTarget) 2849 } 2850 return true; 2851 } 2852 else if (detectIE()) { 2853 if (popup == null && !oLink.href.includes("launchfreeviewer")) { 2854 popup = window.open(oLink.href, sTarget) 2855 } else { 2856 popup.close(); 2857 if (!oLink.href.includes("launchfreeviewer")) { 2858 popup = window.open(oLink.href, sTarget); 2859 } 2860 } 2861 } 2862 else { 2863 if (!oLink.href.includes("launchfreeviewer")) { 2864 popup = window.open(oLink.href, sTarget) 2865 } 2866 popup.close() 2867 if (!oLink.href.includes("launchfreeviewer")) { 2868 popup = window.open(oLink.href, sTarget); 2869 } 2870 return false; 2871 } 2872} 2873 2874function PIPFeatureAlert(url, sTarget) { 2875 $.confirm({ 2876 title: 'Program Certification Alert', 2877 boxWidth: '700px', 2878 boxHeight: '700px', 2879 useBootstrap: true, 2880 icon: 'fa fa-bell', 2881 closeIcon: true, 2882 async: false, 2883 animateFromElement: false, 2884 closeIconClass: 'fa fa-close', 2885 animation: 'scale', 2886 content: "<hr><lable>Your Internet browser might support popping the video out of the program viewer as a picture-in-picture feature.<br>By proceeding, you agree not to utilize this feature, as it may affect your certification outcome.</label><hr>", 2887 buttons: { 2888 CONTINUE: { 2889 text: 'CONTINUE', 2890 btnClass: 'btn btn-success', 2891 action: function () { 2892 popup = window.open(url, sTarget) 2893 return false; 2894 }, 2895 }, 2896 Close: { 2897 text: 'Close', 2898 btnClass: 'btn btn-default', 2899 action: function () { 2900 }, 2901 } 2902 } 2903 });
2904} 2905 2906function detectIE() { 2907 var ua = window.navigator.userAgent; 2908 2909 // Test values; Uncomment to check result ⦠2910 2911 // IE 10 2912 // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'; 2913 2914 // IE 11 2915 // ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; 2916 2917 // IE 12 / Spartan 2918 // ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'; 2919 2920 // Edge (IE 12+) 2921 // ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586'; 2922 2923 var msie = ua.indexOf('MSIE '); 2924 if (msie > 0) { 2925 // IE 10 or older => return version number 2926 return true; 2927 //return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 2928 } 2929 2930 var trident = ua.indexOf('Trident/'); 2931 if (trident > 0) { 2932 // IE 11 => return version number 2933 var rv = ua.indexOf('rv:'); 2934 return true; 2935 //return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); 2936 } 2937 2938 var edge = ua.indexOf('Edge/'); 2939 if (edge > 0) { 2940 // Edge (IE 12+) => return version number 2941 return true; 2942 //return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); 2943 } 2944 2945 // other browser 2946 return false; 2947} 2948 2949 2950//bundle type 5 product add by customer start 2951//Sort random function 2952function random(owlSelector) { 2953 owlSelector.children().sort(function () { 2954 return Math.round(Math.random()) - 0.5; 2955 }).each(function () { 2956 $(this).appendTo(owlSelector); 2957 }); 2958} 2959function initBundleSlider() { 2960 if (parent.$("#divBundleCarousel").length > 0) { 2961 parent.$("#divBundleCarousel").owlCarousel({ 2962 items: 4, 2963 itemsDesktop: [1600, 3], 2964 itemsDesktopSmall: [979, 2], 2965 navigation: true, 2966 navigationText: [ 2967 "<i class='fa fa-angle-left'></i>", 2968 "<i class='fa fa-angle-right'></i>" 2969 ], 2970 beforeInit: function (elem) { 2971 //Parameter elem pointing to $("#owl-demo") 2972 random(elem); 2973 } 2974 }); 2975 } 2976 else if (parent.parent.$("#divBundleCarousel").length > 0) { 2977 parent.parent.$("#divBundleCarousel").owlCarousel({ 2978 items: 4, 2979 itemsDesktop: [1600, 3], 2980 itemsDesktopSmall: [979, 2], 2981 navigation: true, 2982 navigationText: [ 2983 "<i class='fa fa-angle-left'></i>", 2984 "<i class='fa fa-angle-right'></i>" 2985 ], 2986 beforeInit: function (elem) { 2987 random(elem); 2988 } 2989 }); 2990 2991 } 2992} 2993//for widget/serach pages start 2994function DefaultAddToBundleCheckBoxButtonSettings() { 2995 //simple checkbox 2996 $('.chkAddCustomerBundle').prop('checked', false); 2997 2998 2999 //checkbox button 3000 $('.btnAddCustomerBundle').attr('data-status', '0'); 3001 $('.btnAddCustomerBundle').removeClass("btn-warning").addClass("btn-info"); 3002 $('.clsBundleFiveglyphicon').removeClass("glyphicon-check").addClass("glyphicon-unchecked"); 3003 $('.btnAddCustomerBundle').prop('title', 'Use the Add To Bundle button to create your own bundle of products and receive increasing discounts based on the products you add.'); 3004} 3005function SelectedAddToBundleProducts(productId) { 3006 $('.chkCustomerBundle' + productId).prop('checked', true); 3007 var btnClass = '.btnCustomerBundle' + productId; 3008 if ($(btnClass).length > 0) { 3009 $(btnClass).attr('data-status', '1'); 3010 $(btnClass).removeClass("btn-info").addClass("btn-warning"); 3011 $(btnClass).find('i').removeClass("glyphicon-unchecked").addClass("glyphicon-check"); 3012 $(btnClass).prop('title', 'Remove product from Bundle'); 3013 } 3014 3015} 3016//for widget/serach pages end 3017 3018//for Add To Cart popup page start 3019function DefaultAddToBundleCheckBoxButtonSettingsAddToCart() { 3020 //simple check box 3021 $('.chkAddCustomerBundleAddToCart').prop('checked', false); 3022 3023 //check box button 3024 $('.btnAddCustomerBundleAddToCart').attr('data-status', '0'); 3025 $('.divItemProductSection .btnAddCustomerBundleAddToCart, .divAddToCartProductDetail .btnAddCustomerBundleAddToCart').removeClass("btn-warning").addClass("btn-info"); 3026 $('.clsBundleFiveglyphiconAddToCart').removeClass("glyphicon-check").addClass("glyphicon-unchecked"); 3027 $('.btnAddCustomerBundleAddToCart ').prop('title', 'Use the Add To Bundle button to create your own bundle of products and receive increasing discounts based on the products you add.'); 3028} 3029function SelectedAddToBundleProductsAddToCart(productId) { 3030 //simple check box 3031 $('.chkAddCustomerBundleAddToCart' + productId).prop('checked', true); 3032 3033 //check box button 3034 var btnClass = '.btnCustomerBundleAddToCart' + productId; 3035 if ($(btnClass).length > 0) { 3036 $(btnClass).attr('data-status', '1'); 3037 $(btnClass).removeClass("btn-info").addClass("btn-warning"); 3038 $(btnClass).find('i').removeClass("glyphicon-unchecked").addClass("glyphicon-check"); 3039 $(btnClass).prop('title', 'Remove product from Bundle'); 3040 } 3041 3042} 3043//for Add To Cart popup page end 3044 3045 3046function ChkBundleTypeFiveCustomerSelectedProducts() { 3047 //set default all unchecked for widget/serach pages 3048 DefaultAddToBundleCheckBoxButtonSettings();
3049 3050 //Add to cart popup page 3051 DefaultAddToBundleCheckBoxButtonSettingsAddToCart(); 3052 3053 var arrBundle = parent.$(".clsCustomerBundleType5Products").map(function () { return Number($(this).attr("data-productid")) }).get(); 3054 var parentarraybundle = parent.parent.$(".clsCustomerBundleType5Products").map(function () { return Number($(this).attr("data-productid")) }).get(); 3055 var combinedArray = arrBundle.concat(parentarraybundle); 3056 if (combinedArray != undefined && combinedArray != null && combinedArray.length > 0) { 3057 jQuery.each(combinedArray, function (i, productId) { 3058 if (productId != undefined && productId != null && productId > 0) { 3059 //widget/search pages start 3060 SelectedAddToBundleProducts(productId); 3061 3062 //add to cart page start 3063 SelectedAddToBundleProductsAddToCart(productId); 3064 3065 } 3066 }); 3067 } 3068} 3069 3070function BtnBundleTypeFiveCustomerSelectedProducts() { 3071 //for unchecked checkbox 3072 $(this).removeClass("btn-warning").addClass("btn-info"); 3073 $(this).find('i').removeClass("glyphicon-check").addClass("glyphicon-unchecked"); 3074 3075 if ($(this).attr('data-status') == "0") { 3076 $(this).attr('data-status', '1') 3077 } 3078 else if ($(this).attr('data-status') == "0") { 3079 $(this).attr('data-status', '0') 3080 } 3081} 3082 3083function LoadCustomerBundleProductList(isClosePopup) { 3084 3085 if (isClosePopup != undefined && isClosePopup != null && isClosePopup == true) { 3086 $.magnificPopup.close(); 3087 } 3088 3089 if (typeof (isBundle5Active) != "undefined" && isBundle5Active != undefined && isBundle5Active.toLowerCase() == "true" && $("#CustomreProductsList").length == 0) { 3090 3091 if (parent.$("#divCustomerBundleProduct").length == 0) { 3092 parent.$('body').append('<div id="divCustomerBundleProduct"></div>') 3093 } 3094 3095 $.ajax({
3096 type: "GET", 3097 url: BUNDLE_TYPE_5_List_CUSTOMER_PRODUCT, 3098 global: false, 3099 success: function (response) { 3100 if ($('#divCustomerBundleProduct').length > 1 && parent.$('#divCustomerBundleProduct').length > 1) { 3101 parent.$("#divCustomerBundleProduct").html(response); 3102 } 3103 else { 3104 parent.parent.$("#divCustomerBundleProduct").html(response); 3105 } 3106 //selected customer products start 3107 ChkBundleTypeFiveCustomerSelectedProducts(); 3108 //selected customer products end 3109 3110 3111 initBundleSlider(); 3112 if ($('#stickyCompareFooter').length > 0) { 3113 //footer margin from top margin-bottom: 236px; 3114 var height = $("#stickyCompareFooter").height(); 3115 $('footer').attr("style", " margin-bottom:" + height + "px;"); 3116 } 3117 else { 3118 $('footer').attr("style", " margin-bottom: 0px;"); 3119 } 3120 if (isClosePopup != true) { 3121 var arrow = localStorage.getItem("BundleArrow"); 3122 if (arrow == "fa-chevron-up") { 3123 parent.$("#isc-compare-control").hide(); 3124 $(".stickyCompareFooter").removeClass("active"); 3125 parent.$("#StickeyBundleIcon").removeClass("fa-chevron-down").addClass("fa-chevron-up"); 3126 parent.$("#StickeyBundleIcon").attr("data-arrow", "fa-chevron-up"); 3127 $('footer').attr("style", " margin-bottom: 0px;"); 3128 } 3129 } 3130 else { 3131 // open the bottom panel when new product added 3132 localStorage.setItem("BundleArrow", "fa-chevron-down"); 3133 } 3134 } 3135 }); 3136 3137 3138 //parent.$("#divCustomerBundleProduct").load(BUNDLE_TYPE_5_List_CUSTOMER_PRODUCT, function () { 3139 3140 // //selected customer products start 3141 // ChkBundleTypeFiveCustomerSelectedProducts(); 3142 // //selected customer products end 3143 3144 3145 // initBundleSlider(); 3146 // if ($('#stickyCompareFooter').length > 0) { 3147 // //footer margin from top margin-bottom: 236px; 3148 // var height = $("#stickyCompareFooter").height(); 3149 // $('footer').attr("style", " margin-bottom:" + height + "px;"); 3150 // } 3151 // else 3152 // { 3153 // $('footer').attr("style", " margin-bottom: 0px;"); 3154 // } 3155 //}); 3156 3157 } 3158 3159} 3160//var lastClickedButtonId = null; 3161//$('a[data-toggle="modal"], button[data-toggle="modal"]').on('click', function () { 3162// lastClickedButtonId = $(this).attr('id'); // Store the ID of the clicked button 3163//}); 3164 3165 3166//$('.purchaseAlert').on('shown.bs.modal', function () { 3167// if (lastClickedButtonId != undefined) { 3168// var $modal = $(this); 3169 3170// // Hide both buttons initially inside the current modal 3171// $modal.find('.modal-footer a.btn-ok').hide(); 3172 3173// if (lastClickedButtonId === 'btnAddCustomerBundleAddToCart') { 3174// // Add the class to the relevant button in the modal 3175// var $btnAddCustomerBundle = $modal.find('.btnAddCustomerBundle'); 3176// if ($btnAddCustomerBundle.length > 0) { 3177// $btnAddCustomerBundle.removeClass('btnAddCustomerBundle').addClass('btnAddCustomerBundleAddToCart'); 3178// } 3179// } 3180// // Check if the button with the lastClickedButtonId class exists inside the current modal 3181// var $lastClickedBtn = $modal.find('.' + lastClickedButtonId); 3182// if ($lastClickedBtn.length > 0) { 3183// // Show only the relevant button inside the current modal 3184// $lastClickedBtn.show(); 3185// } else { 3186// // If the relevant button does not exist, show a default button if needed
3187// $modal.find('.modal-footer a.btn-ok').first().show(); // Show the first button as a fallback 3188// } 3189// lastClickedButtonId = null; // Reset the lastClickedButtonId 3190// } 3191//}); 3192 3193$('body').on('click', '.btnAddCustomerBundle', function () { 3194 var productId = $(this).attr("data-ProductId"); 3195 var bundleproductId = $(this).attr("data-bundleproductid"); 3196 var eventTimeId = $(this).attr("data-eventid"); 3197 var priceId = $(this).attr("data-priceid"); 3198 var MultipleEventTimeId = $('.EventDate').val(); 3199 $('.purchaseAlert').modal('hide'); 3200 //if date choose from drop down start 3201 if ($("#EventDate").length > 0) { 3202 var selectedEventTimeId = $("#EventDate").val(); 3203 if (selectedEventTimeId != undefined && selectedEventTimeId != null && selectedEventTimeId > 0) { 3204 eventTimeId = selectedEventTimeId 3205 } 3206 } 3207 3208 if (MultipleEventTimeId != undefined && MultipleEventTimeId > 0) { 3209 eventTimeId = MultipleEventTimeId 3210 } 3211 3212 //if date choose from drop down start 3213 var btnstatus = $(this).attr('data-status'); 3214 var status = true; 3215 if (btnstatus != undefined && btnstatus != "" && btnstatus == "0") { 3216 status = true; 3217 } 3218 else if (btnstatus != undefined && btnstatus != "" && btnstatus == "1") { 3219 status = false; 3220 } 3221 3222 //check if video replay & multi dates available start 3223 //comment start #7768 3224 var bundleUrl = $(this).attr("data-href"); 3225 var isDisplayDatePopup = $(this).attr("data-displaypopup"); 3226 if (status != undefined && status == true && isDisplayDatePopup != undefined && isDisplayDatePopup == "True" && bundleUrl != undefined && bundleUrl != "") { 3227 WidgetBundleDateSelectorPopup(bundleUrl); 3228 return false; 3229 } 3230 //comment end #7768 3231 //check if video replay & multi dates available end 3232 var otherProductIds = []; 3233 $('.clsRelatedProduct:checked').each(function (i) { 3234 otherProductIds.push($(this).attr("data-productid")); 3235 }); 3236 var otherProductId = otherProductIds.length > 0 ? otherProductIds.join(',') : null; 3237 SaveCustomerBundleTypeFive(productId, bundleproductId, eventTimeId, status, priceId, otherProductId) 3238}); 3239function RemoveItemFromCart(orderItemId, productId) { 3240 $("#divProgress").show(); 3241 $.ajax({
3242 type: "POST", 3243 url: REMOVE_ITEM_URL, 3244 dataType: "json", 3245 data: { 3246 'OrderItemId': orderItemId, 3247 'ProductId': productId 3248 }, 3249 success: function (data) { 3250 // alert(data); 3251 }, 3252 complete: function (data) { 3253 UpdateItemCart(); 3254 }, 3255 error: function (data) { 3256 alert('Error! Please try again later.'); 3257 } 3258 }); 3259} 3260 3261$("body").on("click", ".bundleEligible", function () { 3262 $('#divProgress').show(); 3263 3264 var elem = $(this); 3265 elem.addClass("disabled"); 3266 setTimeout(function () { 3267 elem.removeClass("disabled"); 3268 }, 2000); 3269 3270 var productId = $(this).attr("data-ProductId"); 3271 var bundleproductId = $(this).attr("data-bundleproductid"); 3272 var eventTimeId = $(this).attr("data-eventtimeid"); 3273 var priceId = $(this).attr("data-priceid"); 3274 var btnstatus = $(this).attr('data-status'); 3275 var orderItemId = $(this).attr('value'); 3276 var status = true; 3277 var productPriceType = $(this).attr('data-pricetype'); 3278 if (btnstatus != undefined && btnstatus != "" && btnstatus == "0") { 3279 status = true; 3280 } 3281 else if (btnstatus != undefined && btnstatus != "" && btnstatus == "1") { 3282 status = false; 3283 } 3284 $.ajax({
3285 type: "POST", 3286 url: BUNDLE_TYPE_5_ADD_CUSTOMER_PRODUCT, 3287 dataType: "json", 3288 data: { 3289 'productId': productId, 3290 'bundleProductId': bundleproductId, 3291 'eventTimeId': eventTimeId, 3292 'status': status, 3293 'priceId': priceId, 3294 'bundleEligible': true, 3295 'productPriceType': productPriceType 3296 }, 3297 success: function (data) { 3298 if (data.Message != null && data.Message != "") { 3299 alert(data.Message); 3300 } 3301 else { 3302 var ceCreditOrderItem = data.ceCreditOrderItem; 3303 $.ajax({ 3304 type: "GET", 3305 url: "bundle/addToCartBundleFiveProducts", 3306 dataType: "json", 3307 data: { 3308 'bundleEligible': true 3309 }, 3310 success: function (data) { 3311 $('#divProgress').show(); 3312 RemoveItemFromCart(orderItemId, productId); 3313 //if (ceCreditOrderItem != undefined && ceCreditOrderItem != null && ceCreditOrderItem > 0) { 3314 // RemoveItemFromCart(ceCreditOrderItem); 3315 //} 3316 //UpdateOrderSummary(); 3317 }, 3318 error: function () { 3319 alert('Error! Please try again later.'); 3320 } 3321 }); 3322 } 3323 }, 3324 error: function (data) { 3325 $('#divProgress').hide(); 3326 alert('Error! Please try again later.'); 3327 } 3328 }); 3329}); 3330 3331$("body").on("click", ".removeFromBundleAddtoCart", function () { 3332 var orderItemId = $(this).attr("data-orderitemid"); 3333 $('#divProgress').show(); 3334 $.ajax({
3335 type: "GET", 3336 url: "bundle/removeFromBundleAddtoCart", 3337 dataType: "json", 3338 data: { 'orderItemId': orderItemId }, 3339 success: function (data) { 3340 if (data == true) { 3341 updateChangedPriceCartItems(); 3342 } 3343 }, 3344 error: function (data) { 3345 $('#divProgress').hide(); 3346 alert('Error! Please try again later.'); 3347 } 3348 }); 3349}); 3350$("body").on("click", "#StickeyBundleIcon", function () { 3351 var Arrow = $(this).attr("data-arrow"); 3352 if (Arrow == "fa-chevron-down") { 3353 $(this).removeClass("fa-chevron-down").addClass("fa-chevron-up"); 3354 $(this).attr("data-arrow", "fa-chevron-up"); 3355 $("#isc-compare-control").hide('500'); 3356 $(".stickyCompareFooter").removeClass("active"); 3357 $('footer').attr("style", " margin-bottom: 0px;"); 3358 localStorage.setItem("BundleArrow", "fa-chevron-up"); 3359 } 3360 else { 3361 $(this).removeClass("fa-chevron-up").addClass("fa-chevron-down"); 3362 $(this).attr("data-arrow", "fa-chevron-down"); 3363 $("#isc-compare-control").show('500'); 3364 $(".stickyCompareFooter").addClass("active"); 3365 var height = $("#stickyCompareFooter").height(); 3366 $('footer').attr("style", " margin-bottom:" + height + "px;"); 3367 localStorage.setItem("BundleArrow", "fa-chevron-down"); 3368 } 3369}); 3370 3371function SaveCustomerBundleTypeFive(productId, bundleproductId, eventTimeId, status, priceId, otherProductId) { 3372 var productPriceType = null; 3373 //selected price from product detail page or add to cart popup modal start 3374 if (priceId == undefined || priceId == "" || priceId == null) { 3375 var chkRadioPrice = $('.rdbprice input[type=radio]:checked,.rdbprice input[type=checkbox]:checked'); 3376 if (chkRadioPrice != undefined && chkRadioPrice != null && chkRadioPrice != "" && chkRadioPrice.length > 0) { 3377 var Price = $(chkRadioPrice).attr('value'); 3378 if (Price != undefined && Price != null && Price.length > 0) { 3379 if (chkRadioPrice.attr("data-pricetype") == "AdditionalPrice") { 3380 alert("The selected price is not eligible to be included in this bundle."); 3381 return false; 3382 } 3383 var PriceData = Price.split(','); 3384 productPriceType = chkRadioPrice.attr("data-pricetype"); 3385 priceId = PriceData[0]; 3386 } 3387 } 3388 else { 3389 alert("Please select one of the pricing options to add this item to bundle."); 3390 return false; 3391 } 3392 } 3393 //selected price from product detail page or add to cart popup modal start 3394 3395 $.ajax({
3396 type: "POST", 3397 url: BUNDLE_TYPE_5_ADD_CUSTOMER_PRODUCT, 3398 dataType: "json", 3399 data: { 3400 'productId': productId, 3401 'bundleProductId': bundleproductId, 3402 'eventTimeId': eventTimeId, 3403 'status': status, 3404 'priceId': priceId, 3405 'otherProductId': otherProductId, 3406 'productPriceType': productPriceType 3407 }, 3408 success: function (data) { 3409 if (data.Message != null && data.Message != "") { 3410 var myContent = data.Message; 3411 if (isHTML(myContent)) { 3412 alert($(myContent).text()); 3413 } 3414 else { 3415 alert(myContent); 3416 } 3417 } 3418 else if (data.IsCECreditPrice) { 3419 displayPurchaseCEMessage(productId, data.CECreditPrice, { 3420 displayPageType: 3, 3421 customerBundleId: data.CustomerBundleId 3422 }); 3423 } 3424 LoadCustomerBundleProductList(); 3425 }, 3426 error: function (data) { 3427 $('#divProgress').hide(); 3428 alert('Error! Please try again later.'); 3429 } 3430 }); 3431} 3432 3433$('body').on('change', '.chkAddCustomerBundle', function () { 3434 var productId = $(this).attr("data-ProductId"); 3435 var bundleproductId = $(this).attr("data-bundleproductid"); 3436 var eventTimeId = $(this).attr("data-eventid"); 3437 var priceId = $(this).attr("data-priceid"); 3438 var MultipleEventTimeId = $('.EventDate').val(); 3439 if ($("#EventDate").length > 0) { 3440 var selectedEventTimeId = $("#EventDate").val(); 3441 if (selectedEventTimeId != undefined && selectedEventTimeId != null && selectedEventTimeId > 0) { 3442 eventTimeId = selectedEventTimeId 3443 } 3444 } 3445 if (MultipleEventTimeId != undefined && MultipleEventTimeId > 0) { 3446 eventTimeId = MultipleEventTimeId; 3447 } 3448 var status = $(this).prop('checked'); 3449 3450 //check if video replay & multi dates available start 3451 //comment start #7768 3452 var isDisplayDatePopup = $(this).attr("data-displaypopup"); 3453 var bundleUrl = $(this).attr("data-href"); 3454 if (status != undefined && status == true && isDisplayDatePopup != undefined && isDisplayDatePopup == "True" && bundleUrl != undefined && bundleUrl != "") { 3455 WidgetBundleDateSelectorPopup(bundleUrl); 3456 return false; 3457 } 3458 //comment end #7768 3459 //check if video replay & multi dates available end 3460 3461 SaveCustomerBundleTypeFive(productId, bundleproductId, eventTimeId, status, priceId); 3462}); 3463 3464$("body").on("click", ".clsDeleteCustomerBundleProduct", function () { 3465 var productId = $(this).attr('data-productid'); 3466 var chkClass = ".chkCustomerBundle" + productId; 3467 if (confirm("Are you sure you want to remove this product?")) { 3468 $('#divProgress').show(); 3469 $.ajax({
3470 type: "POST", 3471 url: "/Bundle/DeleteCustomerBundleProduct", 3472 dataType: "json", 3473 data: { 3474 'customerBundleId': $(this).attr('data-customerbundleid'), 3475 }, 3476 success: function (data) { 3477 LoadCustomerBundleProductList(); 3478 //$(chkClass).attr('checked', false); 3479 }, 3480 complete: function (data) { 3481 $('#divProgress').hide(); 3482 }, 3483 error: function (data) { 3484 $('#divProgress').hide(); 3485 alert('Error! Please try again later.'); 3486 } 3487 }); 3488 } 3489}); 3490 3491var isValidateRegistrantQuestionsForBundle = false; 3492var listBundleProducts; 3493 3494$("body").on("click", ".clsPurchaseall", function () { 3495 var url = $(this).attr('data-href'); 3496 $.ajax({ 3497 type: "GET", 3498 url: url, 3499 dataType: "json", 3500 data: { 3501 'isFromBundlePurchaseAll': true 3502 }, 3503 success: function (data) { 3504 if (data != null) { 3505 listBundleProducts = data; 3506 DisplayRegistrantPopUpForBundle(); 3507 } 3508 } 3509 }); 3510}); 3511 3512function DisplayRegistrantPopUpForBundle() { 3513 if (listBundleProducts.length > 0) { 3514 while (listBundleProducts.length > 0) { 3515 var promoCouponCode = listBundleProducts[0].PromoCouponCode; 3516 if (promoCouponCode.toString() == "CECreditPrice") { 3517 listBundleProducts.splice(0, 1); 3518 } 3519 if (listBundleProducts.length > 0) { 3520 var productId = listBundleProducts[0].ProductId; 3521 var discountId = listBundleProducts[0].ProductPriceId; 3522 var eventTimeId = listBundleProducts[0].EventTimeId; 3523 var productTypeId = listBundleProducts[0].ProductTypeId; 3524 var orderItemId = listBundleProducts[0].OrderItemId; 3525 var customerId = listBundleProducts[0].CustomerId; 3526 var priceType = listBundleProducts[0].PriceType; 3527 var isAgendaExists = listBundleProducts[0].IsAgendaExists != null ? listBundleProducts[0].IsAgendaExists : false; 3528 var isRegQuestionExist = listBundleProducts[0].IsRegQuestionExist != null ? listBundleProducts[0].IsRegQuestionExist : false; 3529 3530 listBundleProducts.splice(0, 1); 3531 if (listBundleProducts.length == 0) { 3532 isValidateRegistrantQuestionsForBundle = true; 3533 } 3534 3535 if (isRegQuestionExist) { 3536 if (typeof OpenRegistrantTypeQuestionSetPopup == 'function') { 3537 OpenRegistrantTypeQuestionSetPopup(productId, discountId, priceType, 0, 0, orderItemId, false, customerId, true, null, null, 0, false, false, isAgendaExists, true, false, "", false) 3538 return false; 3539 } 3540 } 3541 else if (isAgendaExists) { 3542 if (isAgendaExists.toString().toLocaleLowerCase() == 'true' && typeof OpenProductAgendaPopup == "function") { 3543 OpenProductAgendaPopup(productId, orderItemId, null, null, discountId, false, true); 3544 return false; 3545 } 3546 $('#divProgress').hide(); 3547 } 3548 else if (isValidateRegistrantQuestionsForBundle) { 3549 window.location.href = '/shoppingcart'; 3550 } 3551 } 3552 else { 3553 window.location.href = '/shoppingcart'; 3554 } 3555 } 3556 } 3557 else { 3558 return false; 3559 } 3560} 3561 3562$("body").on("click", ".clsClearAllCustomerBundleProduct", function () { 3563 if (confirm("Are you sure you want to Clear this Bundle?")) { 3564 $('#divProgress').show(); 3565 $.ajax({
3566 type: "POST", 3567 url: "/Bundle/ClearCustomerBundle", 3568 dataType: "json", 3569 data: { 3570 }, 3571 success: function (data) { 3572 LoadCustomerBundleProductList(); 3573 if ($('.chkAddCustomerBundle') != undefined) { 3574 $('.chkAddCustomerBundle').attr('checked', false); 3575 } 3576 }, 3577 complete: function (data) { 3578 $('#divProgress').hide(); 3579 }, 3580 error: function (data) { 3581 $('#divProgress').hide(); 3582 } 3583 }); 3584 } 3585}); 3586//bundle type 5 product add by customer end 3587 3588//get the mobile ce21 app 3589 3590$('body').on('click', '.btnGetMobileApp,.linkPagerDutySubmit', function () { 3591 $.magnificPopup.open({ 3592 items: { 3593 src: $(this).attr("data-href") 3594 }, 3595 type: 'iframe', 3596 closeOnBgClick: false, 3597 callbacks: { 3598 close: function () { 3599 //do stuff 3600 } 3601 }, 3602 mainClass: $(this).hasClass('linkPagerDutySubmit') ? 'popPagerDuty' : 'popNotificationOptionMainClass' 3603 }); 3604 return false; 3605}); 3606 3607// #region CE Credit Purchase 3608$("body").on("click", ".btnAddCECredittoCart", function () { 3609 var isClickByAckButton = $('#isAcknowledge').val(); 3610 var productId = $(this).attr('data-productId'); 3611 var promoCouponCodeType = $(this).attr('data-promoCouponCodeType') || ''; 3612 var cartId = $('#cartId').val(); 3613 addCECredittoCart(productId, isClickByAckButton, undefined, undefined, undefined, undefined, undefined, promoCouponCodeType, cartId); 3614}); 3615 3616$("body").on("click", ".btnCloseAddCECredittoCart", function () { 3617 var isSendTocart = $(this).attr('data-isSendCustomerCart'); 3618 var isPreRequestProduct = $('#isPreRequestProduct').val() || "false"; 3619 //if (isPreRequestProduct == "true") { 3620 // $('#dvPrerequisiteModalBody').css('margin-top', '266px'); 3621 //} 3622 if (typeof (IsProceedToMemberShipGroup) == 'function' && IsProceedToMemberShipGroup() && typeof (proceedToMembershipGroup) == 'function') 3623 { 3624 proceedToMembershipGroup();//--0011726 3625 } 3626 else if (isSendTocart != undefined && isSendTocart == "True" && isPreRequestProduct != "true") { 3627 parent.window.location.href = '/ShoppingCart'; 3628 } 3629}); 3630 3631function addCECredittoCart(productId, isClickByAckButton, pageType, discountId, marketingEntityId, marketingEntityType, registrantTypeOrderItemId, promoCouponCodeType, cartId) { 3632 //var datatarget = "cecreditpurchase" + productId; 3633 //$('#' + datatarget).modal('hide'); 3634 if ($("#divPurchaseCECreditmodal").length > 0) { 3635 $("#divPurchaseCECreditmodal").modal("hide"); 3636 } 3637 $.ajax({
3638 type: "POST", 3639 url: ADD_CECREDITTOCART_URL, 3640 dataType: "json", 3641 data: { 3642 productId: productId, pageType: pageType, discountId: discountId, marketingEntityId: marketingEntityId, marketingEntityType: marketingEntityType, registrantTypeOrderItemId: registrantTypeOrderItemId, cartId: cartId 3643 }, 3644 success: function (data) { 3645 3646 // 17507: Google Analytics -E-commerce Tracking 3647 if (data && data.productAddedInCartDetails) { 3648 googleAnalytics.addToCartEvent(data.productAddedInCartDetails); 3649 faceBookAnalytics.addToCartEvent(data.productAddedInCartDetails); 3650 } 3651 if (promoCouponCodeType == 'MemberHours' && data.cartId != null && data.cartId != "") { 3652 memberHoursAdditionalPayments(0, data.cartId, promoCouponCodeType); 3653 return false; 3654 } 3655 3656 if (data.isSendCustomerToCart != undefined && data.isSendCustomerToCart == true && (isClickByAckButton != "true")) { 3657 setTimeout(function () { 3658 parent.window.location.href = '/ShoppingCart'; 3659 }, 555); 3660 return false; 3661 } 3662 3663 if (pageType == 4) { //QuickSignUp 3664 var $target = $(".ce21FreeCourse[data-ProductId='" + productId + "']"); 3665 var type = $target.closest(".ProductDetailPortion").length > 0 ? "productdetail" : "SearchProduct"; 3666 displayCartMessages($target, data, type); 3667 } 3668 if (typeof (proceedToMembershipGroup) == 'function' && !proceedToMembershipGroup()) { 3669 return false; 3670 } 3671 if (typeof (clearSessionStorageKeyForGroup) == 'function' && !(data.IsCECreditPrice !== undefined && data.IsCECreditPrice != null && data.IsCECreditPrice == true)) { 3672 clearSessionStorageKeyForGroup(); 3673 } 3674 if (data.CartCount != null && data.CartCount != "" && data.CartCount != "0") { 3675 parent.$("#cartspancount").html(data.CartCount); 3676 parent.$("#cartItemList").load(GET_CART_URL); 3677 } 3678 }, 3679 complete: function (data) { 3680 }, 3681 error: function (data) { 3682 alert('Error! Please try again later.'); 3683 } 3684 }); 3685} 3686// #endregion CE Credit Purchase 3687 3688//Close Add to cart popup 3689function ClosePurchaseCECreditModel(isSendCustomerToCart) { 3690 $.magnificPopup.close(); 3691 window.location.href = '/ShoppingCart'; 3692} 3693 3694function LoadCustomerBundleWidget() { 3695 $.magnificPopup.close(); 3696 LoadCustomerBundleProductList(); 3697} 3698 3699$(function () { 3700 var queryParams = []; 3701 queryParams.push('IsUpdateCartId'); //ReceiptPart,CheckRegistrationView,PaymentInfo 3702 queryParams.push('Message'); //ShippingInfoView,PaymentInfo,RegistrantConfirmationView,IsShippingAddressExist,PlaceNewOrder 3703 queryParams.push('subscriptionsMessage');//Account-Register,Account-Login 3704 queryParams.push('wishListMessage');//Account-Register,Account-Login 3705 queryParams.push('classroomMessage');//Classroom-AddToCart,ShoppingCart-Mycart 3706 queryParams.push('InActiveProductCount');//ShoppingCart-Mycart 3707 queryParams.push('InActiveDiscountProductCount');//ShoppingCart-Mycart 3708 queryParams.push('alertMsg'); 3709 queryParams.push('sucMsg'); 3710 queryParams.push('warnMsg'); 3711 removeUrlMessage(queryParams); 3712}); 3713 3714function removeUrlMessage(params) { 3715 var queryParams = []; 3716 var urlparts = window.location.href.split('?'); 3717 if (urlparts.length >= 2) { 3718 for (var i = 0; i < params.length; i++) { 3719 if (urlparts[1].indexOf(params[i]) > -1) { 3720 queryParams.push(params[i]); 3721 } 3722 } 3723 if (queryParams && queryParams.length > 0) { 3724 3725 window.history.pushState("object or string", "Title", removeURLParameter(window.location.href.indexOf("#") > -1 ? window.location.href.substring(0, window.location.href.indexOf("#")) : window.location.href, queryParams)); 3726 } 3727 } 3728} 3729 3730function removeURLParameter(url, parameterArray) { 3731 //prefer to use l.search if you have a location/link object 3732 3733 var urlparts = url.split('?'); 3734 if (urlparts.length >= 2) { 3735 var pars = urlparts[1].split(/[&;]/g); 3736 for (var j = 0; j < parameterArray.length; j++) { 3737 3738 var prefix = encodeURIComponent(parameterArray[j]) + '='; 3739 3740 3741 //reverse iteration as may be destructive 3742 for (var i = pars.length; i-- > 0;) { 3743 //idiom for string.startsWith 3744 if (pars[i].lastIndexOf(prefix, 0) !== -1) { 3745 pars.splice(i, 1); 3746 } 3747 } 3748 3749 url = urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : ""); 3750 } 3751 3752 return url; 3753 } 3754 else { 3755 return url; 3756 } 3757} 3758
3759$('.topMyAccountBar').mouseover(function () { 3760 getLinkedTenants(); 3761}) 3762 3763function getLinkedTenants() { 3764 if ($("#divCustomerLinkedTenants").length > 0 && $("#divCustomerLinkedTenants").html().trim().length == 0) { 3765 $("#divCustomerLinkedTenants").prepend("<p class='loaderTxt' >Please wait ...</p>"); 3766 3767 $.ajax({ 3768 type: "GET", 3769 url: GET_CUSTOMER_LINKEDTENANTS, 3770 global: false, 3771 success: function (response) { 3772 $("#divCustomerLinkedTenants").html(response); 3773 } 3774 }); 3775 } 3776} 3777 3778function WidgetBundleDateSelectorPopup(url) { 3779 $.magnificPopup.close(); 3780 $.magnificPopup.open({ 3781 items: { 3782 src: url 3783 }, 3784 type: 'iframe', 3785 closeOnBgClick: false, 3786 callbacks: { 3787 close: function () { 3788 $(".divProgress").hide(); 3789 ChkBundleTypeFiveCustomerSelectedProducts(); 3790 } 3791 }, 3792 mainClass: 'popAddtoCartMainClass' 3793 }); 3794 3795 return false; 3796} 3797 3798function closeMultiPaymentSalesPageModal() { 3799 $.magnificPopup.close(); 3800 window.location.href = '/ShoppingCart'; 3801} 3802 3803$("body").on("click", ".clsGoToLinkedAccount", function () { 3804 var linkedCatalogName = $(this).attr("data-linkedCatalogName"); 3805 if (linkedCatalogName != undefined) { 3806 $("#divProgressLinkedAccount").show(); 3807 $(".clsLinkedAccountLoaderTxt").text("Switching to " + linkedCatalogName); 3808 } 3809}); 3810 3811//START: sidebar button in mobile view #0008719 3812$('.sideBarCloseButton').click(function () { 3813 $('body').removeClass('sidemenu-active'); 3814}); 3815 3816//if ($('#sidebar').length > 0 && $('#sidebar').html().trim().length > 0) { 3817// $('.divBtnFilterShowHide').show(); 3818//} 3819//else { 3820// $('.divBtnFilterShowHide').hide(); 3821//}; 3822 3823 3824//if ($('.btnForHideShowSideBarShoppingCart').length > 0 && $('#sidebar').length > 0) { 3825// $('.btnForHideShowSideBarShoppingCart').click(function () { 3826// $('body').addClass('sidemenu-active'); 3827// }); 3828//}; 3829 3830if ($('.btnForHideShowSideBar').length > 0 && $('#sidebar').length > 0) { 3831 $('.btnForHideShowSideBar').click(function () { 3832 $('body').addClass('sidemenu-active'); 3833 }); 3834}; 3835function updateCartCount() { 3836 $('#mobile-cartspancount').html($("#cartspancount").html()); 3837} 3838//END: sidebar button in mobile view 3839 3840$(window).resize(function () { 3841 if (width != $(window).width()) { 3842 toggleSidebarToHamburger(); 3843 3844 if ($('.fixedSideBar').length) { 3845 if ($(window).width() < 767) {
3846 $('.fixedSideBar').addClass('disableAffix'); 3847 } else { 3848 $('.fixedSideBar').removeClass('disableAffix'); 3849 } 3850 } 3851 } 3852}); 3853 3854 3855function onMarketingCodeBegin() { 3856 $("#btnMarketingCodeSave").attr('disabled', true); 3857 //$("#btnMarketingCodeSave").html('Processing please wait ...'); 3858} 3859function onMarketingCodeSuccess(data) { 3860 if (data != null) { 3861 loadMarketingDiv(false); 3862 //$("#marketingCodeSuccessMassage").html(data).closest('.alert').show(); 3863 } 3864} 3865 3866function onMarketingCodefailure() { 3867 $("#btnMarketingCodeSave").prop('disabled', false); 3868} 3869 3870$("body").on('click', ".btnRemoveMarketingCode", function () { 3871 loadMarketingDiv(true) 3872}); 3873 3874function loadMarketingDiv(removeCode) { 3875 $('#divMarketingCode').load("/ShoppingCart/MarketingCodeViewSummary?removeCode=" + removeCode, function () { }); 3876} 3877 3878$(window).resize(function () { 3879 if ($('.remove-table-responsive').length > 0) { 3880 removeTableResponsiveCss(); 3881 } 3882}); 3883 3884function removeTableResponsiveCss() { 3885 if ($(window).width() < 974) { 3886 if ($('.remove-table-responsive').length > 0) { 3887 $('.remove-table-responsive').removeClass('table-responsive'); 3888 } 3889 } 3890 else { 3891 if (!$('.remove-table-responsive').hasClass('table-responsive')) { 3892 $('.remove-table-responsive').addClass('table-responsive'); 3893 } 3894 } 3895} 3896 3897$("body").on('click', '.popUpFreeCourseRegister', function () { 3898 var element = $(this); 3899 var actionUrl = element.attr("data-href"); 3900 var alternateUrl = element.attr("data-returnUrl"); 3901 var productId = element.attr("data-ProductId"), 3902 pageType = element.closest(".ProductDetailPortion").length > 0 ? "productdetail" : "SearchProduct"; 3903 3904 if (element.hasClass('ce21FreeCourse') && customerId == -1) { 3905 return; 3906 } 3907 handleFreeCourseRegistration(productId, actionUrl, alternateUrl, element, pageType); 3908}); 3909 3910$("body").on("click", ".btnGuestBookRegistration", function () { 3911 3912 var eventTimeId = $(this).attr('data-eventtimeid'); 3913 var guestbookUrl = $(this).attr('data-href') 3914 var timeId = 0; 3915 var multipleEventTimeId = $('.EventDate').val() 3916 element = $(this), 3917 productId = element.attr("data-ProductId"), 3918 pageType = element.closest(".ProductDetailPortion").length > 0 ? "productdetail" : "SearchProduct";; 3919 3920 if (productId) { 3921 $.get("/Items/CheckMaxRegistrantForFreeProducts?productId=" + productId + "&eventTimeId=" + eventTimeId, function (data) { 3922 if (data && data.Message) { 3923 displayCartMessages(element, data, pageType); 3924 } 3925 else { 3926 if (multipleEventTimeId > 0) { 3927 timeId = multipleEventTimeId; 3928 } 3929 else { 3930 timeId = eventTimeId; 3931 } 3932 3933 if (timeId != undefined && timeId > 0 && guestbookUrl != undefined && guestbookUrl != null && guestbookUrl != "") { 3934 parent.location.href = guestbookUrl + '/' + timeId; 3935 } 3936 } 3937 }); 3938 } 3939}); 3940 3941//display purchase alert in widget 3942$("body").on("click", "#purchaseProductWithAlert", function () { 3943 var className = $(this).attr('data-purchasebuttontype'); 3944 if (className.indexOf('zeroDollarOrderPurchased') > -1) { 3945 $("." + className).trigger('click', [true]); 3946 } 3947 if (className != undefined && className != null && className != "" && className.indexOf('zeroDollarOrderPurchased') == -1) { 3948 $("." + className).trigger('click', [1, undefined, true]); 3949 } 3950 $("#divGeneralPurchaseAlert.modal.fade.in:visible").modal('hide'); 3951}); 3952 3953function SearchFiltersCollapse() { 3954 const fromDuration = parseFloat($("#fromDuration").val() || $("#txtFromDuration").val()); 3955 const toDuration = parseFloat($("#toDuration").val() || $("#txtToDuration").val()); 3956 const maxDuration = parseFloat($("#maxDuration").val() || $("#txtToDuration").attr("max")); 3957 3958 if ($('.clsSearchFilterWidget').length > 0) { 3959 $('.clsSearchFilterWidget').each(function () { 3960 3961 if (this.parentElement.classList.contains('filtersSidebarmenuInToggle') && $(this).find('input[type=checkbox]:checked').length>0) { 3962 $(this).closest("div").find(".collapse").parent().find('.panel-heading [data-toggle="collapse"]').attr('aria-expanded', 'true'); 3963 $(this).parent().find(".fa-chevron-down").removeClass("fa-chevron-down").addClass("fa-chevron-up"); 3964 $(this).closest("div").find("#filtersSidebarmenuInToggle").addClass("in"); 3965 } 3966 else { 3967 //Get Checked Box length 3968 var CheckedValues = $(this).find('input[type=checkbox]:checked').length; 3969 var collapseSection = false; 3970 3971 // Open div for checked Item while user seleted filters 3972 if (CheckedValues && CheckedValues > 0) { 3973 collapseSection = true; 3974 } 3975 if ($(this).find('[data-value="Search Near Me"]').length > 0 || $(this).find('[data-value="Directory Search"]').length > 0 || $(this).find('#DirectorySearchByMemberNumber').length > 0) { 3976 collapseSection = true; 3977 } 3978 if ($(this).find('[data-value="Event Date Filter"]').length > 0 && ($("#txtStartingOnOrAfter").val() || $("#txtStartingOnOrBefore").val())) { 3979 collapseSection = true; 3980 } 3981 if ($(this).find('[data-value="Geo Search By City"]').length > 0) { 3982 collapseSection = true; 3983 } 3984 3985 if ($(this).find('[data-value="Durations"]').length > 0 && ((!isNaN(fromDuration) && fromDuration > 0) || (!isNaN(toDuration) && !isNaN(maxDuration) && toDuration < maxDuration))) { 3986 collapseSection = true; 3987 } 3988 3989 if ($(this).find('[data-value="Zip Code Search"]').length > 0 && $.trim($('#txtZipCode').val()) !== '') { 3990 collapseSection = true; 3991 } 3992 3993 if (collapseSection) { 3994 $(this).find(".collapse").parent().find('.panel-heading [data-toggle="collapse"]').attr('aria-expanded', 'true'); 3995 $(this).find(".collapse").parent().find(".glyphicon-plus").removeClass("glyphicon-plus").addClass("glyphicon-minus"); 3996 $(this).find(".panel-collapse").addClass("in"); 3997 } 3998 } 3999 }); 4000 } 4001 4002} 4003 4004$("#txtStartingOnOrAfter").on('change', function () { 4005 $("#txtStartingOnOrBefore").datepicker("option", "minDate", $("#txtStartingOnOrAfter").val()); 4006}); 4007$("#txtStartingOnOrBefore").on('change', function () { 4008 $("#txtStartingOnOrAfter").datepicker("option", "maxDate", $("#txtStartingOnOrBefore").val()); 4009}); 4010 4011 4012$(function () { 4013 if ($('.clsNotices').length > 0 && document.cookie.indexOf('CookieNoticeAccepted=') === -1 && document.cookie.indexOf('CookieNoticeDeclined=') === -1) { 4014 $('.clsNotices').show(); 4015 } 4016}); 4017 4018//Start: 0011084: EUGDPR Step 4: Cookie Notice 4019$('body').on('click', '.clsCookieNoticeAccept', function () { 4020 var expDate = new Date(); 4021 expDate.setFullYear(expDate.getFullYear() + 1); 4022 var domain = window.location.hostname; 4023 if (domain.indexOf("ce21") === -1) { 4024 var d = domain.split('.'); 4025 d.shift(); 4026 domain = d.join('.'); 4027 } 4028 var setDate = new Date(); 4029 document.cookie = "CookieNoticeAccepted=" + setDate.toISOString() + "; domain=" + domain + "; path=/; expires=" + expDate.toUTCString(); 4030 setTimeout(function () { $('.clsNotices').hide(); }, 500); 4031}) 4032$('body').on('click', '.clsCookieNoticeDecline', function () { 4033 var expDate = new Date(); 4034 expDate.setFullYear(expDate.getFullYear() + 1); 4035 var domain = window.location.hostname; 4036 if (domain.indexOf("ce21") === -1) { 4037 var d = domain.split('.'); 4038 d.shift(); 4039 domain = d.join('.'); 4040 } 4041 var setDate = new Date(); 4042 document.cookie = "CookieNoticeDeclined=" + setDate.toISOString() + "; domain=" + domain + "; path=/; expires=" + expDate.toUTCString(); 4043 setTimeout(function () { $('.clsNotices').hide(); }, 500); 4044}) 4045$('body').on('click', '.clsCookieNoticeRevoke', function () { 4046 var domain = window.location.hostname; 4047 if (domain.indexOf("ce21") === -1) { 4048 var d = domain.split('.'); 4049 d.shift(); 4050 domain = d.join('.'); 4051 } 4052 document.cookie = "CookieNoticeAccepted=; domain=" + domain + "; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT"; 4053 document.cookie = "CookieNoticeDeclined=; domain=" + domain + "; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT"; 4054 setTimeout(function () { $('.clsNotices').show(); }, 500); 4055}) 4056//End: 0011084: EUGDPR Step 4: Cookie Notice 4057 4058// #11007:EUGDPR Step 2: Marketing Consent-EU Start 4059function checkMarketingConsentCustomer(email, countryName) { 4060 countryName = countryName == undefined ? "" : countryName; 4061 if ($("#divMarketingConsentCustomerEUAware").length >
4061 0 || $("#divLegitimateInterestEUaware").length > 0) //#11618: Use for displaying Legitimate Interest statement 4062 { 4063 $.ajax({ 4064 type: "GET", 4065 url: CHECK_MARKETINGCONSENT_CUSTOMER, 4066 dataType: "json", 4067 data: { 4068 'email': email, 4069 'countryName': countryName 4070 }, 4071 success: function (data) { 4072 if (data) { 4073 if ($("#divMarketingConsentCustomerEUAware").length > 0) { 4074 $("#divMarketingConsentCustomerEUAware").show(); 4075 enableDisablemarketingConsent(false); 4076 } 4077 if ($("#divLegitimateInterestEUaware").length > 0) { 4078 $("#divLegitimateInterestEUaware").show(); 4079 setOrRemoveConsentInCookie("LegitimateInterestEUaware", false, $("#divLegitimateInterestEUaware").attr("data-page")); 4080 } 4081 } 4082 else { 4083 if ($("#divMarketingConsentCustomerEUAware").length > 0) { 4084 $("#divMarketingConsentCustomerEUAware").hide(); 4085 enableDisablemarketingConsent(true); 4086 setOrRemoveConsentInCookie("MarketingConsentEUAware", true, $("#divMarketingConsentCustomerEUAware").attr("data-page")) 4087 } 4088 if ($("#divLegitimateInterestEUaware").length > 0) { 4089 $("#divLegitimateInterestEUaware").hide(); 4090 setOrRemoveConsentInCookie("LegitimateInterestEUaware", true, $("#divLegitimateInterestEUaware").attr("data-page")); 4091 } 4092 } 4093 }, 4094 error: function (data) { 4095 alert('Error! Please try again later.'); 4096 } 4097 }); 4098 } 4099 4100} 4101 4102// set the consent in cookie 4103function setOrRemoveConsentInCookie(type, isRemove, page) { 4104 if (!page) { return; } 4105 if (isRemove) { 4106 document.cookie = type + "=; path=/ " 4107 } else { 4108 document.cookie = type + "=true; path=/ " 4109 } 4110} 4111 4112//As per mantis : #11211 4113function enableDisablemarketingConsent(enable) { 4114 if ($('#MarketingConsentEUAware').length > 0) { 4115 $('#MarketingConsentEUAware').prop("disabled", enable); 4116 if ($('#hdnMarketingConsentEUAware').length == 0) { 4117 $('input[name="MarketingConsentEUAware"]').prop("disabled", enable); 4118 } 4119 4120 } 4121} 4122// #11007:EUGDPR Step 2: Marketing Consent-EU End 4123 4124// display alert for show the authorization payment of membership when memberhip having recurring payment 4125function membbershipAuthorizationAlert(membershipRequestData, callback) { 4126 4127 var childIds = ""; 4128 var alertFrom = membershipRequestData.alertFrom || ''; 4129 if (alertFrom == "addonpage") { 4130 var childIds = $(".chkAddonMemberships:checked").map(function () { return $(this).attr("data-id") }).get().join(); 4131 } 4132 4133 $.post("/Search/GroupBillingcycle", { 4134 memberShipTypeId: membershipRequestData.mebershipTypeId, 4135 childIds: childIds, 4136 checkAddons: alertFrom != "addonpage", 4137 noOfUser: membershipRequestData.noOfUsers || 0 4138 }, function (data) { 4139 if (data && data.ParentId && data.ParentId > 0) { 4140 4141 if (alertFrom == "questionset") { 4142 $("#parentMembershipId").val(data.ParentId); 4143 callback(); 4144 } 4145 else { 4146 chooseAddonGroups(data.ParentId); 4147 } 4148 } 4149 else if (data && data.trim()) { 4150 $.confirm({ 4151 title: membershipRequestData.memberhipLable || 'Membership', 4152 boxWidth: '550px', 4153 useBootstrap: false, 4154 type: 'green', 4155 content: data, 4156 buttons: { 4157 ok: { 4158 text: 'Accept and Add to Cart', 4159 btnClass: 'btn-success', 4160 action: callback 4161 }, 4162 cancel: { 4163 text: 'Cancel Order', 4164 btnClass: 'btn-warning',
4165 action: function () { 4166 if (typeof (parent.clearSessionStorageKeyForGroup) == 'function') { 4167 parent.clearSessionStorageKeyForGroup();//--0011726 4168 } 4169 $("#groupPaymentCycleId").val(''); 4170 $("#autoRecurringType").val(0); 4171 } 4172 } 4173 } 4174 }); 4175 setTimeout(function () { 4176 $("#groupPaymentCycleId").val($(".billingCycleType:checked").attr("data-GroupCycleId")) 4177 $("#autoRecurringType").val($(".customerRecurringType:checked").val()); 4178 }, 200); 4179 } else { 4180 callback(); 4181 } 4182 }); 4183} 4184 4185// used for send to particular inner tab when url having the has parameter 4186function DisplayInnerTabs() { 4187 var hasTabUrl = window.location.hash; 4188 if (hasTabUrl && $('.aInnerTab[href=' + hasTabUrl + ']').length > 0) { 4189 $('.aInnerTab[href=' + hasTabUrl + ']').trigger('click'); 4190 } 4191} 4192 4193function chooseAddonGroups(parentId) { 4194 if (parentId > 0) { 4195 $('#divProgress').show(); 4196 location.href = "/Group/Addons?parentMembershipId=" + parentId; 4197 } 4198} 4199 4200// used for attached hash tag to url 4201$(".aInnerTab[data-toggle='tab']").click(function () { 4202 var hasTag = $(this).attr('href'); 4203 if (hasTag) { 4204 window.history.replaceState(null, null, hasTag); 4205 } 4206}); 4207 4208//ads image upload in form 4209var adsImageFiles = []; 4210var i;
4211var img = '<img style="max-height:100%;object-fit:contain;">'; 4212var updateImageName = ""; 4213 4214function dragAdsImg(event, i) { 4215 var allowedFileExtension = ["jpg", "jpeg", "png", "gif", "ico", "bmp"]; 4216 var selectedFile = event.target.files[0]; 4217 var selectedFileName = selectedFile.name; 4218 4219 if ($.inArray(selectedFileName.split('.').pop().toLowerCase(), allowedFileExtension) == -1) { 4220 alert("Only the following formats are allowed: .jpg, .jpeg, .png, .gif, .ico or bmp"); 4221 $("#AdsImgUpload" + i).val(""); 4222 $("#EditAdImg" + i).val(""); 4223 return; 4224 } 4225 4226 var fileSize = selectedFile.size; 4227 if (fileSize > (1048576 * 5)) { 4228 alert("Maximum file size is 5 MB"); 4229 $("#AdsImgUpload" + i).val(""); 4230 $("#EditAdImg" + i).val(""); 4231 return; 4232 } 4233 4234 if (updateImageName != undefined && updateImageName != null && updateImageName != "") { 4235 var deletedFiles = $('#DeletedFiles').text(); 4236 var latestDeletedFiles = updateImageName; 4237 var allDeleteFiles = deletedFiles.concat(latestDeletedFiles, ","); 4238 $('#DeletedFiles').text(allDeleteFiles); 4239 $('#DeletedFiles').attr('value', allDeleteFiles); 4240 updateImageName = ""; 4241 } 4242 4243 adsImageFiles[i] = event.target.files[0]; 4244 imgSrc = URL.createObjectURL(event.target.files[0]); 4245 $('#FileUploadDiv' + i + ' span').remove(); 4246 $('#FileUploadDiv' + i + ' #btnDivAdsUpload' + i).remove(); 4247 $('#FileUploadDiv' + i + ' h4').remove(); 4248 $('#FileUploadDiv' + i + ' img').remove(); 4249 $("#inputDiv" + i).css({ 'display': 'none' }); 4250 $('#FileUploadDiv' + i).css({ 'background': 'white', 'padding': '0' }); 4251 $('#FileUploadDiv' + i).append('<img style="max-height:100%;object-fit:contain;" src="' + imgSrc + '">'); 4252 $('#FileUploadDiv' + i).append('<input type="file" name="files" accept=".jpg,.jpeg,.png,.gif,.ico,.bmp" id="EditAdImg' + i + '" class="EditAdImg" onChange="dragAdsImg(event,' + i + ')" style="display:none;" /><div id="btnDivAdsUpload' + i + '" class="btnDivAdsUpload"><a style ="border-right:1px solid #ddd;padding-left:5px" title = "click here for edit this image" ><h4><span aria-hidden="true" style="margin-right: 5px;" class="glyphicon glyphicon-edit" onclick="EditAdsImg(' + i + ')"></span></h4></a ><a style="padding-left:5px;" title="click here for remove this image" ><h4><span aria-hidden="true" style="margin-right: 5px;" onclick="removeAdsImg(' + i + ')" class="glyphicon glyphicon-remove"></span></h4></a></div > '); 4253 $('#AdsImgUpload' + i).css('display', 'none'); 4254} 4255 4256$('body').on('click', '#uploadImageButton', function () { 4257 var isRequired = $(this).attr('data-val'); 4258 var imageCount = $("#imageAddedCount").val(); 4259 $('#imageInputGroup').append('<div id="0" class="FileUploadThumbnail col-lg-2" style="width:151px;"><div id="FileUploadDiv' + imageCount + '" class="FileUploadDiv"><div class="inputDiv" id="inputDiv' + imageCount + '"><h4 class="fa fa-cloud-upload" style="margin-top: 0; text-align: end; font-size:25px"></h4><span style="padding-bottom:35px; text-align:center;">Drag & Drop Image<br>Or<br> Click Here to Upload</span><input class="' + (isRequired == "1" ? 'adsAnswerImages' : '') + '" type="file" name="files" accept=".jpg,.jpeg,.png,.gif,.ico,.bmp" onchange="dragAdsImg(event,' + imageCount + ')" id="AdsImgUpload' + imageCount + '" style="height: 100%; width: 100%; opacity: 0; margin-top: -110px;"></div></div></div>'); 4260 $("#imageAddedCount").val(parseInt(imageCount) + 1); 4261}) 4262 4263$('#ClassifiedAdsPostingForm').submit(function (e) { 4264 //chek date is valid or not start 4265 var isValid = checkCommonFormValidation($(this)); 4266 4267 // Trim whitespace from input fields and textareas in the #ClassifiedAdsPostingForm 4268 $('#ClassifiedAdsPostingForm input[type="text"]').each(function () { 4269 var element = $(this); 4270 var elementValue = element.val().trim(); 4271 element.val(elementValue); // Trim the value and set it back to the input field 4272 }); 4273 4274 $('#ClassifiedAdsPostingForm textarea').each(function () { 4275 var element = $(this); 4276 var elementValue = element.val().trim(); 4277 if (elementValue == '') { 4278 element.val(elementValue); 4279 } 4280 // Trim the value and set it back to the input textarea 4281 });
4282 4283 //check Ads Images required validation 4284 $('.adsAnswerImages').each(function () { 4285 var isRequired = $('#IsImageUploadRequired').val(); 4286 var imageCount = $("#imageAddedCount").val(); 4287 var count = 0; 4288 4289 if (isRequired == '1') { 4290 for (var i = 0; i < parseInt(imageCount); i++) { 4291 if ($('#FileUploadDiv' + i).find('img').length != 0) { 4292 count++; 4293 } 4294 } 4295 4296 if (count == 0) { 4297 $("#spnError_AdsImage").text('Please upload Image.') 4298 $("#spnError_AdsImage").addClass("field-validation-error"); 4299 $("#spnError_AdsImage").addClass("help-block"); 4300 isValid = false; 4301 } else { 4302 $("#spnError_AdsImage").text('') 4303 $("#spnError_AdsImage").addClass(""); 4304 } 4305 } 4306 else { 4307 $("#spnError_AdsImage").text('') 4308 $("#spnError_AdsImage").addClass(""); 4309 } 4310 }); 4311 4312 //isValid = checkMultiChoiceValidation(isValid); 4313 4314 //var isCKEditorRequired = $("#IsCKEditorRequired").val(); 4315 //if (isCKEditorRequired == "1") { 4316 // var ckEditorValue = $(".ckEditorValue").val(); 4317 // if (ckEditorValue == "") { 4318 // $("#CKEditorValidationMessage").html("This field is required.").css("color", "#b94a48").addClass("field-validation-error").show(); 4319 // return false; 4320 // } 4321 //} 4322 4323 if (isValid == false) { 4324 return false; 4325 } 4326 4327 var formdetails = document.getElementById("ClassifiedAdsPostingForm"); // Find the form by its ID 4328 if (formdetails.checkValidity()) { 4329 $('#btnClassifiedQuestionSet').html('<i class="fa fa-refresh fa-spin"></i> Processing...').attr('disabled', 'disabled'); 4330 } 4331}); 4332 4333//Ordering Ads Images start 4334$(function () { 4335 $("#imageInputGroup").sortable({ 4336 update: function (event, ui) { 4337 getIdsOfImages(); 4338 } 4339 }); 4340}); 4341 4342 4343function getIdsOfImages() { 4344 var values = []; 4345 $('.FileUploadThumbnail').each(function (index) { 4346 values.push($(this).attr("id")); 4347 }); 4348 4349 $('#ImageDisplayOrder').text(values); 4350 $('#ImageDisplayOrder').attr('value', values); 4351} 4352 4353//Ordering Ads Images end 4354 4355function AdDetailsTxtLmt(id) { 4356 var TextLimit = $("#TextLimit").val(); 4357 if (TextLimit != "") { 4358 $(id).attr('maxlength', TextLimit); 4359 } 4360 var adsDetailsMsg = $(".AdsDetailsMsg").val(); 4361 var CharLeft = adsDetailsMsg.length; 4362 $("#charLeftforMsg").text(" " + CharLeft + " of ") 4363} 4364 4365function EditAdsImg(i, imageName) { 4366 if (imageName != undefined) { 4367 updateImageName = imageName; 4368 } 4369 4370 $("#EditAdImg" + i).trigger("click"); 4371 $("#inputDiv" + i).remove(); 4372} 4373 4374function removeAdsImg(i, fileName) { 4375 var deletedFiles = $('#DeletedFiles').text(); 4376 var latestDeletedFiles = fileName ? fileName : ""; // If fileName is undefined, set it to an empty string 4377 var allDeleteFiles = deletedFiles.concat(latestDeletedFiles, ","); 4378 $('#DeletedFiles').text(allDeleteFiles); 4379 $('#DeletedFiles').attr('value', allDeleteFiles); 4380 4381 var isRequired = $('#IsImageUploadRequired').val(); 4382 document.getElementById('FileUploadDiv' + i).innerHTML = ""; 4383 $('#FileUploadDiv' + i).append('<h4 class="fa fa-cloud-upload" style="margin-top: 0; text-align: end; font-size:25px"></h4><span style = "padding-bottom:35px; text-align:center;">Drag & Drop Image<br />Or <br /> Click Here to Upload</span ><input type="file" name="files" class="' + (isRequired == "1" ? 'adsAnswerImages' : '') + '" accept=".jpg,.jpeg,.png,.gif,.ico,.bmp" onChange="dragAdsImg(event,' + i + ')" id="AdsImgUpload' + i + '" />'); 4384 SetDefault(i); 4385 $('#FileUploadDiv' + i).css({ 4386 'background': 'lightgrey', 4387 'padding': '5px' 4388 }); 4389} 4390 4391//css changes for ads img div 4392function NoOfImg() { 4393 var NoOfImg = (document.getElementById("NoOfImg") != null && document.getElementById("NoOfImg").value != null && document.getElementById("NoOfImg").value != undefined) ? document.getElementById("NoOfImg").Value : 0; 4394 if (NoOfImg > 0) { 4395 for (i = 0; i < NoOfImg; i++) { 4396 $('#AdsImgUpload' + i).css({ 4397 'height': '100%', 4398 'width': '100%', 4399 'opacity': '0', 4400 'margin-top': '-110px' 4401 }) 4402 } 4403 } 4404} 4405 4406function SetDefault(i) { 4407 $('#AdsImgUpload' + i).css({ 4408 'height': '100%', 4409 'width': '100%', 4410 'opacity': '0', 4411 'margin-top': '-110px' 4412 4413 }) 4414} 4415 4416//mantis item : #11106: Manager/Catalog > Do not allow letters to be entered into any phone files / fax fields in Customer / Speaker Accounts 4417$("body").on("input", ".numValidation", function (e) { 4418 var input = $(this).val();
4419 var validateNumber = /^([0-9]|[(]|[)]|[-]|[+]|[ ])+$/; 4420 // Allow: backspace, delete, tab, escape, enter and . 4421 //if ($.inArray(key, [46, 8, 9, 27, 13, 110, 190]) !== -1 || 4422 // Allow: Ctrl+A, Command+A,Ctrl+V, Command+V 4423 // ((key === 65 || key === 86) && (e.ctrlKey === true || e.metaKey === true)) || 4424 // Allow: home, end, left, right, down, up 4425 // (key >= 35 && key <= 40)) { 4426 // let it happen, don't do anything 4427 //return; 4428 //} 4429 //else 4430 if (validateMobileNumber(input)) { 4431 return; 4432 } 4433 else { 4434 e.preventDefault(); 4435 $(this).val(input.replace(/[^0-9()+\- ]+/g, '')); // Remove invalid characters 4436 } 4437 4438}); 4439 4440$('body').on('paste', '.numValidation', function (e) { 4441 var pastedData = e.originalEvent.clipboardData.getData('text'); 4442 if (pastedData && pastedData != "") 4443 { 4444 var isValid = validateMobileNumber(pastedData); 4445 if (!isValid) 4446 { 4447 e.preventDefault(); 4448 } 4449 4450 } 4451}); 4452 4453var validateMobileNumber = function (number) { 4454 var validateNumber = /^([0-9]|[(]|[)]|[-]|[+]|[ ])+$/; 4455 if (validateNumber.test(number)) { 4456 return true; 4457 } 4458 else { 4459 return false; 4460 } 4461} 4462 4463 4464$("body").on("click", ".clsExistsMembership", function () { 4465 var membershipTypeId = $(this).attr("data-val"); 4466 var url = $(this).attr("data-href"); 4467 $("#divProgress").show(); 4468 $.get("/Search/MembershipExistsForCustomer?membershipTypeId=" + membershipTypeId, function (data) { 4469 $("#divProgress").hide(); 4470 if (data !== undefined && data !== "") { 4471 alert(data); 4472 } 4473 else { 4474 window.location.href = url; 4475 } 4476 }); 4477}); 4478 4479function addtoCartMembership(mebershipTyprId, isPurchaseGroupWithProduct, priceId, childMembershipIds, itemId) { 4480 var groupPaymentCycleId = $("#groupPaymentCycleId").val(); 4481 var autoRecurringType = Number($("#autoRecurringType").val() || 0); 4482 if (mebershipTyprId) { 4483 $("#divProgress").show(); 4484 $.ajax({
4485 type: "POST", 4486 url: "/Search/AddToCartMemberType", 4487 dataType: "json", 4488 data: { 4489 "membershipTypeId": mebershipTyprId, 4490 "groupPaymentCycleId": groupPaymentCycleId, 4491 "autoRecurringType": autoRecurringType, 4492 "childMemberships": childMembershipIds, 4493 "itemId": itemId 4494 }, 4495 success: function (data) { 4496 $("#divProgress").hide(); 4497 var message = data.message; 4498 if (data.isSuccess != undefined && data.isSuccess == false && data.message) { 4499 alert(data.message); 4500 } 4501 if (isPurchaseGroupWithProduct && isPurchaseGroupWithProduct == true) { 4502 memberShipSuccessMessage(data); 4503 if (typeof (addToCartProductAfterMembership) == "function") { 4504 addToCartProductAfterMembership(priceId); 4505 } 4506 } 4507 else { 4508 if (data.isSendCustomerToCart != undefined && data.isSendCustomerToCart == true && !data.message) { 4509 window.location.href = '/ShoppingCart'; 4510 return false; 4511 } 4512 // retrieve message 4513 memberShipSuccessMessage(data); 4514 } 4515 4516 4517 }, 4518 error: function (data) { 4519 $("#divProgress").hide(); 4520 alert("Error! please try later."); 4521 } 4522 }); 4523 } 4524} 4525 4526function memberShipSuccessMessage(data) { 4527 if (data && data.message != "") { 4528 $("#spnMemberTypeConfirmationMessage").html(data.message); 4529 $("#divMemberTypeConfirmationMessage").show(); 4530 setTimeout(function () { 4531 $("#divMemberTypeConfirmationMessage").hide(); 4532 }, 10000); 4533 } 4534 parent.$("#cartspancount").html(data.CartCount); 4535 parent.$("#cartItemList").load('/ShoppingCart/GetCart'); 4536} 4537 4538//#10402 - Save BrowserInfo - Start 4539function SaveBrowserInfo() { 4540 if ($("#hfBrowserInfo").length > 0) { 4541 browserReport(function (err, report) { 4542 if (err) { 4543 throw err; 4544 } 4545 $("#hfBrowserInfo").val(JSON.stringify(report)); 4546 }); 4547 } 4548} 4549 4550$("body").on("click", ".webinar-launch-button, .clsFreeViewerLaunch, .CE21_MyAccount_tabPendingSeminars_LaunchScrombtn", function () { 4551 SubmitBrowerInfoForWebinar($(this).attr("data-ProgramRegistrantId")); 4552}) 4553 4554function SubmitBrowerInfoForWebinar(programRegistrantId) { 4555 if ($("#hfBrowserInfo").length > 0) { 4556 if (!$("#hfBrowserInfo").val()) { 4557 browserReport(function (err, report) { 4558 if (err) { 4559 throw err; 4560 } 4561 $("#hfBrowserInfo").val(JSON.stringify(report)); 4562 }); 4563 } 4564 4565 if (isImpersonateSession()) return; 4566 4567 $.get("/ShowtimeWidget/GetCurrurntDateTimeWithTimeZone", function (data) { 4568 if (data !== undefined && $("#hfBrowserInfo").val()) { 4569 report = JSON.parse($("#hfBrowserInfo").val()); 4570 report.submittedVia = "Webinar Launch Button"; 4571 report.SubmmitedDate = data; 4572 4573 $.ajax({
4574 type: 'POST', 4575 url: '/ShowtimeWidget/SubmitBrowser', 4576 dataType: 'json', 4577 data: { 4578 'programRegistrantId': programRegistrantId, 'settings': JSON.stringify(report) 4579 }, 4580 success: function () { 4581 }, 4582 error: function (jqXHR, textStatus, errorThrown) { 4583 } 4584 }); 4585 } 4586 }); 4587 } 4588} 4589//#10402 - Save BrowserInfo - End 4590 4591function getProductsInfo() { 4592 var pIds = $(".hdnGlobalPid").map(function () { 4593 return $(this).val(); 4594 }).get().join(","); 4595 4596 $.ajax({ 4597 type: "POST", 4598 url: GET_PRODUCTS_INFO, 4599 dataType: "json", 4600 data: { 4601 'pIds': pIds, 4602 }, 4603 success: function (data) { 4604 if (data) { 4605 $.each(data, function (i, data) { 4606 if (Number(data.ProductId) > 0) { 4607 if (data.WidgetMessage) { //set widget messages for shippable item 4608 $(".clsWidgetMessage[data-Pid=" + data.ProductId + "]").html(data.WidgetMessage); 4609 } 4610 if (data.CatalogMessage) { //set catalog messages for shippable item 4611 $(".clsCatalogMessage[data-Pid=" + data.ProductId + "]").html(data.CatalogMessage); 4612 } 4613 } 4614 }); 4615 } 4616 }, 4617 error: function (data) { 4618 } 4619 }); 4620} 4621 4622function CheckADARequirement() { 4623 if ($('.clsAdditionalRegistrantFeilds').length > 0) { 4624 if ($("#DivADARequirement").length > 0) { 4625 $('input[field="ADARequirement"]:visible').each((i, e) => { 4626 if ($("#list_" + i + "__ADARequirementNote").val() != "" && $("#list_" + i + "__ADARequirementNote").val() != undefined) { 4627 $(e).prop("checked", true); 4628 $("#list_" + i + "__ADARequirementNote").attr("data-Note", $("#list_" + i + "__ADARequirementNote").val()); 4629 } 4630 else { 4631 removeADARequirementValidation($("#list_" + i + "__ADARequirementNote")); 4632 } 4633 }); 4634 } 4635 } 4636 else { 4637 if ($("#DivADARequirement").length > 0) { 4638 if ($("#ADARequirementNote").val() != "" && $("#ADARequirementNote").val() != undefined) { 4639 $("#ADARequirement").prop("checked", true); 4640 $("#ADARequirementNote").attr("data-Note", $("#ADARequirementNote").val()); 4641 } 4642 else { 4643 $("#ADARequirement").prop("checked", false); 4644 removeADARequirementValidation(); 4645 } 4646 } 4647 } 4648} 4649function AddADARequirementValidation() { 4650 if ($('.clsAdditionalRegistrantFeilds').length > 0) { 4651 if ($("#DivADARequirement").length > 0) { 4652 $('input[field="ADARequirement"]:visible').each((i, e) => { 4653 if ($(e).prop("checked") == true || $(e).is('[required]')) { 4654 $("#list_" + i + "__ADARequirementNote").attr("required", "required"); 4655 $("#list_" + i + "__ADARequirementNote").closest("div").find("span.field-validation-error").show().html(''); 4656 $("#list_" + i + "__ADARequirementNote").val($("#list_" + i + "__ADARequirementNote").val() || $("#list_" + i + "__ADARequirementNote").attr("data-Note")); 4657 } 4658 else { 4659 $("#list_" + i + "__ADARequirementNote").attr("data-Note", $("#list_" + i + "__ADARequirementNote").val()); 4660 $("#list_" + i + "__ADARequirementNote").val(""); 4661 removeADARequirementValidation($("#list_" + i + "__ADARequirementNote")); 4662 } 4663 }); 4664 } 4665 } 4666 else { 4667 if ($("#DivADARequirement").length > 0) { 4668 if ($("#ADARequirement").prop("checked") == true || $("#ADARequirement").is('[required]')) { 4669 $("#ADARequirementNote").attr("required", "required");
4670 $("#ADARequirementNote").closest("div").find("span.field-validation-error").show().html(''); 4671 $("#ADARequirementNote").val($("#ADARequirementNote").val() || $("#ADARequirementNote").attr("data-Note")); 4672 } 4673 else { 4674 $("#ADARequirementNote").attr("data-Note", $("#ADARequirementNote").val()); 4675 $("#ADARequirementNote").val(""); 4676 removeADARequirementValidation(); 4677 } 4678 } 4679 } 4680} 4681function removeADARequirementValidation($this) { 4682 if ($('.clsAdditionalRegistrantFeilds').length > 0) { 4683 $($this).removeAttr("required").removeClass("input-validation-error");; 4684 $($this).closest("div").find("span.field-validation-error").hide(); 4685 $($this).closest("div").parents('div').removeClass("has-error"); 4686 } 4687 else { 4688 $("#ADARequirementNote").removeAttr("required").removeClass("input-validation-error");; 4689 $("#ADARequirementNote").closest("div").find("span.field-validation-error").hide(); 4690 $("#ADARequirementNote").closest("div").parents('div').removeClass("has-error"); 4691 } 4692} 4693 4694//Start::> 0012639: iPhone Only > Browser > Attendance Question/Participation Code Cert Requirement - not compatible warning w/ Quick Launch 4695//method using for all pages on catalog: classroom-schedule, product-detail, all widgets, membership-group 4696$('body').on('click', 'a:not(.clsIphoneMsgBtn)[href*="/launchfreeviewer?"], .clsFreeViewerLaunch, .btnScheduletabsLaunchViewer', function () { 4697 if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 4698 var $this = $(this); 4699 var viewerURL = $this.attr('href'); 4700 var slashIndex = 0; 4701 var programRegistrantId = 0; 4702 var encryptedString = getParameterByNameForHref(viewerURL, 'x'); 4703 4704 var isShowTimeUrl = viewerURL.indexOf('showtime/') > 0; 4705 4706 if (!viewerURL || viewerURL.indexOf('javascript') > 0) 4707 return false; 4708 4709 if (isShowTimeUrl) { 4710 var classroomViewerRegId = $this.attr('data-programregistrantid'); 4711 slashIndex = viewerURL.lastIndexOf('/'); 4712 programRegistrantId = viewerURL.indexOf('?') > 0 ? classroomViewerRegId : viewerURL.substring(slashIndex + 1); //handle viewer open through classroom schedule tab 4713 } 4714 4715 4716 if ((encryptedString && encryptedString.trim() != "") || (isShowTimeUrl && Number(programRegistrantId) > 0)) { 4717 $.ajax({
4718 type: "POST", 4719 url: "/Items/IphoneNonCompatibleMessage", 4720 dataType: "json", 4721 data: { 4722 'encryptedStr': encryptedString.trim(), 'viewerUrl': viewerURL, 'programRegistrantId': programRegistrantId 4723 }, 4724 success: function (data) { 4725 $('#divProgress').hide(); 4726 4727 4728 if (data && data.ShowMessage == true) { 4729 var showMessage = function () { 4730 var ExistAttendanceRequirment = data.ExistAttendanceRequirment; 4731 parent.$('#divIphoneMessageGeneral').modal('show'); 4732 parent.$("#divIphoneMessageGeneral .modal-footer").find('a').attr('href', viewerURL); 4733 parent.$("#divIphoneMessageGeneral .modal-footer").find('a').addClass('csViewerOk'); 4734 4735 if (ExistAttendanceRequirment == true) { 4736 parent.$('.iphone-questionrequirement-message').show(); 4737 parent.$('.iphone-participationcode-message').hide(); 4738 } else { 4739 parent.$('.iphone-questionrequirement-message').hide(); 4740 parent.$('.iphone-participationcode-message').show(); 4741 } 4742 parent.$.magnificPopup.close(); 4743 4744 }; 4745 4746 if (parent.$('#divIphoneMessageGeneral').length > 0) { 4747 showMessage(); 4748 } 4749 else { 4750 //Firs time call get html 4751 $.get('/Items/IphoneInCompatiblePopup', function (iPohneHtml) { 4752 parent.$('body').append(iPohneHtml); 4753 showMessage(); 4754 }); 4755 } 4756 return false; 4757 } else { 4758 if (!isIOsSafari() && $this.attr('target') && ($this.attr('target') == '_blank' || $this.attr('target').indexOf('ce21') >= 0)) { 4759 window.open(viewerURL, '_blank'); 4760 } else if (isIOsSafari()) { 4761 window.open(viewerURL, '_self'); //#0017560 4762 } 4763 } 4764 }, 4765 error: function (data) { 4766 alert('Error! Please try again later.'); 4767 $('#divProgress').hide(); 4768 } 4769 }); 4770 } 4771 return false; 4772 } 4773 else { 4774 //#22343 4775 var href = ($(this).attr('href') || '').trim(); 4776 var btnUrl = (!href || href.toLowerCase().indexOf('javascript:') === 0) ? $(this).attr('data-href') : href; 4777 if (!$(this).hasClass('csIphone')) { 4778 if (btnUrl.indexOf('?ClassroomTab=') != -1) { 4779 var classroomTabVal = getURLParameter(btnUrl, "ClassroomTab"); 4780 if (classroomTabVal != null && classroomTabVal != undefined && classroomTabVal != '') { 4781 var newUrl = new URL(btnUrl); 4782 newUrl.searchParams.set("ClassroomTab", classroomTabVal + "_" + document.documentElement.scrollTop); // setting your param 4783 window.open(newUrl, 'ce21'); 4784 return false; 4785 } 4786 } 4787 } 4788 } 4789}); 4790 4791$("body").on('click', '.csViewerOk', function () { 4792 window.open($(this).attr("href"), isIOsSafari() ? '_self' : '_blank'); 4793}); 4794//End::> 0012639 4795 4796//Logic for Checking checkboxes and all Checkbox. 4797//Use the pattern for class for single checkbox => "chkSelect-'AnySignificantName'" and for all checkbox => "chkSelect-'AnySignificantName'-all" to make use of this logic. 4798$("body").on("click", "input[type='checkbox'][class*='chkSelect-']", function () { 4799 var classes = $(this).attr('class').split(' '); 4800 var selfClassname = '', type = 'single', singleClassName = '', allClassName = ''; 4801 if (classes.length > 0) {
4802 classes.forEach(function (a) { 4803 if (a.indexOf('chkSelect-') > -1) { 4804 selfClassname = a; 4805 return; 4806 } 4807 }); 4808 } 4809 if (selfClassname !== '') { 4810 if ((selfClassname.match(/-/g) || []).length === 2) { 4811 type = 'all'; 4812 allClassName = selfClassname; 4813 singleClassName = allClassName.replace("-All", ""); 4814 } 4815 else { 4816 singleClassName = selfClassname; 4817 allClassName = singleClassName + "-All"; 4818 } 4819 if (singleClassName !== '' && allClassName !== '') { 4820 if (type === "all") { 4821 $("." + singleClassName).prop("checked", $(this).is(":checked")); 4822 } 4823 else { 4824 if ($(this).is(":checked") && $("." + singleClassName).length === $("." + singleClassName + ":checked").length) { 4825 $("." + allClassName).prop("checked", true); 4826 } 4827 else { 4828 $("." + allClassName).prop("checked", false); 4829 } 4830 } 4831 } 4832 } 4833}); 4834 4835function deleteOldRegistrantTypeQuestionSetAnswers(orderItemId, isDeleteRegistrantSetAnswers, customerId) { 4836 $.getJSON("/Search/DeleteRegistrantTypeQuestionSetAnswers/", { 4837 orderItemId: orderItemId, 4838 isDeleteRegistrantSetAnswers: isDeleteRegistrantSetAnswers, 4839 customerId: customerId 4840 }) 4841 .fail(() => { 4842 console.error("Failed to delete registrant type question set answers."); 4843 }); 4844} 4845 4846var getComparelist = function () { 4847 $("#compareProductcartItemList").load(GET_COMPAREPRODUCTCART_URL, function () { 4848 var count = $('#compareProductcartItemList input[name="CompareCount"]').val(); 4849 $('#compareProductcartspancount').text(count); 4850 }); 4851}; 4852 4853//12850: Catalog - change placement of mail code functionality to make more visible / likely a customer will enter one 4854$("body").on("click", "#btnMarketingCodeSave", function () { 4855 var marketingCode = $("#MarketingCode").val(); 4856 if (!marketingCode) { 4857 $(".clsRequired").show(); 4858 return false; 4859 } 4860 $('#divProgress').show(); 4861 $.ajax({
4862 type: "POST", 4863 url: "/ShoppingCart/SaveMarketingCode", 4864 dataType: "json", 4865 data: { 4866 'marketingCode': marketingCode 4867 }, 4868 beforeSend: function () { 4869 onMarketingCodeBegin(); 4870 }, 4871 success: function (data) { 4872 onMarketingCodeSuccess(data); 4873 $('#divProgress').hide(); 4874 }, 4875 error: function (data) { 4876 onMarketingCodefailure(); 4877 $('#divProgress').hide(); 4878 } 4879 }); 4880 $('#divProgress').hide(); 4881}); 4882 4883 4884 4885//12842: Registration Types - Registration Question Sets start. 4886//chek any registrant type question set available with price adjustment 4887var IsRegistrantTypeQuestionSetAvailable = function (discountId, eventTimeId, productId, productTypeId, isCheckForRegistrants = false, isFromEditRegistrant = false, includeDiscountIdCheck = false, entityType) { 4888 var isEnable = false; 4889 $.ajax({ 4890 type: "GET", 4891 url: "/Items/IsRegistrantTypeQuestionSetAvailable/", 4892 data: { "discountId": discountId, "eventTimeId": eventTimeId, "productId": productId, "productTypeId": productTypeId, "isCheckForRegistrants": isCheckForRegistrants, "isFromEditRegistrant": isFromEditRegistrant, "includeDiscountIdCheck": includeDiscountIdCheck, "entityType": entityType }, 4893 dataType: "json", 4894 async: false, 4895 success: function (Data) { 4896 isEnable = Data; 4897 }, 4898 error: function () { 4899 isEnable = false; 4900 } 4901 }); 4902 return isEnable; 4903} 4904 4905 4906//open registrant type question set popup 4907var OpenRegistrantTypeQuestionSetPopup = function (productId, discountId, priceType, questionSetId = 0, programRegistrantId = 0, orderItemId = 0, isFetchAnswers = false, customerId = 0, isRegistrantConfirmationPage = false, customerEmail = '', _callback = '', orderId = 0, isShowCloseButton = true, IsRealtedProduct = false, isAgendaExists = false, isForBundle = false, isCompleteRegistration = false, btnType = "", isDisplayRequestInfo = false, isFromUnAssignedOrder = false) { 4908 var width = 800; 4909 var height = 700; 4910 if (customerEmail && customerEmail.trim()) { 4911 customerEmail = encodeURIComponent(customerEmail.trim()); 4912 } else { 4913 customerEmail = ""; 4914 } 4915 var url = "/Search/RegistrantTypeQuestionSet" + '?productId=' + productId + '&discountId=' + discountId + '&priceType=' + priceType 4916 + '&questionSetId=' + questionSetId + '&programRegistrantId=' + programRegistrantId + '&orderItemId=' + orderItemId 4917 + '&isFetchAnswer=' + isFetchAnswers + '&customerId=' + customerId + '&isRegistrantConfirmationPage=' + isRegistrantConfirmationPage + '&customerEmail=' + customerEmail 4918 + '&orderId=' + orderId + '&IsRealtedProduct=' + IsRealtedProduct + '&isAgendaExists=' + isAgendaExists + '&isForBundle=' + isForBundle + '&isCompleteRegistration=' + isCompleteRegistration + '&btnType=' + btnType + '&isDisplayRequestInfo=' + isDisplayRequestInfo + '&isFromUnAssignedOrder=' + isFromUnAssignedOrder; 4919 4920 parent.$('.mfp-iframe-holder .mfp-iframe-scaler').css('padding-top', '80%'); 4921 parent.$('.mfp-iframe-holder .mfp-content').css('max-width', '900px'); 4922 parent.parent.$('.mfp-iframe-holder .mfp-iframe-scaler').css('padding-top', '80%'); 4923 parent.parent.$('.mfp-iframe-holder .mfp-content').css('max-width', '920px'); 4924 4925 $.magnificPopup.open({ 4926 items: { 4927 src: url 4928 }, 4929 type: 'iframe', 4930 showCloseBtn: isShowCloseButton, 4931 closeOnBgClick: false, 4932 mainClass: 'CustomPop registrantType-popup', 4933 callbacks: { 4934 close: function () {
4935 if (_callback && typeof _callback == 'function') { 4936 _callback(); 4937 } 4938 //if (typeof(clearSessionStorageKeyForGroup) == 'function') { 4939 // clearSessionStorageKeyForGroup(); 4940 //} 4941 } 4942 } 4943 }); 4944 $('.mfp-content').css('height', height); 4945 $('.mfp-content').css('width', width); 4946 $('.mfp-iframe-holder .mfp-content').css('max-height', height + 'px'); 4947 $('.mfp-iframe-holder .mfp-content').css('max-width', width + 'px'); 4948 return false; 4949} 4950 4951//close registrant type question set pop up 4952var addToCartProductAfterRegistrantTypeQuestionSet = function (isRealtedProduct, ProductId, orderItemId, groupProductPricecId, isUserInfoRequest = false, isClosePopUp = 'false', registrantQuestionSubmissionType = 0, customerEmail = '', isAgendaExists = 'false', isAgendaRequestInfo = false, isForBundle = false, chkPurchaserForRegistrant = 'false') { 4953 var isRegistrantRequestInfo = registrantQuestionSubmissionType == 2 ? true : false; 4954 if (isClosePopUp.toLowerCase() == 'true' && isForBundle) { 4955 if (isAgendaExists.toLocaleLowerCase() == 'true' && typeof OpenProductAgendaPopup == "function") { 4956 OpenProductAgendaPopup(ProductId, orderItemId, null, null, groupProductPricecId, false, true, 0, false, chkPurchaserForRegistrant, isRegistrantRequestInfo); 4957 return false; 4958 } 4959 else if (registrantQuestionSubmissionType >= 0) { 4960 if (isValidateRegistrantQuestionsForBundle) { 4961 window.location.href = '/shoppingcart'; 4962 } 4963 if (typeof DisplayRegistrantPopUpForBundle == "function") { 4964 DisplayRegistrantPopUpForBundle(); 4965 } 4966 return false; 4967 } 4968 } 4969 else { 4970 if (isClosePopUp.toLowerCase() == 'true' && customerEmail) { 4971 if (registrantQuestionSubmissionType == 2 || isAgendaRequestInfo) { 4972 SaveRequestInfoByCustomerOrderItemId(orderItemId, customerEmail, isAgendaRequestInfo); 4973 } 4974 4975 if (isAgendaExists.toLocaleLowerCase() == 'true' && typeof OpenProductAgendaPopup == "function") { 4976 OpenProductAgendaPopup(ProductId, orderItemId, null, null, groupProductPricecId, true, customerEmail, 0, false, chkPurchaserForRegistrant, isRegistrantRequestInfo) 4977 return false; 4978 } 4979 else if (registrantQuestionSubmissionType >= 0) { 4980 if (isValidateRegistrantQuestions) { 4981 $('#btnContinue').trigger("click"); 4982 } 4983 else if (typeof DisplayRegistrantPopUp == "function") { 4984 DisplayRegistrantPopUp(); 4985 } 4986 return false; 4987 } 4988 } 4989 if (isClosePopUp && isClosePopUp.toLowerCase() == 'true') { return false; } 4990 4991 //#21279 4992 if (isUserInfoRequest.toLowerCase() === 'true') { 4993 location.reload(); 4994 return false; 4995 } 4996 4997 //search,widget pages 4998 if (cls_saveSingleProduct && cls_saveSingleProduct.length > 0) { 4999 $(cls_saveSingleProduct).attr('data-isRegistrantRequestInfo', isRegistrantRequestInfo); 5000 $(cls_saveSingleProduct).attr('data-chkPurchaserForRegistrant', chkPurchaserForRegistrant); 5001 if ($(cls_saveSingleProduct).hasClass("btnAddtocartDiscountProductFromSearch")) { 5002 $(cls_saveSingleProduct).trigger("click", [1, orderItemId]); 5003 //addToCartFromDiscount(cls_saveSingleProduct, orderItemId); 5004 } else { 5005 saveSingleProduct(false, cls_saveSingleProduct, orderItemId, null, null); 5006 } 5007 5008 } 5009 else if (isRealtedProduct == "true") { 5010 saveAddToCartProductsForAcknowledge(orderItemId, groupProductPricecId, ProductId); 5011 5012 } 5013 else if (chkPurchaserForRegistrant.toLocaleLowerCase() === 'true' || registrantQuestionSubmissionType == 2) { 5014 let params = { 5015 registrantTypeOrderItemId: orderItemId, 5016 groupProductPricecId: groupProductPricecId, 5017 chkPurchaserForRegistrant: chkPurchaserForRegistrant, 5018 isRegistrantRequestInfo: isRegistrantRequestInfo, 5019 isFromPaymentPlan: (typeof isPaymentPlanMode !== "undefined") ? isPaymentPlanMode : false 5020 }; 5021 //product detail page 5022 saveAddToCartProducts(params); 5023 5024 } else { 5025 let params = { 5026 registrantTypeOrderItemId: orderItemId, 5027 groupProductPricecId: groupProductPricecId, 5028 chkPurchaserForRegistrant: chkPurchaserForRegistrant, 5029 isRegistrantRequestInfo: isRegistrantRequestInfo, 5030 isFromPaymentPlan: (typeof isPaymentPlanMode !== "undefined") ? isPaymentPlanMode : false 5031 }; 5032 saveAddToCartProducts(params); 5033 } 5034 } 5035} 5036 5037//12842: Registration Types - Registration Question Sets end. 5038 5039//#12874: Sales - Discounts - Free shipping limitation - only within <selectedRegion> 5040function ApplyFreeShipping(freeshipping, data) { 5041 if (freeshipping) { 5042 $("#divShippingMethods").hide(); 5043 $('.clsshippingOption').prop('checked', false); 5044 } 5045 else if (data && data.partialShipping) { 5046 $("#divShippingMethods").show(); 5047 updateShippingOptionsByDiscount(); 5048 } 5049 else { 5050 $("#divShippingMethods").show(); 5051 } 5052} 5053 5054function updateShippingOptionsByDiscount() { 5055 $("#divShippingMethods").load(GET_SHIPPING_METHOD_URL).prepend("<p class='loaderTxt'>Please wait ...</p>"); 5056} 5057 5058//#13296: Catalog > Products > Edit Product - 'No Certificate' option for programs 5059function LoadCertificateButton() { 5060 if ($(".btnCert[data-certid=-1]").length > 0) { 5061 var productIds = $(".btnCert[data-certid=-1]").map(function () { return $(this).attr('data-pid'); }).get().join(','); 5062 if (productIds) { 5063 $.ajax({
5064 type: "GET", 5065 url: "/Certificate/GetProductWithoutCertRequirement", 5066 data: { "productIds": productIds }, 5067 dataType: "json", 5068 async: false, 5069 success: function (data) { 5070 if (data.length > 0) { 5071 $.each(data, function (i, data) { 5072 parent.$(".btnCert_" + data).hide(); 5073 parent.$(".tdCert_" + data).html('<span>N/A</span>'); 5074 }); 5075 } 5076 }, 5077 }); 5078 } 5079 } 5080 initAfterMyAccountProduct(); 5081} 5082 5083function initAfterMyAccountProduct() { 5084 var launchChatProducts = ""; 5085 if ($(".btnLaunchChat").length > 0) { 5086 launchChatProducts = $(".btnLaunchChat").map(function () { return $(this).attr('data-pid'); }).get().join(','); 5087 } 5088 if (launchChatProducts) { 5089 $.ajax({ 5090 type: "GET", 5091 url: "/Account/InitMyAccountProducts", 5092 data: { "launchChatProductIds": launchChatProducts }, 5093 dataType: "json", 5094 async: false, 5095 success: function (data) { 5096 if (data && data.directChatId) { 5097 $.each(data.directChatId.split(","), function (i, data) { 5098 $(".btnLaunchChat[data-pid=" + data + "]").removeClass("hidden"); 5099 }); 5100 } 5101 }, 5102 }); 5103 } 5104} 5105//END 5106 5107function openAddToCartPopupModal(url) { 5108 $.magnificPopup.open({ 5109 items: { 5110 src: url 5111 }, 5112 type: 'iframe', 5113 closeOnBgClick: false, 5114 mainClass: 'popAddtoCartMainClass', 5115 callbacks: { 5116 close: function () { 5117 $(".divProgress").hide(); 5118 isValidateRegistrantQuestions = false; 5119 listProductsForBundle = []; 5120 arrRandomOrderItemId = []; 5121 relatedProductPopup = false; 5122 } 5123 } 5124 }); 5125 return false; 5126} 5127 5128function openAddToCartFeePlanPopupModal(url) { 5129 $.magnificPopup.open({ 5130 items: { 5131 src: url 5132 }, 5133 type: 'iframe', 5134 closeOnBgClick: false, 5135 mainClass: 'popAddToCartFeePlan' 5136 }); 5137 return false; 5138} 5139 5140 5141//13398: Quick Launch is selecting the wrong date again : Start 5142//launch free catalog courses 5143$("body").on("change", ".videoReplyEventDate", function () { 5144 setFreeViewerUrl($(this).attr('data-productid'), $(this).val()); 5145 if ($(".memberHoursBtn").length > 0) { 5146 setFreeViewerUrl($(this).attr('data-productid'), $(this).val(), "True"); 5147 } 5148}); 5149 5150function setFreeViewerUrl(productId, eventTimeId, isMemberHours) { 5151 var $this = getProductButton(productId, isMemberHours);; 5152 var url = $this.attr("href") 5153 var btnTitle = $this.attr("data-btnTitle"); 5154 var discountId = $this.attr("data-productpriceid"); 5155 var marketingEntityId = $this.attr("data-marketingEntityId"); 5156 var marketingEntityType = $this.attr("data-marketingEntityType"); 5157 var x = $.trim(productId) + "|" + $.trim(eventTimeId); 5158 var cartId = $this.attr("data-cartId") || ''; 5159 //var launchPurchased = $(".clsLaunchPurchasedSeminar") 5160 5161 //var memberShipDiscountId = 0; 5162 //var marketingEntityType = 'General'; 5163 //if ($("#hdnMemberShipDiscountId").length > 0) { 5164 // memberShipDiscountId = $("#hdnMemberShipDiscountId").val(); 5165 // marketingEntityType = 'MemberShipGroup'; 5166 //} 5167 5168 $this.attr("data-eventtimeid", eventTimeId); 5169 5170 $.ajax({
5171 url: "/Viewer/GetEncryptedValue?x=" + $.trim(x), 5172 type: "GET", 5173 async: false, // Makes the request synchronous 5174 success: function (data) { 5175 // } 5176 //}); 5177 //$.get("/Viewer/GetEncryptedValue?x=" + $.trim(x), function (data) { 5178 5179 if (btnTitle && btnTitle.toLowerCase() == "launch") { 5180 const queryString = url.split('?')[1]; 5181 5182 // Create URLSearchParams object 5183 const params = new URLSearchParams(queryString); 5184 const registrantTypeOrderItemId = params.get("registrantTypeOrderItemId"); 5185 var paramLaunchFreeViewer = { 5186 x: data, 5187 discountId: discountId, 5188 marketingEntityId: marketingEntityId, 5189 marketingEntityType: marketingEntityType, 5190 cartId: cartId 5191 }; 5192 5193 // Add only if present 5194 if (registrantTypeOrderItemId) { 5195 paramLaunchFreeViewer.registrantTypeOrderItemId = registrantTypeOrderItemId; 5196 } 5197 5198 var launchFreeViewerUrl = LAUNCH_FREE_VIEWER_URL + "?" + $.param(paramLaunchFreeViewer); 5199 $this.attr("href", launchFreeViewerUrl); 5200 5201 //if (launchPurchased) { 5202 // $(launchPurchased).attr("href", launchFreeViewerUrl + "&isLaunchPurchased=true"); 5203 //} 5204 url = launchFreeViewerUrl; 5205 5206 } 5207 else { 5208 var paramCompleteFreeOrder = { 5209 x: data, 5210 discountId: discountId 5211 }; 5212 5213 var returnUrl = COMPLETE_FREE_ORDER_URL + "?" + $.param(paramCompleteFreeOrder); 5214 var classRoomLogInUrl = CLASSROOM_LOGIN_URL + "?isFromFreeProduct=" + true + "&returnUrl=" + encodeURIComponent(returnUrl); 5215 $this.attr("data-returnUrl", returnUrl); 5216 $this.attr("data-href", classRoomLogInUrl); 5217 //if (launchPurchased) { 5218 // $(launchPurchased).attr("href", classRoomLogInUrl + "&isLaunchPurchased=true"); 5219 //} 5220 url = returnUrl; 5221 } 5222 } 5223 }); 5224 return url; 5225} 5226//13398: Quick Launch is selecting the wrong date again : End 5227 5228$("body").on("click", ".ce21FreeCourse", async function (e, displayDownPaymentAlert) { 5229 e.preventDefault(); 5230 const $this = $(this); 5231 const productId = $this.data("productid") || 0; 5232 const productTypeId = $this.data("producttypeid") || 0; 5233 const purchaseAlertId = $this.data("purchasealertid") || 0; 5234 const productAvailabilityRuleId = $this.data("productavailibityruleid") || 0; 5235 const programRegistrantId = $this.data("programregistrantid") || 0; 5236 const btnType = $this.data("btntype") || ""; 5237 const entityType = $this.data("entitytype") || ""; 5238 let $modal = $("#zeroDollarOrderPurchased" + productId); 5239 var message = ($modal.find(".modal-body p").text() || "").trim(); 5240 5241 const processFlow = function () { 5242 5243 // Case 1: Run directly if flag is passed or alrday purchased 5244 if (displayDownPaymentAlert === true || programRegistrantId > 0) { 5245 runProcess($this); 5246 return false; 5247 } 5248 5249 // Helper: show confirmation modal 5250 const showConfirmation = (bindConfirmClick) => { 5251 if ($modal?.length && message) { 5252 $modal.modal("show"); 5253 if (bindConfirmClick === true) { 5254 $modal.off("click", ".confirm-btn").on("click", ".confirm-btn", function () { 5255 $modal.modal("hide"); 5256 runProcess($this); 5257 }); 5258 } 5259 } else { 5260 runProcess($this); // fallback if modal not found 5261 } 5262 }; 5263 5264 // Case 2: purchased message not in DOM â fetch it 5265 if ((!$modal?.length) && btnType?.includes("zeroDollarOrderPurchased")) { 5266 $.get( 5267 `${GET_PURCHASEALERTMESSSAGE}?purchaseAlertId=${purchaseAlertId}&btyType=${btnType}&productAvailibityRuleId=${productAvailabilityRuleId}&productTypeId=${productTypeId}&productId=${productId}`, 5268 function (data) { 5269 if (data?.includes("divGeneralPurchaseAlert")) { 5270 $modal = $(data);
5271 message = ($modal.find(".modal-body p").text() || "").trim(); 5272 message ? showMemberHourPurchasePopup($this, showConfirmation) : runProcess($this); 5273 } else { 5274 showMemberHourPurchasePopup($this, showConfirmation); 5275 } 5276 } 5277 ); 5278 } 5279 // Case 3: purchased message already exists 5280 else { 5281 message && entityType != '9' ? showConfirmation(true) : entityType == '9' && $this.hasClass("memberHoursBtn") ? showMemberHourPurchasePopup($this, showConfirmation) : runProcess($this); //EntityType = 9 for Member Hours 5282 } 5283 } 5284 5285 if ($this.hasClass("memberHoursBtn")) { 5286 var eventTimeId = $this.data("eventtimeid") || ""; 5287 $.get(`/items/MemberHoursProductAlreadyInCartOrNot?productId=${productId}&eventTimeId=${eventTimeId}`, 5288 function (isAlreadyInCart) { 5289 if (isAlreadyInCart === true) { 5290 alert("This product is already in the cart through Member Hours. You cannot purchase it again using Member Hours."); 5291 return; 5292 } 5293 processFlow(); 5294 } 5295 ); 5296 } 5297 else { 5298 processFlow(); 5299 } 5300 5301 return false; 5302}); 5303 5304function runProcess($this) { 5305 var URL = $this.attr("href"); 5306 var productId = $this.attr("data-ProductId"), 5307 eventTimeId = $this.attr("data-eventtimeid"), 5308 productTypeId = $this.attr("data-productTypeId"), 5309 discountId = $this.attr("data-productpriceid"), 5310 priceType = $this.attr("data-pricetype"), 5311 entityType = $this.attr("data-entityType"), 5312 programRegistrantId = $this.attr("data-ProgramRegistrantId"), 5313 pageType = $this.closest(".ProductDetailPortion").length > 0 ? "productdetail" : "SearchProduct", 5314 orderitemid = $this.attr("data-orderItemId") || 0; 5315 // if the user is not login 5316 if ($this.hasClass('popUpFreeCourseRegister') && customerId == -1) { 5317 var actionUrl = $this.attr("data-href"); 5318 var alternateUrl = $this.attr("data-returnUrl"); 5319 var page = $this.closest(".ProductDetailPortion").length > 0 ? "productdetail" : "SearchProduct"; 5320 handleFreeCourseRegistration(productId, actionUrl, alternateUrl, $this, page); 5321 } 5322 // Disable clicked button temporarily 5323 $this.attr("disabled", "disabled"); 5324 setTimeout(function () { 5325 $(".ce21FreeCourse").removeAttr("disabled"); 5326 }, 3000); 5327 5328 if (!URL) return; 5329 if (URL.toLowerCase() === "javascript:void(0);" || URL.toLowerCase() === "javascript:void(0)") { 5330 return; 5331 } 5332 5333 // If already purchased 5334 if (Number(programRegistrantId) > 0 && productTypeId != "3") { //3:Member hours 5335 URL += "&isProductPurchased=" + true; 5336 launchPurchasedProduct($this, URL); 5337 return; // stop further execution 5338 } 5339 5340 // Otherwise, check from server 5341 if (productId) { 5342 $.get("/Items/CheckMaxRegistrantForFreeProducts?productId=" + productId + "&eventTimeId=" + eventTimeId) 5343 .done(function (data) { 5344 if (data && data.Message) { 5345 displayCartMessages($this, data, pageType); 5346 } 5347 else if (data && data.IsAlreadyPurchased) { 5348 launchPurchasedProduct($this, URL); 5349 } 5350 else { 5351 if (discountId && Number(discountId) > 0 || $this.hasClass("memberHoursBtn")) { //#6648104808 5352 var isQuestionExist = IsRegistrantTypeQuestionSetAvailable(discountId, eventTimeId, productId, productTypeId, false, false, true, entityType); 5353 if (isQuestionExist) { 5354 OpenRegistrantTypeQuestionSetPopup(productId, discountId, priceType, 0, 0, orderitemid, $this.hasClass("memberHoursBtn") ? true : false, $this.hasClass("memberHoursBtn") ? customerId : 0, false, null, null, 0, true, false, false, false, false, "ce21FreeCourse",false,false); 5355 return false; 5356 } 5357 } 5358 5359 var isAgendaExists = (productTypeId && Number(productTypeId) === 1) ? IsAgendaForProductAvailable(discountId, productId, entityType) : false; 5360 if (isAgendaExists) { 5361 if (Number(orderitemid) > 0) { 5362 OpenProductAgendaPopup(productId, orderitemid, 0, entityType, 0, false, false, 0, false); 5363 } else { 5364 openAgendaFormFromDiscount(productId, "ce21FreeCourse", 0, discountId, entityType, 0, false); 5365 5366 } 5367 return false; 5368 } 5369 5370 if (Number(orderitemid) <= 0) { 5371 var certReqs = getCertificateRequirements(productId, 6); // 6 = Purchase CE Credit 5372 } 5373 5374 if (certReqs && certReqs.length > 0) { 5375 displayPurchaseCEMessage(productId, certReqs[0].CECreditPrice, { 5376 displayPageType: 4, 5377 customerBundleId: 0, 5378 isAcknowledge: false, 5379 promoCouponCodeType: $this.hasClass("memberHoursBtn") ? "MemberHours" : "" 5380 }); 5381 } else { 5382 URL = setFreeViewerUrl(productId, eventTimeId, $this.hasClass("memberHoursBtn")); 5383 launchPurchasedProduct($this, URL); 5384 } 5385 } 5386 }) 5387 .fail(function (err) { 5388 console.error("Error calling CheckMaxRegistrantForFreeProducts:", err); 5389 return false; 5390 }); 5391 } 5392} 5393 5394function launchFreeProductAfterRegistrantTypeQuestionSet(registrantTypeOrderItemId, productId, promoCouponCodeType) { 5395 var $this = getProductButton(productId, promoCouponCodeType == 'MemberHours'); 5396 var productTypeId = $this.attr("data-productTypeId"), 5397 discountId = $this.attr("data-productpriceid"), 5398 entityType = $this.attr("data-entityType"), 5399 eventTimeid = $this.attr("data-eventtimeid"); 5400 orderitemid = $this.attr("data-orderItemId") || 0; 5401 $this.attr("disabled", "disabled").attr("data-btnTitle", "launch"); 5402 5403 var url = setFreeViewerUrl(productId, eventTimeid, promoCouponCodeType == 'MemberHours'); 5404 setTimeout(function () { 5405 $this.removeAttr("disabled"); 5406 }, 5000); 5407 5408 if ($this && url) { 5409 url += '®istrantTypeOrderItemId=' + registrantTypeOrderItemId; 5410 $this.attr('href', url); 5411 5412 var isAgendaExists = (productTypeId != undefined && Number(productTypeId) == 1) ? IsAgendaForProductAvailable(discountId, productId, entityType) : false; 5413 if (isAgendaExists) { 5414 if (orderitemid > 0) { 5415 OpenProductAgendaPopup(productId, orderitemid, 0, entityType, 0, false, false, 0, false); 5416 } else { 5417 openAgendaFormFromDiscount(productId, "ce21FreeCourse", 0, discountId, entityType, registrantTypeOrderItemId, false); 5418 } 5419 return false; 5420 } 5421 5422 if (Number(orderitemid) <= 0) { 5423 var certReqs = getCertificateRequirements(productId, 6); // 6 = Purchase CE Credit 5424 } 5425 5426 if (certReqs && certReqs.length > 0) { 5427 displayPurchaseCEMessage(productId, certReqs[0].CECreditPrice, { 5428 displayPageType: 4, 5429 customerBundleId: 0, 5430 isAcknowledge: false, 5431 promoCouponCodeType: promoCouponCodeType 5432 }); 5433 } else { 5434 launchPurchasedProduct($this, url); 5435 } 5436 } 5437} 5438function launchFreeProductAfterAgenda(productId, agendaPrice, registrantTypeOrderItemId, promoCouponCodeType, isFromEditAgendaSelection) { 5439 var $this = getProductButton(productId, promoCouponCodeType == 'MemberHours'); 5440 var eventTimeid = $this.attr("data-eventtimeid"); 5441 5442 $this.attr("disabled", "disabled").attr("data-btnTitle", "launch"); 5443 5444 var url = setFreeViewerUrl(productId, eventTimeid, promoCouponCodeType == 'MemberHours'); 5445 var isCeCerditAlreadyAdded = $('#ceCreditOrderItem').val() > 0; 5446 setTimeout(function () { 5447 $this.removeAttr("disabled"); 5448 }, 5000); 5449 5450 if ($this && url && Number(agendaPrice) <= 0 && !isCeCerditAlreadyAdded) { 5451 url += '®istrantTypeOrderItemId=' + registrantTypeOrderItemId; 5452 $this.attr('href', url); 5453 url = Number(agendaPrice) <= 0 ? url + "&isSamePageMH=false" : url; 5454 5455 var certReqs = getCertificateRequirements(productId, 6); // 6: Purchase CE Credit 5456 5457 if (certReqs && certReqs.length > 0 && isFromEditAgendaSelection !== true) { 5458 displayPurchaseCEMessage(productId, certReqs[0].CECreditPrice, { 5459 displayPageType: 4, 5460 customerBundleId: 0, 5461 isAcknowledge: false, 5462 promoCouponCodeType: promoCouponCodeType 5463 }); 5464 } else { 5465 launchPurchasedProduct($this, url); 5466 } 5467 } 5468 else if (isFromEditAgendaSelection === true && Number(agendaPrice) > 0 || isCeCerditAlreadyAdded) { 5469 window.location.reload(); 5470 } 5471 else { 5472 AddSingleProductToCart($this, registrantTypeOrderItemId, agendaPrice); 5473 } 5474} 5475 5476function hideShowAddToCartButton() { 5477 5478 //5167: Pricing checkbox - If customer unselect the main price, gray out the add on product checkboxes. 5479 if ($('.productBody input[name="price"]').length > 0) { 5480 if ($('.productBody input[name="price"][data-pricetype!="AdditionalPrice"]:checked').length > 0) { 5481 $(".clsRelatedAddOnProducts").removeClass('addongrayout').find('input[type="checkbox"]').prop('disabled', false); 5482 } 5483 else { 5484 $(".clsRelatedAddOnProducts").addClass('addongrayout').find('input[type="checkbox"]').prop('disabled', true).prop('checked', false); 5485 } 5486 } 5487 5488 var elem = $(".productBody input[name='price']:checked"); 5489 var checkedPrice = elem.val(); 5490 var price = checkedPrice ? parseFloat(checkedPrice.split(',')[1]) : 0; 5491 5492 var productpriceid = elem.attr('data-productpriceid'); 5493 var pricetype = elem.attr('data-pricetype'); 5494 var entitytype = elem.attr('data-entitytype'); 5495 5496 var launchBtn = $('.productBody .LaunchFreeViewerRoute:not(.memberHoursBtn)'); 5497 5498 if (launchBtn.length > 0) { 5499 if (price > 0) { 5500 launchBtn.hide(); 5501 if ($(".clsAdditionalprice").is(":checked")) { 5502 $(".clsAdditionalPriceCart").show(); 5503 $(".clsStandardPriceCart").hide(); 5504 } 5505 else { 5506 $(".clsAdditionalPriceCart").hide(); 5507 $(".clsStandardPriceCart").show(); 5508 } 5509 } 5510 else { 5511 if ($(".clsAdditionalprice").is(":checked")) { 5512 launchBtn.hide(); 5513 if ($(".ShowAcknowledgePopup").length > 0) { 5514 $(".ShowAcknowledgePopup").attr("data-val", $(".ShowAcknowledgePopup").attr("data-additionalpricediv")); 5515 $(".ShowAcknowledgePopup").show(); 5516 } 5517 else { 5518 $(".clsAdditionalPriceCart").show(); 5519 $(".clsStandardPriceCart").hide(); 5520 } 5521 } 5522 else { 5523 launchBtn.attr('data-productpriceid', productpriceid).attr('data-pricetype', pricetype).attr('data-entitytype', entitytype); 5524 setFreeViewerUrl(launchBtn.attr('data-productid'), launchBtn.attr('data-eventTimeId')); 5525 launchBtn.show(); 5526 $('.clsStandardPriceCart, .clsAdditionalPriceCart').hide(); 5527 } 5528 } 5529 } 5530 else if ($(".ShowAcknowledgePopup").length > 0) { 5531 if ($(".clsAdditionalprice").is(":checked")) { 5532 $(".ShowAcknowledgePopup").attr("data-val", $(".ShowAcknowledgePopup").attr("data-additionalpricediv")); 5533 if ($(".ShowPrerequisiteProducts").length > 0) { 5534 $(".ShowAcknowledgePopup").show(); 5535 $(".ShowPrerequisiteProducts").hide(); 5536 } 5537 } 5538 else if (price > 0) { 5539 $(".ShowAcknowledgePopup").attr("data-val", $(".ShowAcknowledgePopup").attr("data-nexttargetdiv")); 5540 if ($(".ShowPrerequisiteProducts").length > 0) { 5541 $(".ShowAcknowledgePopup").show(); 5542 $(".ShowPrerequisiteProducts").hide(); 5543 } 5544 } 5545 else { 5546 $(".ShowAcknowledgePopup").attr("data-val", $(".ShowAcknowledgePopup").attr("data-nexttargetdiv")); 5547 if ($(".ShowPrerequisiteProducts").length > 0) { 5548 $(".ShowPrerequisiteProducts").show(); 5549 $(".ShowAcknowledgePopup").hide(); 5550 } 5551 } 5552 } 5553 else { 5554 if ($(".clsAdditionalprice").is(":checked")) { 5555 $(".clsAdditionalPriceCart").show(); 5556 $(".clsStandardPriceCart").hide(); 5557 } 5558 else { 5559 $(".clsAdditionalPriceCart").hide(); 5560 $(".clsStandardPriceCart").show(); 5561 } 5562 } 5563} 5564$("body").on("click", ".btnLunchModelYmLogin", function () { 5565 top.window.location = $(this).attr("data-href"); 5566 return; 5567}); 5568 5569$("body").on("change", ".billingCycleType", function () { 5570 $("#groupPaymentCycleId").val($(this).attr("data-GroupCycleId")); 5571 $("#renewAmount").html($(this).attr("data-price")); 5572 $("#renewDays").html($(this).attr("data-days")); 5573 $("#renewalDate").html($(this).attr("data-renewalDate")); 5574}); 5575 5576$("body").on("change", ".customerRecurringType", function () { 5577 $("#autoRecurringType").val($(this).val()); 5578}); 5579 5580$("body").on("click", ".freeMembershipRegistration", function () { 5581 var membershipTypeId = $(this).attr("data-val"); 5582 processQuickPurchaseMembership(membershipTypeId) 5583 return false; 5584}); 5585 5586function processQuickPurchaseMembership(membershipTypeId, orderItemId, childMembershipIds) { 5587 quickPurchaseMembership(membershipTypeId, orderItemId, childMembershipIds, function () { 5588 $("#divProgress").show(); 5589 window.location.href = "/account/myaccount#tabMemberShip"; 5590 });
5591} 5592 5593function quickPurchaseMembership(membershipTypeId, orderItemId, childMembershipIds, callback) { 5594 5595 if (membershipTypeId > 0) { 5596 $("#divProgress").show(); 5597 $.ajax({ 5598 type: "POST", 5599 url: "/Search/FreeMembershipRegistration", 5600 dataType: "json", 5601 data: { 5602 "membershipTypeId": membershipTypeId, 5603 "orderItemId": orderItemId, 5604 "childMembershipIds": childMembershipIds || '' 5605 }, 5606 success: function (data) { 5607 5608 $("#divProgress").hide(); 5609 if (!data.Message && !data.PopUp) { 5610 $("#divProgress").show(); 5611 if (window.location.pathname.toLowerCase() == '/account/myaccount' && data.RedirectURL.toLowerCase().includes('/account/myaccount')) { 5612 LoadMemberhipTab(); //if redirect URL is my account page and already in my account page load only membership tab 5613 } 5614 else { 5615 window.location = data.RedirectURL; 5616 } 5617 } 5618 else if (!data.Message && data.PopUp) { 5619 5620 $.magnificPopup.open({ 5621 items: { 5622 src: data.RedirectURL 5623 }, 5624 type: 'iframe', 5625 callbacks: { 5626 afterClose: callback 5627 }, 5628 closeOnBgClick: false, 5629 }); 5630 5631 } 5632 else { 5633 alert(data.Message); 5634 } 5635 5636 }, 5637 error: function (data) { 5638 $("#divProgress").hide(); 5639 alert("Error! please try later."); 5640 } 5641 }); 5642 } 5643} 5644 5645//Show Progressing 5646$('#memberShipQuestionAnswerForm').submit(function () { 5647 5648 $(':disabled').prop('disabled', false); 5649 if (checkCommonFormValidation($("#memberShipQuestionAnswerForm"))) { 5650 $('button[type="submit"],input[type="submit"],#btnQuestionSetContinue').html('<i class="fa fa-refresh fa-spin"></i> Processing...').prop('disabled', true); 5651 5652 if ($(this).attr('pagetype') === "Default") { 5653 $('#divProgress').show(); 5654 saveMembershipQuestion(); 5655 return false; 5656 } 5657 } 5658 else { 5659 return false; 5660 } 5661}); 5662 5663$('#frmEditCustomer').submit(function () { 5664 5665 var isValid = true; 5666 //Monday: 6480813440 5667 var ActiveCBM = false; 5668 var CBMOwner = false; 5669 if ($("#hasActiveCBM").val() == "True") { 5670 ActiveCBM = true; 5671 } 5672 if ($('#IsCBMOwner').val() == "True") { 5673 CBMOwner = true; 5674 } 5675 var IsCompanyChanged = $("#hdnIsCompanyChanged").val(); 5676 if (ActiveCBM && $('#CompanyName').length > 0 && IsCompanyChanged == 'False') { 5677 var OldCompanyName = $("#hdnCompanyName").val(); 5678 var CompanyName = $("#CompanyName").val(); 5679 5680 const details = { 5681 hasActiveCBM: ActiveCBM, 5682 IsCBMOwner: CBMOwner, 5683 EncryptedCompanyId: $("#EncryptedCompanyId").val(), 5684 CustomerId: $("#CustomerId").val(), 5685 CustomerMembershipId: parseInt($("#CustomerMembershipId").val()), 5686 OldCompanyName: OldCompanyName, 5687 CompanyName: CompanyName, 5688 pageName: 'EditCustomer', 5689 formid: '', 5690 buttonid: '' 5691 }; 5692 5693 if (OldCompanyName != undefined && OldCompanyName != '' && OldCompanyName != CompanyName) { 5694 isValid = false; 5695 $("#hdnIsCompanyChanged").val('True'); 5696 ChangeCompanyConfirmation(details); 5697 } 5698 } 5699 5700 return isValid; 5701}); 5702 5703$('#SignUp-form').submit(function () { 5704 5705 var isValid = true; 5706 //check document required validation 5707 isValid = checkDocumentsValidation(isValid); 5708 5709 return isValid; 5710}); 5711 5712function saveMembershipQuestion() { 5713 var formData = $('#memberShipQuestionAnswerForm').serialize(); 5714 $.post('/Search/SaveMemberTypeQuestions', formData, function (data) { 5715 if (data.membershipTypeId && data.orderItemId) { 5716 processQuickPurchaseMembership(data.membershipTypeId, data.orderItemId); 5717 } else { 5718 if (data && data.PriceId) { 5719 parent.addToCartProductAfterMembership(data.PriceId); 5720 } 5721 window.location.href = data.RedirectUrl || '/ShoppingCart'; 5722 } 5723 });
5724} 5725 5726function openMembershipCertificate(customerMembershipId, displayMembershipCertButtonLabel) { 5727 $.get("/Group/CustomerMembershipCertificate?customerMembershipId=" + customerMembershipId + "&displayMembershipCertButtonLabel=" + displayMembershipCertButtonLabel, function (data) { 5728 if (data && data.trim()) { 5729 $.confirm({ 5730 title: displayMembershipCertButtonLabel, 5731 boxWidth: '550px', 5732 useBootstrap: false, 5733 content: data, 5734 buttons: { 5735 cancel: { 5736 text: 'Close', 5737 btnClass: 'btnCloseMemberCertificate', 5738 action: function () { 5739 } 5740 } 5741 } 5742 }); 5743 } 5744 }); 5745} 5746 5747$('body').on('click', '.btnEmailGroupCert', function () { 5748 $(".btnCloseMemberCertificate").trigger('click'); 5749 $.magnificPopup.open({ 5750 items: { 5751 src: $(this).attr("href") 5752 }, 5753 type: 'iframe', 5754 closeOnBgClick: false, 5755 mainClass: 'popPagerDuty' 5756 }); 5757 return false; 5758}); 5759 5760$('body').on('click', '.popEditAddress', function () { 5761 $.magnificPopup.open({ 5762 items: { 5763 src: $(this).attr("href") 5764 }, 5765 type: 'iframe', 5766 closeOnBgClick: false, 5767 mainClass: 'popEditAddressMainClass' 5768 }); 5769 return false; 5770}); 5771 5772$('.autoCompleteCompanyName').autocomplete({ 5773 source: function (data, callback) { 5774 $.ajax({
5775 global: false, // <-- this is the key! 5776 url: '/Search/Autocomplete', 5777 dataType: 'json', 5778 data: data, 5779 success: callback 5780 }); 5781 } 5782}); 5783 5784//#14552 5785function addressMethod(editAddressPopupType, isHideDirectory, customerCustomFieldId, selectedAddressId, isPrimary) { 5786 $.magnificPopup.close(); 5787 // Track explicit primary addresses in hidden field for company custom address blocks 5788 if (isPrimary && selectedAddressId > 0 && $("#ExplicitPrimaryAddresses").length > 0) { 5789 var current = $("#ExplicitPrimaryAddresses").val(); 5790 var ids = current ? current.split(',').filter(function (x) { return x; }) : []; 5791 if (ids.indexOf(selectedAddressId.toString()) === -1) { 5792 ids.push(selectedAddressId.toString()); 5793 } 5794 $("#ExplicitPrimaryAddresses").val(ids.join(',')); 5795 } 5796 if ($(".grid-list-address").length > 0) { 5797 isHideDirectory = (isHideDirectory && isHideDirectory.toLowerCase() === "false") ? false : true; 5798 var customerCustomFieldIds = $("#CustomerCustomFieldIds").val() || ""; 5799 var isRequiredInformationPopup = $("#IsRequiredInformationPopup").val() || false; 5800 var isFromShoppingCart = ($('#currentCartStage').val() || '') == 'PersonalInfo'; 5801 $(".grid-list-address").each(function () { 5802 5803 var isQuestionset = ($(this).attr("data-isquestionset") || "").toLowerCase() == "true"; 5804 var isRequired = ($(this).attr("data-isrequired") || "").toLowerCase() == "true"; 5805 var questionId = $(this).attr("data-questionid") || ""; 5806 var selectedValue = parseInt(customerCustomFieldId) == questionId && selectedAddressId > 0 ? selectedAddressId : $('#IsAddressBlockQuestion' + questionId).attr("data-selectedvalue"); 5807 var companyCustomFieldID = $(this).attr("data-companyCustomFieldID") || ""; 5808 var entityType = $(this).attr("data-EntityType") || ""; 5809 var entityId = $(this).attr("data-entityId") || ""; 5810 var onlyCustomField = $(this).attr("data-onlyCustomField") || ""; 5811 5812 if (parseInt(customerCustomFieldId) == questionId && selectedAddressId > 0) { 5813 $('#IsAddressBlockQuestion' + questionId).attr("data-selectedvalue", selectedAddressId) 5814 } 5815 5816 $(this).load(GET_CUSTOMER_GET_CUSTOMER_ADDRESS_LIST + '?editAddressPopupType=' + editAddressPopupType + '&isHideDirectory=' + isHideDirectory + '&IsQuestionset=' + isQuestionset + '&IsRequired=' + isRequired + '&QuestionId=' + questionId + "&customerCustomFieldIds=" + customerCustomFieldIds + "&isRequiredInformationPopup=" + isRequiredInformationPopup + "&customerCustomFieldId=" + questionId + "&selectedAddressId=" + selectedValue + "&isFromShoppingCart=" + isFromShoppingCart + "&companyCustomFieldID=" + companyCustomFieldID + "&entityId=" + entityId + "&entityType=" + entityType + "&onlyCustomField=" + onlyCustomField, function () { 5817 $('.verifiedLabel[data-toggle="tooltip"]').tooltip(); 5818 5819 $(".divAddressListLayout:visible").each(function () { 5820 $(this).height($(this).outerHeight()); 5821 $(".addresslist-card", this).height($(".addresslist-card", this).outerHeight()); 5822 }); 5823 loadAlertToolTip(); 5824 }).prepend("<p class='loaderTxt'>Please wait ...</p>"); 5825 }); 5826 5827 5828 } else if (editAddressPopupType == "EditCompanyPortal") { 5829 companyAddressMethod(); 5830 } 5831 if ($("#divExistingAddress").length > 0) { 5832 $("#divExistingAddress").load(GET_CUSTOMER_CUSTOMER_GET_EXISTING_ADDRESSES + '?editAddressPopupType=' + editAddressPopupType).prepend("<p class='loaderTxt'>Please wait ...</p>"); 5833 if (editAddressPopupType === "EditShippingInfo") { 5834 getShippingMethodByAddress(); 5835 } 5836 else { 5837 UpdateOrderSummary(); 5838 5839 if (typeof (calculatePriceAndTax) === "function") { 5840 calculatePriceAndTax() 5841 } 5842 } 5843 } 5844} 5845 5846// Set as Default address 5847$("body").on("click", ".setDefaultAddress", function () { 5848 var addressId = $(this).attr('data-value'); 5849 var editAddressPopupType = $(this).attr('data-editAddressPopupType'); 5850 var referralClientId = $(this).attr('data-referralClientId'); 5851 5852 if (confirm('Are you sure you want to set this address as default?')) { 5853 $.post(referralClientId > 0 ? "/ReferralService/MakePrimaryAddress" : "/Account/MakePrimaryAddress", { addressId: addressId }, function (data) { 5854 if (referralClientId > 0) { 5855 referralAddressMethod(editAddressPopupType, referralClientId) 5856 } else { 5857 addressMethod(editAddressPopupType); 5858 } 5859 }).fail(function (data) { 5860 alert('Error! Please try again later.'); 5861 }); 5862 } 5863}); 5864 5865// Set as Directory address 5866$("body").on("click", ".setDirectoryAddress", function () { 5867 var addressId = $(this).attr('data-value'); 5868 var editAddressPopupType = $(this).attr('data-editAddressPopupType'); 5869 var isDirectoryAddress = ($(this).attr('data-isDirectoryAddress') == "True") ? true : false; 5870 var addressUsageType = isDirectoryAddress ? 0 : 1; 5871 //var alertMessage = isDirectoryAddress ? "Are you sure you want to remove this address from the directory address?" : "Are you sure you want to set this address as directory address?"; 5872 //#21752 5873 //if (confirm(alertMessage)) { 5874 $.post("/Account/MakeDirectoryAddress", { addressId: addressId, addressUsageType: addressUsageType }, function (data) { 5875 addressMethod(editAddressPopupType); 5876 }).fail(function (data) { 5877 alert('Error! Please try again later.'); 5878 });
5879 //} else { 5880 // return false; 5881 //} 5882}); 5883 5884//js for check element is visible or not on screen 5885function isElementVisibleOnScreen(elem) { 5886 var $elem = $(elem); 5887 var $window = $(window); 5888 5889 var docViewTop = $window.scrollTop(); 5890 var docViewBottom = docViewTop + $window.height(); 5891 if ($elem.length > 0) { 5892 var elemTop = $elem.offset().top; 5893 var elemBottom = elemTop + $elem.height(); 5894 return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); 5895 } 5896 5897 return false; 5898} 5899 5900// #14921: Delete Address 5901$("body").on("click", ".deleteAddress", function () { 5902 var id = $(this).attr('data-encrypted'); 5903 var editAddressPopupType = $(this).attr('data-editAddressPopupType'); 5904 var isHideDirectory = $(this).attr('data-isHideDirectory'); 5905 var questionId = $(this).attr('data-questionId') || 0; 5906 var referralClientId = $(this).attr('data-referralClientId'); 5907 var tempCustomerId = $(this).attr('data-tempCustomerId'); 5908 var isFromUserRegistration = $(this).attr('data-isFromUserRegistration'); 5909 if (confirm('Are you sure you want to delete this address?')) { 5910 $.post(referralClientId > 0 ? "/ReferralService/DeleteAddress" : "/Account/DeleteAddress", { a: id }, function (data) { 5911 if (questionId > 0) { 5912 if (isFromUserRegistration == 'True') { 5913 loadCustomerCustomAddressBlock(tempCustomerId, false); 5914 } 5915 else { 5916 loadCustomerAddressListForQuestionSet(); 5917 } 5918 } else if (referralClientId > 0) { 5919 referralAddressMethod(editAddressPopupType, referralClientId) 5920 } else { 5921 addressMethod(editAddressPopupType, isHideDirectory); 5922 } 5923 }).fail(function (data) { 5924 alert('Error! Please try again later.'); 5925 }); 5926 } 5927}); 5928 5929 5930function toggleGroupType(groupType) { 5931 5932 var eleAccordian = $(".groupAccordian[data-gId=" + groupType + "]"); 5933 if ($(eleAccordian).find(".panel-collapse").is(':visible')) { 5934 $(eleAccordian).find(".groupExpander").addClass("fa-plus").removeClass("fa-minus"); 5935 $(eleAccordian).find(".pastMembershipGroupAccordian[data-gId=" + groupType + "]").find(".pastMembershipGroupExpander").addClass("fa-plus").removeClass("fa-minus"); 5936 } 5937 else { 5938 $(eleAccordian).find(".groupExpander").addClass("fa-minus").removeClass("fa-plus"); 5939 } 5940} 5941 5942function pastToggleGroup(groupType) { 5943 var eleAccordian = $(".pastMembershipGroupAccordian[data-gId=" + groupType + "]"); 5944 if ($(eleAccordian).find(".pastMembershipPanel-collapse").is(':visible')) { 5945 $(eleAccordian).find(".pastMembershipGroupExpander").addClass("fa-plus").removeClass("fa-minus"); 5946 } 5947 else { 5948 $(eleAccordian).find(".pastMembershipGroupExpander").addClass("fa-minus").removeClass("fa-plus"); 5949 } 5950 5951} 5952 5953//#15273 5954$('body').on('click', '#printProductDecription', function () { 5955 var printContents = $('.printDescription').html(); 5956 var originalContents = document.body.innerHTML; 5957 document.body.innerHTML = printContents; 5958 window.print(); 5959 document.body.innerHTML = originalContents; 5960}); 5961 5962//# 15037 - Custom Fields Multi-Select DropDown - START 5963$("body").on('change', '.chkSelecAllCustomFields', function () { 5964 checkUncheckAllCustomCheckBox(this); 5965}); 5966 5967$("body").on('click', '.btnClearCustomFields', function () { 5968 var txtSearch = $(this).closest('th').find('input[type="text"]'); 5969 $(txtSearch).val(''); 5970 searchCustomFieldCheckBox(txtSearch); 5971}); 5972 5973function checkUncheckAllCustomCheckBox(ele) { 5974 5975 if ($(ele).prop('checked') === true) { 5976 $(ele).closest("table").find('input[type="checkbox"]:visible').prop('checked', true); 5977 } 5978 else { 5979 $(ele).closest("table").find('input[type="checkbox"]').prop('checked', false); 5980 } 5981 5982 var findTrigger = $(ele).closest("table").find('input[data-triggerType="1"],[data-tirggerquestiontype="1"]').first(); 5983 if (findTrigger) { 5984 if ($("#MemberShipQuestionSetId").val() > 0) { 5985 callQuestionSetTriggerQuestion(findTrigger); 5986 } 5987 else if ($('.chkSelecAllCustomFields').closest('form').length > 0 && !['frmRegistrant'].includes( 5988 $('.chkSelecAllCustomFields').closest('form').attr('id'))){ 5989 callTriggerQuestion(findTrigger); 5990 } 5991 } 5992 5993} 5994 5995function searchCustomFieldCheckBox(txtSearch) { 5996 if (txtSearch) { 5997 $(txtSearch).closest("table").find("tbody>tr").filter(function () { 5998 $(this).toggle($(this).text().toLowerCase().indexOf($(txtSearch).val().toLowerCase()) > -1) 5999 }); 6000 } 6001} 6002 6003//# 15037 - Custom Fields Multi-Select DropDown - END 6004 6005$("body").on("click", ".btnCancelPurchaseCE", function () { 6006 var productId = $(this).attr('data-productId'); 6007 var displaypagetype = $(this).attr('data-displaypagetype'); 6008 if (displaypagetype && displaypagetype === '3') { 6009 $.ajax({
6010 type: "POST", 6011 url: "/Bundle/DeleteCustomerBundleProduct", 6012 dataType: "json", 6013 data: { 6014 'customerBundleId': $(this).attr('data-customerbundleid'), 6015 }, 6016 success: function (data) { 6017 LoadCustomerBundleProductList(); 6018 }, 6019 complete: function (data) { 6020 $('#divProgress').hide(); 6021 }, 6022 error: function (data) { 6023 $('#divProgress').hide(); 6024 alert('Error! Please try again later.'); 6025 } 6026 }); 6027 } 6028 else if (productId && displaypagetype != '4') { 6029 $.get(CENCEL_PURCHASECE, { productId: productId }, function (data) { 6030 if (data != undefined) { 6031 parent.$("#cartspancount").html(data); 6032 parent.$("#cartItemList").load(GET_CART_URL); 6033 } 6034 }); 6035 } 6036}); 6037 6038function dataCustomFilter() { 6039 var elCustomFilter = $('.dataCustomFilter'), 6040 elFilterInput = $('input#customFilterinput'), 6041 divEntities = $('.dataEntities'), 6042 entities = $('.dataEntity'); 6043 6044 if (!elCustomFilter || elCustomFilter.length == 0 6045 || !elFilterInput || elFilterInput.length == 0 6046 || !divEntities || divEntities.length == 0 6047 || !entities || entities.length == 0) return; 6048 6049 elFilterInput.on("change", function () { 6050 var input = ($(this).val() || '').trim(); 6051 if (input) { 6052 6053 divEntities.attr('data-filter', 'true'); 6054 divEntities.find('.active').removeClass('active'); 6055 6056 entities.filter(function () { 6057 return $(this).attr('data-title').toLowerCase().indexOf((input || "").toLowerCase()) > -1 || $(this).is(':contains(' + (input || "") + ')'); 6058 }).addClass('active'); 6059 6060 } else { 6061 divEntities.attr('data-filter', 'false'); 6062 } 6063 return false; 6064 }) 6065 .on("keyup", function () { 6066 // fire the above change event after every letter 6067 $(this).change(); 6068 }); 6069} 6070 6071// custom css expression for a case-insensitive contains() 6072jQuery.expr[":"].contains = function (a, i, m) { 6073 return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase()) >= 0; 6074}; 6075 6076function loadAlertToolTip() { 6077 if ($('.moreinfo') != undefined) { 6078 $('.moreinfo').popover({ trigger: 'hover' }) 6079 .on("show.bs.popover", function () { 6080 return $(this).data("bs.popover").tip().css({ 6081 maxWidth: "500px" 6082 }) 6083 }); 6084 } 6085} 6086 6087function redirectToShoppingCart() { 6088 window.location.href = '/ShoppingCart'; 6089} 6090$('.chkSelect-FuturePayment, .chkSelect-FuturePayment-All').on('change', function () { 6091 if ($('.chkSelect-FuturePayment:checked').length > 0) { 6092 $('.btnPayMultiple').removeClass('disabled'); 6093 } else { 6094 $('.btnPayMultiple').addClass('disabled'); 6095 } 6096}); 6097$("body").on('click', '.processMembershipPaymentWithSaveCard', function () { 6098 6099 if (!confirm("Are you sure you want to Process Payment?")) { return; } 6100 6101 var customerMembershipId = $(this).attr("data-customerMembershipId"); 6102 var membershipsPaymentIds = $(this).attr("data-paymentId"); 6103 6104 $('#divProgress').show(); 6105 $.ajax({
6106 type: "GET", 6107 url: "/Group/ProcessMembershipPayment", 6108 data: { 6109 "customerMembershipId": customerMembershipId, 6110 "membershipsPaymentIds": membershipsPaymentIds 6111 }, 6112 success: function (data) { 6113 if (data && data.Success) { 6114 window.location.reload(); 6115 } 6116 else { 6117 if (data && data.Message) { 6118 alert(data.Message); 6119 window.location.reload(); 6120 } 6121 else { 6122 alert('Error! Please try again later.'); 6123 } 6124 } 6125 $('#divProgress').hide(); 6126 }, 6127 error: function () { 6128 alert('Error! Please try again later.'); 6129 } 6130 }); 6131}); 6132isValidPayNowForSeleted = function () { 6133 if ($("input[type='checkbox'][class='chkSelect-FuturePayment']:checked").length === 0) { 6134 alert('Please select a record for payment.'); 6135 return false; 6136 } 6137 6138 var firstSelectedIndex = parseInt($("input[type='checkbox'][class='chkSelect-FuturePayment']:checked:first").attr("data-index")); 6139 var lastSeletectedIndex = parseInt($("input[type='checkbox'][class='chkSelect-FuturePayment']:checked:last").attr("data-index")); 6140 var firstNotSeletedIndex = parseInt($("input[type='checkbox'][class='chkSelect-FuturePayment']:not(:checked):first").attr("data-index")); 6141 if (firstSelectedIndex && lastSeletectedIndex && firstNotSeletedIndex && (firstSelectedIndex > firstNotSeletedIndex || firstNotSeletedIndex < lastSeletectedIndex)) { 6142 alert('You cannot skip a middle payment.'); 6143 return false; 6144 } 6145 6146 return true; 6147} 6148 6149$("body").on('click', '.btnPayNow,.btnPayMultiple', function () { 6150 var customerMembershipId = $(this).attr("data-customerMembershipId"); 6151 var paymentIds = $(this).attr("data-paymentId"); 6152 var pageName = $(this).attr("data-pageName"); 6153 6154 //Pay selected invoices 6155 if ($(this).hasClass("btnPayMultiple")) { 6156 //if the pay now for selected items is valid 6157 if (!isValidPayNowForSeleted()) { 6158 return false; 6159 } 6160 paymentIds = $("input[type='checkbox'][class='chkSelect-FuturePayment']:checked").map(function () { return $(this).val() }).get().join(','); 6161 } 6162 6163 if ($("#hdnAutoPayerEnable").length > 0 && $("#hdnAutoPayerEnable").val() === "false") { 6164 var content = "You have not yet authorized a payment method to be used for recurring payments. Would you like to set up an automatic payment method for future dues invoices?"; 6165 content += "<br/><br/> If you select Yes, the payment method will be stored and can be updated in the Invoices & Payments section of your membership tab. If you select No, only this current transaction will be processed." 6166 $.confirm({ 6167 title: "Enable Automatic Recurring Payments?", 6168 boxWidth: '750px', 6169 useBootstrap: false, 6170 type: 'green', 6171 content: content, 6172 buttons: { 6173 ok: { 6174 text: 'Yes', 6175 btnClass: 'btn-success', 6176 action: function () { 6177 var rdata = { IsAuthorize: true }; 6178 AddToCartPayments(customerMembershipId, paymentIds, pageName, rdata); 6179 } 6180 }, 6181 cancel: { 6182 text: 'No', 6183 btnClass: 'btn-warning', 6184 action: function () { 6185 AddToCartPayments(customerMembershipId, paymentIds, pageName); 6186 } 6187 } 6188 } 6189 }); 6190 } 6191 else { 6192 AddToCartPayments(customerMembershipId, paymentIds, pageName); 6193 } 6194}); 6195 6196 6197function AddToCartPayments(customerMembershipId, paymentIds, pageName, rdata) { 6198 var IsAuthorize = rdata && rdata.IsAuthorize || 0; 6199 6200 $('#divProgress').show(); 6201 $.post("/Group/AddMembershipPaymentsInCart", { customerMembershipId: customerMembershipId, membershipPaymentsIds: paymentIds, IsAuthorize: IsAuthorize }, function (data) { 6202 if (data && data.Success) { 6203 if (pageName && pageName.toLowerCase() == "companybasedmembershipdetail") { 6204 parent.goToShoppingCart(); 6205 } 6206 window.location.href = '/ShoppingCart'; 6207 } else { 6208 $('#divProgress').hide(); 6209 if (data && data.Message) { 6210 alert(data.Message); 6211 } 6212 else { 6213 alert('Currently, invoice(s) is not added into cart. Please try again.'); 6214 } 6215 } 6216 });
6217} 6218 6219function showPendingPaymentPopup() { 6220 $(".PendingPaymentPopOver").popover({ 6221 trigger: "manual", 6222 content: function () { 6223 var element = $(this); 6224 var content = element.attr('data-originalcontent'); 6225 var customerMembershipId = element.attr('data-customermembershipId'); 6226 return content + $("#dvPendingPayments" + customerMembershipId).html() 6227 }, 6228 placement: 'top', 6229 container: 'body', 6230 html: true, 6231 animation: false 6232 }).on("mouseenter", function () { 6233 var _this = this; 6234 $(_this).popover("show"); 6235 6236 $(".popover").on("mouseleave", function () { 6237 $(_this).popover('hide'); 6238 }); 6239 6240 }).on("mouseleave", function () { 6241 var _this = this; 6242 setTimeout(function () { 6243 if (!$(".popover:hover").length) { 6244 $(_this).popover("hide"); 6245 } 6246 }, 100); 6247 }).on("show.bs.popover", function () { 6248 return $(this).data("bs.popover").tip().css({ 6249 minWidth: "925px" 6250 }) 6251 }); 6252} 6253 6254 6255 6256 6257function reloadParentWindow(url) { 6258 window.top.location.href = url; 6259} 6260 6261 6262function clearGroupSessionAfterPurchaseProduct() { 6263 if (typeof (clearSessionStorageKeyForGroup) === "function") { 6264 clearSessionStorageKeyForGroup(); 6265 } 6266} 6267 6268 6269//mantis item : 16481: Mobile check out - remove popup and put discount code into main page. 6270$("body").on("click", ".clsContinueCartForMobile, #btnCheckoutContinue", function () { 6271 //shopping cart stages 6272 var listForms = ["#frmEditCustomer", "#frmShippingInfo", "#frmRegistrant", "#frmMarketingCode", "#frmPaymentInfo"]; 6273 6274 var $this_From = $($.grep(listForms, function (itemForm) { 6275 return $(itemForm).length > 0; 6276 })[0]); 6277 var isPaymentForm = $this_From.attr('id') === 'frmPaymentInfo'; 6278 var message = isPaymentForm 6279 ? '<span><i class="fa fa-refresh fa-spin"></i> Processing Payment...</span>' 6280 : '<span><i class="fa fa-refresh fa-spin"></i> Please wait...</span>'; 6281 var buttonText = isPaymentForm ? 'Place Order' : '<span class="m-5"> Continue </span><i class="fa fa-solid fa-caret-right "></i>'; 6282 6283 if (!$this_From) { return false; } 6284 6285 //disabled button for invalid form 6286 if ($this_From.valid()) { 6287 $(".clsContinueCartForMobile, #btnCheckoutContinue").html(message); 6288 $(".clsContinueCartForMobile, #btnCheckoutContinue").attr('disabled', 'disabled'); 6289 } 6290 6291 //submit form 6292 $this_From.submit(); 6293 6294 //remove disabled attributes 6295 setTimeout(function () { 6296 if (!window.Stripe) { // do not enable if stripe payment gateway 6297 $(".clsContinueCartForMobile, #btnCheckoutContinue").html(buttonText); 6298 $(".clsContinueCartForMobile, #btnCheckoutContinue").removeAttr('disabled'); 6299 } 6300 }, 4000); 6301 6302}); 6303 6304function toggleSidebarToHamburger() { 6305 var divSidebar = $('div#sidebar.sidebar-offcanvas[role="navigation"]'); 6306 6307 if (window && window.innerWidth > 768) { 6308 $('body').removeClass('custom-mobileview'); 6309 $(".custom-navbar.navbar").addClass("hidden-xs"); 6310 var divContent = $("body").find('#groupTopCartBar').length > 0 ? $('div.container div.container-fluid .ce21_tab_cotent #mainSection') : $('div.container2 > div.body-content > div.row.row-offcanvas.row-offcanvas-right > div.col-xs-12.col-sm-9'); 6311 6312 if (!divContent || !divSidebar || divContent.length == 0 || divSidebar.length == 0) return; 6313 6314 switch (divSidebar.attr('data-layouttype')) { 6315 case "LeftSidebar": 6316 divSidebar.insertBefore(divContent); 6317 break; 6318 case "RightSidebar": 6319 divSidebar.insertAfter(divContent); 6320 break; 6321 default: 6322 break; 6323 } 6324 } else { 6325 $('body').addClass('custom-mobileview'); 6326 6327 var navbarToggle = $("body").find('#groupTopCartBar').length > 0 ? $('#groupTopCartBar a.dropdown-toggle') : $('#cartbar button.navbar-toggle'); 6328 6329 if (navbarToggle.length == 0) { 6330 $(".custom-navbar.navbar").removeClass("hidden-xs"); 6331 navbarToggle = $(".custom-navbar.navbar"); 6332 } 6333 if (!navbarToggle || !divSidebar || navbarToggle.length == 0 || divSidebar.length == 0) return; 6334 6335 var sidebarFiltersMenu = $("body").find('.filtersSidebarmenuInToggle').length > 0 ? $("#filtersSidebarmenuInToggle div.TopmenuInToggle") : $('#navbar div.TopmenuInToggle'); 6336 divSidebar.insertAfter(sidebarFiltersMenu); 6337 } 6338 6339 if (divSidebar && divSidebar.hasClass("hidden-xs")) divSidebar.removeClass("hidden-xs"); 6340} 6341 6342//mantis item : 15859#c14803 6343$("body").on('click', '.PayOutStandingInvoices', function () { 6344 6345 var customerMembershipId = $(this).attr("data-customerMembershipId"); 6346 var productPriceId = $(this).attr("data-productpriceid"); //As per mantis item 15859#c14280 6347 6348 if (!productPriceId || !customerMembershipId || Number(productPriceId) <= 0 || Number(customerMembershipId) <= 0) { return false; } 6349 6350 $('#divProgress').show(); 6351 $.post(ADD_OUT_STANDING_INVOICE_IN_CART, { customerMembershipId: customerMembershipId }, function (data) { 6352 if (data && data.Success) { 6353 let params = { 6354 registrantTypeOrderItemId: undefined, 6355 groupProductPricecId: productPriceId 6356 }; 6357 saveAddToCartProducts(params); 6358 } 6359 else { 6360 $('#divProgress').hide(); 6361 var errorMessage = data && data.Message ? data.Message : 'Currently, invoice(s) is not added into cart. Please try again.'; 6362 alert(errorMessage); 6363 } 6364 });
6365 6366}); 6367 6368function getCartItems() { 6369 $("#cartItemList").load(GET_CART_URL); 6370} 6371 6372//#14452 - Viewer Launch Button Click Event - Start 6373$("body").on("click", ".ShowPrerequisiteProducts", function () { 6374 var productId = parseInt($(this).attr("data-productid")) || 0; 6375 var productName = $(this).attr("data-productname"); 6376 if (productId > 0) { 6377 showPrerequisiteProducts(productId, productName); 6378 } 6379}); 6380 6381function showPrerequisiteProducts(productId, productName) { 6382 $.ajax({ 6383 type: 'get', 6384 url: GET_PREREQUSITE_PRODUCTS + '?productId=' + productId + '&productName=' + productName, 6385 success: function (html) { 6386 if ($("#divPrerequisiteProducts").length === 0) { 6387 $("body").append("<div class='modal fade' id='divPrerequisiteProducts' tabindex='- 1' role='dialog' aria-hidden='true' style='display: none;'></div>"); 6388 } 6389 6390 $("#divPrerequisiteProducts").html(html); 6391 $("#divPrerequisiteProducts").modal(); 6392 }, 6393 error: function () { 6394 alert('Error! Please try again later.'); 6395 } 6396 }); 6397} 6398//#14452 - Viewer Launch Button Click Event - End 6399 6400$("body").on("click", ".ShowAcknowledgePopup", function () { 6401 var IsChangePopupLoaction = ($(this).attr("data-IscenterPopUp") != undefined && $(this).attr("data-IscenterPopUp") != null) ? $(this).attr("data-IscenterPopUp") : 'false'; 6402 var productId = parseInt($(this).attr("data-productid")) || 0; 6403 var params = { 6404 "productId": productId, 6405 "nextTargetDiv": $(this).attr("data-val") || "", 6406 "agendaHeight": parseInt($(this).attr("data-height")) || 0, 6407 "agendaWidth": parseInt($(this).attr("data-width")) || 0 6408 }; 6409 if (productId > 0) { 6410 $.ajax({
6411 type: 'get', 6412 url: GET_ACKNOWLEDGE_PREREQUISITE_PRODUCTS + "?" + $.param(params), 6413 success: function (html) { 6414 if ($("#dvAcknowledgePopup").length === 0) { 6415 $("body").append("<div class='modal fade' id='dvAcknowledgePopup' data-bs-backdrop='static' data-bs-keyboard='false' tabindex='-1' role='dialog' aria-hidden='true' style='display: none;'></div>"); 6416 6417 } 6418 6419 $("#dvAcknowledgePopup").html(html); 6420 $('#dvAcknowledgePopup').modal({ 6421 backdrop: 'static', 6422 keyboard: false 6423 }); 6424 if (IsChangePopupLoaction == 'true') { 6425 $('#AcknowledgeForm').css('margin-left', '25%'); 6426 } 6427 }, 6428 error: function () { 6429 alert('Error! Please try again later.'); 6430 } 6431 }); 6432 return false; 6433 } 6434}); 6435 6436$("body").on("click", "#dvAcknowledgePopup a", function () { 6437 var val = $(this).attr("data-val") || "";; 6438 $("#dvAcknowledgePopup").modal('hide'); 6439 if (val) { 6440 $(val).modal(); 6441 } 6442}); 6443 6444 6445$('body').on('click', '.btnSocilMediaShare', function () { 6446 var provider = $(this).attr('displayText'); 6447 var productUrl = $(this).attr('st_url') || location.href; 6448 var providerUrl = ''; 6449 var productTitle = $(this).attr('st_title') || $('title').text(); 6450 switch (provider) { 6451 case 'Facebook': 6452 providerUrl = 'https://www.facebook.com/sharer/sharer.php?u={productUrl}'; //'https://www.facebook.com/dialog/share?href={productUrl}'; 6453 break; 6454 case 'LinkedIn': 6455 providerUrl = 'https://www.linkedin.com/shareArticle?mini=true&url={productUrl}&title={productTitle}'; 6456 break; 6457 case 'Tweet': 6458 providerUrl = 'http://twitter.com/share?url={productUrl}&text={productTitle}'; 6459 break; 6460 case 'Email': 6461 openSharToEmailModel(productTitle, productUrl); 6462 return; 6463 break; 6464 6465 default: 6466 } 6467 6468 if (providerUrl) { 6469 providerUrl = providerUrl.replace('{productUrl}', encodeURIComponent(productUrl)).replace('{productTitle}', encodeURIComponent(productTitle)); 6470 window.open(providerUrl, 'NewSharingWindow', 'height=700,width=800'); 6471 } 6472}); 6473 6474 6475$('body').on('click', '.btnShareOnMail', function () { 6476 var provider = $(this).attr('displayText'); 6477 var productUrl = $('#externalEmailShareScreen #shareUrl').val() || location.href; //$(this).attr('st_url'); 6478 var providerUrl = ''; 6479 var productTitle = $('#externalEmailShareScreen #shareTitle').val() || $('title').text(); // $(this).attr('st_title') || ''; 6480 var subject = productTitle; 6481 var body = '{productUrl}'; 6482 switch (provider) { 6483 case 'Gmail': 6484 providerUrl = 'https://mail.google.com/mail/?view=cm&fs=1&su={subject}&body={body}'; 6485 break; 6486 case 'Yahoo': 6487 providerUrl = 'http://compose.mail.yahoo.com/?subject={subject}&body={body}'; 6488 break; 6489 case 'Email': 6490 providerUrl = 'mailto:[email protected]?subject={productUrl}&body={body}'; 6491 break; 6492 default: 6493 } 6494 6495 if (providerUrl) { 6496 body = body.replace('{productUrl}', productUrl); 6497 providerUrl = providerUrl.replace('{subject}', encodeURIComponent(subject)).replace('{body}', encodeURIComponent(body)); 6498 window.open(providerUrl); 6499 } 6500}); 6501 6502function openSharToEmailModel(productTitle, productUrl) { 6503 $('#externalEmailShareScreen #shareUrl').val(productUrl); 6504 $('#externalEmailShareScreen #shareTitle').val(productTitle); 6505 var content = $('#externalEmailShareScreen').html(); 6506 $.confirm({ 6507 title: '', 6508 boxWidth: '450px', 6509 useBootstrap: false, 6510 type: '', 6511 content: content, 6512 buttons: { 6513 close: { 6514 text: 'Close', 6515 btnClass: 'btn-danger', 6516 action: function () { 6517 } 6518 } 6519 } 6520 });
6521} 6522 6523$('body').on('click', '.impersonateInfo', function () { 6524 $.alert({ 6525 title: 'Impersonate Session', 6526 content: $(".clsImpersonateTextModel").html(), 6527 useBootstrap: false, 6528 boxWidth: '600px', 6529 backgroundDismiss: true, 6530 buttons: { 6531 cancel: { 6532 text: 'Close', 6533 btnClass: 'btn-default' 6534 } 6535 }, 6536 onContentReady: function () { 6537 $(".impersonateUL").css("padding-left", "18px") 6538 } 6539 }); 6540}); 6541function getParameterFromUrl(param) { 6542 var sPageURL = window.location.search.substring(1); 6543 var sURLVariables = sPageURL.split('&'); 6544 for (var i = 0; i < sURLVariables.length; i++) { 6545 var sParameterName = sURLVariables[i].split('='); 6546 if (sParameterName[0] && param && sParameterName[0].toLowerCase() == param.toLowerCase()) { 6547 return sParameterName[1]; 6548 } 6549 } 6550} 6551 6552$("body").on("click", ".supoortSolutionPopup", function () { 6553 $.magnificPopup.open({ 6554 items: { 6555 src: '/Tickets/TicketEmailPopup?isViewer=false' 6556 }, 6557 type: 'iframe', 6558 closeOnBgClick: false, 6559 mainClass: 'pop700' 6560 }); 6561 $(".pop700").find('iframe').attr("id", "ifrSupportSolution"); 6562 $(".pop700").attr("data-html2canvas-ignore", "true"); 6563 return false; 6564}); 6565 6566 6567 6568function isIOsSafari() { 6569 var userAgent = navigator.userAgent; 6570 6571 return /iP(ad|od|hone)/i.test(userAgent) && /WebKit/i.test(userAgent) && !(/(CriOS|FxiOS|OPiOS|mercury)/i.test(userAgent)); 6572} 6573 6574//#region #0017560: Viewer > Safari > Mobile Device >Open viewer in same tab vs target _blank 6575function preventViewerLaunchInNewTab() { 6576 if (!isIOsSafari()) return false; 6577 6578 var buttons = []; 6579 6580 var targetButtons = [$('a[href*="/ShowTime"]'), $('a[href*="/viewer/classroom"]'), $('a[href*="/Viewer"]'), $('a[href*="/UnAutheticatedLinkDemo"]'), $('a[href*="/LaunchFreeViewer"]')]; 6581 6582 if (!targetButtons || targetButtons.length == 0) return false; 6583 6584 targetButtons.map(function (element) { 6585 if (element && element.length > 0) { 6586 buttons.push(element); 6587 } 6588 }); 6589 6590 if (!buttons || buttons.length == 0) return false; 6591 6592 buttons.map(function (element) { 6593 var $this = $(element); 6594 6595 if (!$this || $this.length == 0) return false; 6596 6597 var targetAttr = $this.attr('target'); 6598 6599 if (!targetAttr || targetAttr != '_self') { 6600 $this.attr('target', '_self'); 6601 } 6602 }); 6603} 6604//#endregion 6605 6606$("body").on("click", ".copyToClipboard", function () { 6607 var element = $(this); 6608 var text = $(this).attr("data-text"); 6609 Helper.Common.copyToClipBoard(text, element); 6610}); 6611 6612function showWebinarPassword() { 6613 if ($(".webinar-launch-button").length > 0) { 6614 $(".webinar-launch-button").each(function () { 6615 var programRegistrantId = $(this).attr("data-programregistrantid"); 6616 $(".webinar-password[data-programRegistrantId=" + programRegistrantId + "]").show(); 6617 }); 6618 } 6619} 6620//#endregion 6621 6622$("body").on('click', '.popCancellationOptions', function () { 6623 $.magnificPopup.open({ 6624 items: { 6625 src: $(this).attr("href") 6626 }, 6627 type: 'iframe', 6628 closeOnBgClick: false, 6629 mainClass: 'popCancellationOptionsMainClass' 6630 }); 6631 return false; 6632}); 6633 6634 6635// check card type and card number validation 6636function checkCreditCardTypeValidation(VARCARDTYPE, ccNumber) { 6637 var ERROR_MSG = 'You have selected ' + VARCARDTYPE + ' as card type. Please make sure your card is ' + VARCARDTYPE + '.'; 6638 if (VARCARDTYPE == "American Express") { 6639 VARCARDTYPE = "amex"; 6640 } 6641 if (VARCARDTYPE && VARCARDTYPE != 'MasterPass' && ccNumber) { 6642 var VAR_ORIGINAL_CARDTYPE = getCreditCardName(ccNumber) 6643 if (VAR_ORIGINAL_CARDTYPE != VARCARDTYPE.toLowerCase()) { 6644 alert(ERROR_MSG); 6645 } 6646 } 6647} 6648 6649// get card name from payment method selection 6650function getCreditCardName(cur_val) { 6651 var sel_brand; 6652 6653 // the regular expressions check for possible matches as you type, hence the OR operators based on the number of chars 6654 // Visa 6655 visa_regex = new RegExp('^4[0-9]{0,15}$'); 6656 // MasterCard 6657 mastercard_regex = new RegExp('^5[1-5][0-9]{0,17}$|^2[2-7][0-9]{0,17}$'); 6658 // Maestro 6659 maestro_regex = new RegExp('^6[7-9][0-9]{0,17}$'); 6660 // American Express 6661 amex_regex = new RegExp('^3$|^3[47][0-9]{0,13}$'); 6662 // Diners Club 6663 diners_regex = new RegExp('^3$|^3[068]$|^3(?:0[0-5]|[68][0-9])[0-9]{0,11}$'); 6664 //Discover
6665 discover_regex = new RegExp('^6$|^6[05]$|^601[1]?$|^65[0-9][0-9]?$|^6(?:011|5[0-9]{2})[0-9]{0,12}$'); 6666 //JCB 6667 jcb_regex = new RegExp('^2[1]?$|^21[3]?$|^1[8]?$|^18[0]?$|^(?:2131|1800)[0-9]{0,11}$|^3[5]?$|^35[0-9]{0,14}$'); 6668 6669 // get rid of spaces and dashes before using the regular expression 6670 cur_val = cur_val.replace(/ /g, '').replace(/-/g, ''); 6671 6672 // checks per each, as their could be multiple hits 6673 if (cur_val.match(visa_regex)) { 6674 sel_brand = "visa"; 6675 } else if (cur_val.match(mastercard_regex)) { 6676 sel_brand = "mastercard"; 6677 } else if (cur_val.match(maestro_regex)) { 6678 sel_brand = "maestro"; 6679 } else if (cur_val.match(amex_regex)) { 6680 sel_brand = "amex"; 6681 } else if (cur_val.match(diners_regex)) { 6682 sel_brand = "diners_club"; 6683 } else if (cur_val.match(discover_regex)) { 6684 sel_brand = "discover"; 6685 } else if (cur_val.match(jcb_regex)) { 6686 sel_brand = "jcb"; 6687 } else { 6688 sel_brand = "unknown"; 6689 } 6690 6691 return sel_brand; 6692} 6693 6694function fixedSideBarScrollTop() { 6695 //setTimeout(function () { 6696 // $(".fixedSideBar").css("top", $(".fixedSideBar").offset().top - $(".divPurhaceItems:first").height() - 20); 6697 //}, 500); 6698 //Mantis: #22280 6699 window.scrollBy(0, -500); 6700} 6701 6702$("body").on("keypress", "#frmMembershipSearch", function (e) { 6703 kCode = e.keyCode || e.charCode 6704 if (kCode == 13) { 6705 membershipList(); 6706 return false; 6707 } 6708}); 6709 6710function membershipList() { 6711 var search = $("#txtMembershipSearch").val(); 6712 var groupTypeName = $("#txtMembershipSearch").attr("data-groupTypeName"); 6713 search = encodeURIComponent(search); 6714 if (groupTypeName != "") { 6715 window.location.href = '/grouptype/' + groupTypeName + '?q=' + search; 6716 } 6717 else { 6718 window.location.href = '/search/membershiptypeslist?q=' + search; 6719 } 6720} 6721$("body").on("click", "#btnClearTxtbox", function () { 6722 $("#txtMembershipSearch").val(""); 6723 membershipList(); 6724}); 6725$("body").on("click", "#btnSearchGroupType", function () { 6726 membershipList(); 6727}); 6728 6729$("body").on('click', '.popManualRenewal', function () { 6730 var isAutoPayer = $(this).attr("data-isautopayer"); 6731 var isACHPayment = $(this).attr("data-isACHPayment"); 6732 if (isAutoPayer && isAutoPayer.toLocaleLowerCase() == "true") { 6733 DisplayCardOnFile($(this).attr("data-href"), isACHPayment); 6734 } 6735 else { 6736 ManualRenewalPopup($(this).attr("data-href")); 6737 return false; 6738 } 6739}); 6740 6741function ManualRenewalPopup(url, useCardOnFile) { 6742 url = url + "&IsUseCardOnFile=" + (useCardOnFile || false); 6743 openPopup(url); 6744 return false; 6745} 6746 6747function DisplayCardOnFile(url, isACHPayment) { 6748 var contentMessage = "A credit card has been authorized to be used for recurring payments. Would you like to use this payment method to process any outstanding invoices? " 6749 if (isACHPayment && isACHPayment.toLocaleLowerCase() == "true") { 6750 contentMessage = "ACH/eCheck has been authorized to be used for recurring payments. Would you like to use this payment method to process any outstanding invoices? " 6751 } 6752 $.confirm({ 6753 title: 'Use Payment Method on File?', 6754 boxWidth: '500px', 6755 useBootstrap: false, 6756 type: 'green', 6757 content: '<span style="font-size: 14px;margin-top:20px;">' + contentMessage + '</span>', 6758 buttons: { 6759 ok: { 6760 text: "Yes", 6761 btnClass: 'btn-success', 6762 action: function () { 6763 ManualRenewalPopup(url, true); 6764 } 6765 }, 6766 cancel: { 6767 text: 'No', 6768 btnClass: 'btn-danger', 6769 action: function () { 6770 ManualRenewalPopup(url, false); 6771 } 6772 } 6773 } 6774 }); 6775} 6776 6777function openPopup(url) { 6778 $.magnificPopup.open({ 6779 items: { 6780 src: url 6781 }, 6782 type: 'iframe', 6783 closeOnBgClick: false, 6784 mainClass: 'poprenewManually' 6785 });
6786 return false; 6787} 6788 6789 6790//#region mantis item #19014 6791$("body").on('click', '.btnPendingInvoiceRetryPayment', function () { 6792 var customerMembershipId = $(this).attr("data-customerMembershipId"); 6793 $.confirm({ 6794 title: 'Retry Payment', 6795 content: '<p>The Retry Payment will just check, whether the pending payment has received or not.</p>', 6796 type: 'green', 6797 useBootstrap: true, 6798 buttons: { 6799 YES: { 6800 btnClass: 'btn-success', 6801 action: function () { retryPendingInvoicePayments(customerMembershipId); } 6802 }, 6803 NO: { 6804 btnClass: 'btn-warning' 6805 } 6806 } 6807 }); 6808}); 6809 6810function retryPendingInvoicePayments(customerMembershipId, isManulaPayment) { 6811 6812 if (!customerMembershipId) { return false; } 6813 6814 $('#divProgress').show(); 6815 //check the payment is received or not 6816 $.post(RETRY_PENDING_INVOICE_PAYMENTS, { "customerMembershipId": customerMembershipId, "isManulaPayment": isManulaPayment }, function (data) { 6817 $('#divProgress').hide(); 6818 6819 if (!data || !data.success) { 6820 if (data.errorMessage) alert(data.errorMessage); 6821 6822 return false; 6823 } 6824 6825 //manually pay the invoice 6826 function manuallyPayPendingInvoice(customerMembershipId) { 6827 //Pay selected invoices 6828 if (!isValidPayNowForSeleted()) { return false; } 6829 6830 //first deactivate the payment profile and then proceed 6831 $.post(DEACTIVATE_MEMBERSHIP_PAYMENT_PROFILE, { "customerMembershipId": customerMembershipId }, function (data) { 6832 $('#divProgress').hide(); 6833 //profile not deactivated successfully. 6834 if (!data) { alert("Your payment profile has not been deactivated successfully. Please try again or contact support."); return false; } 6835 6836 //add invoice to the cart and proceed further 6837 var pageName = $(this).attr("data-pageName"); 6838 var paymentIds = $("input[type='checkbox'][class='chkSelect-FuturePayment']:checked").map(function () { return $(this).val() }).get().join(','); 6839 AddToCartPayments(customerMembershipId, paymentIds, pageName); 6840 6841 }); 6842 6843 } 6844 6845 if (isManulaPayment && data.isPendingPayment === true) { 6846 manuallyPayPendingInvoice(customerMembershipId); 6847 } 6848 else { 6849 window.location.reload(); 6850 } 6851 6852 }); 6853} 6854 6855$("body").on('click', '.btnPendingInvoiceManualPayment', function () { 6856 var customerMembershipId = $(this).attr("data-customerMembershipId"); 6857 6858 //Pay selected invoices 6859 if (!isValidPayNowForSeleted()) { return false; } 6860 6861 $.confirm({ 6862 title: 'Pay Manually', 6863 content: '<p>It will deactivate your current payment profile. It allows paying manually all the pending selected invoices.</p>', 6864 type: 'red', 6865 useBootstrap: true, 6866 buttons: { 6867 YES: { 6868 btnClass: 'btn-red', 6869 action: function () { retryPendingInvoicePayments(customerMembershipId, true); } 6870 }, 6871 NO: { 6872 btnClass: 'btn-warning' 6873 } 6874 } 6875 }); 6876}); 6877 6878//#endregion mantis item #19014 6879 6880$("body").on("click", ".showMoreFaculty", function () { 6881 var $this = $(this); 6882 $this.closest(".facultyList").find(".moreFacultyList").toggleClass("hidden"); 6883 6884 if (!$this.closest(".facultyList").find(".moreFacultyList").hasClass("hidden")) { 6885 $this.text('- Less'); 6886 } 6887 else { 6888 $this.text('+ More'); 6889 } 6890}); 6891 6892$('body').on('click', '.previewInfo', function () { 6893 $.alert({ 6894 title: 'Preview Viewer', 6895 content: $(".clsPreviewTextModel").html(), 6896 useBootstrap: false, 6897 boxWidth: '800px', 6898 backgroundDismiss: true, 6899 buttons: { 6900 cancel: { 6901 text: 'Close', 6902 btnClass: 'btn-default' 6903 } 6904 } 6905 }); 6906}); 6907
6908function edgeBrowserLaunch() { 6909 window.location = 'microsoft-edge:' + window.location; 6910 setTimeout(function () { 6911 window.location = 'https://www.microsoft.com/en-us/edge?browser=Chrome&FORM=MG0AU2'; 6912 }, 100); 6913} 6914 6915$("body").on("click", ".clsLaunchPurchasedSeminar", function () { 6916 var $this = $(this); 6917 var URL = $(this).attr("href"); 6918 6919 if (!URL) return; 6920 if (URL.toLowerCase() == "javascript:void(0);" || URL.toLowerCase() == "javascript:void(0)") { return; } 6921 6922 if ($this.attr("data-ProductId")) { 6923 launchPurchasedProduct($this, URL); 6924 } 6925 6926 return false; 6927}); 6928 6929 6930function launchPurchasedProduct($this, URL) { 6931 6932 $.ajax({ 6933 url: URL, 6934 type: 'GET', 6935 dataType: 'json', 6936 success: function (data) { 6937 if (data.Success === false && data.ErrorMessage) { 6938 alert(data.ErrorMessage); 6939 return; 6940 } 6941 6942 if (data.Success === true) { 6943 if (data.IsOpenPopup !== undefined && data.IsOpenPopup === true) { 6944 6945 if ($this.hasClass("clsLaunchModel")) { 6946 if (data.PopupClass) { 6947 parent.parent.$(".mfp-bg.mfp-ready").addClass(data.PopupClass).removeClass("CustomPop"); 6948 parent.parent.$(".mfp-wrap.mfp-ready").addClass(data.PopupClass).removeClass("CustomPop"); 6949 parent.parent.$(".mfp-content").removeAttr("style"); 6950 } 6951 window.location = data.RedirectURL; 6952 return; 6953 } 6954 6955 $.magnificPopup.open({ 6956 items: { 6957 src: data.RedirectURL 6958 }, 6959 type: 'iframe', 6960 closeOnBgClick: false, 6961 mainClass: data.PopupClass || 'popQuickLaunchMainClass' 6962 }); 6963 return false; 6964 } 6965 else if (data.OpenInNewTab !== undefined && data.OpenInNewTab === true && !isIOsSafari()) { 6966 var pop = window.open(data.RedirectURL, '_blank'); 6967 if (!pop) { 6968 window.top.location = data.RedirectURL; //if popup is blocked by the browser open in same tab 6969 } 6970 if ($this.hasClass("clsLaunchModel")) { 6971 parent.$.magnificPopup.close(); 6972 } 6973 } else { 6974 if ($this.hasClass("clsLaunchModel") || $this.text() == 'View in Account' || data.RedirectURL.toLowerCase() == '/account/myaccount') { 6975 window.top.location = data.RedirectURL; 6976 parent.$.magnificPopup.close(); 6977 } 6978 else { 6979 window.location = data.RedirectURL; 6980 } 6981 } 6982 } 6983 } 6984 }); 6985} 6986 6987$("body").on('click', '.popUpdateQuestionset', function () { 6988 parent.$('.mfp-bg,.mfp-ready').removeClass("pop700").addClass('CustomPop'); 6989 $.magnificPopup.open({ 6990 items: { 6991 src: $(this).attr("href") 6992 }, 6993 type: 'iframe', 6994 closeOnBgClick: false, 6995 callbacks: { 6996 close: function () { 6997 parent.$('.mfp-bg,.mfp-ready').removeClass("CustomPop").addClass('pop700'); 6998 } 6999 }, 7000 mainClass: 'poprenewManually', 7001 }) 7002 7003 return false; 7004}); 7005 7006$("body").on('change', 'input[type=radio].addressQuestionRadio', function () { 7007 var questionId = $(this).attr("data-questionid") || ""; 7008 $('#IsAddressBlockQuestion' + questionId).attr('data-selectedvalue', $(this).val()) 7009 $('#addressRadioerror' + questionId).text('').removeClass("field-validation-error").addClass("field-validation-Valid"); 7010}); 7011 7012$("body").on("keypress", ".searchByEnter", function (e) { 7013 7014 kCode = e.keyCode || e.charCode //for cross browser 7015 if (kCode == 13) { 7016 var defaultbtn = $(this).attr("data-DefaultButton"); 7017 $("#" + defaultbtn).click(); 7018 return false; 7019 } 7020});
7021function validateUploadingFile(param, disableButtons) { 7022 var fileExtension = ['gif', 'jpeg', 'jpg', 'png', '.ico', 'bmp', 'webp', 'avif']; 7023 var fUpload = $('#' + param); 7024 if (fUpload[0].files.length > 0) { 7025 if ($.inArray(fUpload.val().split('.').pop().toLowerCase(), fileExtension) == -1) { 7026 $("#rfvFile").html("File upload is limited to the following formats (e.g - gif, jpeg, jpg, png, ico, bmp, webp or avif )").css("color", "red").addClass("field-validation-error"); 7027 $(disableButtons).attr("disabled", "disabled"); 7028 } 7029 else { 7030 $("#rfvFile").html("").removeClass("field-validation-error"); 7031 $(disableButtons).removeAttr("disabled"); 7032 } 7033 } 7034 else { 7035 $("#rfvFile").html("").removeClass("field-validation-error"); 7036 $(disableButtons).removeAttr("disabled"); 7037 } 7038} 7039 7040$("body").on("change", ".socialmedia", function () { 7041 7042 var count = 0; 7043 var urlRegex = /^(http(s)?:\/\/)?([\w-]+\.)+[\w-]+(:[0-9]{1,5})?(\/[\w- .\/?%&=+#]*)?$/i; 7044 var url = $(this).val(); 7045 7046 var $element = $('#divProdNotActiveMessageOnFirstRegistration'); 7047 var isUnPublishAlert = $element.length > 0 ? $element.is(':hidden') : true; 7048 7049 if (url) { 7050 if (!urlRegex.test(url)) { 7051 $(':submit').attr("disabled", "disabled"); 7052 alert("Invalid Url. Please Enter Url in proper Format"); 7053 $(this).focus(); 7054 } 7055 else if (isUnPublishAlert) { 7056 $(':submit').removeAttr("disabled"); 7057 } 7058 } 7059 $(".socialmedia").each(function () { 7060 if ($(this).val() && !urlRegex.test($(this).val())) { 7061 count += 1; // here is the validation condition 7062 } 7063 else if ($(this).val()) { 7064 var spanId = $(this).prop('id'); 7065 $("#" + spanId + "errorMsg").text(""); 7066 $(this).css("border-color", "#ccc"); 7067 } 7068 }); 7069 if (count > 0 || !isUnPublishAlert) { 7070 $(':submit').attr("disabled", "disabled"); 7071 } 7072 else { 7073 $(':submit').removeAttr("disabled"); 7074 } 7075}); 7076 7077 7078jQuery.fn.extend({ 7079 serializeJSONObj: function () { 7080 var fields = this.serializeArray(), 7081 keys = {}; 7082 7083 fields.map(function (x, i) { 7084 if (keys[x.name]) { 7085 keys[x.name] = keys[x.name] + ',' + x.value 7086 } 7087 else { 7088 keys[x.name] = x.value 7089 } 7090 }); 7091 7092 return keys; 7093 } 7094}); 7095 7096//mantis #21829 - Sales > Bundles > Display Purchase CE within Bundles - START 7097// #region CE Credit Purchase 7098$("body").on("click", ".btnBundle05AddCECredittoCart", function () { 7099 var productId = $(this).attr('data-productId'); 7100 if ($("#divPurchaseCECreditmodal").length > 0) { 7101 $("#divPurchaseCECreditmodal").modal("hide"); 7102 } 7103 $.ajax({
7104 type: "POST", 7105 url: BUNDLE_TYPE_5_ADD_CECREDITTOCART_URL, 7106 dataType: "json", 7107 data: { 7108 'productId': productId 7109 }, 7110 success: function (data) { 7111 LoadCustomerBundleProductList(); 7112 }, 7113 complete: function (data) { 7114 }, 7115 error: function (data) { 7116 alert('Error! Please try again later.'); 7117 } 7118 }); 7119}); 7120 7121$("body").on("click", ".btnBundle05CloseAddCECredittoCart", function () { 7122 LoadCustomerBundleProductList(); 7123}); 7124 7125//display purchase CE popup modal 7126var displayBundlePurchaseCEMessage = function (bundleId) { 7127 $.get(BUNDLE_GET_PURCHASE_CE_PRICE_POPUP + '?bundleId=' + bundleId, function (dataPurchaseCEHtml) { 7128 if ($('#divBundlePurchaseCECreditmodal').length > 0) { 7129 $('#divBundlePurchaseCECreditmodal').remove(); 7130 } 7131 $('body').append(dataPurchaseCEHtml); 7132 $("#divBundlePurchaseCECreditmodal").modal(); 7133 return false; 7134 }); 7135} 7136 7137$("body").on("click", ".chkAllBundleCECreditPurchase", function () { 7138 var chkAll = this; 7139 $('#divBundlePurchaseCECreditmodal').find("input[type='checkbox'][class='chkBundleCECreditPurchase']:not(:disabled)").each(function () { 7140 $(this).prop('checked', chkAll.checked); 7141 }); 7142}); 7143 7144$("body").on("click", ".chkBundleCECreditPurchase", function () { 7145 $(".chkAllBundleCECreditPurchase").prop("checked", $(".chkBundleCECreditPurchase:checkbox").length === $(".chkBundleCECreditPurchase:checkbox:checked").length); 7146}); 7147 7148// #region CE Credit Purchase 7149$("body").on("click", ".btnBundleAddCECredittoCart", function () { 7150 var bundleId = $(this).attr("data-bundleId") 7151 var productids = []; 7152 if ($('#divBundlePurchaseCECreditmodal').find(".chkBundleCECreditPurchase:checkbox:checked").length > 0) { 7153 $('#divBundlePurchaseCECreditmodal').find(".chkBundleCECreditPurchase:checkbox:checked").each(function () { 7154 productids.push($(this).attr("data-productid")); 7155 var ele = $(".clsBundleDiv").closest("[data-bundleid='" + bundleId + "']"); 7156 var hdnTotal = $(ele).find(".hdnTotal").val(); 7157 var newPrice = $(this).attr("data-price"); 7158 var newval = parseFloat(hdnTotal) + parseFloat(newPrice) 7159 $(ele).find(".hdnTotal").val(newval.toFixed(2)); 7160 $(ele).find(".spnTotal").html($(ele).find(".hdnTotal").val()).addClass("dollarsign"); 7161 }); 7162 } 7163 else { 7164 alert("Please select atleast one " + $("#CustomPurchaseCECreditTitle").val() + ""); 7165 return false; 7166 } 7167 7168 if ($("#divBundlePurchaseCECreditmodal").length > 0) { 7169 $("#divBundlePurchaseCECreditmodal").modal("hide"); 7170 } 7171 7172 $.ajax({
7173 type: "POST", 7174 url: BUNDLE_ADD_CECREDITTOCART_URL, 7175 dataType: "json", 7176 data: { 7177 'productIds': productids, 'bundleId': bundleId 7178 }, 7179 success: function (data) { 7180 if (data.isSendCustomerToCart != undefined && data.isSendCustomerToCart == true) { 7181 window.parent.location.href = '/shoppingcart'; 7182 return false; 7183 } 7184 7185 if (data.CartCount != null && data.CartCount != "" && data.CartCount != "0") { 7186 parent.$("#cartspancount").html(data.CartCount); 7187 parent.$("#cartItemList").load('/shoppingcart/getcart'); 7188 } 7189 7190 if (typeof backtoParent === "function" && productids.length > 0) { 7191 backtoParent(productids[0], data.Message); 7192 } 7193 7194 }, 7195 complete: function (data) { 7196 }, 7197 error: function (data) { 7198 alert('Error! Please try again later.'); 7199 } 7200 }); 7201}); 7202 7203$("body").on("click", ".btnBundleCloseAddCECredittoCart", function () { 7204 var isSendTocart = $(this).attr('data-isSendCustomerCart'); 7205 7206 if (isSendTocart != undefined && isSendTocart == "True") { 7207 parent.window.location.href = '/ShoppingCart'; 7208 } 7209}); 7210 7211//mantis #21829 - Sales > Bundles > Display Purchase CE within Bundles - END 7212 7213//#21763 7214$("body").on('change', 'input[type=radio].addressQuestionSetRadio', function () { 7215 var questionId = $(this).attr("data-questionid") || ""; 7216 $(this).parents('#QuestionSetExistingAddress' + questionId).attr('data-selectedvalue', $(this).val()); 7217}); 7218 7219$("body").on("click", ".questionSetAddressType", function (e) { 7220 var $this = $(this); 7221 $.magnificPopup.open({ 7222 items: { 7223 src: $this.attr("data-href") 7224 }, 7225 type: 'iframe', 7226 closeOnBgClick: false, 7227 mainClass: 'popEditAddressMainClass', 7228 callbacks: { 7229 beforeClose: function () { 7230 $this.prop("checked", false); 7231 } 7232 } 7233 }); 7234 return false; 7235}); 7236 7237function loadCustomerAddressListForQuestionSet(questionId, addressId) { 7238 7239 if ($(".divQuestionSetAddress").length <= 0) return false; 7240 7241 $(".divQuestionSetAddress").each(function () { 7242 var $this = $(this); 7243 var divQuestionId = $this.attr("data-questionid") || 0; 7244 var isRequired = $this.attr("data-isRequired") || false; 7245 var customerCustomFieldId = $this.attr("data-entityId") || 0; 7246 var isCurrentQuestion = divQuestionId > 0 && (questionId || 0) > 0 && divQuestionId == questionId; 7247 var selectedAddressId = isCurrentQuestion ? (addressId || 0) : $this.find(".divExistingAddress").attr("data-selectedvalue"); 7248 var isExistingAddressSelected = $this.find(".questionSetAddressType[value='ExistingAddress']").is(':checked'); 7249 7250 $this.load('/Account/GetQuestionSetAddressDetails?questionId=' + divQuestionId + '&addressId=' + selectedAddressId + '&isRequired=' + isRequired + '&customerCustomFieldId=' + customerCustomFieldId, function () { 7251 if (isCurrentQuestion) { 7252 $this.find(".questionSetAddressType[value='ExistingAddress']").trigger("change"); 7253 } 7254 7255 if (isExistingAddressSelected) { 7256 $this.find(".divExistingAddress").show(); 7257 } 7258 }).prepend("<p class='loaderTxt'>Please wait ...</p>"); 7259 }); 7260} 7261 7262//#21771
7263$("body").on("click", ".unlinkCustomAddress", function () { 7264 if (confirm("Are you sure want to unlink this address?")) { 7265 var id = $(this).attr("data-id"); 7266 var editAddressPopupType = $(this).attr('data-editAddressPopupType'); 7267 var entityType = $(this).attr("data-entityType"); 7268 7269 if (id) { 7270 $('#divProgress').show(); 7271 $.post('/Account/UnlinkCustomAddress', { id: id, entityType: entityType }, function (data) { 7272 addressMethod(editAddressPopupType); 7273 $('#divProgress').hide(); 7274 }); 7275 } 7276 } 7277}); 7278 7279//pagging for New Single Column Upcoming Live Programs Widget in Catalog - #21544 7280$("body").on("click", ".datatables_paginate_single_upcoming_live_widget >.pagination a", function () { 7281 var url = $(this).attr('href'); 7282 var upcomingPageWidgetId = 0; 7283 if ($(this).closest('.grid-list-singlecol').find("#UpcomingPageWidgetId").length > 0) { 7284 upcomingPageWidgetId = $(this).closest('.grid-list-singlecol').find("#UpcomingPageWidgetId").val(); 7285 } 7286 $(".divSingleUpcomingLiveWidget-" + upcomingPageWidgetId + "").load(url, function () { 7287 $('.scheduleAtGlance').popover({ trigger: 'hover', placement: 'top' }) 7288 .on("show.bs.popover", function () { 7289 return $(this).data("bs.popover").tip().css({ "width": "fit-content", "max-width": "500px" }); 7290 }); 7291 }); 7292 return false; 7293}); 7294 7295 7296//#21994 Start 7297function ConfirmRegistrantDiscount(couponCode, couponId, inValidRegistrants, message, registrantsDiscountMessageType) { 7298 7299 //#22585 7300 if (registrantsDiscountMessageType != 'Default') { 7301 7302 switch (registrantsDiscountMessageType) { 7303 case "AssignLater": 7304 message = message + " We cannot allow you to assign these later as we need to validate who those registrants are at this time."; 7305 break; 7306 case "NoRegistrantsInTheCart": 7307 message = message + " You must register the registrants, then you will be able to apply the discount on next step."; 7308 break; 7309 case "AllRegistrantsAreInValid": 7310 message = " This discount is limited to specific registrants. The additional registrants not included in the discount will need to be registered in a separate transaction and will be removed from this order."; 7311 } 7312 7313 $.confirm({ 7314 title: '', 7315 boxWidth: '500px', 7316 useBootstrap: false, 7317 type: 'green', 7318 content: message, 7319 buttons: { 7320 ok: { 7321 text: 'Ok', 7322 btnClass: 'btn-success' 7323 } 7324 } 7325 }); 7326 } 7327 else { 7328 $.confirm({ 7329 title: '', 7330 boxWidth: '500px', 7331 useBootstrap: false, 7332 type: 'green', 7333 content: message, 7334 buttons: { 7335 ok: { 7336 text: 'Continue', 7337 btnClass: 'btn-success', 7338 action: function () { 7339 RemoveInvalidRegistrants(couponCode, couponId, inValidRegistrants); 7340 if ($('#currentCartStage').val() == 'RegistrantConfirmation') { 7341 if (couponId) { 7342 applyGlobalDiscount(couponId); 7343 } 7344 else { 7345 ApplyDiscountCode(couponCode); 7346 } 7347 } 7348 } 7349 }, 7350 cancel: { 7351 text: 'Cancel Discount', 7352 btnClass: 'btn-warning', 7353 action: function () { 7354 } 7355 } 7356 } 7357 }); 7358 } 7359} 7360 7361function RemoveInvalidRegistrants(couponCode, discountId, inValidRegistrants) { 7362 if ($('#currentCartStage').val() == 'RegistrantConfirmation') { 7363 let lstRegistrantEmail = inValidRegistrants.split(','); 7364 $.each(lstRegistrantEmail, function (e, i) { 7365 $.each($('.clsEmailAddress'), function () { 7366 if ($(this).val() == i) { 7367 var isPurchaserEmail = $(this).closest(".row").parent('.divPurchaseSection.clsInputPortion').find('#chkPurchaser')
7368 $(this).closest(".row").find('input:text').val('').trigger('change'); 7369 if (isPurchaserEmail) { 7370 $(isPurchaserEmail).prop('checked', 'checked').trigger('change'); 7371 } 7372 7373 } 7374 }); 7375 }); 7376 } 7377 else { 7378 $.post('/ShoppingCart/RemoveInvalidRegistrants', { inValidRegistrants: inValidRegistrants }, function (data) { 7379 if (couponCode) { 7380 $("#txtCouponCode").val(couponCode); 7381 $(".btnCouponShoppingCart").trigger('click'); 7382 } 7383 else if (discountId) { 7384 applyGlobalDiscount(discountId); 7385 } 7386 ISRELOADPAGE = true; 7387 }); 7388 } 7389} 7390//#21994 End 7391 7392//#Start Region 21323: Enhancement: Catalog Mobile Updates 7393 7394// Prepend back button to sub menu(s) 7395$('.nav__item .nav__sub').prepend('<li class="nav__item"><a class="nav__link sub__close" href="#"><i class="fa fa-chevron-left"></i> Back</a></li>'); 7396 7397// Close out sub menu 7398$('.sub__close').click(function (e) { 7399 e.preventDefault(); 7400 7401 $(this).parent().parent().removeClass('is-active'); 7402}); 7403 7404// Trigger sub menu 7405$('.drop-link .nav__item_i, .nav__item .nav__link').click(function (e) { 7406 e.preventDefault(); 7407 7408 $(this).siblings().addClass('is-active'); 7409}); 7410 7411//#end Region 7412 7413// 22459 Set and Collect Cookie 7414function setCookie(cname, cvalue, exdays) { 7415 const d = new Date(); 7416 if (exdays > 0) { 7417 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 7418 let expires = "expires=" + d.toUTCString(); 7419 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 7420 } else { 7421 document.cookie = cname + "=" + cvalue + ";path=/"; 7422 } 7423} 7424 7425function getCookie(cname) { 7426 let name = cname + "="; 7427 let ca = document.cookie.split(';'); 7428 for (let i = 0; i < ca.length; i++) { 7429 let c = ca[i]; 7430 while (c.charAt(0) == ' ') { 7431 c = c.substring(1); 7432 } 7433 if (c.indexOf(name) == 0) { 7434 return c.substring(name.length, c.length); 7435 } 7436 } 7437 return ""; 7438} 7439 7440function getURLParameter(url, name) { 7441 return (RegExp(name + '=' + '(.+?)(&|$)').exec(url) || [, null])[1]; 7442} 7443 7444$("body").on('click', '.pop700', function () { 7445 $.magnificPopup.open({ 7446 items: { 7447 src: $(this).attr("href") 7448 }, 7449 type: 'iframe', 7450 closeOnBgClick: true, 7451 mainClass: 'pop700' 7452 }); 7453 return false; 7454}); 7455 7456function isHTML(str) { 7457 var a = document.createElement('div'); 7458 a.innerHTML = str; 7459 7460 for (var c = a.childNodes, i = c.length; i--;) { 7461 if (c[i].nodeType == 1) return true; 7462 } 7463 7464 return false; 7465} 7466 7467//0022254 7468function validateAddressField(frmId) { 7469 if ($("#" + frmId + " #OtherState:visible").length > 0 && $("#" + frmId + " #OtherState:visible").attr("required") != undefined) { 7470 var fieldVal = $("#" + frmId + " #OtherState:visible").val(); 7471 if (fieldVal != undefined && (fieldVal.length <= 0 || $.trim(fieldVal).length <= 0)) { 7472 validateAddressFieldWithErrorMsg($("#" + frmId + " #OtherState:visible")); 7473 return false; 7474 } 7475 } 7476 if ($("#" + frmId + " #PostalCode:visible").length > 0 && $("#" + frmId + " #PostalCode:visible").attr("required") != undefined && $("#" + frmId + " #PostalCode:visible").parent().find(".help-block").length <= 0) { 7477 var fieldVal = $("#" + frmId + " #PostalCode:visible").val(); 7478 if (fieldVal.length <= 0 || $.trim(fieldVal).length <= 0) { 7479 validateAddressFieldWithErrorMsg($("#" + frmId + " #PostalCode:visible")); 7480 return false; 7481 } 7482 } 7483 if ($("#" + frmId + " #Address2:visible").length > 0 && $("#" + frmId + " #Address2:visible").attr("required") != undefined) { 7484 var fieldVal = $("#" + frmId + " #Address2:visible").val(); 7485 if (fieldVal.length <= 0 || $.trim(fieldVal).length <= 0) { 7486 validateAddressFieldWithErrorMsg($("#" + frmId + " #Address2:visible")); 7487 return false; 7488 } 7489 }
7490 if ($("#" + frmId + " #City:visible").length > 0 && $("#" + frmId + " #City:visible").attr("required") != undefined) { 7491 var fieldVal = $("#" + frmId + " #City:visible").val(); 7492 if (fieldVal.length <= 0 || $.trim(fieldVal).length <= 0) { 7493 validateAddressFieldWithErrorMsg($("#" + frmId + " #City:visible")); 7494 return false; 7495 } 7496 } 7497 if ($("#" + frmId + " #Address:visible").length > 0 && $("#" + frmId + " #Address:visible").attr("required") != undefined) { 7498 var fieldVal = $("#" + frmId + " #Address:visible").val(); 7499 if (fieldVal.length <= 0 || $.trim(fieldVal).length <= 0) { 7500 validateAddressFieldWithErrorMsg($("#" + frmId + " #Address:visible")); 7501 return false; 7502 } 7503 } 7504 if ($("#" + frmId + " #Address1:visible").length > 0 && $("#" + frmId + " #Address1:visible").attr("required") != undefined) { 7505 var fieldVal = $("#" + frmId + " #Address1:visible").val(); 7506 if (fieldVal.length <= 0 || $.trim(fieldVal).length <= 0) { 7507 validateAddressFieldWithErrorMsg($("#" + frmId + " #Address1:visible")); 7508 return false; 7509 } 7510 } 7511 if ($("#" + frmId + " #AddressLabel:visible").length > 0 && $("#" + frmId + " #AddressLabel").attr("required") != undefined) { 7512 var fieldVal = $("#" + frmId + " #AddressLabel").val(); 7513 if (fieldVal.length <= 0 || $.trim(fieldVal).length <= 0) { 7514 validateAddressFieldWithErrorMsg($("#" + frmId + " #AddressLabel")); 7515 return false; 7516 } 7517 } 7518 if ($("#" + frmId + " #County:visible").length > 0 && $("#" + frmId + " #County:visible").attr("required") != undefined && $("#" + frmId + " #County:visible").parent().find(".help-block").length <= 0) { 7519 var fieldVal = $("#" + frmId + " #County:visible").val(); 7520 if (fieldVal != undefined && (fieldVal.length <= 0 || $.trim(fieldVal).length <= 0)) { 7521 validateAddressFieldWithErrorMsg($("#" + frmId + " #County:visible")); 7522 return false; 7523 } 7524 } 7525 return true; 7526} 7527 7528function validateAddressFieldWithErrorMsg(element) { 7529 var elementId = element.attr("id"); 7530 element.closest(".form-group").addClass("has-error"); 7531 element.next("#fieldErrorMsg").html(""); 7532 if ($("#" + elementId + "-error").length <= 0) { 7533 element.after('<span id="fieldErrorMsg" style="color:#a94442;font-weight: bold;"> This field is required </span>'); 7534 } 7535} 7536 7537function CheckGiftCardCodeAlerdayApplied(GiftCardCode) { 7538 $.ajax({
7539 type: "GET", 7540 url: CHECK_GIFT_CARD_CODE_ALERDAY_APPLIED_URL, 7541 dataType: "json", 7542 data: { 7543 'giftCardCode': GiftCardCode, 7544 }, 7545 success: function (data) { 7546 if (data != null && data.IsExist) { 7547 alert(data.Message); 7548 $('#txtCouponCode').val(''); 7549 } 7550 else { 7551 ApplyGiftCard(GiftCardCode); 7552 } 7553 }, 7554 error: function (data) { 7555 return false; 7556 } 7557 }); 7558} 7559 7560//23621 - 7561function QuestionSetCompanyConformation(frmid) { 7562 var ActiveCBM = false; 7563 var CBMOwner = false; 7564 if ($("#ActiveCBM").val() == "True") { 7565 ActiveCBM = true; 7566 } 7567 if ($('#IsCBMOwner').val() == "True") { 7568 CBMOwner = true; 7569 } 7570 if ($("#" + frmid).valid() && ($(".autoCompleteCompanyName").length == 1 || $("select.dropQsetCompanyName").length == 1) && ActiveCBM) { 7571 var OldCompanyName = ($(".autoCompleteCompanyName").length == 1 ? $(".autoCompleteCompanyName").attr('data-answer') : $("select.dropQsetCompanyName").attr('data-answer')); 7572 var IsEnableCompanyDrop = ($(".autoCompleteCompanyName").length == 1 ? false : ($("select.dropQsetCompanyName").length == 1 ? true : false)); 7573 var CompanyName = ""; 7574 var othercompanyid = ""; 7575 if (IsEnableCompanyDrop) { 7576 if ($("select.dropQsetCompanyName").val() == "-1") { 7577 othercompanyid = "OtherCompany_" + $("select.dropQsetCompanyName").attr("id"); 7578 CompanyName = $("#" + othercompanyid).val(); 7579 } else { 7580 CompanyName = $("select.dropQsetCompanyName").val(); 7581 } 7582 } else { 7583 CompanyName = $(".autoCompleteCompanyName").val(); 7584 } 7585 7586 const details = { 7587 hasActiveCBM: ActiveCBM, 7588 IsCBMOwner: CBMOwner, 7589 EncryptedCompanyId: $("#EncryptedCompanyId").val(), 7590 CustomerId: $("#hdnCustomerId").val(), 7591 CustomerMembershipId: parseInt($("#CBMCustomerMembershipId").val()), 7592 OldCompanyName: OldCompanyName, 7593 CompanyName: CompanyName, 7594 pageName: 'ParentQuestionSet', 7595 formid: frmid, 7596 buttonid: '' 7597 }; 7598 7599 if (OldCompanyName != '' && OldCompanyName != CompanyName) { 7600 ChangeCompanyConfirmation(details); 7601 } else { 7602 $("#" + frmid).submit(); 7603 } 7604 } else { 7605 $("#" + frmid).submit(); 7606 } 7607}; 7608 7609//#23067 7610function GetRegistrantEmails() { 7611 var emailAddress = ''; 7612 if ($('#currentCartStage').val() == 'PersonalInfo') { 7613 emailAddress = email 7614 } else if ($('#currentCartStage').val() == 'RegistrantConfirmation') { 7615 emailAddress = $.map($('.clsEmailAddress'), function (e) { 7616 if ($(e).val()) { 7617 return $(e).val(); 7618 } 7619 }).join(","); 7620 } 7621 return emailAddress; 7622} 7623function GetPurchaserCustomerId() { 7624 return (($('#chkPurchaser').is(':checked')) ? ($(".purchaserEmail").closest(".clsInputPortion").find("input[name='Email']").attr('data-purchasercustomerid')) : ''); 7625} 7626 7627 7628//#23969 7629var SaveRequestInfoByCustomerOrderItemId = function (orderItemId, customerEmail, isAgendaRequestInfo) { 7630 var divOrderItemId = $('#OrderItemId[value="' + orderItemId + '"]').closest('.divFullRegConfirmation'); 7631 7632 if (divOrderItemId.hasClass("consolidateRegistrant")) { 7633 $(divOrderItemId).find('.purchaserEmail').attr('data-RequestQuestionSet', true); 7634 $(divOrderItemId).find('.purchaserEmail').attr('data-IsAddRegTypeId', true); 7635 } 7636 else { 7637 $(divOrderItemId).find('.registrantInfo').each(function (e, d) { 7638 if ($(this).find('.registrantEmail').val() == customerEmail) { 7639 if (!isAgendaRequestInfo) { 7640 $(this).find('.registrantEmail').attr('data-RequestQuestionSet', true); 7641 $(this).find('.registrantEmail').attr('data-IsAddRegTypeId', true); 7642 } 7643 else { 7644 $(this).find('.registrantEmail').attr('data-RequestAgenda', true); 7645 } 7646 } 7647 }); 7648 } 7649}; 7650 7651//Monday: 6480813440 7652function QuestionSetForChildQuestionSet(frmid, buttonid) { 7653 var formdetails = buttonid.closest("#" + frmid); 7654 var ActiveCBM = false; 7655 var CBMOwner = false; 7656 if (formdetails[0]["ActiveCBM"].value == "True") { 7657 ActiveCBM = true; 7658 } 7659 if (formdetails[0]["IsCBMOwner"].value == "True") { 7660 CBMOwner = true; 7661 } 7662 7663 if (formdetails.valid()) { 7664 var OldCompanyName = formdetails.find(".autoCompleteCompanyName").attr('data-answer'); 7665 var CompanyName = formdetails.find(".autoCompleteCompanyName").val(); 7666 7667 const details = { 7668 hasActiveCBM: ActiveCBM, 7669 IsCBMOwner: CBMOwner, 7670 EncryptedCompanyId: formdetails[0]["EncryptedCompanyId"].value, 7671 CustomerId: formdetails[0]["hdnCustomerId"].value, 7672 CustomerMembershipId: parseInt(formdetails[0]["CBMCustomerMembershipId"].value), 7673 OldCompanyName: OldCompanyName, 7674 CompanyName: CompanyName, 7675 pageName: 'ChildQueastionSet', 7676 formid: frmid, 7677 buttonid: buttonid 7678 }; 7679 7680 if (OldCompanyName != '' && OldCompanyName != CompanyName && ActiveCBM) { 7681 ChangeCompanyConfirmation(details) 7682 } else { 7683 SubmitForm(buttonid, frmid); 7684 } 7685 } 7686}; 7687function SubmitForm(thisbutton, formid) { 7688 $(':disabled').prop('disabled', false); 7689 var ChildQuestionSetForm = thisbutton.closest("#" + formid).serialize(); 7690 var MembershipTypeId = thisbutton.closest("#" + formid)[0]["MembershipTypeId"].value; 7691 $.ajax({
7692 url: '/group/SaveGroupQuestionsets', 7693 type: "post", 7694 dataType: "JSON", 7695 contentType: 'application/x-www-form-urlencoded; charset=UTF-8', 7696 data: ChildQuestionSetForm, 7697 success: function (data) { 7698 if (data != null) { 7699 if (data.membershipTypeId > 0 && data.orderItemId < 0) { 7700 $("#IsQuestionSetField").val(true); 7701 $(".panel-default .chkAddonMemberships:checked").each(function () { 7702 if ($(this).attr('data-id') == MembershipTypeId) { 7703 $(this).attr('data-QSetFiled', true); 7704 $("#childalert_" + data.membershipTypeId).removeClass("hidden"); 7705 thisbutton.closest("#" + formid).focus(); 7706 } else { 7707 $(this).click(); 7708 $(this).click(); 7709 } 7710 }); 7711 var parentCustomerMembershipId = $(".btnAddChildMembership").attr("data-parentcustomermembershipsid"); 7712 if (parentCustomerMembershipId != undefined) 7713 AddChildMembership(MembershipTypeId, parentCustomerMembershipId, data.orderItemId); 7714 7715 var pendingQuestionSet = $(".chkAddonMemberships:checked").map(function () { if ($(this).attr("data-questionsetexist") == "True" && $(this).attr("data-qsetfiled") == "False") { return $(this).attr("data-id"); } }).get().join(); 7716 if (pendingQuestionSet == '') 7717 $(".btnAddGroupAddOns").removeClass("disabled"); 7718 } 7719 } 7720 }, 7721 error: function (errmsg) { 7722 console.log(errmsg); 7723 } 7724 }); 7725}; 7726// mantish(#22985) 7727$("body").on("click", ".btnAddtocartForpreProduct,.btnCartAgendaProductForPrepare", function (e, registrantTypeOrderItemId, ProductId, groupProductPricecId, chkPurchaserForRegistrant = false, isRegistrantRequestInfo = false) { 7728 var ProductsId = ($(this).attr("data-ProductId") != undefined && $(this).attr("data-ProductId") != null) ? $(this).attr("data-ProductId") : ProductId; 7729 if (!$(".list-group-item" + ProductsId + " input[name='PreRequestProductprice']:checked").val()) { 7730 alert("Please select one of the pricing options to add this item to your cart."); 7731 return false; 7732 } 7733 else { 7734 $('.SpinnerForAddToCart' + ProductsId).remove(); 7735 $('.btnAddtocart' + ProductsId).html('<span class"ProcessingItem"><i class="fa fa-refresh fa-spin"></i> Processing...</span>').prop('disabled', true); 7736 saveAddToCartProductsForAcknowledge(registrantTypeOrderItemId, groupProductPricecId, ProductsId, chkPurchaserForRegistrant, isRegistrantRequestInfo); 7737 } 7738}) 7739 7740function openAgendaFormFromDiscount(productId, btnType, productPrice, productpriceid, discountEntityType, registrantTypeOrderItemId, isFromDiscountPage = true, isRegistrantRequestInfo = false, chkPurchaserForRegistrant = false) { 7741 var height = $(this).attr("data-height"); 7742 var width = $(this).attr("data-width"); 7743 $.magnificPopup.close(); 7744 $.magnificPopup.open({ 7745 items: { 7746 src: AGENDA_PRODUCT_POPUP + '?productId=' + productId + '&orderItemId=' + 0 + '&btnType=' + btnType + "&productPrice=" + productPrice + "&discountId=" + productpriceid + "&entityType=" + discountEntityType + "®istrantTypeOrderItemId=" + registrantTypeOrderItemId + "&isFromDiscountPage=" + isFromDiscountPage + "&isRegistrantRequestInfo=" + isRegistrantRequestInfo + "&chkPurchaserForRegistrant=" + chkPurchaserForRegistrant 7747 }, 7748 type: 'iframe', 7749 closeOnBgClick: false, 7750 mainClass: 'CustomPop agenda-popup' 7751 }); 7752 $('.mfp-content').css('height', height); 7753 $('.mfp-content').css('width', width); 7754 $('.mfp-iframe-holder .mfp-content').css('max-height', height + 'px'); 7755 $('.mfp-iframe-holder .mfp-content').css('max-width', width + 'px'); 7756 return false; 7757 7758} 7759 7760$("body").on("change", "#divOptInSetting .chkOptInItem", function () { 7761 var name = $(this).attr("name"); 7762 7763 if ($('input[name=' + name + ' ]:checked').length > 0) { 7764 $("input[data-optintype='" + name + "'].chkUnsubscribeAll").prop("checked", false); 7765 } 7766}); 7767 7768$("body").on("click", "#divOptInSetting #btnSaveOptInSetting", function () { 7769 $('#divProgress, #divProgressReciept').show(); 7770 //get selected email freq setting 7771 var emailFrequency = $("#divOptInSetting #EmailFrequency").val(); 7772 var mobile = $("#divOptInSetting #Mobile").val(); 7773 7774 //get selected category 7775 var chkCategories = $('input[name=chkCategories]:checked'); 7776 var categoryIds = ""; 7777 chkCategories.each(function () { 7778 categoryIds += $(this).attr("value") + "," 7779 });
7780 categoryIds = categoryIds.substring(0, categoryIds.length - 1); 7781 7782 //get selected tag 7783 var chkTags = $('input[name=chkTags]:checked'); 7784 var tagIds = ""; 7785 chkTags.each(function () { 7786 tagIds += $(this).attr("value") + "," 7787 }); 7788 tagIds = tagIds.substring(0, tagIds.length - 1); 7789 7790 //get selected topic area 7791 var topicAreaIds = $('input[name=chkTopicArea]:checked').map(function () { 7792 return $(this).attr("value"); 7793 }).get().join(","); 7794 7795 //get selected emailCampaignCategorie 7796 var emailCampaignCategorieIds = ''; 7797 $.each($('input.chkEmailCampaignCategories:checked'), function (i, data) { 7798 emailCampaignCategorieIds += $(this).val() + ','; 7799 }); 7800 emailCampaignCategorieIds = emailCampaignCategorieIds.substring(0, emailCampaignCategorieIds.length - 1); 7801 if ($(".chkUnsubscribeAll").is(":checked")) { 7802 7803 var unsubScribeAllCategoriesName = []; 7804 7805 $.each($(".chkUnsubscribeAll:checked"), function (i, data) { 7806 unsubScribeAllCategoriesName.push($(this).attr("name")); 7807 }); 7808 7809 if (unsubScribeAllCategoriesName.length > 0) { 7810 for (var i = 0; i < unsubScribeAllCategoriesName.length; i++) { 7811 if (unsubScribeAllCategoriesName[i] != undefined && unsubScribeAllCategoriesName[i].toLowerCase() == "chkcategoriesunsubscribeall") { 7812 categoryIds = ""; 7813 $.each($('input[name=chkCategories]'), function (i, data) { 7814 categoryIds += $(this).attr("value") + ','; 7815 }); 7816 7817 categoryIds = categoryIds.substring(0, categoryIds.length - 1); 7818 categoryIds += ",-1" 7819 } 7820 if (unsubScribeAllCategoriesName[i] != undefined && unsubScribeAllCategoriesName[i].toLowerCase() == "chktagsunsubscribeall") { 7821 tagIds = ""; 7822 $.each($('input[name=chkTags]'), function (i, data) { 7823 tagIds += $(this).attr("value") + ','; 7824 }); 7825 7826 tagIds = tagIds.substring(0, tagIds.length - 1); 7827 tagIds += ",-1" 7828 } 7829 if (unsubScribeAllCategoriesName[i] != undefined && unsubScribeAllCategoriesName[i].toLowerCase() == "chktopicareaunsubscribeall") { 7830 topicAreaIds = ""; 7831 $.each($('input[name=chkTopicArea]'), function (i, data) { 7832 topicAreaIds += $(this).attr("value") + ','; 7833 }); 7834 7835 topicAreaIds = topicAreaIds.substring(0, topicAreaIds.length - 1); 7836 topicAreaIds += ",-1" 7837 } 7838 } 7839 } 7840 } 7841 7842 var jsonSMSNotifications = $(".smsNotification").map(function () { 7843 if ($(this).find(".chkOptInItem").is(":checked")) { 7844 return { 7845 EntityId: $(this).attr("data-entityid"), 7846 EntityType: $(this).attr("data-entitytype"), 7847 Period: $(this).find(".notificationPeriod").val(), 7848 PeriodType: $(this).find(".notificationPeriodType").val(), 7849 EntityName: $(this).attr("data-entityname") 7850 }; 7851 } 7852 }); 7853 7854 $.ajax({
7855 type: "POST", 7856 url: "/CustomerNotification/SaveOptIn/", 7857 dataType: "json", 7858 data: { 7859 'categoryIds': categoryIds, 7860 'tagIds': tagIds, 7861 'topicAreaIds': topicAreaIds, 7862 'emailFrequency': emailFrequency, 7863 'mobile': mobile, 7864 'jsonSMSNotifications': JSON.stringify(jsonSMSNotifications.get()), 7865 'emailCampaignCategorieIds': emailCampaignCategorieIds 7866 }, 7867 success: function (data) { 7868 $('#divProgress, #divProgressReciept').hide(); 7869 if (typeof (OptInEmails) == 'function') { 7870 OptInEmails(); 7871 } 7872 }, 7873 error: function (data) { 7874 $('#divProgress, #divProgressReciept').hide(); 7875 alert('Error! Please try again later.'); 7876 } 7877 }); 7878}); 7879 7880$("body").on('click', '.clsCompanyPurchase', function () { 7881 $("#divProgress").show(); 7882 var value = $(this).is(":checked") ? "false" : "true"; 7883 var pageName = $(this).attr("data-pageName"); 7884 var isFromAfterOrder = false; 7885 var orderid = $(this).attr("data-orderId"); 7886 if (pageName && pageName == 'AllTransactionsTab') 7887 isFromAfterOrder = true; 7888 //12952: Company - Employees - allows for company purchase if active employee even if no valid tax status 7889 $.post("/ShoppingCart/SaveCompanyTaxExemptPurchase?isCompanyPurchase=" + value + "&isFromAfterOrder=" + isFromAfterOrder + "&orderId=" + orderid, function (data) { 7890 if (data && pageName && pageName == "shoppingCart") { 7891 UpdateItemCart(0, true); 7892 } else if (pageName && pageName == "shoppingCart") { 7893 hideShowPyamentAssignToCompanyPurchase(); 7894 } 7895 $("#divProgress").hide(); 7896 }); 7897}); 7898 7899function hideShowPyamentAssignToCompanyPurchase() { 7900 $("#divProgress").show(); 7901 if ($(".clsCompanyPurchase").length > 0) { 7902 if ($(".clsCompanyPurchase").is(":checked")) { 7903 $(".clsPyamentAssignToCompanyPurchase").hide(); 7904 if ($("#rbtnCompanyPurchase").is(":checked")) { 7905 $("#rbtnCompanyPurchase").prop("checked", false); 7906 $("#rbtnCreditCard").prop("checked", true); 7907 $("#creditCard").show('slow'); 7908 } 7909 if ($('input[name=paymentMethod]:visible').length == 1) { 7910 $("#creditCardPanel").hide(); 7911 $("#rbtnCreditCard").prop("checked", true).trigger("click"); 7912 } 7913 } else { 7914 $(".clsPyamentAssignToCompanyPurchase").show(); 7915 if ($("#rbtnCompanyPurchase").length > 0 && $("#rbtnCompanyPurchase").is(":checked")) { 7916 $("#CompanyPurchase").show(); 7917 } else { 7918 $("#CompanyPurchase").hide(); 7919 } 7920 $("#creditCardPanel").show(); 7921 } 7922 } else { 7923 $(".clsPyamentAssignToCompanyPurchase").hide(); 7924 if ($('input[name=paymentMethod]:visible').length == 1) { 7925 $("#creditCardPanel").hide(); 7926 $("#rbtnCreditCard").prop("checked", true).trigger("click"); 7927 } 7928 } 7929 7930 $("#divProgress").hide(); 7931} 7932 7933//mantish(#22985) 7934var saveAddToCartProductsForAcknowledge = function (registrantTypeOrderItemId, groupProductPricecId, ProductId, chkPurchaserForRegistrant = false, isRegistrantRequestInfo = false) { 7935 var productTypeId = $('#ProductId' + ProductId).val(); 7936 var addOnPriceType = "AddOnPrice"; 7937 if (productTypeId != undefined && productTypeId == 12) { 7938 addOnPriceType = "ClassroomAddOn"; 7939 } 7940 //need to check this 7941 var hdnBundleType4Product = ""; 7942 if ($("#hdnBundleType4Product") != undefined) { 7943 hdnBundleType4Product = $("#hdnBundleType4Product").val(); 7944 } 7945 var datatarget; 7946 if (hdnBundleType4Product == "1" && !$(".clsAdditionalprice").is(":checked")) { 7947 datatarget = "bundleType4AlertPopup"; 7948 $('#' + datatarget).modal('hide'); 7949 } else { 7950 if ($(".clsAdditionalprice").is(":checked")) { 7951 datatarget = "alertmodelAdditionalPrice" + ProductId; 7952 $('#' + datatarget).modal('hide'); 7953 } 7954 else { 7955 datatarget = "alertmodel" + ProductId; 7956 $('#' + datatarget).modal('hide'); 7957 } 7958 } 7959 var TimeId = 0; 7960 var $current_radio = $('.rdbprice input[type="radio"][name="PreRequestProductprice"]:checked, .rdbprice input[type="checkbox"][name="PreRequestProductprice"]:checked'); 7961 7962 //mantis item : 15859 > note > c14280 7963 var isGroupPendingPaymentWithProduct = groupProductPricecId && Number(groupProductPricecId) > 0; 7964 if (isGroupPendingPaymentWithProduct) { 7965 $("#divProgress").show(); 7966 $current_radio = $('.rdbprice input[type=radio][data-productpriceid=' + groupProductPricecId + '],.rdbprice input[type=checkbox][data-productpriceid=' + groupProductPricecId + ']'); 7967 } 7968 7969 var chkRadioPrice = $('.rdbprice input[type=radio]:checked, .rdbprice input[type=checkbox]:checked'); 7970 var Price = $current_radio.attr('value'); 7971 var PriceData = Price != undefined && Price != null ? Price.split(',') : 0; 7972 var productPriceId = PriceData[0]; 7973 var productPrice = PriceData[1]; 7974 var Quantity = 1; 7975 var EventTimeId = $('.btnAddtocart' + ProductId).attr("data-eventtimeid"); 7976 var MultipleEventTimeId = $('.EventDate' + ProductId).val(); 7977 if (EventTimeId == undefined) { 7978 EventTimeId = $("#ProductEventTimeId").val(); 7979 } 7980 var priceType = $current_radio.attr("data-priceType"); 7981 var pagetype = ''; 7982 var pageno = 1; 7983 var sortby = 11; 7984 var entitytype = $current_radio.attr("data-entitytype"); 7985 var marketingEntityId = $("#hdnMarketingEntityId").val(); 7986 var marketingEntityType = $("#hdnMarketingEntityType").val(); 7987 var SwapOrderItemId = $("#hdnSwapOrderItemId").val(); 7988 var relatedProductId = $("#hdnRelatedProductId").val(); 7989 var productregistranttypeId = $current_radio.attr("data-productregistranttypeid"); 7990 var productDiscountId = $("#hdnProductDiscountId").val(); 7991 var isDiscountProduct = false; 7992 if (productDiscountId && productDiscountId > 0) { 7993 isDiscountProduct = true; 7994 priceType = "DiscountPrice"; 7995 } 7996 7997 if (parent.$("#pageType").val() != undefined) { 7998 pagetype = parent.$("#pageType").val(); 7999 } 8000 8001 if (parent.$("#pageno").val() != undefined) { 8002 pageno = parent.$("#pageno").val(); 8003 } 8004 if (parent.$("#sortby").val() != undefined) { 8005 sortby = parent.$("#sortby").val(); 8006 } 8007 8008 8009 if (MultipleEventTimeId > 0) { 8010 TimeId = MultipleEventTimeId; 8011 } 8012 else { 8013 TimeId = EventTimeId; 8014 } 8015 8016 var isAdditionalItemChecked = false; 8017 var additionalItemChecked = $('input[class=clsAdditionalprice]:checked').prop('checked'); 8018 var additionalprice = 0; 8019 var marketingEntityId = 0; 8020 var marketingEntityType = 0; 8021 8022 if (isGroupPendingPaymentWithProduct) { 8023 priceType = '@(CE21.Data.Common.PromoCouponCodeType.MembershipPrice.ToString())'; 8024 marketingEntityId = $current_radio.closest('.clsProductPriceItem').find('.PayOutStandingInvoices').attr('data-groupmembershiptypeid'); 8025 marketingEntityType = 1; 8026 } 8027 //#21208 8028 else if ($('#hdnMarketingEntityType').val() != '' && $('#hdnMarketingEntityType').val() == 2) { 8029 marketingEntityId = $("#hdnMarketingEntityId").val(); 8030 marketingEntityType = $("#hdnMarketingEntityType").val(); 8031 } 8032 8033 if (isGroupPendingPaymentWithProduct) { 8034 priceType = 'MembershipPrice'; 8035 } 8036 8037 8038 var listCart = []; 8039 if (priceType != "AdditionalPrice") { 8040 listCart.push({ 8041 "productId": ProductId, "productPriceId": productPriceId, "EventTimeId": TimeId, "productPrice": productPrice, 8042 "quantity": Quantity, "priceType": priceType, "MarketingEntityType": marketingEntityType, "MarketingEntityId": marketingEntityId, "SwapOrderItemId": SwapOrderItemId, "RelatedProductId": relatedProductId, 8043 "RegistrantTypeOrderItemId": (registrantTypeOrderItemId && !isNaN(registrantTypeOrderItemId) ? registrantTypeOrderItemId : 0), 8044 "IsAdditionalItemChecked": isAdditionalItemChecked, "additionalprice": additionalprice, 8045 "MarketingEntityId": marketingEntityId, 8046 "MarketingEntityType": marketingEntityType, 8047 "productDiscountId": productDiscountId, "IsDiscountProduct": isDiscountProduct, 8048 }); 8049 } 8050 8051 if (additionalItemChecked && !isGroupPendingPaymentWithProduct) { 8052 isAdditionalItemChecked = true; 8053 additionalprice = $('input[class=clsAdditionalprice]:checked').attr('data-value'); 8054 var additionalPriceTimeId = $('input[class=clsAdditionalprice]:checked').attr('data-eventid'); 8055 listCart.push({ 8056 "productId": ProductId, "productPriceId": productPriceId, "EventTimeId": additionalPriceTimeId, "productPrice": productPrice, 8057 "quantity": Quantity, "priceType": priceType, "IsAdditionalItemChecked": isAdditionalItemChecked, "additionalprice": additionalprice, 8058 "IsAddOnProduct": false 8059 }); 8060 } 8061 8062 //Add Related Add On Products 8063 if (!isGroupPendingPaymentWithProduct) { 8064 $('.clsRelatedProduct:checked').each(function (i) { 8065 listCart.push({ 8066 "productId": $(this).attr("data-productId"), "EventTimeId": $(this).attr("data-eventTimeId"), 8067 "priceType": addOnPriceType, "productPrice": $(this).attr("data-ProductPrice"), "quantity": 1, 8068 "IsAddOnProduct": true, "RelatedProductId": $(this).attr("data-relatedproductid") 8069 }); 8070 }); 8071 } 8072 8073 //12842: Registration Types - Registration Question Sets. 8074 if (productPriceId && Number(productPriceId) > 0 && !registrantTypeOrderItemId && productregistranttypeId > 0) { 8075 var isQuestionExist = IsRegistrantTypeQuestionSetAvailable(productPriceId, TimeId, ProductId, productTypeId); 8076 if (isQuestionExist) {
8077 $("#dvAcknowledgePopup").css("z-index", "0"); 8078 OpenRegistrantTypeQuestionSetPopup(ProductId, productPriceId, priceType, 0, 0, 0, false, 0, false, '', '', 0, false,true); 8079 return false; 8080 } 8081 } 8082 else { 8083 $("#dvAcknowledgePopup").css("z-index", ""); 8084 } 8085 8086 8087 var agendaAnswer = $("#hdnAgendaAnswer").val(); 8088 var isAgenda = $('#hdnisExistAgendaonCart' + ProductId).val(); 8089 if ((isAgenda != undefined) && (isAgenda == 1) && (agendaAnswer == undefined || agendaAnswer == '' || agendaAnswer == "")) { 8090 $.ajax({ 8091 type: "POST", 8092 url: "/Items/IsOpenAgendaPopup", 8093 dataType: "json", 8094 data: { 8095 'productId': ProductId, 8096 'productPriceId': productPriceId, 8097 'entityType': entitytype 8098 }, 8099 success: function (data) { 8100 if (data != undefined && data == true) { 8101 $("#dvAcknowledgePopup").css("z-index", "0"); 8102 OpenAgendaPopup(ProductId, productPrice, entitytype, productPriceId, registrantTypeOrderItemId, priceType, false, true, chkPurchaserForRegistrant, isRegistrantRequestInfo); 8103 return false; 8104 } 8105 else { 8106 AddProductToCart(listCart, ProductId, true); 8107 } 8108 }, 8109 error: function (data) { 8110 $("#divProgress").hide(); 8111 alert('Error! Please try again later.'); 8112 } 8113 }); 8114 } 8115 else { 8116 $("#dvAcknowledgePopup").css("z-index", ""); 8117 AddProductToCart(listCart, ProductId, true); 8118 } 8119} 8120 8121//Commented because of firing double click event on delete documents in classified ad form. 8122//$("body").on("click", ".delDocuments", function () { 8123// if (confirm("Are you sure, you want to remove documents?")) { 8124 8125// var documentId = $(this).attr('data-migrationid'); 8126// var entityType = "ClassifiedAdsPosting"; 8127 8128// $.post("/Search/DeleteDocuments", { documentId: documentId, entityType: entityType }, function (response) { 8129// if (response != null) { 8130 8131// } 8132// }); 8133// } 8134//}); 8135 8136 8137//For Customer Custom Field 8138$("body").on("click", ".delCustomFieldDocuments", function () { 8139 if (confirm("Are you sure, you want to remove documents?")) { 8140 var documentId = $(this).attr('data-migrationid'); 8141 var questionId = $(this).attr('data-questionid'); 8142 var answerId = $(this).attr('data-answerid'); 8143 var tempCustomerId = $(this).attr('data-temp-customerid'); 8144 var entityType = 'CustomerCustomFieldUpload'; 8145 $.post("/Account/DeleteDocuments", { documentId: documentId, entityType: entityType }, function (response) { 8146 if (response != null) { 8147 loadDocuments(answerId, questionId, entityType, null, tempCustomerId); 8148 } 8149 }); 8150 } 8151}); 8152 8153function loadDocuments(answerId, questionId, entityType, question, customerId) { 8154 var Question = encodeURIComponent(question); 8155 var CustomerID = encodeURIComponent(customerId); 8156 var url = "/Account/GetCustomerDocumentList?answerId=" + answerId + "&questionId=" + questionId + "&customerId=" + CustomerID + "&entityType=" + entityType + "&question=" + Question; 8157 $("#grid-list-MembershipAnswerDocuments_" + questionId).load(url, function () { 8158 }).prepend("<p class='loaderTxt'>Please wait ...</p>"); 8159} 8160 8161// Search Terms 8162var elt = $('#txtSearchTerm'); 8163 8164var hdSearchTerms = $("#hdSearchTerms").val() ? JSON.parse($("#hdSearchTerms").val()) : null; 8165elt.tagsinput({ 8166 tagClass: function (item) { 8167 return 'label label-default'; 8168 }, 8169 itemValue: 'value', 8170 itemText: 'text' 8171}); 8172 8173//Set serach filters 8174$.each(hdSearchTerms, function (index, data) { 8175 elt.tagsinput('add', { "value": data.Id + '-' + data.sst, "text": data.Name, "sst": data.sst, "id": data.Id }); 8176}); 8177 8178$("#txtSearchTerm").parent().find('input[type="text"]').attr("style", "display:none;"); 8179 8180var isSearchTextTermRemoved = false; // Flag to track if search text term removed 8181 8182$('#txtSearchTerm').on('itemRemoved', function (event) { 8183 if (event.item.sst == 'cat') { 8184 var category = $("#AdCategoryIds").val(); 8185 categoryList = category.split(','); 8186 8187 var deletedCategoryIndex = categoryList.indexOf(event.item.id); 8188 categoryList.splice(deletedCategoryIndex, 1); 8189 $("#AdCategoryIds").val(categoryList.join(',')); 8190 8191 var selectedAdsCategory = $('#AdCategoryIds').val() || []; 8192 if (selectedAdsCategory.length > 0) { 8193 var selectedList = selectedAdsCategory.split(','); 8194 $('#AdCategoryFilter').val(selectedList).multiselect('refresh'); 8195 } 8196 else { 8197 $('#AdCategoryFilter').val([]).multiselect('refresh'); 8198 } 8199 8200 getSearchResult(); 8201 } 8202 else if (event.item.sst == 'searchText') { 8203 isSearchTextTermRemoved = true; 8204 $("#keyword").val(""); 8205 getSearchResult(); 8206 isSearchTextTermRemoved = false; 8207 } 8208 else if (event.item.sst == 't') { 8209 var removeItem = event.item.id.toString(); 8210 var chk = $('.chkTopicAreas[value="' + removeItem + '"]'); 8211 chk.trigger('click'); 8212 } else if (event.item.sst == 'p') { 8213 var removeItem = event.item.id.toString(); 8214 var chk = $('.chkProductType[name="SelectedProductType"][value="' + removeItem + '"]'); 8215 chk.trigger('click'); 8216 } else if (event.item.sst == 'o') { 8217 var removeItem = event.item.id.toString(); 8218 var chk = $('.chkProductType[name="SelectedOtherMediaType"][value="' + removeItem + '"]'); 8219 chk.trigger('click'); 8220 } else if (event.item.sst == 'c') { 8221 var removeItem = event.item.id.toString(); 8222 var chk = $('.chkCategory[value="' + removeItem + '"]'); 8223 chk.trigger('click'); 8224 } else if (event.item.sst == 's') { 8225 isSearchTextTermRemoved = true; 8226 $("#txtSearch, #txtProductSearch").val(""); 8227 getSearchResult(); 8228 isSearchTextTermRemoved = false; 8229 } else if (event.item.sst == 'd') { 8230 var removeItem = event.item.id.toString(); 8231 var chk = $('.chkMonthDates[value="' + removeItem + '"]'); 8232 chk.trigger('click'); 8233 } else if (event.item.sst == 'tag') { 8234 var removeItem = event.item.id.toString(); 8235 getSearchResult(); 8236 } else if (event.item.sst == 'cc') { 8237 $('.chkClosedCaptioning').prop('checked', false); 8238 getSearchResult(); 8239 } 8240 //cert credit type 8241 else if (event.item.sst == 'cct') { 8242 $("#certCreditType").val(0); 8243 getSearchResult(); 8244 } else if (event.item.sst == 'zcs') { 8245 $("#txtZipCode").val(''); 8246 $("#drpMiles").val(25); 8247 getSearchResult(); 8248 } else if (event.item.sst == 'geoSearchByCity') { 8249 $("#hdnLatitude").val(''); 8250 $("#hdnLongitude").val(''); 8251 $("#txtGeoSearchByCity").val(''); 8252 getSearchResult(); 8253 } else if (event.item.sst == 'ss') { 8254 $('input[name="SubscriptionRadio"]').prop('checked', false); 8255 getSearchResult(); 8256 } else if (event.item.sst == 'liveEventState') { //10438 8257 var removeItem = event.item.id.toString(); 8258 var chk = $('.clsChkbState[value="' + removeItem + '"]'); 8259 chk.trigger('click'); 8260 } else if (event.item.sst == 'liveEventCity') { 8261 var removeItem = event.item.id.toString(); 8262 var chk = $('.clsChkbCity[value="' + removeItem + '"]'); 8263 chk.trigger('click'); 8264 } else if (event.item.sst == 'dateStartingOnOrAfter') { //10436 8265 $("#txtStartingOnOrAfter").val(''); 8266 getSearchResult(); 8267 } else if (event.item.sst == 'dateStartingOnOrBefore') { //10436 8268 $("#txtStartingOnOrBefore").val(''); 8269 getSearchResult(); 8270 } else if (event.item.sst == 'rpt') { //#12836 8271 var removeItem = event.item.id.toString(); 8272 var chk = $('.chkRegistrantTypes[value="' + removeItem + '"]'); 8273 chk.trigger('click'); 8274 } else if (event.item.sst == 'certCreditIdsSearch') { 8275 var removeItem = event.item.id.toString(); 8276 var chk = $('.chkCreditTypes[value="' + removeItem + '"]'); 8277 chk.trigger('click'); 8278 } else if (event.item.sst == 'certJurisdictionIdsSearch') { 8279 var removeItem = event.item.id.toString(); 8280 var chk = $('.chkCertJurisdictions[value="' + removeItem + '"]'); 8281 chk.trigger('click'); 8282 } else if (event.item.sst == 'searchClearAll') { 8283 $("#hdSearchTerms, #keyword, #txtSearch, #txtProductSearch,#txtZipCode, #txtStartingOnOrAfter, #txtStartingOnOrBefore, #txtGeoSearchByCity, #hdnLongitude, #hdnLatitude, #txtZipCode").val(""); $('.chkTopicAreas, .chkProductType, .chkCategory, .chkMonthDates, .chkClosedCaptioning, .clsChkbState, .clsChkbCity, .chkRegistrantTypes, .chkCreditTypes, .chkCertJurisdictions').prop('checked', false); 8284 getSearchResult(); 8285 } 8286}); 8287 8288function getSearchResult(latestSelecetedFacet = "", currentIndex = 1, scrollPage = false) { 8289 8290 if (scrollPage) 8291 $("#divProgress").hide(); 8292 else 8293 $("#divProgress").show(); 8294 8295 var Url = ''; 8296 8297 if ($('body').find('#AdCategoryIds').length > 0) { 8298 var Url = '?keyword=' + $("#keyword").val(); 8299 Url = Url + '&pagevalue=' + $("#pagevalue").val(); 8300 Url = Url + "&page=" + $("#page").val(); 8301 Url = Url + "&SortDir=" + $("#SortDir").val(); 8302 Url = Url + "&SortCol=" + $("#SortCol").val(); 8303 var adsCategory = $('#AdCategoryFilter').val() || []; 8304 if (adsCategory.length > 0) { 8305 $('#AdCategoryIds').val(adsCategory); 8306 $("#divProgress").show(); 8307 Url += '&adCategoryIds=' + adsCategory; 8308 } 8309 window.location = "/classifiedads/searchadsposting" + Url; 8310 } 8311 else { 8312 if ($("#CustomerMembershipTypeId").val() > 0 || $("#MembershipTypeId").val() > 0 || $("#CurrentTabId").val()) {
8313 Url = Url + '?customerMembershipId=' + $("#CustomerMembershipTypeId").val(); 8314 Url = Url + '&membershipTypeId=' + $("#MembershipTypeId").val(); 8315 Url = Url + '&tabId=' + $("#CurrentTabId").val(); 8316 } 8317 var sep = Url.indexOf("?") >= 0 ? "&" : "?"; 8318 Url += sep + "pagesize=" + ($("#CustomerMembershipTypeId").val() > 0 8319 ? $("#drpPageSize").val() 8320 : 25); 8321 //Url = Url + ($("#CustomerMembershipTypeId").val() > 0 ? '&pagesize=' + $("#drpPageSize").val() : '?pagesize=25'); 8322 Url = Url + "&sortby=" + $("#drpSortBy").val(); 8323 Url = Url + "&myProductFilter=" + $("#drpMyProductFilter").val(); 8324 8325 //get product type 8326 var selectedProductType = $('input[name=SelectedProductType]:checked'); 8327 var producttype = ""; 8328 selectedProductType.each(function () { 8329 producttype += $(this).attr("value") + "," 8330 }); 8331 producttype = producttype.substring(0, producttype.length - 1); 8332 if (producttype != "") { 8333 Url = Url + "&productType=" + producttype; 8334 } 8335 8336 //get other media type 8337 var selectedOtherMediaType = $('input[name=SelectedOtherMediaType]:checked'); 8338 var othermediatype = ""; 8339 selectedOtherMediaType.each(function () { 8340 othermediatype += $(this).attr("value") + "," 8341 }); 8342 othermediatype = othermediatype.substring(0, othermediatype.length - 1); 8343 if (othermediatype != "") { 8344 Url = Url + "&othermediatype=" + othermediatype; 8345 } 8346 8347 //get category 8348 var selectedCategory = $('input[name=SelectedCategory]:checked'); 8349 var category = ""; 8350 selectedCategory.each(function () { 8351 category += $(this).attr("value") + "," 8352 }); 8353 category = category.substring(0, category.length - 1); 8354 if (category != "") { 8355 Url = Url + "&category=" + category; 8356 } 8357 8358 //get topicarea 8359 var SelectedTopicArea = $('input[name=SelectedTopicArea]:checked'); 8360 var topicarea = ""; 8361 SelectedTopicArea.each(function () { 8362 topicarea += $(this).attr("value") + "," 8363 }); 8364 topicarea = topicarea.substring(0, topicarea.length - 1); 8365 if (topicarea != "") { 8366 Url = Url + "&topicArea=" + topicarea; 8367 } 8368 else if ($("#topicArea").val()) { 8369 Url = Url + "&topicArea=" + $("#topicArea").val(); 8370 } 8371 8372 //get monthName 8373 var monthName = $('input[name=MonthName]:checked'); 8374 var getmonth = ""; 8375 monthName.each(function () { 8376 getmonth += $(this).attr("value") + "," 8377 }); 8378 getmonth = getmonth.substring(0, getmonth.length - 1); 8379 if (getmonth != "") { 8380 Url = Url + "&eventdate=" + getmonth; 8381 } 8382 8383 //get registrant types : #12836 8384 var selectedRegistrantTypes = $('input[name=SelectedchkRegistrantTypes]:checked').map(function () { 8385 return this.value; 8386 }).get().join(','); 8387 if (selectedRegistrantTypes) { 8388 Url = Url + "®istrantProductTypeIds=" + selectedRegistrantTypes; 8389 } 8390 8391 8392 if (producttype == "" && category == "" && getmonth == "" && topicarea == "" && othermediatype == "" && selectedRegistrantTypes == "") { 8393 $("#txtsst").val(""); 8394 } 8395 Url = Url + "&sst=" + $("#txtsst").val(); 8396 8397 8398 //search text value 8399 var search = $("#txtSearch").val() || $("#txtProductSearch").val() || ""; 8400 8401 if (search.trim() != "") { 8402 Url = Url + "&search=" + encodeURIComponent(search); 8403 } else { 8404 var searchTermsarray = $("#hdSearchTerms").val() ? JSON.parse($("#hdSearchTerms").val()) : ""; 8405 for (var i = 0; i < searchTermsarray.length; i++) { 8406 if (searchTermsarray[i].sst == 's' && !isSearchTextTermRemoved) { 8407 Url = Url + "&search=" + encodeURIComponent(searchTermsarray[i].Name); 8408 } 8409 } 8410 } 8411 8412 //search closed captioning 8413 var isClosedCaptioning = $(".chkClosedCaptioning").prop('checked'); 8414 if (isClosedCaptioning != undefined) { 8415 Url = Url + "&isClosedCaptioning=" + isClosedCaptioning; 8416 } 8417 8418 //search duration, legacy search 8419
8420 var duration = $("#duration-slider").val(); 8421 if (duration != undefined) { 8422 var fromDuration = duration.split(';')[0]; 8423 var toDuration = duration.split(';')[1]; 8424 Url = Url + "&fromDuration=" + fromDuration + "&toDuration=" + toDuration; 8425 } 8426 8427 //search by duration filter 8428 var fromDuration = $("#txtFromDuration").val(); 8429 var toDuration = $("#txtToDuration").val(); 8430 if (fromDuration || toDuration) { 8431 Url = Url + "&fromDuration=" + fromDuration + "&toDuration=" + toDuration; 8432 } 8433 8434 //search by Zip Code start 8435 var zipCode = $("#txtZipCode").val(); 8436 var distanceMiles = $("#drpMiles").val(); 8437 if (zipCode != undefined && zipCode != '' && zipCode != "") { 8438 Url = Url + "&zipCode=" + zipCode + "&distanceMiles=" + distanceMiles; 8439 8440 } 8441 //search by Zip Code end 8442 8443 //search by subscription 8444 var subscriptionId = $('input[name=SubscriptionRadio]:checked').val(); 8445 if (subscriptionId != undefined && subscriptionId > 0) { 8446 Url = Url + "&subscriptionId=" + subscriptionId; 8447 } 8448 8449 //live event venue location #10438 8450 var cityVenueIds = ""; 8451 $('input[name=ChkProductCity]:checked').each(function () { 8452 cityVenueIds += $(this).attr("value") + "," 8453 }); 8454 cityVenueIds = cityVenueIds.substring(0, cityVenueIds.length - 1); 8455 8456 var stateVenueIds = ""; 8457 $('input[name=ChkProductState]:checked').each(function () { 8458 stateVenueIds += $(this).attr("value") + "," 8459 }); 8460 stateVenueIds = stateVenueIds.substring(0, stateVenueIds.length - 1); 8461 8462 if (stateVenueIds != "" || cityVenueIds != "") { 8463 Url = Url + "&cityVenueIds=" + cityVenueIds + "&stateVenueIds=" + stateVenueIds; 8464 } 8465 //live event venue location #10438 8466 8467 var discountId = $('#hdDiscountId').val(); 8468 if (discountId != undefined && discountId != null && discountId > 0) { 8469 Url = Url + "&discountId=" + discountId; 8470 } 8471 8472 var productGroupCampaignId = $('#hdProductGroupCampaignId').val(); 8473 if (productGroupCampaignId != undefined && productGroupCampaignId != null && productGroupCampaignId > 0) { 8474 Url = Url + "&productGroupCampaignId=" + productGroupCampaignId; 8475 } 8476 8477 var latitude = $('#hdnLatitude').val(); 8478 if (latitude != undefined && latitude != null) { 8479 Url = Url + "&gioLat=" + latitude; 8480 } 8481 8482 var longitude = $('#hdnLongitude').val(); 8483 if (longitude != undefined && longitude != null) { 8484 Url = Url + "&gioLong=" + longitude; 8485 } 8486 8487 var geoSearchByCity = $('#txtGeoSearchByCity').val(); 8488 if (geoSearchByCity) { 8489 Url = Url + "&geoSearchByCity=" + geoSearchByCity; 8490 } 8491 8492 //search by event date filter 8493 var eventFromDate = $("#txtStartingOnOrAfter").val(); 8494 var eventToDate = $("#txtStartingOnOrBefore").val(); 8495 if (eventFromDate || eventToDate) { 8496 Url = Url + "&dateStartingOnOrAfter=" + eventFromDate + "&dateStartingOnOrBefore=" + eventToDate; 8497 } 8498 8499 //#22352 8500 //get category 8501 var selectedCreditTypes = $('input[name=SelectedCreditTypes]:checked'); 8502 var creditTypes = ""; 8503 selectedCreditTypes.each(function () { 8504 creditTypes += $(this).attr("value") + "," 8505 }); 8506 creditTypes = creditTypes.substring(0, creditTypes.length - 1); 8507 if (creditTypes != "") { 8508 Url = Url + "&CertCreditTypeIds=" + creditTypes; 8509 } 8510 8511 //#22351 8512 var certJurisdicationsTypes = $('input[name=SelectedCertJurisdictions]:checked'); 8513 var certJurisdications = ""; 8514 certJurisdicationsTypes.each(function () { 8515 certJurisdications += $(this).attr("value") + "," 8516 }); 8517 certJurisdications = certJurisdications.substring(0, certJurisdications.length - 1); 8518 if (certJurisdications != "") { 8519 Url += '&CertJurisdictionIds=' + certJurisdications; 8520 } 8521 8522 if ($("#tag").val()) { 8523 Url += '&tag=' + $("#tag").val(); 8524 } 8525 8526 if ($("#drpProductDisplayType").val() == "3") //3:Member hours 8527 window.location = "/calendar" + Url; 8528 else { 8529 if ($("#CustomerMembershipTypeId").val() || $("#MembershipTypeId").val() || $("#CurrentTabId").val()) { // group search page 8530 window.location.href = '/group/searchproducts/' + Url; 8531 } 8532 else {// catalog search page 8533 if (latestSelecetedFacet != "") { 8534 Url = Url + "&latestSelection=" + latestSelecetedFacet; 8535 } 8536 var isChange = currentIndex != Number($("#hdnPageNo").val()); 8537 8538 if (isChange && scrollPage) { //for lazy loading in search page 8539 Url = Url + '&page=' + currentIndex; 8540 var bundleIds = $('#bundleIds').val(); 8541 if (bundleIds.endsWith(',')) { // remove last unnecessary comma 8542 bundleIds = bundleIds.slice(0, -1); 8543 } 8544 Url = Url + '&bundleIds= ' + bundleIds; 8545 $('#bundleIds').remove(); 8546 const querystring_url = new URL('http://search' + Url); 8547 const params = new URLSearchParams(querystring_url.search); 8548 $('#hdnIsWaitingForResponse').val('true'); 8549 8550 var keys = [ 8551 'search', 'category', 'topicArea', 'productType', 'sst', 'eventdate', 'tag', 'dateStartingOnOrAfter', 8552 'dateStartingOnOrBefore', 'displaytype', 'page', 'pagesize', 'pagewidgetid', 'sortby', 'isClosedCaptioning', 'fromDuration', 'toDuration', 'certCreditType', 'z
8552ipCode', 'distanceMiles', 'subscriptionId', 'cityVenueIds', 'stateVenueIds', 'othermediatype', 'discountId', 'productGroupCampaignId', 'geoSearchByCity', 'registrantProductTypeIds', 'gioLat', 'gioLong', 'CertCreditTypeIds', 'CertJurisdictionIds', 'latestSelection', 'sortbtnId', 'pagewidgetid', 'isShowMyProductFilter', 'myProductFilter', 'bundleIds' 8553 ]; 8554 $('#hdnPageNo').val(currentIndex); 8555 const requestData = Object.fromEntries(keys.map(key => [key, params.get(key)])); 8556 8557 $.ajax({ 8558 url: '/search/ProductList', 8559 type: 'POST', 8560 contentType: 'application/json', 8561 data: JSON.stringify(requestData), 8562 beforeSend: function () { 8563 // Show loader here 8564 $(".searchProductList").append('<div id="productSearchLoader" style="display:flex; justify-content:center;"><p class= "loaderTxt" > loading ...</p></div>'); 8565 }, 8566 success: function (data) { 8567 8568 //$('.divsearchterms').addClass('hidden'); 8569 if (data != undefined && data != null && data.trim() != '') { 8570 $(".searchProductList").append(data); 8571 $("#hdnHasNextPage").val('true'); 8572 } else { 8573 $("#hdnHasNextPage").val('false'); 8574 } 8575 $('#hdnIsWaitingForResponse').val('false'); 8576 //addSearchTags(urlQuerstring); 8577 $("#productSearchLoader").remove(); // Hide the loader after the request is complete 8578 }, 8579 error: function (xhr, status, error) { 8580 console.error('Error:', error); 8581 } 8582 }); 8583 } 8584 else 8585 window.location = "/search" + Url; 8586 } 8587 } 8588 } 8589} 8590 8591$("body").on('click', '.popEditAdDetails', function () { 8592 $.magnificPopup.open({ 8593 items: { 8594 src: $(this).attr("href") 8595 }, 8596 type: 'iframe', 8597 closeOnBgClick: false, 8598 mainClass: 'popEditPosting' 8599 }); 8600 return false; 8601}); 8602 8603function closeClassifiedAdPostingPopup() { 8604 $.magnificPopup.close(); 8605 window.location.reload(true) 8606 8607} 8608 8609//#5633846136 8610function createFreeClassifiedAd(classifiedFeePlanId, isAutoRenew) { 8611 8612 $.ajax({
8613 url: '/classifiedads/CreateFreeAd', 8614 type: 'POST', 8615 data: { classifiedFeePlanId: classifiedFeePlanId, isAutoRenew: isAutoRenew == "1" }, 8616 success: function (data) { 8617 // Redirect to the specified URL 8618 if (data?.RedirectUrl) 8619 window.location.href = data.RedirectUrl; 8620 }, 8621 error: function (error) { 8622 } 8623 }); 8624} 8625 8626function userIsAuthenticated() { 8627 var isAuthenticated = false; 8628 // Make an AJAX request to check the session status 8629 $.ajax({ 8630 url: '/classifiedads/CheckSessionStatus', 8631 type: 'GET', 8632 async: false, 8633 success: function (data) { 8634 isAuthenticated = data.isAuthenticated; 8635 }, 8636 error: function (error) { 8637 } 8638 }); 8639 8640 return isAuthenticated; 8641} 8642 8643function redirectToLogin() { 8644 var returnUrl = window.location.href; 8645 window.location.href = "/account/login?returnUrl=" + encodeURIComponent(returnUrl); 8646} 8647 8648function addProductToBundleTypeFive(productId, bundleproductId, eventTimeId, status, priceId, otherProductId, productPriceType) { 8649 $.ajax({
8650 type: "POST", 8651 url: BUNDLE_TYPE_5_ADD_CUSTOMER_PRODUCT, 8652 dataType: "json", 8653 data: { 8654 'productId': productId, 8655 'bundleProductId': bundleproductId, 8656 'eventTimeId': eventTimeId, 8657 'status': status, 8658 'priceId': priceId, 8659 'otherProductId': otherProductId, 8660 'productPriceType': productPriceType 8661 }, 8662 success: function (data) { 8663 if (data.Message != null && data.Message != "") { 8664 var myContent = data.Message; 8665 if (isHTML(myContent)) { 8666 alert($(myContent).text()); 8667 } 8668 else { 8669 alert(myContent); 8670 } 8671 } 8672 else if (data.IsCECreditPrice) {//mantis #21829 8673 parent.displayPurchaseCEMessage(productId, data.CECreditPrice, { 8674 displayPageType: 3, 8675 customerBundleId: data.CustomerBundleId 8676 }); 8677 } 8678 parent.LoadCustomerBundleProductList(data.Message == ""); 8679 }, 8680 error: function (data) { 8681 $('#divProgress').hide(); 8682 alert('Error! Please try again later.'); 8683 } 8684 }); 8685} 8686 8687var saveAddToCartProducts = function (params) { 8688 8689 let registrantTypeOrderItemId = params.registrantTypeOrderItemId; 8690 let groupProductPricecId = params.groupProductPricecId; 8691 8692 var ProductId = '0'; 8693 var ClassifiedFeePlanId = '@Model.ClassifiedFeePlanId'; 8694 var $current_radio = $('.rdbprice input[type=radio]:checked, .rdbprice input[type=checkbox]:checked'); 8695 var chkRadioPrice = $('.rdbprice input[type=radio]:checked, .rdbprice input[type=checkbox]:checked'); 8696 var Price = $current_radio.attr('value'); 8697 var PriceData = Price != undefined && Price != null ? Price.split(',') : 0; 8698 var productPriceId = PriceData[0]; 8699 var productPrice = PriceData[1]; 8700 var Quantity = 1; 8701 var priceType = $current_radio.attr("data-priceType"); 8702 var pagetype = ''; 8703 var pageno = 1; 8704 var sortby = 11; 8705 var productDiscountId = $("#hdnProductDiscountId").val(); 8706 var SwapOrderItemId = $("#hdnSwapOrderItemId").val(); 8707 8708 var isDiscountProduct = false; 8709 if (productDiscountId && productDiscountId > 0) { 8710 isDiscountProduct = true; 8711 priceType = "DiscountPrice"; 8712 } 8713 8714 if (parent.$("#pageType").val() != undefined) { 8715 pagetype = parent.$("#pageType").val(); 8716 } 8717 8718 if (parent.$("#pageno").val() != undefined) { 8719 pageno = parent.$("#pageno").val(); 8720 } 8721 if (parent.$("#sortby").val() != undefined) { 8722 sortby = parent.$("#sortby").val(); 8723 } 8724 8725 var listCart = []; 8726 8727 listCart.push({ 8728 "productId": parseInt(ProductId), 8729 "ClassifiedFeePlanId": parseInt(ClassifiedFeePlanId), 8730 "productPriceId": productPriceId, 8731 "productPrice": parseInt(productPrice), 8732 "quantity": Quantity, 8733 "priceType": priceType, 8734 "SwapOrderItemId": SwapOrderItemId, 8735 "RegistrantTypeOrderItemId": (registrantTypeOrderItemId && !isNaN(registrantTypeOrderItemId) ? registrantTypeOrderItemId : 0) 8736 }); 8737} 8738 8739$("body").on('click', '.clsbetterPriceForBundle', function () { 8740 8741 var bundleId = $(this).attr("data-bundleId"); 8742 var bundlePermalink = $(this).attr("data-bundlePermalink"); 8743 var bundleLabel = $(this).attr("data-bundleLabel"); 8744 var registrantCustomerId = $(this).attr("data-registrantCustomerId"); 8745 var isInvalidPurchaseMsg = $(this).attr("data-invalidpurchasemsg") || false; 8746 8747 var alertMsg = isInvalidPurchaseMsg ? '<hr><label>This registrant cannot register at the selected prices. You will be redirected to the bundle page to choose from the available prices for this registrant.</label><hr>' 8748 : '<hr><label>There may be a better price available for you on this <b>' + bundleLabel + '</b>. To change your prices, you will be taken to the bundle to review and reselect.<br> If you would like to keep the <b>' + bundleLabel + '</b> as it is, choose to make no change instead.</label><hr>'; 8749 8750 var title = isInvalidPurchaseMsg ? 'This price Not Available' : 'Change Price'; 8751 8752 $.confirm({ 8753 title: title, 8754 boxWidth: '600px', 8755 boxHeight: '700px', 8756 useBootstrap: true, 8757 icon: 'fa fa-warning',
8758 async: false, 8759 animateFromElement: false, 8760 animation: 'scale', 8761 content: alertMsg, 8762 buttons: { 8763 CONTINUE: { 8764 text: 'Change Price', 8765 btnClass: 'btn btn-success', 8766 action: function () { 8767 window.location.href = bundlePermalink + '?isForBundlePrice=true' + (registrantCustomerId > 0 ? '®istrantCustomerId=' + registrantCustomerId : ''); 8768 }, 8769 }, 8770 Close: { 8771 text: 'Make No Change', 8772 btnClass: 'btn btn-default', 8773 action: function () { 8774 // $(".betterPriceAlert").remove(); 8775 }, 8776 } 8777 } 8778 }); 8779}); 8780 8781$("body").on('click', '.pop600', function () { 8782 $.magnificPopup.open({ 8783 items: { 8784 src: $(this).attr("href") 8785 }, 8786 type: 'iframe', 8787 closeOnBgClick: false, 8788 mainClass: 'pop600MainClass' 8789 }); 8790 return false; 8791}); 8792 8793function OpenProductAgendaPopup(productId, orderItemId, productPrice, entitytype, productPriceId, isDisplayRequestInfo, isFromBundle, bundleTypeId = 0, isFromRegistrantConfirmation = true, chkPurchaserForRegistrant = false, isRegistrantRequestInfo = false, isFromUnAssignedOrder = false, customerEmail = '', programRegistrantId = null, orderId = 0, isCompleteRegistration = false) { 8794 $.magnificPopup.open({ 8795 items: { 8796 src: AGENDA_PRODUCT_POPUP + '?productId=' + productId + '&orderItemId=' + orderItemId + "&productPrice=" + productPrice + "&entityType=" + entitytype + "&discountId=" + productPriceId + "&isDisplayRequestInfo=" + isDisplayRequestInfo + '&isFromRegistrantConfirmation=' + isFromRegistrantConfirmation + "&isFromBundle=" + isFromBundle + "&bundleTypeId=" + bundleTypeId + "&chkPurchaserForRegistrant=" + chkPurchaserForRegistrant + "&isRegistrantRequestInfo=" + isRegistrantRequestInfo + "&isFromUnAssignedOrder=" + isFromUnAssignedOrder + "&customerEmail=" + customerEmail + "&programRegistrantId=" + programRegistrantId + "&orderId=" + orderId + "&isCompleteRegistration=" + isCompleteRegistration 8797 }, 8798 type: 'iframe', 8799 closeOnBgClick: false, 8800 showCloseBtn: ((bundleTypeId != undefined && Number(bundleTypeId) > 0) || !isFromRegistrantConfirmation || !isFromUnAssignedOrder) ? true : false, 8801 mainClass: 'CustomPop agenda-popup', 8802 callbacks: { 8803 close: function () { 8804 if (bundleTypeId != undefined && Number(bundleTypeId) > 0) { 8805 isValidateRegistrantQuestions = false; 8806 listProductsForBundle = []; 8807 arrRandomOrderItemId = []; 8808 isFromPopup = false; 8809 } 8810 } 8811 } 8812 }); 8813 return false; 8814} 8815 8816var IsAgendaForProductAvailable = function (discountId, productId, entityType) { 8817 var isEnable = false; 8818 $.ajax({
8819 type: "GET", 8820 url: "/Items/IsOpenAgendaPopup", 8821 dataType: "json", 8822 async: false, 8823 data: { 8824 'productId': productId, 8825 'productPriceId': discountId, 8826 "entityType": entityType 8827 }, 8828 success: function (data) { 8829 if (data != undefined && data == true) { 8830 isEnable = true; 8831 } 8832 else { 8833 isEnable = false; 8834 } 8835 }, 8836 error: function (data) { 8837 isEnable = false; 8838 } 8839 }); 8840 return isEnable; 8841} 8842 8843function referralAddressMethod(editAddressPopupType, clientId) { 8844 $.magnificPopup.close(); 8845 $(".grid-list-address").each(function () { 8846 8847 var isRequired = ($(this).attr("data-isrequired") || "").toLowerCase() == "true"; 8848 var questionId = $(this).attr("data-questionid") || ""; 8849 var referralClientId = clientId > 0 ? clientId : $(this).attr("data-referralClientId") 8850 $(this).load("/referralservice/getcustomeraddresslist" + '?editAddressPopupType=' + editAddressPopupType + '&referralClientId=' + referralClientId, function () { 8851 $('.verifiedLabel[data-toggle="tooltip"]').tooltip(); 8852 8853 var selectedValue = $('#IsAddressBlockQuestion' + questionId).attr("data-selectedvalue"); 8854 $("input[name=addressRadio" + questionId + "][value='" + selectedValue + "']").prop("checked", true); 8855 8856 $(".divAddressListLayout:visible").each(function () { 8857 $(this).height($(this).outerHeight()); 8858 $(".addresslist-card", this).height($(".addresslist-card", this).outerHeight()); 8859 }); 8860 loadAlertToolTip(); 8861 }).prepend("<p class='loaderTxt'>Please wait ...</p>"); 8862 }); 8863 if ($("#divExistingAddress").length > 0) { 8864 $("#divExistingAddress").load("/referralservice/getreferralclientexistingaddresses" + '?editAddressPopupType=' + editAddressPopupType + '&clientId=' + clientId).prepend("<p class='loaderTxt'>Please wait ...</p>"); 8865 } 8866} 8867 8868$("body").on('click', '.csIphone', function () { 8869 var viewerUrl = $(this).attr('data-href') == undefined ? $(this).attr('href') : $(this).attr('data-href'); 8870 var programRegistrantId = $(this).attr('data-ProgramRegistrantId'); 8871 var btntarget = $(this).attr('target'); 8872 var ExistAttendanceRequirment = $(this).attr('data-ExistAttendanceRequirment'); 8873 if (ExistAttendanceRequirment != undefined && ExistAttendanceRequirment == "true") { 8874 $('.iphone-questionrequirement-message').show(); 8875 $('.iphone-participationcode-message').hide(); 8876 } else { 8877 $('.iphone-questionrequirement-message').hide(); 8878 $('.iphone-participationcode-message').show(); 8879 } 8880 8881 8882 $('#divIphoneMessage').appendTo("body").modal('show'); 8883 $("#divIphoneMessage .modal-footer").find('a').attr('data-href', viewerUrl).attr('target', btntarget); 8884 $("#divIphoneMessage .modal-footer").find('a').addClass('csViewer').attr('data-ProgramRegistrantId', programRegistrantId); 8885}); 8886 8887// Monday #6063805421 8888$("body").on('click', '.firefoxlaunch', function () { 8889 var viewerUrl = $(this).attr('data-href') == undefined ? $(this).attr('href') : $(this).attr('data-href'); 8890 var sTarget = $(this).attr('target'); 8891 8892 if (popup == null) { 8893 popup = window.open(viewerUrl, sTarget); 8894 } else { 8895 popup.close(); 8896 popup = window.open(viewerUrl, sTarget); 8897 } 8898}) 8899 8900var openAgendaPopUpAfterRegistration = function (orderItemId, isAgendaExists, chkPurchaserForRegistrant, registrantQuestionSubmissionType) { 8901 if (isAgendaExists && isAgendaExists.toString().toLocaleLowerCase() == 'true' && typeof OpenProductAgendaPopup == "function") { 8902 isRegistrationComplete = true; 8903 var element = $("#clsEditSelection" + orderItemId); 8904 var isRegistrantRequestInfo = registrantQuestionSubmissionType == 2 ? true : false; 8905 editSelection(element, chkPurchaserForRegistrant, isRegistrantRequestInfo); 8906 } 8907 else { 8908 $.magnificPopup.close(); 8909 } 8910} 8911 8912function loadCustomerCustomAddressBlock(tempCustomerId = 0, isFromParent = false) { 8913 const context = isFromParent ? parent.$ : $; 8914 const matchingBlocks = context("[id^='grid-list-CustomerCustomAddressBlock_']"); 8915 8916 if (matchingBlocks.length > 0) { 8917 matchingBlocks.each(function () { 8918 const questionId = $(this).data("questionid"); 8919 const url = `/Account/GetCustomerCustomAddressBlock?questionId=${questionId}&tempCustomerId=${tempCustomerId}`; 8920 const $target = context(`#grid-list-CustomerCustomAddressBlock_${questionId}`); 8921 8922 $target.prepend("<p class='loaderTxt'>Please wait ...</p>"); 8923 $target.load(url, function (response, status, xhr) { 8924 }); 8925 }); 8926 } 8927 8928 if (isFromParent) { 8929 parent.$.magnificPopup.close(); 8930 } else { 8931 $.magnificPopup.close(); 8932 } 8933} 8934 8935$("body").on("click", "#btnSearch, #btnProductSearch", function () { //#7016454545 8936 var search = ""; 8937 search = $("#txtSearch").val() || $("#txtProductSearch").val(); 8938 var searchPages = ['search', 'discount', 'productgroupcampaigns', 'group']; 8939 if (search.trim().length > 0) { 8940 if (searchPages.includes(window.location.pathname.split('/')[1].toLowerCase())) { 8941 getSearchResult("SearchText"); 8942 } 8943 else { 8944 window.location.href = '/search?search=' + encodeURIComponent(search); 8945 } 8946 } 8947}); 8948$("body").on("click", ".loadMoreProduct", function () {
8949 var parentDiv = $(this).closest('.divWidget'); 8950 var url = $(this).attr("data-href") 8951 $(this).remove(); 8952 8953 $("<div>").load(url, function () { 8954 var $seminars = $(this); 8955 parentDiv.append($seminars.html()); 8956 initializeMemberHoursTooltip(); 8957 }) 8958}); 8959$(window).scroll(function () { 8960 $(".loadMoreProduct").each(function () { 8961 if (isElementVisibleOnScreen($(this))) { 8962 $(this).trigger('click'); 8963 } 8964 }); 8965}); 8966 8967$("body").on('click', '.cancelMembership', function () { 8968 $.magnificPopup.open({ 8969 items: { 8970 src: $(this).attr("href") 8971 }, 8972 type: 'iframe', 8973 closeOnBgClick: false, 8974 mainClass: 'popCancelGroup' 8975 }); 8976 return false; 8977}); 8978 8979function TransferOwnershipCallBack(IsCanceled, pagename, formid, buttonid, OldCompanyName) { 8980 if (pagename == 'EditCustomer') { 8981 $("#hdnIsCompanyChanged").val(true); 8982 if (IsCanceled) { 8983 $('#CompanyName').val(OldCompanyName); 8984 $('#frmEditCustomer').submit(); 8985 } else { 8986 $('#frmEditCustomer').submit(); 8987 } 8988 } else if (pagename == 'ParentQuestionSet') { 8989 if (IsCanceled) { 8990 $("select.dropQsetCompanyName").val(OldCompanyName).trigger('change'); 8991 $(".autoCompleteCompanyName").val(OldCompanyName); 8992 $("#" + formid).submit(); 8993 } else { 8994 $("#companyChange").val('1'); 8995 $("#" + formid).submit(); 8996 } 8997 } else if (pagename == 'ChildQueastionSet') { 8998 if (IsCanceled) { 8999 $(".autoCompleteCompanyName").val(OldCompanyName); 9000 SubmitForm(buttonid, formid); 9001 } else { 9002 SubmitForm(buttonid, formid); 9003 } 9004 } else if (pagename == 'UpdateSpeakerDetails') { 9005 if (IsCanceled) { 9006 $('#CompanyName').val(OldCompanyName); 9007 } 9008 $('#divProgress').show(); 9009 $('#frmEditSpeaker').submit(); 9010 } 9011} 9012 9013$(document).keydown(function (event) { 9014 if (event.target.id === 'Address' && event.key === 'Enter') { 9015 event.preventDefault(); 9016 return false; 9017 } 9018}); 9019 9020$("#btnDateFilterSearch").on("click", function () { 9021 getSearchResult("DateFilter"); 9022}); 9023 9024$("body").on("click", ".chkCreditTypes, .chkCertJurisdictions", function () { 9025 getSearchResult(); 9026}); 9027 9028$("body").on("change", ".topFilters #drpPageSize", function () { 9029 getSearchResult(); 9030}); 9031 9032$("#btnGeoSearchByCity").on("click", function () { 9033 getSearchResult(); 9034}); 9035 9036$("body").on("click", ".chkClosedCaptioning", function () { 9037 if ($("#txtsst").val() == "") 9038 $("#txtsst").val("cc"); 9039 getSearchResult("TranscriptCount"); 9040}); 9041 9042$("#btnDurationSearch").on("click", function () { 9043 getSearchResult(); 9044}); 9045 9046$("body").on("click", ".chkProductType", function () { 9047 var pdtype = $(this).attr('data-type'); 9048 if ($("#txtsst").val() == "" && (pdtype == 11 || pdtype == 14)) { 9049 $("#txtsst").val("o"); 9050 } else if ($("#txtsst").val() == "") { 9051 $("#txtsst").val("p"); 9052 } 9053 9054 if (getParameterByName('sortby') == "" && (pdtype == 1 || pdtype == 2 || pdtype == 3)) { 9055 $("#drpSortBy").val("51"); 9056 } 9057 9058 getSearchResult("ProductTypeId"); 9059}); 9060 9061$("body").on("click", ".chkCategory", function () { 9062 if ($("#txtsst").val() == "") 9063 $("#txtsst").val("c"); 9064 getSearchResult("Categories"); //21954 9065}); 9066 9067$("body").on("click", ".chkMonthDates", function () { 9068 if ($("#txtsst").val() == "") 9069 $("#txtsst").val("d"); 9070 getSearchResult("MonthStartDates"); 9071}); 9072 9073$("body").on("click", ".chkTopicAreas", function () { 9074 if ($("#txtsst").val() == "") 9075 $("#txtsst").val("t"); 9076 getSearchResult("TopicAreas"); 9077}); 9078 9079$("body").on("click", ".clsChkbState", function () { 9080 if ($("#txtsst").val() == "") 9081 $("#txtsst").val("liveEventState"); 9082 getSearchResult("VenueIdToState"); 9083}); 9084$("body").on("click", ".clsChkbCity", function () { 9085 if ($("#txtsst").val() == "") 9086 $("#txtsst").val("liveEventCity"); 9087 getSearchResult("IdtoCityWithAbbreviationtoState"); 9088}); 9089 9090$("body").on("click", ".rblSubscription", function () { 9091 if ($("#txtsst").val() == "") 9092 $("#txtsst").val("ss"); 9093 getSearchResult(); 9094}); 9095 9096$("body").on('keyup', '.txtSearch', function () { 9097 searchSidebarMenu($(this)); 9098}); 9099 9100function searchSidebarMenu(elSearchTextbox) { 9101 var keyword = elSearchTextbox.val(); 9102 $(elSearchTextbox).closest("ul").find("li").show(); 9103 if (keyword) { 9104 $(elSearchTextbox).closest("ul").find("li").filter(function () { 9105 $(this).toggle($(this).text().toLowerCase().indexOf(keyword.toLowerCase().trim()) > -1); 9106 }); 9107 } 9108} 9109 9110$("body").on('click', '.clearSearch', function () { 9111 var elSearchTextbox = $(this).closest('ul').find('.txtSearch'); 9112 $(elSearchTextbox).val(''); 9113 searchSidebarMenu(elSearchTextbox); 9114}); 9115 9116function validateCashDiscount() { 9117 if (($("#hdnGiftCardTotal") != undefined && Number($("#hdnGiftCardTotal").val()) > 0) || $("#hdnGrandTotal") != undefined && Number($("#hdnGrandTotal").val()) <= 0) {
9118 $(".msgCashDiscount,.lblCashDiscount").hide(); 9119 } 9120 else { 9121 $(".msgCashDiscount,.lblCashDiscount").show(); 9122 } 9123} 9124 9125function manageNotificationAccordions() { 9126 const cid = $('.loadMyAccountTab[data-tab-val="optInNotificationTabMyAccount"], #notificationOptions').data("cid") || $('#hiddenCustomerId').val(); 9127 const accordionState = JSON.parse(localStorage.getItem(`Accordion-Notification-${cid}`)) || {}; 9128 9129 $('.panel-group').map(function () { 9130 const accordionId = this.id.split("-")[1]; 9131 if (accordionState[accordionId] !== false) { 9132 $(`#${this.id} .accordion-toggle`).trigger("click"); 9133 } 9134 }).get(); 9135 9136 notificationAccordionsInfo(); 9137} 9138 9139$(document).on('click', '.accordion-toggle', function () { 9140 const cid = $('.loadMyAccountTab[data-tab-val="optInNotificationTabMyAccount"], #notificationOptions').data("cid") || $('#hiddenCustomerId').val(); 9141 const accordionState = JSON.parse(localStorage.getItem(`Accordion-Notification-${cid}`)) || {}; 9142 const accordionId = $(this).data('parent')?.split("-")[1]; 9143 const willExpand = $(this).attr('aria-expanded') === 'true'; 9144 $(this).find('i.fa-angle-down, i.fa-angle-up').toggleClass('fa-angle-up', willExpand).toggleClass('fa-angle-down', !willExpand); 9145 9146 if (accordionId) { 9147 accordionState[accordionId] = $(this).attr('aria-expanded') === 'true'; 9148 localStorage.setItem(`Accordion-Notification-${cid}`, JSON.stringify(accordionState)); 9149 } 9150}); 9151 9152function notificationAccordionsInfo() { 9153 $('.panel-group').each(function () { 9154 const collapseId = `collapse-${this.id.split('-')[1]}`; 9155 const isUnsubscribed = $(`#${collapseId} input.chkUnsubscribeAll:checked, #${collapseId} input.chkAllEmailCampaignCategories:checked`).length > 0; 9156 const label = $(this).find(`[href="#${collapseId}"] .accordion-info`); 9157 const type = $(this).find(`[href="#${collapseId}"] b`).text().toLowerCase(); 9158 9159 if (isUnsubscribed) { 9160 label.text(`Unsubscribed from all ${type}`); 9161 } else { 9162 const checkboxes = $(`#${collapseId} input[type="checkbox"]:not(.chkUnsubscribeAll):not(.chkAllEmailCampaignCategories)`); 9163 label.text(`Subscribed to ${checkboxes.filter(':checked').length} of ${checkboxes.length} ${type}`); 9164 } 9165 }); 9166 const allUnsubscribed = $('.chkUnsubscribeAll').not(':checked').length === 0; 9167 const allCategoriesChecked = $('.chkAllEmailCampaignCategories').not(':checked').length === 0; 9168 9169 if (allUnsubscribed && allCategoriesChecked) { 9170 $('#marketingConsentEUAware').prop('checked', false); 9171 } 9172} 9173 9174function checkParentCategories(parentCategoryId) { 9175 if (parentCategoryId > 0) { 9176 let parentCheckbox = $("input[name='chkCategories'][value='" + parentCategoryId + "']"); 9177 if (parentCheckbox.length && !parentCheckbox.prop("checked")) { 9178 parentCheckbox.prop("checked", true); 9179 checkParentCategories(parentCheckbox.data("parentcategoryid")); 9180 } 9181 } 9182} 9183 9184function uncheckChildCategories(parentCategoryId) { 9185 if (parentCategoryId > 0) { 9186 $("input[name='chkCategories'][data-parentcategoryid='" + parentCategoryId + "']").each(function () { 9187 if ($(this).prop("checked")) { 9188 $(this).prop("checked", false); 9189 uncheckChildCategories($(this).val()); 9190 } 9191 }); 9192 } 9193} 9194 9195function autoSaveOptIn(thisElement) { 9196 if (window.location.pathname == '/emails/unsubscribe') return; 9197 let saveMsgLabel = $(thisElement).parent().find('span.savedMsg'); 9198 if (saveMsgLabel.length == 0) { 9199 saveMsgLabel = $(thisElement).closest(".smsNotification").find('span.savedMsg'); 9200 } 9201 saveMsgLabel.text('Saving...').addClass('text-primary'); 9202 9203 const data = { 9204 categoryIds: $('input[name=chkCategories]:checked').map(function () { return $(this).val(); }).get().join(','), 9205 tagIds: $('input[name=chkTags]:checked').map(function () { return $(this).val(); }).get().join(','), 9206 topicAreaIds: $('input[name=chkTopicArea]:checked').map(function () { return $(this).val(); }).get().join(','), 9207 emailFrequency: $("#divOptInSetting #EmailFrequency").val(), 9208 mobile: $("#divOptInSetting #Mobile").val(), 9209 emailCampaignCategorieIds: $('input.chkEmailCampaignCategories:checked').map(function () { return $(this).val(); }).get().join(','), 9210 jsonSMSNotifications: JSON.stringify($(".smsNotification").map(function () { 9211 if ($(this).find(".chkOptInItem").is(":checked")) { 9212 return { 9213 EntityId: $(this).attr("data-entityid"), 9214 EntityType: $(this).attr("data-entitytype"),
9215 Period: $(this).find(".notificationPeriod").val(), 9216 PeriodType: $(this).find(".notificationPeriodType").val(), 9217 EntityName: $(this).attr("data-entityname") 9218 }; 9219 } 9220 }).get()), 9221 }; 9222 9223 $(".chkUnsubscribeAll").each((_, el) => { 9224 if (el.checked) { 9225 const type = $(el).data('optintype'); 9226 switch (type) { 9227 case 'chkCategories': data.categoryIds = "-1"; break; 9228 case 'chkTags': data.tagIds = "-1"; break; 9229 case 'chkTopicArea': data.topicAreaIds = "-1"; break; 9230 } 9231 } 9232 }); 9233 9234 $.ajax({ 9235 type: "POST", 9236 url: "/CustomerNotification/SaveOptIn/", 9237 dataType: "json", 9238 data: data, 9239 global: false, 9240 success: function () { 9241 saveMsgLabel.text('Saved!').addClass('text-success'); 9242 setTimeout(() => saveMsgLabel.text(''), 3000); 9243 if ($(thisElement).hasClass('chkEmailCampaignCategories') && $('.chkAllEmailCampaignCategories').prop('checked')) $(`#accordion-EmailCampaignCategories .accordion-toggle`).trigger("click"); 9244 if ($(thisElement).hasClass('chkUnsubscribeAll') && thisElement.checked) $(`#${$(thisElement).closest('.panel-group').attr('id')} .accordion-toggle`).trigger("click"); 9245 if ($(thisElement).hasClass('checkmarketingConsent') && !$(thisElement).prop('checked')) { 9246 $('.panel-group .accordion-toggle:not(.collapsed)').each(function () { 9247 $(this).trigger('click'); 9248 }); 9249 } 9250 const name = $(thisElement).attr("name"); 9251 if ($(thisElement).hasClass("chkEmailCampaignCategories") || name === "chkCategories" || name === "chkTags" || name === "chkTopicArea") { 9252 const anyChecked = ["chkEmailCampaignCategories", "chkCategories", "chkTags", "chkTopicArea"].some(n => $(`input[name='${n}']:checked`).length > 0); 9253 $(".checkmarketingConsent").prop("checked", anyChecked); 9254 } 9255 }, 9256 error: function () { 9257 saveMsgLabel.find('span.savedMsg').text('Failed!').addClass('text-danger'); 9258 setTimeout(() => saveMsgLabel.text(''), 3000); 9259 } 9260 }).always(function () { 9261 notificationAccordionsInfo(); 9262 }); 9263} 9264 9265$("body").on("change", ".chkUnsubscribeAll", function () { 9266 if (this.checked) { 9267 $("input[name='" + $(this).attr("data-optintype") + "']").prop("checked", false); 9268 } 9269 autoSaveOptIn(this); 9270}); 9271 9272$("body").on("change", "input[name='chkCategories']", function () { 9273 if ($(this).prop("checked")) { 9274 checkParentCategories($(this).data("parentcategoryid")); 9275 } else { 9276 uncheckChildCategories($(this).val()); 9277 } 9278 autoSaveOptIn(this); 9279}); 9280 9281$("body").on("change", "input[name=chkTags], input[name=chkTopicArea],#EmailFrequency,#Mobile,.notificationPeriodType,.notificationPeriod,input[name=chkSmsNotification]", function () { 9282 autoSaveOptIn(this); 9283}); 9284 9285//17693: Price not updating in cart when it changes start 9286function priceChangedNotification() { 9287 9288 var isDirectPaymentPage = ($("#isDirectPaymentPage").val() || "").toLowerCase() == 'true'; 9289 var cartId = isDirectPaymentPage ? $("#ShoppingCartId").val() : ""; 9290 $.post(UPDATE_CHANGED_PRICE_CART_ITEMS, { sessionId: cartId }, function (data) { 9291 if (!data.isProductPriceChanged && !data.IsGroupPriceChanged && !data.isDonationUpdated) { return; } 9292 9293 var title = "Price Change"; 9294 var strContent = "The price has been updated for one or more items in your cart."; 9295 if (data.IsGroupPriceChanged) { 9296 strContent = "The invoice in your cart was out of date and the amount differed from the current amount of the invoice."; 9297 if (data.isProductPriceChanged) { 9298 strContent = "The price has been updated for one or more items in your cart. " + strContent; 9299 } 9300 } 9301 strContent += " Click the OK button to receive the updated pricing."; 9302 if (data.IsGroupPriceChanged && data.isNotMatchDueRulesCriteria) { 9303 strContent = "The invoice(s) in your cart will be removed because it does not match the due rules criteria."; 9304 } 9305 if (data.isDonationUpdated) { 9306 strContent = "The selected donation option has been updated. Please review and re-add it to your cart"; 9307 title = "Donation Update"; 9308 } 9309 $.confirm({ 9310 title: title, 9311 useBootstrap: true, 9312 icon: 'fa fa-warning',
9313 type: 'orange', 9314 animateFromElement: false, 9315 content: strContent, 9316 draggable: true, 9317 buttons: { 9318 ok: { 9319 text: 'Ok', 9320 btnClass: 'btn-primary', 9321 action: function () { 9322 updateChangedPriceCartItems() 9323 } 9324 } 9325 } 9326 }); 9327 9328 }); 9329} 9330function updateChangedPriceCartItems() { 9331 var isDirectPaymentPage = ($("#isDirectPaymentPage").val() || "").toLowerCase() == 'true'; 9332 var cartId = isDirectPaymentPage ? $("#ShoppingCartId").val() : ""; 9333 9334 $.post(UPDATE_CHANGED_PRICE_CART_ITEMS, { 'isSave': true, sessionId: cartId }, function () { 9335 UpdateItemCart(0); 9336 }); 9337} 9338//#17693: Price not updating in cart when it changes end 9339 9340var getCertificateRequirements = function (productId, certificateType) { 9341 var result = null; 9342 $.ajax({ 9343 type: 'GET', 9344 url: GET_PRODUCTCERT_REQ, 9345 dataType: 'json', 9346 async: false, 9347 data: { 9348 productId: productId, 9349 certificateType: certificateType 9350 }, 9351 success: function (data) { 9352 result = data; 9353 }, 9354 error: function () { 9355 result = null; 9356 } 9357 }); 9358 return result; 9359}; 9360 9361$("body").on("click", ".btnQuickSignUpCloseAddCECredittoCart", function () { 9362 var isAddPurchaseCE = $(this).attr('data-isAddPurchaseCE') || ""; 9363 var productId = $(this).attr('data-productId'); 9364 var $target = $(".ce21FreeCourse[data-ProductId='" + productId + "']:not(.memberHoursBtn)"); 9365 9366 if (!$target.length) return false; 9367 9368 $target.attr("disabled", "disabled").attr("data-btnTitle", "launch"); 9369 9370 setTimeout(function () { 9371 $target.removeAttr("disabled"); 9372 }, 5000); 9373 9374 var url = ($target.attr("href") || "").trim(); 9375 if (url === "" || url === "javascript:void(0)" || url === "javascript:void(0);") { 9376 var eventTimeid = $target.attr("data-eventtimeid"); 9377 url = setFreeViewerUrl(productId, eventTimeid); 9378 } 9379 9380 url += "&isAddPurchaseCE=" + isAddPurchaseCE; 9381 9382 launchPurchasedProduct($target, url); 9383 return false; 9384}); 9385 9386$("body").on("click", ".btnQuickSignUpAddCECredittoCart", function () { 9387 var productId = $(this).attr('data-productId'); 9388 var promoCouponCodeType = $(this).attr('data-promoCouponCodeType') || ''; 9389 var $target = getProductButton(productId, promoCouponCodeType == 'MemberHours'); 9390 9391 if (!$target.length) return false; 9392 9393 $target.attr("disabled", "disabled").attr("data-btnTitle", "launch"); 9394 9395 setTimeout(function () { 9396 $target.removeAttr("disabled"); 9397 }, 5000); 9398 9399 var url = ($target.attr("href") || "").trim(); 9400 if (url === "" || url === "javascript:void(0)" || url === "javascript:void(0);") { 9401 var eventTimeid = $target.attr("data-eventtimeid"); 9402 url = setFreeViewerUrl(productId, eventTimeid); 9403 } 9404 9405 // Extract the query string part 9406 const queryString = url.split('?')[1]; 9407 9408 // Create URLSearchParams object 9409 const params = new URLSearchParams(queryString); 9410 9411 // Get values 9412 const discountId = params.get("discountId"); 9413 const marketingEntityId = params.get("marketingEntityId"); 9414 const marketingEntityType = params.get("marketingEntityType"); 9415 const registrantTypeOrderItemId = params.get("registrantTypeOrderItemId"); 9416 9417 addCECredittoCart(productId, false, 4, discountId, marketingEntityId, marketingEntityType, registrantTypeOrderItemId, promoCouponCodeType); 9418}); 9419 9420function handleFreeCourseRegistration(productId, actionUrl, alternateUrl, element, pageType) { 9421 if (!productId) return; 9422 9423 $.get("/Items/CheckMaxRegistrantForFreeProducts?productId=" + productId, function (data) { 9424 // Case 1: Max registrant check failed â show message 9425 if (data && data.Message) { 9426 displayCartMessages(element, data, pageType); 9427 return; 9428 } 9429 9430 // Case 2: Continue to check logged-in customer 9431 $.ajax({
9432 type: "GET", 9433 url: GET_LOGGEDINCUSTOMERID, 9434 dataType: "json", 9435 success: function (data) { 9436 var isOpenInFullPage = false; 9437 9438 if (data) { 9439 actionUrl = data.customerId > 0 ? alternateUrl : actionUrl; 9440 isOpenInFullPage = data.customerId <= 0 && data.isLoginRedirectUrlActive; 9441 } 9442 9443 if (isOpenInFullPage) { 9444 window.location.href = actionUrl; 9445 } else { 9446 $.magnificPopup.open({ 9447 items: { src: actionUrl }, 9448 type: "iframe", 9449 closeOnBgClick: true, 9450 mainClass: "CustomPop" 9451 }); 9452 } 9453 }, 9454 error: function (xhr) { 9455 console.log("Error getting customer ID:", xhr); 9456 } 9457 }); 9458 }); 9459} 9460function checkMultiChoiceValidation(isValid) { 9461 9462 //Required validation if all rows rows are hidden 9463 $(".tblCustomFieldMultiSelect:visible").each(function () { 9464 var table = $(this); 9465 if ($(table).find("tbody>tr:visible").length == 0) { 9466 if ($(table).find("tbody>tr:hidden").find('input[type="checkbox"]:required').length > 0 && $(table).find("tbody>tr:hidden").find('input[type="checkbox"]:checked').length == 0) { 9467 $(table).find("tbody>tr").show(); 9468 isValid = false; 9469 } 9470 } 9471 }); 9472 9473 return isValid; 9474} 9475function isPaidTransaction(element, id = 0) { 9476 var paymentTransactionId = id > 0 ? id : parseInt(element.attr("data-paymentTransactionId") || "0"); 9477 var isPaid = false; 9478 9479 if (paymentTransactionId > 0) { 9480 $.ajax({
9481 type: 'GET', 9482 url: `${IS_PAID_TRANSACTION_URL}?paymentTransactionId=${paymentTransactionId}`, 9483 async: false, 9484 success: function (data) { 9485 if (data) { 9486 isPaid = data.Success; 9487 if (isPaid && data.Message.length > 0) { 9488 alert(data.Message); 9489 window.top.location.reload(); 9490 } 9491 } 9492 }, 9493 error: function (data) { 9494 $("#divProgress").hide(); 9495 alert('Error! Please try again later.'); 9496 } 9497 }); 9498 } 9499 9500 return isPaid; 9501} 9502 9503function showMemberHourPurchasePopup($this, callback) { 9504 9505 var data = $this.attr("data-content"); 9506 var allowPurchase = $this.attr("data-allowPurchase") == 'true'; 9507 9508 if (allowPurchase) { 9509 9510 $.confirm({ 9511 title: '', 9512 boxWidth: '550px', 9513 useBootstrap: false, 9514 content: data, 9515 closeIcon: true, 9516 buttons: { 9517 ok: { 9518 text: 'Yes', 9519 btnClass: 'btn-success', 9520 action: function () { 9521 9522 /*$("#divProgress").show();*/ 9523 9524 if (callback) 9525 callback(true); 9526 9527 return true; 9528 } 9529 }, 9530 cancel: { 9531 text: 'No', 9532 btnClass: 'btn-warning', 9533 } 9534 } 9535 }); 9536 9537 } 9538 else if (!allowPurchase && !data) { 9539 9540 if (callback) 9541 callback(true); 9542 } 9543 else { 9544 9545 $.dialog({ 9546 title: '', 9547 boxWidth: '550px', 9548 useBootstrap: false, 9549 content: data, 9550 closeIcon: true, 9551 buttons: {} 9552 }); 9553 } 9554} 9555function getProductButton(productId, isMemberHours) { 9556 const isMember = typeof isMemberHours === "boolean" ? isMemberHours : String(isMemberHours).toLowerCase() === "true"; 9557 if (isMember) { 9558 var $btn = $(".memberHoursBtn[data-ProductId='" + productId + "']"); 9559 9560 if ($btn.length === 0 && window.parent) { 9561 $btn = parent.$(".memberHoursBtn[data-ProductId='" + productId + "']"); 9562 $btn.attr('data-cartId', parent.$('#cartId').val()); 9563 } 9564 9565 return $btn; 9566 } 9567 return $(".ce21FreeCourse[data-ProductId='" + productId + "']:not(.memberHoursBtn)"); 9568} 9569 9570function initializeMemberHoursTooltip() { 9571 if ($('.clsMemberHoursToolTip').length) { 9572 $('.clsMemberHoursToolTip') 9573 .popover({ 9574 trigger: 'hover', 9575 container: 'body' 9576 }) 9577 .on('show.bs.popover', function () { 9578 $(this).data('bs.popover').tip().css({ 9579 maxWidth: '300px', 9580 whiteSpace: 'normal' 9581 }); 9582 }); 9583 } 9584} 9585 9586$("body").on("click", ".memberHourLaunchProduct", function (e) { 9587 e.preventDefault(); 9588 var url = $(this).attr("href"); 9589 if (!url) return; 9590 window.location.href = url; 9591}) 9592 9593$("body").on("click", ".registerWithoutCE", function () { 9594 var isClickByAckButton = $('#isAcknowledge').val(); 9595 var productId = $(this).attr('data-productId'); 9596 var promoCouponCodeType = $(this).attr('data-promoCouponCodeType') || ''; 9597 var cartId = $('#cartId').val(); 9598 var isAgendaExists = $(this).attr('data-isAgendaExists') == 'True'; 9599 if (isAgendaExists) { 9600 memberHoursAdditionalPayments(0, cartId, promoCouponCodeType); 9601 } else { 9602 var $this = getProductButton(productId, true); 9603 var eventTimeid = $this.attr("data-eventtimeid"); 9604 var url = setFreeViewerUrl(productId, eventTimeid, true); 9605 launchPurchasedProduct($this, url); 9606 } 9607}); 9608 9609function memberHoursAdditionalPayments(orderId, cartId, promoCouponCodeType) { 9610 $.magnificPopup.open({ 9611 items: { src: "/Account/ConvertToOther?orderId=" + orderId + "&cartId=" + cartId + "&promoCouponCodeType=" + promoCouponCodeType }, 9612 type: 'iframe', 9613 closeOnBgClick: false, 9614 mainClass: 'pop820', 9615 callbacks: { 9616 open: function () { 9617 var mfp = $.magnificPopup.instance; 9618 var originalClose = mfp.close.bind(mfp); 9619 var closeButtonClicked = false; 9620 9621 // â Track close button click 9622 document.querySelector('.mfp-close').addEventListener('click', function () { closeButtonClicked = true; }, true); 9623 9624 mfp.close = function () { 9625 if (closeButtonClicked) { 9626 closeButtonClicked = false; // reset flag 9627 $.confirm({ 9628 title: "Confirm Close", 9629 boxWidth: '550px', 9630 useBootstrap: false, 9631 type: 'red', 9632 backgroundDismiss: false, 9633 closeIcon: false, 9634 content: "Caution: If you leave, you will lose all your registration selections.", 9635 buttons: { 9636 ok: { 9637 text: 'Ok', 9638 btnClass: 'btn-success', 9639 action: function () { 9640 delteMemberHoursOrder(cartId); 9641 mfp.close = originalClose; // â Restore 9642 originalClose(); // â Close 9643 } 9644 }, 9645 cancel: { 9646 text: 'Cancel', 9647 btnClass: 'btn-danger'
9648 // Do nothing - popup stays open 9649 } 9650 } 9651 }); 9652 } else { 9653 // â Not close button â close directly without confirm 9654 mfp.close = originalClose; 9655 originalClose(); 9656 } 9657 }; 9658 }, 9659 close: function () { 9660 $(document).off('click.mfpClose'); // â Cleanup 9661 } 9662 } 9663 }); 9664 9665 return false; 9666} 9667function delteMemberHoursOrder(cartId) { 9668 $.ajax({ 9669 type: "POST", 9670 url: "/Items/DeleteMemberHoursOrder", 9671 dataType: "json", 9672 data: { 9673 'cartId': cartId 9674 }, 9675 success: function (data) { } 9676 }); 9677}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.