;(function($,_,undefined){"use strict";ips.controller.register('membersshop.buypoints',{initialize:function(){this.on('change','[name="ms_purchase_points"]',this.editAmount);this.setup();},setup:function(){},editAmount:function(){var amountVal=this.scope.find('[name="ms_purchase_points"]').val();var url=ips.getSetting('baseURL')+"?app=membersshop&module=shop&controller=main&do=sendAmount&amount=&amount="+amountVal;var submit=this.scope.find('[type="submit"]');ips.getAjax()(url).done(function(response){submit.text("Checkout "+response);});}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('membersshop.shop',{initialize:function(){this.on('click','[data-action="ms_filters"]',this.changeCategories);this.on('click','[data-action="ms_index_filters"]',this.changeIndexCategories);this.on('click','[data-action="ms_buy_and_use"]',this.buyAndUse);this.on('click','[data-action="ms_buy_use"]',this.buyUse);this.on('click','[data-action="ms_buy_and_store"]',this.buyAndStore);this.on('submit','[data-action="redeem"]',this.redeem);this.on('click','[data-role="ms_close_rpsls"]',this.rpslsClose);this.on('click','[data-action="ms_my_items_redeem"]',this.myItemsRedeem);this.on('click','[data-action="ms_my_items_redeem_ns"]',this.myItemsRedeemNS);this.on('click','[data-action="ms_view_item"]',this.viewItem);this.on('click','[data-action="ms_close_form"]',this.closeForm);this.on('click','[data-action="ms_change_stats"]',this.changeStats);this.on('click','[data-action="deposit"]',this.depositPoints);this.on('click','[data-action="withdraw"]',this.withdrawPoints);this.on('click','[data-action="sendItem"]',this.sendItem);this.on('click','[data-action="sellBack"]',this.sellBack);this.on('click','[data-action="redeemOthers"]',this.redeemOthers);this.on('click','[data-action="ms_bt_index"]',this.indexPage);this.setup();},setup:function(){},changeCategories:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;loading...</div>");ips.getAjax()(ajaxurl).done(function(response){if(response){mainElement.html(response.contents);sideBar.html(response.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,ajaxurl);document.getElementById("ipsLayout_header").scrollIntoView({behavior:"smooth"});$('body, html').animate({scrollTop:$("#membersshopMain").offset().top-10},1000);}}).fail(function(response){}).always(function(){$('.elAjaxLoading').remove();$('.ipsModal').remove();});return false;},changeIndexCategories:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;loading...</div>");ips.getAjax()(ajaxurl).done(function(response){if(response){mainElement.html(response.contents);sideBar.html(response.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,ajaxurl);$('body, html').animate({scrollTop:$("#membersshopMain").offset().top-10},1000);}}).fail(function(response){}).always(function(){$('.elAjaxLoading').hide();$('.ipsModal').hide();});return false;},buyAndUse:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');ips.ui.alert.show({type:'confirm',message:ips.getString('ms_confirm_purchase'),icon:'info',callbacks:{ok:function(){mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;Processing...</div>");ips.getAjax()(ajaxurl).done(function(response){$('.elAjaxLoading').remove();if(!response.error){mainElement.prepend(response.contents);var win=$(window);var offset=win.scrollTop();$("#membersshopForm").css({top:offset+'px'});$(document).trigger('contentChange',[mainElement]);}
if(response.error){$('.ipsModal').remove();ips.ui.alert.show({type:'alert',message:response.error,icon:'info',buttons:{ok:ips.getString('ms_ok')},});}});},cancel:function(){}}});return false;},buyUse:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');var refreshURL=document.location.href;ips.ui.alert.show({type:'confirm',message:ips.getString('ms_confirm_purchase'),icon:'info',callbacks:{ok:function(){mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;Processing...</div>");ips.getAjax()(ajaxurl).done(function(response){if(!response.error){ips.getAjax()(refreshURL).done(function(newResponse){if(newResponse){mainElement.html(newResponse.contents);sideBar.html(newResponse.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,refreshURL);}}).always(function(){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});});}
if(response.error){$('.elAjaxLoading').remove();$('.ipsModal').remove();ips.ui.alert.show({type:'alert',message:response.error,icon:'info',buttons:{ok:ips.getString('ms_ok')},});}});},cancel:function(){}}});return false;},buyAndStore:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');var refreshURL=document.location.href;ips.ui.alert.show({type:'confirm',message:ips.getString('ms_confirm_purchase'),icon:'info',callbacks:{ok:function(){mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;Processing...</div>");ips.getAjax()(ajaxurl).done(function(response){if(!response.error){ips.getAjax()(refreshURL).done(function(newResponse){if(newResponse){mainElement.html(newResponse.contents);sideBar.html(newResponse.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,refreshURL);}}).always(function(){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});});}
if(response.error){$('.elAjaxLoading').remove();$('.ipsModal').remove();ips.ui.alert.show({type:'alert',message:response.error,icon:'info',buttons:{ok:ips.getString('ms_ok')},});}});},cancel:function(){}}});return false;},redeem:function(e){e.preventDefault();var form=$(e.currentTarget).closest('form');var submit=this.scope.find('[type="submit"]');var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');var refreshURL=document.location.href;submit.prop('disabled',true).text(ips.getString('ms_processing'));ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(response){if(response.extra){form.html(response.extra);$(document).trigger('contentChange',[mainElement]);}
if(!response.extra){ips.getAjax()(refreshURL).done(function(newResponse){if(response.message){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});$('.ipsModal').remove();}
if(newResponse){$('#membersshopForm').remove();mainElement.html(newResponse.contents);sideBar.html(newResponse.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,refreshURL);}});}});return false;},myItemsRedeem:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');ips.ui.alert.show({type:'confirm',message:ips.getString('ms_confirm_redeem'),icon:'info',callbacks:{ok:function(){mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;Processing...</div>");ips.getAjax()(ajaxurl).done(function(response){if(response){mainElement.prepend(response.contents);var win=$(window);var offset=win.scrollTop();$("#membersshopForm").css({top:offset+'px'});$('.elAjaxLoading').remove();$(document).trigger('contentChange',[mainElement]);}}).fail(function(response){}).always(function(){});},cancel:function(){}}});return false;},myItemsRedeemNS:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var refreshURL=document.location.href;ips.ui.alert.show({type:'confirm',message:ips.getString('ms_confirm_redeem'),icon:'info',callbacks:{ok:function(){mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;Processing...</div>");ips.getAjax()(ajaxurl).done(function(response){ips.getAjax()(refreshURL).done(function(newResponse){if(newResponse){mainElement.html(newResponse.contents);$(document).trigger('contentChange',[mainElement]);History.pushState(null,document.title,refreshURL);}}).always(function(){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});$('.elAjaxLoading').remove();});});},cancel:function(){}}});return false;},viewItem:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;Loading...</div>");ips.getAjax()(ajaxurl).done(function(response){if(response){mainElement.html(response.contents);sideBar.html(response.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,ajaxurl);$('body, html').animate({scrollTop:$("#membersshopMain").offset().top-10},1000);}}).always(function(){$('.elAjaxLoading').remove();});return false;},rpslsClose:function(e){e.preventDefault();var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');var refreshURL=document.location.href;$('.membersshopForm').remove();$('.ipsModal').remove();ips.getAjax()(refreshURL).done(function(response){if(response){mainElement.html(response.contents);sideBar.html(response.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,refreshURL);}});return false;},closeForm:function(e){e.preventDefault();var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');var refreshURL=document.location.href;$('.membersshopForm').remove();$('.ipsModal').remove();ips.getAjax()(refreshURL).done(function(response){if(response){mainElement.html(response.contents);sideBar.html(response.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,refreshURL);}});return false;},changeStats:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;loading...</div>");ips.getAjax()(ajaxurl).done(function(response){if(response){mainElement.html(response.contents);$(document).trigger('contentChange',[mainElement]);History.pushState(null,document.title,ajaxurl);}}).fail(function(response){}).always(function(){$('.elAjaxLoading').remove();$('.ipsModal').remove();});return false;},depositPoints:function(e){e.preventDefault();var form=$(e.currentTarget).closest('form');var submit=$(e.currentTarget);var currentText=submit.text();var mainElement=$('#ipsLayout_mainArea');var refreshURL=document.location.href;var formValue=$('[name="ms_deposit_amount"]').val();var formMax=$('[name="ms_deposit_amount"]').attr('max');var formMin=$('[name="ms_deposit_amount"]').attr('min');if(!formValue||formValue>formMax||formValue<formMin){if(formMax<formMin){$('#deposit_message').html(ips.getSetting('depositMinAmount'));ips.utils.anim.go('pulseOnce slow',$('#deposit_message'));return false;}
else{$('#deposit_message').html(ips.getSetting('depositMinMax'));ips.utils.anim.go('pulseOnce slow',$('#deposit_message'));return false;}}
submit.prop('disabled',true).text(ips.getString('ms_processing'));ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(response){ips.getAjax()(refreshURL).done(function(newResponse){if(newResponse){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});mainElement.html(newResponse.contents);$(document).trigger('contentChange',[mainElement]);History.pushState(null,document.title,refreshURL);}});}).fail(function(){form.submit();}).always(function(){});return false;},withdrawPoints:function(e){e.preventDefault();var form=$(e.currentTarget).closest('form');var submit=$(e.currentTarget);var currentText=submit.text();var mainElement=$('#ipsLayout_mainArea');var refreshURL=document.location.href;var formValue=$('[name="ms_withdraw_amount"]').val();var formMax=$('[name="ms_withdraw_amount"]').attr('max');var formMin=$('[name="ms_withdraw_amount"]').attr('min');if(!formValue||formValue>formMax||formValue<formMin){if(formMax<formMin){$('#withdraw_message').html(ips.getSetting('withdrawMinAmount'));ips.utils.anim.go('pulseOnce slow',$('#withdraw_message'));return false;}
else{$('#withdraw_message').html(ips.getSetting('withdrawMinMax'));ips.utils.anim.go('pulseOnce slow',$('#withdraw_message'));return false;}}
submit.prop('disabled',true).text(ips.getString('ms_processing'));ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(response){ips.getAjax()(refreshURL).done(function(newResponse){if(newResponse){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});mainElement.html(newResponse.contents);$(document).trigger('contentChange',[mainElement]);History.pushState(null,document.title,refreshURL);}});}).fail(function(){form.submit();}).always(function(){});return false;},sendItem:function(e){e.preventDefault();var form=$(e.currentTarget).closest('form');var submit=$(e.currentTarget);var currentText=submit.text();var mainElement=$('#ipsLayout_mainArea');var refreshURL=document.location.href;submit.prop('disabled',true).text(ips.getString('ms_processing'));ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(response){$('.ipsDialog').trigger('closeDialog');$('.ipsModal').remove();$('.ipsDialog').remove();ips.getAjax()(refreshURL).done(function(newResponse){if(newResponse){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});mainElement.html(newResponse.contents);$(document).trigger('contentChange',[mainElement]);History.pushState(null,document.title,refreshURL);}});}).fail(function(){form.submit();}).always(function(){});return false;},sellBack:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var refreshURL=document.location.href;ips.ui.alert.show({type:'confirm',message:ips.getSetting('sellBackMessage'),icon:'info',callbacks:{ok:function(){mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;Processing...</div>");ips.getAjax()(ajaxurl).done(function(response){ips.getAjax()(refreshURL).done(function(newResponse){if(newResponse){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});mainElement.html(newResponse.contents);$(document).trigger('contentChange',[mainElement]);History.pushState(null,document.title,refreshURL);}});}).always(function(){});return false;},cancel:function(){}}});return false;},redeemOthers:function(e){e.preventDefault();var form=$(e.currentTarget).closest('form');var submit=$(e.currentTarget);var currentText=submit.text();var mainElement=$('#ipsLayout_mainArea');var refreshURL=document.location.href;submit.prop('disabled',true).text(ips.getString('ms_processing'));ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(response){ips.getAjax()(refreshURL).done(function(newResponse){if(newResponse){ips.ui.flashMsg.show(response.message,{timeout:5,position:ips.getSetting('ms_flash_msg_pos'),dismissable:false,escape:false});mainElement.html(newResponse.contents);$(document).trigger('contentChange',[mainElement]);History.pushState(null,document.title,refreshURL);}});}).fail(function(){form.submit();}).always(function(){});return false;},indexPage:function(e){e.preventDefault();var ajaxurl=$(e.currentTarget).attr('href');var mainElement=$('#ipsLayout_mainArea');var sideBar=$('#elContextualTools');mainElement.append("<div class='ipsModal'></div><div id='elAjaxLoading' class='elAjaxLoading'><i class='icon-spinner2 ipsLoading_tinyIcon fa-spin'></i> &nbsp;&nbsp;loading...</div>");ips.getAjax()(ajaxurl).done(function(response){if(response){mainElement.html(response.contents);sideBar.html(response.sidebar);$(document).trigger('contentChange',[mainElement,sideBar]);History.pushState(null,document.title,ajaxurl);$('body, html').animate({scrollTop:$("#membersshopMain").offset().top-10},1000);}}).fail(function(response){}).always(function(){$('.elAjaxLoading').remove();$('.ipsModal').remove();});return false;},});}(jQuery,_));;