$(document).ready(function() { var formTarget = ".form_validation"; if ($(formTarget).length > 0) { $(formTarget).each(function() { $(this).validate({ focusInvalid: false, errorPlacement: function(error, elem) { $(elem).attr('id') == 'sso_terms' ? error.appendTo(elem.closest('.controls').find('.sso_terms_labeldiv')) : $(elem).closest('.controls').find('.error-wrapper').text(error.text()); }, onfocusout: function(elem) { $(elem).valid(); if ($(elem).val() == "") { $(elem).removeClass('error').next('.error').remove(); } }, onkeyup: function(elem) { $(elem).valid(); $(elem).removeClass('error').next('.error').remove(); }, highlight: function(elem) { $(elem).addClass('error').removeClass('valid').closest('.control-group').addClass('error').removeClass('valid'); }, unhighlight: function(elem) { $(elem).removeClass('error').addClass('valid').closest('.control-group').removeClass('error').addClass('valid'); } }); }); }; $(".owl-carousel").owlCarousel({ navigation: false, slideSpeed: 300, addClassActive: true, singleItem: true, responsiveRefreshRate: 500 }); $(".myAccountContentMenu-1111").owlCarousel({ items: 5, navigation: false, pagination: false, slideSpeed: 300, responsive: false, autoWidth: true, afterInit: function(contentMenuCarousel) { contentMenuCarousel.find('.owl-item').each(function() { $(this).width( $(this).find('a').outerWidth() ); }); } }); /* links inside labels fix $('label a').click(function() { window.open($(this).attr('href'), "_blank"); return false; }); */ // Validation on Inputs for Numbers Only $('.numbersOnly').keyup(function () { this.value = this.value.replace(/[^0-9\.]/g,''); }); // tooltip fix on iOS (iPhones) $('[data-toggle="tooltip"]').on('touchstart',function() { $(this).tooltip('show'); }); $(document).on('touchstart',function(e) { if ( !$(e.target).is('[data-toggle="tooltip"]') ) { $('[data-toggle="tooltip"]').tooltip('hide'); } }); // end tooltip fix on iOS (iPhones) if ($('#cardTable').length > 0) { $('#cardTable').cardtable({myClass:"stacktableMobile"}); } // Global Close Modal $('.closeModalBtn').click(function() { $(this).closest('.modal').modal('hide'); return false; }); // OPTIMIZARE ABONAMENT var myacc_planTarifar_itemTitle, myacc_planTarifar_itemValue = ""; $('.myacc_planTarifar_item .planTarifarSelectBtn').click(function() { if ( !$(this).hasClass('disabled') ) { myacc_planTarifar_itemTitle = $(this).closest('.myacc_planTarifar_details').find('h3').text(); myacc_planTarifar_itemValue = $(this).closest('.myacc_planTarifar_details').find('.myacc_planTarifar_price').text(); $(this).hide(); $(this).parent().find('.planTarifarDeselectBtn').css('display', 'inline-block'); $(this).closest('.myacc_planTarifar_item').siblings().find('.planTarifarSelectBtn').addClass('disabled'); $('.myacc_spt_ContinueBtn').removeClass('disabled'); $('.myacc_spt_newPlanWrapper .myacc_spt_planLeftCol').text(myacc_planTarifar_itemTitle); $('.myacc_spt_newPlanWrapper .myacc_spt_planRightCol').text(myacc_planTarifar_itemValue); $('#modal-optimized-plan-title').html(myacc_planTarifar_itemTitle + ' (' + myacc_planTarifar_itemValue + ')'); $('.myacc_spt_newPlanWrapper').show(); return false; } }); $('.myacc_planTarifar_item .planTarifarDeselectBtn').click(function() { $(this).hide(); $(this).parent().find('.planTarifarSelectBtn').css('display', 'inline-block'); $(this).closest('.myacc_planTarifar_item').siblings().find('.planTarifarSelectBtn').removeClass('disabled'); $('.myacc_spt_newPlanWrapper .myacc_spt_planLeftCol, .myacc_spt_newPlanWrapper .myacc_spt_planRightCol').text(""); $('.myacc_spt_newPlanWrapper').hide(); $('.myacc_spt_ContinueBtn').addClass('disabled'); return false; }); // END OPTIMIZARE ABONAMENT $('.closeAlertBox').click(function() { $(this).closest('.telekomAlertBox').stop().fadeOut(400, function() { $(this).closest('.telekomAlertBox').hide(); }); return false; }); /* ACCORDION SLIDE SCRIPT */ $('.custom_accordionTitle').click(function() { $(this).parent('.custom_accordionItem').siblings().removeClass('active').find('.custom_accordionContent').slideUp('fast'); $(this).parent('.custom_accordionItem').toggleClass('active'); $(this).next('.custom_accordionContent').slideToggle('fast'); $('input[name=new_service_group_1]:checked', '.myacc_actDeactExtraoptionForm').attr("checked", false); return false; }); // My Account Left Menu $('.myAccountLeftMenu > ul > li > a').click(function() { return false; }); // check if cost has more than 4 chars if ($('.icib_costSupl .icib_value span').text().length > 4) { $('.icib_costSupl').addClass('higherCostSupl'); } // Admin Acorduri $(".select-consent-status").change(function () { $(this).closest('form').find('.adm_ac_status_btn_save').removeAttr('disabled'); }); $('.adm_ac_status_btn_save').click(function(event) { $('#consent-name').val($(this).data('consent-name')); $('#consent-type').val($(this).data('consent-type')); if ($('#consent-status').val() == 'NO'){ $('#modal_admin_acord_change').modal('show'); } else { $('#changeStatus').click(); } // $(this).addClass('hidden').parent().find('.adm_ac_status_btn_edit').removeClass('hidden'); // $(this).closest('form').find('.myacc_adm_ac_status_select select').attr('disabled', 'disabled'); return false; }); $('.details-modal').click(function(event) { $('#modal_details_consent div.modal-header h2').html($(this).data('name')); $('#modal_details_consent div.modal-body p').html($(this).data('long-description')); $('#modal_details_consent').modal('show'); }); $('.loialitate_accepted_marketing_consent').click(function(event) { if ($(this).data('from-prelungire-abonament-page') == true){ $('#fromPrelungireAbonamentPage').val(true); $('#successUrlPrelungireAbonament').val($(this).attr("href")); } else { $('#fromPrelungireAbonamentPage').val(false); } if ($(this).data('display-consent-modal') == true){ $('#mobileRateplanChangeTabModal').modal('show'); } else { $(".loialitate_accepted_marketing_consent").click(); } return false; }); $("#renewalAboname").click(function(event) { if ($('#renewalAbo span').text() == "true"){ $('#mobileRateplanChangeTabModal').modal('show'); return false; } }); $('#modal_loialitate_consent_change_cancel').click(function(event) { $('#mobileRateplanChangeTabModal').modal('hide'); return false; }); // SMS FROM WEB var $smsFromWebTextarea = $('.myacc_smsFromWeb_Sections .smsfw_textarea'); var smsFromWebTextareaMaxLength = $smsFromWebTextarea.attr('maxlength'); $('.smsfw_ta_totalCh').text(smsFromWebTextareaMaxLength); function checkLengthTextarea() { var length = $smsFromWebTextarea.val().length; var length = smsFromWebTextareaMaxLength-length; $('.smsfw_ta_currentCh').text(length); } $smsFromWebTextarea.on('keydown keypress keyup', function() { checkLengthTextarea(); }); // END SMS FROM WEB // My Account Responsive Menu var windw = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; $('header').after('
 
'); if (windw < 769) { $('.myAccount').unbind('click'); $('.myAccount').click(function() { // hide main menu if opened $('.menuM.selected').click(); // reload vars on click var windw = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if (windw < 769) { $('body').stop().toggleClass('userMenuActive'); $('.mobileUserMenuOverlay').stop().fadeToggle('fast'); return false; } }); $('.myAccUserMenuClose a, .mobileUserMenuOverlay').click(function() { var windw = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if (windw < 769) { $('body').stop().removeClass('userMenuActive'); $('.mobileUserMenuOverlay').stop().fadeOut('fast'); return false; } }); } if($('.serviceLabelClass').length > 0) { $('#'+$('.serviceLabelClass')[0].id).click() } // $(".myacc_available_services").find("label#serviceLabel0").click(); // $(".myacc_available_services").find("label#tvServiceLabel00").click(); }); function selectNetService(label, event) { //event.preventDefault(); $("form#activateOptionForm").find("#offerId").val(""); $("form#activateOptionForm").find("#vOffer").val(""); $("form#activateOptionForm").find("#siid").val(""); $("form#activateOptionForm").find("#activationCode").val(""); $("form#deactivateOptionForm").find("#offerId").val(""); $("form#deactivateOptionForm").find("#vOffer").val(""); $("form#deactivateOptionForm").find("#siid").val(""); $("form#deactivateOptionForm").find("#skuCode").val(""); var modem = $(label).parent().parent().find("div[name='modem']"); var modemProductLabel = modem.attr("modemProductLabel"); var userName = modem.attr("userName"); var password = modem.attr("password"); var ip = modem.attr("ip"); var netServiceName = modem.attr("netServiceName"); var netServiceSid= modem.attr("netServiceSid"); var netServiceCompany = modem.attr("netServiceCompany"); if (modemProductLabel || userName || password) { $("#selectedNetService").find("#modemProductLabel").text(modemProductLabel); $("#selectedNetService").find("#modemUserName").text(userName); $("#selectedNetService").find("#modemPassword").text(password); //$("#selectedNetService").find("#modemIp").text(ip); $("#selectedNetService").find("#selectedServiceName").text(netServiceName); $("#selectedNetService").show(); } else { $("#selectedNetService").hide(); } var traffic = ServicesReady(function(isActiveLoaded, isAvailableLoaded) { if (isActiveLoaded && isAvailableLoaded) { $.getScript("/assets/js/myaccount/modals.js"); $.getScript("/assets/custom/internetFix/js/customjs-details-pages.js"); } }); $("#selectedNetService").find("#modemIpSpan").hide(); $("#activeServices").empty(); $("#availableServices").empty(); $("#myacc_netServiceActive_loading").show(); $("#myacc_netServiceAvail_loading").show(); $.ajax({ dataType: "html", type: "POST", url: "/blocks/myaccount/one/internetFix/activeOptions.jsp?selectedServiceSid=" + netServiceSid + "&selectedServiceName=" + netServiceName + "&selectedServiceCompany=" + netServiceCompany, success: function(data){ $("#activeServices").html(data); var $ipSpan = $("#activeServices").find("#ipAddress"); if($ipSpan.length > 0) { var ip = $ipSpan.data('ipaddress'); $("#selectedNetService").find("#modemIp").text(ip); $("#selectedNetService").find("#modemIpSpan").show(); } traffic.setIsActiveLoaded(true); $("#myacc_netServiceActive_loading").hide(); }, }); $.ajax({ dataType: "html", type: "POST", url: "/blocks/myaccount/one/internetFix/availableOptions.jsp?selectedServiceSid=" + netServiceSid + "&selectedServiceName=" + netServiceName + "&selectedServiceCompany=" + netServiceCompany, success: function(data){ $("#availableServices").html(data); traffic.setIsAvailableLoaded(true); $("#myacc_netServiceAvail_loading").hide(); }, }); } function selectNetServiceAvailableOption(label) { var option = $(label).parent().parent().find("div[name='option']"); var offerId = option.attr("offerId"); var vOffer = option.attr("vOffer"); var siid = option.attr("siid"); var activationCode = option.attr("activationCode"); $("form#activateOptionForm").find("#offerId").val(offerId); $("form#activateOptionForm").find("#vOffer").val(vOffer); $("form#activateOptionForm").find("#siid").val(siid); $("form#activateOptionForm").find("#activationCode").val(activationCode); } function selectVoceFixService(label) { $(label).find("input[type='radio']").prop('checked', true); var voceFix = $(label).parent().find("div[name='voceFix']"); var productLabel = voceFix.attr("voceFixServiceProductLabel"); var company= voceFix.attr("voceFixServiceCompany"); var siid = voceFix.attr("voceFixServiceSid"); var voceFixName = voceFix.attr("voceFixServiceName"); $("#availableSubscriberServices").empty(); $("#myacc_voceFixOptions_loading").show(); $.ajax({ dataType: "html", type: "POST", url: "/blocks/myaccount/one/voceFix/voceFixServiceOptions.jsp?productLabel=" + productLabel + "&company=" + company + "&siid="+siid + "&voceFixName=" + voceFixName, success: function(data){ $("#availableSubscriberServices").html(data); $('head').append( $('').attr('href', '/assets/custom/voceFix/css/customcss-details-pages.css') ); $.getScript("/assets/custom/voceFix/js/customjs-details-pages.js"); $.getScript("/assets/custom/voceFix/js/voce_fix_servicii.js"); $("#myacc_voceFixOptions_loading").hide(); }, }); } function ServicesReady(callback) { var isActiveLoaded = false; var isAvailableLoaded = false; return { getIsActiveLoaded : function() { return isActiveLoaded; }, setIsActiveLoaded : function(p) { isActiveLoaded = p; callback(isActiveLoaded, isAvailableLoaded); }, getIsAvailableLoaded : function() { return isAvailableLoaded; }, setIsAvailableLoaded : function(p) { isAvailableLoaded = p; callback(isActiveLoaded, isAvailableLoaded); } }; } function selectTvService(label, event) { //event.preventDefault(); $("form#activateOptionForm").find("#offerId").val(""); $("form#activateOptionForm").find("#vOffer").val(""); $("form#activateOptionForm").find("#siid").val(""); $("form#activateOptionForm").find("#activationCode").val(""); $("form#activateOptionForm").find("#incompatibaleActivated").val(""); $("form#activateOptionForm").find("#bundle").val(""); $("form#activateOptionForm").find("#bundleEoSkuCode").val(""); $("form#activateOptionForm").find("#bundleMessage").empty(); $("form#activateOptionForm").find("#bundleMessage").hide(); $("div#myAcc-modal-confirm-activate-warning").find("#incompatibleWarningMessage").empty(); $("form#deactivateOptionForm").find("#offerId").val(""); $("form#deactivateOptionForm").find("#vOffer").val(""); $("form#deactivateOptionForm").find("#siid").val(""); $("form#deactivateOptionForm").find("#skuCode").val(""); $("#activeTvServices").empty(); $("#availableTvServices").empty(); $("#myacc_tvServiceActive_loading").show(); $("#myacc_tvServiceAvail_loading").show(); var tvService = $(label).parent().parent().find("div[name='tvService']"); var tvServiceName = tvService.attr("tvServiceName"); var tvServiceSid= tvService.attr("tvServiceSid"); var tvServiceCompany = tvService.attr("tvServiceCompany"); var traffic = ServicesReady(function(isActiveLoaded, isAvailableLoaded) { if (isActiveLoaded && isAvailableLoaded) { $.getScript("/assets/js/myaccount/modals.js"); $.getScript("/assets/custom/tvServices/js/customjs-details-pages.js"); } }); $.ajax({ dataType: "html", type: "POST", url: "/blocks/myaccount/one/tv/activeTvOptions.jsp?selectedServiceSid=" + tvServiceSid + "&selectedServiceName=" + tvServiceName + "&selectedServiceCompany=" + tvServiceCompany, success: function(data){ $("#activeTvServices").html(data); traffic.setIsActiveLoaded(true); $("#myacc_tvServiceActive_loading").hide(); $.ajax({ dataType: "html", type: "POST", url: "/blocks/myaccount/one/tv/availableTvOptions.jsp?selectedServiceSid=" + tvServiceSid + "&selectedServiceName=" + tvServiceName + "&selectedServiceCompany=" + tvServiceCompany, success: function(data){ $("#availableTvServices").html(data); traffic.setIsAvailableLoaded(true); $("#myacc_tvServiceAvail_loading").hide(); } }); } }); } function selectTvServiceAvailableOption(label) { $("form#activateOptionForm").find("#bundleMessage").empty(); $("form#activateOptionForm").find("#bundleMessage").hide(); var option = $(label).parent().parent().find("div[name='option']"); var offerId = option.attr("offerId"); var vOffer = option.attr("vOffer"); var siid = option.attr("siid"); var activationCode = option.attr("activationCode"); var incompatibaleActivated = option.attr("incompatibaleActivated"); var bundle = option.attr("bundle"); var messageOnActivation = option.attr("messageOnActivation"); var incompatibleActivatedSkuCode = option.attr("incompatibleActivatedSkuCode"); if (!(incompatibaleActivated === 'true' && bundle === 'false')) { $("form#activateOptionForm").find("#offerId").val(offerId); $("form#activateOptionForm").find("#vOffer").val(vOffer); $("form#activateOptionForm").find("#siid").val(siid); $("form#activateOptionForm").find("#activationCode").val(activationCode); $("form#activateOptionForm").find("#incompatibaleActivated").val(incompatibaleActivated); $("form#activateOptionForm").find("#bundle").val(bundle); $("form#activateOptionForm").find("#bundleEoSkuCode").val(incompatibleActivatedSkuCode); } if (incompatibaleActivated === 'true' && bundle === 'true') { $("form#activateOptionForm").find("#bundleMessage").html(messageOnActivation); $("form#activateOptionForm").find("#bundleMessage").show(); } if (incompatibaleActivated === 'true' && bundle === 'false') { $("div#myAcc-modal-confirm-activate-warning").find("#incompatibleWarningMessage").html(messageOnActivation); $("p#activate-new-service-warning").show(); $("p#activate-new-service-common").hide(); } else { $("div#myAcc-modal-confirm-activate-warning").find("#incompatibleWarningMessage").empty(); $("p#activate-new-service-warning").hide(); $("p#activate-new-service-common").show(); } } function selectConsentStatus(selectedContract) { $('#consent-status').val(selectedContract); }