$(function(){$('.subscription-change-btn.button-active').on('click',function(e){let f=$(this).closest('.subscription-change-cont'),btn=$(this),type=btn.attr('data-type'),subscriptionId=btn.attr('data-subscription-id');e.preventDefault();if(type==='bucket'){f=$(this).closest('.tarifi-list-item-text-container');btn=f.find('.subscription-change-btn');}if(btn.hasClass('in-progress')){return;}else{btn.addClass('in-progress');}btn.off('click');btn.removeClass('subscription-change-btn button-active').addClass('button-inactive');f.find('.tariff-change-text').html('Sūta pieprasījumu...');$.request('onSubscriptionChange',{data:{subscription_id:subscriptionId},complete:function(data){let response=data.responseJSON;if(response.success){f.find('.tariff-change-text').html('Pieprasījums tiek apstrādāts... Par veiksmīgu pieslēgšanu, Tu saņemsi īsziņu telefonā.');}else if(response.error){f.find('.tariff-change-text').addClass('error-text').html(response.error);}btn.removeClass('in-progress' );}});});});