$(document).ready(function () { var tdy = new Date(); var rand1 = Math.random().toString(36).substr(2, 5); var rand2 = Math.random().toString(36).substr(2, 5); var rand3 = Math.random().toString(36).substr(2, 5); var rand = tdy.getFullYear() + "" + rand1 + "" + ("0" + (tdy.getMonth() + 1)).slice(-2) + "" + rand2 + "" + ("0" + tdy.getDate()).slice(-2) + "" + rand3; setTimeout(function () { var capVal = $("input[name='g-recaptcha-response']").val(); $("input[name='g-recaptcha-response']").val(capVal + "" + rand); }, 3000); }); function toggleDisable(e, t) { $("#" + e).prop("disabled", t); } function validateLisenceForm(e) { var t = $("#" + e + " #lisence_update_form").serialize(), r = BASE_URL + "users/extendLisence"; $.ajax({ type: "POST", url: r, data: t, dataType: "json", beforeSend: function () { toggleDisable("btn-demo", !0), $("#btn-demo").after(function () { return getLoadingImg(); }); }, success: function (t) { "Error" == t.msgStatus ? $("#" + e + " #response").html(t.msg) : "Success" == t.msgStatus && ($("#" + e + " #response").html(t.msg), setTimeout(function () { redirectPage(BASE_URL + "users/"); }, 2e3)), toggleDisable("btn-demo", !1), $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"), toggleDisable("btn-demo", !1), $("#imgLoader").remove(); }, }); } function radioOneClick() {} function radioTwoClick() {} function radioThreeClick() {} function redirectPage(e) { setTimeout(function () { window.location.href = e; }, 2e3); } function getLoadingImg() { return ''; } function submitForm(e) { (document.listing_form.action = e), document.listing_form.submit(); } function updateCartQty() { var e = BASE_URL + "carts/updateCart"; (document.cartForm.action = e), document.cartForm.submit(); } function updateCartLisenceQty() { var e = BASE_URL + "carts/updateLisenceCart"; (document.cartForm.action = e), document.cartForm.submit(); } function ajaxLoadCertifications(e) { if (e > 0) { var t = BASE_URL + "certifications/ajaxGetcerts"; $.ajax({ type: "POST", url: t, data: { vid: e }, dataType: "json", beforeSend: function () { $("#certification_id").before(function () { return getLoadingImg(); }); }, success: function (e) { for (var t = '', r = 0; r < e.length; r++) t += '"; $("#certification_id").find("option").remove().end().append(t), $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"), $("#imgLoader").remove(); }, }); } else { $("#certification_id").find("option").remove().end().append(''), $("#imgLoader").remove(); } } function ajaxLoadExams(e) { if (e > 0) { var t = BASE_URL + "exams/ajaxGetexams"; $.ajax({ type: "POST", url: t, data: { cid: e }, dataType: "json", beforeSend: function () { $("#exam_id").before(function () { return getLoadingImg(); }); }, success: function (e) { for (var t = '', r = 0; r < e.length; r++) t += '"; $("#exam_id").find("option").remove().end().append(t), $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"), $("#imgLoader").remove(); }, }); } else { $("#exam_id").find("option").remove().end().append(''), $("#imgLoader").remove(); } } function UpdateGrandTotal() { var e, t = 0; $(".cartQty").each(function () { var e = $(this).attr("data") * $(this).val(); (e = parseFloat(e).toFixed(2)), console.log(e), $(this) .parent() .parent() .next("td") .children("p") .children() .text("$" + e); }); var r = 0; $(".sub-total-amount").each(function () { var e = $(this).html().replace("$", ""); (e = e.replace(",", "")), (Am = parseInt(e)), (r = parseInt(r + Am)); }), (e = parseInt($("#DiscountAmount").html().replace("$", ""))), (t = parseInt(r - e)), (t = parseFloat(t).toFixed(2)), $("#DiscountNewAmount").html("$" + t), $("#GrandTotalAmount").html("$" + t); } function validate_coupon_code(code) { UpdateGrandTotal(); var URL = BASE_URL + "carts/validate_coupon"; $(".loadingimg").css("display", "block"); $.ajax({ type: "POST", url: URL, data: { Coupon: code, }, dataType: "html", beforeSend: function () {}, success: function (resp) { var re = /\s\s+/g; resp = resp.replace(re, " "); RespObject = JSON.parse(resp); if (RespObject.Status) { var discountId = RespObject.Coupon.id; var coupon_codetxt = RespObject.Coupon.coupon_code; var checkType = RespObject.Coupon.discount_type; var grandTotal = 0; var totalOrderAmount = 0; $(".sub-total-amount").each(function () { var Am = parseInt($(this).html().replace("$", "")); grandTotal = totalOrderAmount = parseInt(totalOrderAmount + Am); }); var totalOrderQuantity = 0; $(".cartQty").each(function () { var Am = parseInt($(this).val().replace("$", "")); totalOrderQuantity = parseInt(totalOrderQuantity + Am); }); if (RespObject.Coupon.discount_type == 1) { var discountAmount = RespObject.Coupon.discount_amount; var subTotal = totalOrderAmount - discountAmount; subTotal = Math.round(subTotal * 100) / 100; var grandTotal = subTotal; var countPercent = (discountAmount / totalOrderAmount) * 100; var discount_percenttxt = countPercent; $(".disCode").html('"' + coupon_codetxt + '"'); $(".disPer").html(discount_percenttxt); console.log(coupon_codetxt); console.log(discount_percenttxt); } else if (RespObject.Coupon.discount_type == 2) { var discount_percent = RespObject.Coupon.discount_percent; var discountAmount = (totalOrderAmount * discount_percent) / 100; var subTotal = totalOrderAmount - discountAmount; subTotal = Math.round(subTotal * 100) / 100; var grandTotal = subTotal; var discount_percenttxt = RespObject.Coupon.discount_percent; $(".disCode").html('"' + coupon_codetxt + '"'); $(".disPer").html(discount_percenttxt); console.log(coupon_codetxt); console.log(discount_percenttxt); $(".coupon-discount-area").show(); } discountAmount = parseFloat(discountAmount).toFixed(2); subTotal = parseFloat(subTotal).toFixed(2); grandTotal = parseFloat(grandTotal).toFixed(2); $(".DiscountAmount").html("$" + discountAmount); $("#DiscountNewAmount").html("$" + subTotal); $(".GrandTotalAmount").html("$" + grandTotal); update_total(discountAmount, subTotal, grandTotal, discountId); $(".codemsg").hide(); $(".couponApplied").show(); $(".coupon-field").hide(); } else { $(".codemsg").addClass("invalid").html(RespObject.Message); $(".codemsg").show(); } $(".loadingimg").css("display", "none"); }, error: function () { console.log("something went wrong please try again"); $(".loadingimg").css("display", "none"); }, }); } function update_total(e, t, r, a) { var o = BASE_URL + "carts/update_coupon_total"; $.ajax({ type: "POST", url: o, data: { cm: e, dm: t, gt: r, ci: a }, dataType: "html", beforeSend: function () {}, success: function (e) { (e = e.replace(/\s\s+/g, " ")), (RespObject = JSON.parse(e)), console.log(RespObject); }, error: function () {}, }); } function reapplycoupon() { setTimeout(function () { $("#ApplyCoupon").trigger("click"); }, 1e3); } function loadVideoDetails(e) { if (e > 0) { var t = BASE_URL + "exam/ajaxGetVideoDetails"; $.ajax({ type: "POST", url: t, data: { vid: e }, dataType: "html", beforeSend: function () { $(".CourseListData").before(function () { return getLoadingImg(); }); }, success: function (e) { $(".CourseListData").html(e), $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"), $("#imgLoader").remove(); }, }); } } function convertToMonthsYears(e) { if (0 == e) var t = "Life Time"; else if (e > 0 && e < 365) t = Math.ceil(e / 30) + " Months"; else t = Math.ceil(e / 365) + " Years"; return t; } function ChangePriceByMonth(e) { var t = e.split(":"), r = t[0], a = t[1], o = convertToMonthsYears(r); $("#lbl_price").html(a), $("#checkout_price").val(a), $("#price").val(a), $("#free_update").html(o), $("#free_update_val").val(r); var n = $("#subscription_plan").val(); "1" == n ? ($("#plan_type").html("Single User - 2 PC's"), $("#usage").val("Single User - 2 PC's")) : "2" == n ? ($("#plan_type").html("10 Users - 25 PC's"), $("#usage").val("10 Users - 25 PC's")) : "3" == n && ($("#plan_type").html("Unlimited Users, PC's"), $("#usage").val("Unlimited Users, PC's")); } function ChangePriceByType(e) { var t = $("#sub_options_container_" + e).html(); $("#subscription_options").html(t); var r = $("#subscription_options").val().split(":"), a = r[1], o = r[0], n = ((a = r[1]), convertToMonthsYears(o)); $("#lbl_price").html(a), $("#checkout_price").val(a), $("#price").val(a), $("#free_update").html(n), $("#free_update_val").val(o), $("#lbl_price").html(a), $("#checkout_price").val(a), $("#price").val(a), "1" == e ? ($("#plan_type").html("Single User - 2 PC's"), $("#usage").val("Single User - 2 PC's")) : "2" == e ? ($("#plan_type").html("10 Users - 25 PC's"), $("#usage").val("10 Users - 25 PC's")) : "3" == e && ($("#plan_type").html("Unlimited Users, PC's"), $("#usage").val("Unlimited Users, PC's")); } function submitBundle() { $("#bundleInfoForm").submit(); } function validatePreOrder() { var e = $.trim($("#preorder-email").val()); if ("" == e) return $("#preorderMsg").show(), $("#preorderMsg").html('
Please enter your email address.
'), !1; if (0 == validateEmail(e)) return (msg = 'Please enter valid email address.
'), $("#preorderMsg").show(), $("#preorderMsg").html(msg), !1; var t = BASE_URL + "/exams/preorder", r = $("#preorder-form").serialize(); $.ajax({ type: "POST", url: t, data: r, dataType: "json", beforeSend: function () { $("#btnPreOrder").before(function () { return getLoadingImg(); }); }, success: function (e) { e.Error ? ($("#preorderMsg").show(), $("#preorderMsg").html('' + e.MSG + "
")) : ($("#preorderMsg").show(), $("#preorderMsg").html('' + e.MSG + "
")), $("#imgLoader").remove(); $("#perOrderExamId").val(); }, error: function () { alert("something went wrong please try again"), $("#imgLoader").remove(); }, }); } function validateEmail(e) { return /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(e); } function ajaxLoadVendorExams(e) { if (e > 0) { var t = BASE_URL + "demos/ajax_get_exams"; $.ajax({ type: "POST", url: t, data: { vid: e }, dataType: "json", beforeSend: function () {}, success: function (e) { for (var t = '', r = 0; r < e.length; r++) t += '"; $("#demo_exam_id").find("option").remove().end().append(t), $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"), $("#imgLoader").remove(); }, }); } else { $("#demo_exam_id").find("option").remove().end().append(''), $("#imgLoader").remove(); } } function getLisenceKey(e, t, r, a, o) { if (e) { var n = e.replace(/[_\W]+/g, ""); n = n + "_practice_" + t; var i = BASE_URL + "users/getLisenceKey"; $.ajax({ type: "POST", url: i, data: { exam_code: e, order_id: t, validity: r, allowed_devices: a, qty: o }, dataType: "json", beforeSend: function () { $("#" + n + " #serialKeyBtn").before(function () { return getLoadingImg(); }), $("#" + n + " #serialKeyBtn").remove(); }, success: function (e) { var t = e.html, r = e.popup, a = e.share; $(".member-area-container").append(r), $(".member-area-container").append(a), $("body").on("click", 'input[name="extension_type"]', function () { if ("add_users" == $(this).val()) { $(".hideifDuration").show(); var e = $('input[name="lisence_key_price_activation"]').val(); $("#lisence_update_form #lbl_price").html(e); } else { $(".hideifDuration").hide(); e = $('input[name="lisence_key_price"]').val(); $("#lisence_update_form #lbl_price").html(e); } }), $("#" + n + " .serialKeyBox").append(t), $("#" + n + " #serialKeyBtn").remove(), $("#imgLoader").remove(); var o = $(".lisencePopup #cardNumber"), i = $(".lisencePopup #card-number-field"), s = $(".lisencePopup #cvv"); o.payform("formatCardNumber"), s.payform("formatCardCVC"), o.keyup(function () { o.removeClass("visa"), o.removeClass("amex"), o.removeClass("mastercard"), console.log($.payform.parseCardType(o.val())), 0 == $.payform.validateCardNumber(o.val()) ? i.addClass("has-error") : (i.removeClass("has-error"), i.addClass("has-success")), "visa" == $.payform.parseCardType(o.val()) ? o.addClass("visa") : "amex" == $.payform.parseCardType(o.val()) ? o.addClass("amex") : "mastercard" == $.payform.parseCardType(o.val()) && o.addClass("mastercard"); }); }, error: function () { alert("something went wrong please try again"), $("#" + n + " #imgLoader").remove(); }, }); } else $("#" + n + " .serialKeyBox").html(""), $("#" + n + " #imgLoader").remove(); } function validateDemoForm() { var type = $("#demo_product_type").val(), e = $("#demo_vendor_id").val(), t = $("#demo_exam_id").val(), r = $("#demo_email").val(); return "" == type ? ($("#demoMsg").show(), $("#demoMsg").html('Please select type.
'), !1) : "" == e ? ($("#demoMsg").show(), $("#demoMsg").html('Please select vendor.
'), !1) : "" == t ? ($("#demoMsg").show(), $("#demoMsg").html('Please select exam.
'), !1) : "" == r ? ($("#demoMsg").show(), $("#demoMsg").html('Please enter your email address.
'), !1) : 0 == validateEmail(r) ? (msg = 'Please enter valid email address.
', $("#demoMsg").show(), $("#demoMsg").html(msg), !1) : void $("#demos_form").submit() } function updateLicense(e, t) { if (e <= 2) var r = "69", a = 0; else if (3 == e) (r = "84"), (a = 21); else if (4 == e) (r = "112"), (a = 28); else if (5 == e) (r = "140"), (a = 35); else if (6 == e) (r = "168"), (a = 42); $("#sub_total_" + t).html("$" + r), $("#license_discount_" + t).html("$" + a + " discount"), e > 2 ? $("#license_discount_" + t).show() : $("#license_discount_" + t).hide(); } function validatePasswordChange() { var e = $.trim($("#password").val()), t = $.trim($("#cpassword").val()); if ("" == e) return $("#passwordErrorMsg").show(), $("#passwordErrorMsg").html('Please enter your password.
'), !1; if (e != t) return $("#passwordErrorMsg").show(), $("#passwordErrorMsg").html('Password should match with confirm password.
'), !1; var r = BASE_URL + "users/changePassword", a = $("#passwordForm").serialize(); $.ajax({ type: "POST", url: r, data: a, dataType: "json", beforeSend: function () { $("#passwordErrorMsg").before(function () { return getLoadingImg(); }); }, success: function (e) { e.Error ? ($("#passwordErrorMsg").show(), $("#passwordErrorMsg").html('' + e.MSG + "
")) : ($("#passwordErrorMsg").show(), $("#passwordErrorMsg").html('' + e.MSG + "
")), $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"), $("#imgLoader").remove(); }, }); } function validatePasswordChange2() { var e = $.trim($("#password").val()), t = $.trim($("#cpassword").val()); return "" == e ? ($("#passwordErrorMsg").show(), $("#passwordErrorMsg").html('Please enter your password.
'), !1) : e != t ? ($("#passwordErrorMsg").show(), $("#passwordErrorMsg").html('Password should match with confirm password.
'), !1) : void 0; } function validateUserProfile() { var e = $.trim($("#full_name").val()), t = $.trim($("#email").val()), r = $.trim($("#country_id").val()), a = ($.trim($("#gender").val()), $.trim($("#mobile").val())), o = $.trim($("#mobile").val()); if ("" == e) return $("#profileErrorMsg").show(), $("#profileErrorMsg").html('Please enter your name.
'), !1; if ("" == t) return $("#profileErrorMsg").show(), $("#profileErrorMsg").html('Please enter your email address.
'), !1; if ("" == r) return $("#profileErrorMsg").show(), $("#profileErrorMsg").html('Please select your country.
'), !1; if ("" == a) return $("#profileErrorMsg").show(), $("#profileErrorMsg").html('Please enter your phone.
'), !1; if ("" == o) return $("#profileErrorMsg").show(), $("#profileErrorMsg").html('Please enter your mobile.
'), !1; var n = BASE_URL + "users/updateprofile", i = $("#userProfileForm").serialize(); $.ajax({ type: "POST", url: n, data: i, dataType: "json", beforeSend: function () { $("#btnChangePasswordSubmit").before(function () { return getLoadingImg(); }); }, success: function (e) { e.Error ? ($("#profileErrorMsg").show(), $("#profileErrorMsg").html('' + e.MSG + "
")) : ($("#profileErrorMsg").show(), $("#profileErrorMsg").html('' + e.MSG + "
")), $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"), $("#imgLoader").remove(); }, }); } function checkEmailExistsforReseller(e) { if ("" == e) return !1; var t = BASE_URL + "../register/checkifEmailExists"; $.ajax({ type: "POST", url: t, data: { email: e }, dataType: "json", success: function (t) { "Success" == t.msgStatus ? ($(".createCustomer p.error").remove(), $(".createCustomer #btnCreateResellerUser").removeAttr("disabled")) : ($(".createCustomer p.error").remove(), $(".createCustomer #email").val(""), $(".createCustomer #email").after('' + e + " already exists please try another email address.
")); }, error: function () { console.log("something went wrong please try again"); }, }); } function getResellerUsers() { var e = BASE_URL + "users/getResellerUsers"; $.ajax({ type: "POST", url: e, dataType: "json", success: function (e) { e.data && (console.log(e.data), $(".listCustomers #dataTable").DataTable().destroy(), $(".listCustomers #dataTable tbody").html(e.data), $(".listCustomers #dataTable").DataTable({ aaSorting: [[2, "desc"]] })); }, error: function () { console.log("something went wrong please try again"); }, }); } function deleteUser(e) { if (!confirm("Are you sure you want to delete this User?")) return !1; $("#user_" + e).remove(); var t = BASE_URL + "users/deleteUser"; $.ajax({ type: "POST", url: t, data: { user_id: e }, dataType: "json", success: function (t) { "Success" == t.msgStatus && ($("#user_" + e).remove(), getResellerUsers(), location.reload()); }, error: function () { console.log("something went wrong please try again"); }, }); } function validateShareForm(e) { var t = $("#" + e + " #user_id option:selected").val(); if ("" == t) return $("#" + e + " #user_id").css("border", "1px solid red"), !1; var r = $("#" + e + " #share_product_form").serialize(), a = BASE_URL + "users/share_product"; $.ajax({ type: "POST", url: a, data: r, dataType: "json", beforeSend: function () { toggleDisable("btn-demo", !0), $("#btn-demo").after(function () { return getLoadingImg(); }); }, success: function (r) { "Error" == r.msgStatus ? $("#" + e + " #response").html(r.msg) : "Success" == r.msgStatus && ($("#" + e + " #response").html(r.msg), getUserSharedProducts(t), location.reload()), toggleDisable("btn-demo", !1), $("#imgLoader").remove(); }, error: function () { console.log("something went wrong please try again"), toggleDisable("btn-demo", !1), $("#imgLoader").remove(); }, }); } function checkEmailExists(email) { var URL = BASE_URL + "register/checkifEmailExists"; $.ajax({ type: "POST", url: URL, data: { email: email, }, dataType: "json", beforeSend: function () { $("#email").before(function () { return getLoadingImg(); }); $("#email_pay").before(function () { return getLoadingImg(); }); }, success: function (response) { if (response.msgStatus == "Success") { $("p.error").remove(); $(".sign-in-login-btn").removeAttr("disabled"); $("#imgLoader").remove(); } else { $("#imgLoader").remove(); $("p.error").remove(); // $('#email').val(''); $("#email").after('' + email + ', this account already exists. Kindly Login to your account.
'); // $('#email_pay').val(''); $(".sign-in-login-btn").attr("disabled", "disabled"); $("#email_pay").after('' + email + ', this account already exists. Kindly Login to your account.
'); $(".popupBox").magnificPopup({ type: "ajax", alignTop: !0, closeOnBgClick: !0, showCloseBtn: !0, modal: !0, overflowY: "scroll", fixedContentPos: !0, }); } $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"); $("#imgLoader").remove(); }, }); } function updateBundlePrice() { var e = $("#subscription").val(), t = $("#subscription_plan").val(), r = $("#price").val(); $("#checkout_price").val(), $("#subscription_price_3_inc").val(), $("#subscription_price_6_inc").val(), $("#subscription_price_12_inc").val(), $("#individual_pcs").val(), $("#individual_price_inc").val(), $("#corporate_pcs").val(), $("#corporate_price_inc").val(), $("#trainer_pcs").val(), $("#trainer_price_inc").val(); (r = parseInt(r) + parseInt($("#subscription_price_" + e + "_inc").val())), (r = parseInt(r) + parseInt($("#" + t + "_price_inc").val())), $("#checkout_price").val(r), // alert(t); $("#lbl_price").html(r); var a = 30 * e; $("#free_update").html(a + " days"), $("#plan_type").html($("#" + t + "_pcs").val() + " PC's"); } function openPopup() { $.magnificPopup.open(); } function closePopup() { $.magnificPopup.close(); } function deleteUserProduct(e, t, r, a, o) { if (!confirm("Are you sure you want to remove this product from user?")) return !1; $("#userProd_" + e).remove(); var n = BASE_URL + "users/deleteUserProduct"; $.ajax({ type: "POST", url: n, data: { user_id: t, exam: r, serial_key: a, order_id: o }, dataType: "json", success: function (r) { "Success" == r.msgStatus && ($("#userProd_" + e).remove(), getUserSharedProducts(t), location.reload()); }, error: function () { console.log("something went wrong please try again"); }, }); } function getUserSharedProducts(e) { var t = BASE_URL + "users/getUserSharedProducts"; $.ajax({ type: "POST", url: t, data: { reseller_id: e }, dataType: "json", success: function (e) { e.data && ($(".listCustomers #dataTableProducts").DataTable().destroy(), $(".listCustomers #dataTableProducts tbody").html(e.data), $(".listCustomers #dataTableProducts").DataTable()); }, error: function () { console.log("something went wrong please try again"); }, }); } function calculatePrice() { var e = $("#demo_exam_id option:selected").val(); if ("" != e && "Select Exam" != e) { var t = 0, r = BASE_URL + "exams/getProductPrice"; $.ajax({ type: "POST", url: r, data: { exam_code: e }, dataType: "json", success: function (r) { if (r) { console.log(r); var a = r.pdf_price, o = r.practice_price, n = r.key_price, i = r.exam_id; if ((console.log(n), $("#pdf_check").is(":checked"))) { var s = 0, l = $("#num_copy").val(); $("#num_pdf").val(l), l ? (s = n * (l -= 1)) : $("#num_pdf").val(1), $("#bundle_type_id").val(i); var d = parseInt(a) + parseInt(s); t = parseInt(t) + parseInt(d); } if ($('input[name="practice_check"]:checked').length > 0) if ("additional" == $('input[name="practice_check"]:checked').val()) { var c = 0, p = $("#num_license").val(); $("#num_license_hidden").val(p), $("#qty").val(1), p ? (c = n * (p -= 1)) : $("#num_license_hidden").val(1); var u = parseInt(n) + parseInt(c); t = parseInt(t) + parseInt(u); } else { var m = 0, f = $("#num_license_act").val(); $("#qty").val(f), $("#num_license_hidden").val(1), f ? (m = n * (f -= 1)) : $("#qty").val(1); u = parseInt(n) + parseInt(m); t = parseInt(t) + parseInt(u); } $("#bundle_name").val(e + " Reseller Bundle Pack"), $("#price").val(t), $("#checkout_price").val(t), $("#bundle_type_id").val(i), $("#actualPrice").html(n), t > 0 ? ($("#lbl_price").html(t), $(".resel_price").show(), $("#rtl_price").html(o), $(".retail_Price").show(), $(".yourPrice").show(), $("#submitResellBtn").removeAttr("disabled")) : ($(".retail_Price").hide(), $(".yourPrice").hide(), $(".resel_price").hide(), $("#submitResellBtn").attr("disabled", "disabled")), console.log(t); } }, error: function () { alert("something went wrong please try again"); }, }); } else $(".retail_Price").hide(), $(".yourPrice").hide(), $(".resel_price").hide(), $("#submitResellBtn").attr("disabled", "disabled"); } function updateBundlePriceNew(e) { var t = "#" + e; console.log(t + " #subscription"); var r = $(t + " #subscription").val(), a = $(t + " #subscription_plan").val(); console.log(r), console.log(a); var o = $(t + " #price").val(); $(t + " #checkout_price").val(), $(t + " #subscription_price_3_inc").val(), $(t + " #subscription_price_6_inc").val(), $(t + " #subscription_price_12_inc").val(), $(t + " #individual_pcs").val(), $(t + " #individual_price_inc").val(), $(t + " #corporate_pcs").val(), $(t + " #corporate_price_inc").val(), $(t + " #trainer_pcs").val(), $(t + " #trainer_price_inc").val(); (o = parseInt(o) + parseInt($(t + " #subscription_price_" + r + "_inc").val())), (o = parseInt(o) + parseInt($(t + " #" + a + "_price_inc").val())), $(t + " #checkout_price").val(o), $(t + " #lbl_price").html(o); var n = 30 * r; console.log(n + " days"), console.log($(t + " #" + a + "_pcs").val() + " PC's"), $(t + " #free_update").html(n + " days"), $(t + " #plan_type").html($(t + " #" + a + "_pcs").val() + " PC's"); } function validateLisenceFormPopup(e) { if (0 == $("#cardNumber").val().length) return $("#cardNumber").css("border-color", "red"), !1; if (0 == $("#cvv").val().length) return $("#cvv").css("border-color", "red"), !1; $("input").css("border-color", "#ccc"); var t = $("#" + e + " #lisence_update_form").serialize(), r = BASE_URL + "users/extendLisence"; $.ajax({ type: "POST", url: r, data: t, dataType: "json", beforeSend: function () { toggleDisable("btn-demo", !0), $("#btn-demo").after(function () { return getLoadingImg(); }); }, success: function (t) { "Error" == t.msgStatus ? $("#" + e + " #response").html(t.msg) : "Success" == t.msgStatus && ($("#" + e + " #response").html(t.msg), setTimeout(function () { redirectPage(BASE_URL + "users/"); }, 2e3)), toggleDisable("btn-demo", !1), $("#imgLoader").remove(); }, error: function () { alert("something went wrong please try again"), toggleDisable("btn-demo", !1), $("#imgLoader").remove(); }, }); } function extendLicensePrice() { var e = 30 * $("#num-of-licenses").val(); $('input[name="lisence_key_price_activation"]').val(e), $("#lbl_price").text(e); } function replaceThisKey(e, t, r, a) { var o = { serial_key: e, customer_email: t, exam_code: r, order_id: a }, n = BASE_URL + "users/replaceKeyFunc"; $.ajax({ type: "POST", url: n, data: o, dataType: "json", beforeSend: function () { $("#replaceKey").after(function () { return getLoadingImg(); }); }, success: function (e) { location.reload(), $("#imgLoader").remove(); }, error: function () { location.reload(), console.log(response), $("#imgLoader").remove(); }, }); } function submitCartForm() { return 0 == $("#first_name").val().length ? ($(".first_name-error").text("The First Name field is required."), !1) : 0 == $("#email").val().length ? ($(".email-error").text("The Email field is required."), !1) : 0 == $("#street_address").val().length ? ($(".street_address-error").text("The Street Address field is required."), !1) : 0 == $("#city").val().length ? ($(".city-error").text("The City field is required."), !1) : 0 == $("#zip").val().length ? ($(".zip-error").text("The Zip Code field is required."), !1) : 0 == $("#InputCountry").val().length ? ($(".InputCountry-error").text("The Country field is required."), !1) : 0 == $("#cardNumber").val().length ? ($(".cardNumber-error").text("The Card Number field is required."), !1) : 0 == $("#cvv").val().length ? ($(".cvv-error").text("The Card Code field is required."), !1) : ($("#checkoutForm").submit(), $(".loadingimg h3").text("Please Wait - Your Transaction is in Process......."), void $(".loadingimg").show()); } function submitPaypalForm() { if (0 == $(".paypal_mail").val().length) return $(".paypal_mail_error").text("The Email field is required."), !1; $("#checkoutPaypalForm").submit(), $(".paypal_mail_error").text(""); } function saveManualOrder(e) { var t = getOldHtml("ordersInfMsg"), r = $("#user_id").val(), a = $("#exam_id").val(); if ("" == r || r < 1) { var o = "Please select customer"; displayMessage("ordersInfMsg", "danger", o, t); } if ("" == a || a < 1) { o = "Please select exam"; displayMessage("ordersInfMsg", "danger", o, t); } var n = $("#order_type").val(), i = $("#discount").val(); if ("bundle" == n) { var s = 100 + $("#productId_" + e).val(), l = "bundle"; $("#bundle_type").val(); } else (s = $("#productId_" + e).val()), (l = "single"); if ($("#add_order_" + e).is(":checked")) { var d = $("#ptypeId_" + e).val(), c = $("#productName_" + e).val(), p = $("#productQty_" + e).val(), u = $("#productPrice_" + e).val(), m = i, f = $("#itemSubPlan_" + e).val(), v = $("#itemSubPeriod_" + e).val(), g = parseInt(u) * parseInt(p), h = BASE_URL + "admin/orders/listManualOrder"; $.ajax({ type: "POST", url: h, dataType: "json", data: { pTypeId: d }, beforeSend: function () { $("#orderListContainer").before(function () { return getLoadingImg(); }); }, success: function (e) { var t = s.split(","), r = t[0], a = t[1], o = '", n = e.iconImg, i = ($("#tblOrderProducts tbody tr").size(), "'); calculateOrderAmount(u, m, g); var d = ''; (d += ''), (d += ''), (d += ''), (d += ''), (d += ''), (d += ''), (d += ''), (d += ''), (d += ''), (d += ''); var h = '