;(function($){"use strict";ips.controller.register('calendar.front.view.reminderButton',{initialize:function(){this.setup();this.on(document,'reminderItem',this.reminderItemChange);},setup:function(){this._id=this.scope.attr('data-reminderID');this._button=this.scope.find('[data-role="reminderButton"]');},reminderItemChange:function(e,data){this._reloadButton();},_reloadButton:function(){this._button.addClass('i-opacity_3');var self=this;var pos=ips.utils.position.getElemPosition(this._button);var dims=ips.utils.position.getElemDims(this._button);this.scope.append(ips.templates.render('calendar.reminder.loading'));this.scope.css({position:'relative'}).find('.ipsLoading').css({width:dims.outerWidth+'px',height:dims.outerHeight+'px',top:"0",left:"0",position:'absolute',zIndex:ips.ui.zIndex()});ips.getAjax()(ips.getSetting('baseURL')+'index.php?app=calendar&module=calendar&controller=event&do=reminderButton',{data:Object.assign({id:this._id},(this.scope.attr('data-buttonType'))?{button_type:this.scope.attr('data-buttonType')}:{})}).done(function(response){self.scope.html(response);$(document).trigger('contentChange',[self.scope]);}).fail(function(){self._button.removeClass('i-opacity_3');}).always(function(){self.scope.find('.ipsLoading').remove();});}});}(jQuery));;
;(function($){"use strict";ips.controller.register('calendar.front.view.reminderForm',{initialize:function(){this.on('submit',this.submitForm);this.on('click','[data-action="removereminder"]',this.removereminder);this.setup();},setup:function(){},removereminder:function(e){e.preventDefault();this._doRemindAction($(e.currentTarget).attr('href'),{},true);},submitForm:function(e){e.preventDefault();this._doRemindAction(this.scope.attr('action'),this.scope.serialize(),false);},_doRemindAction:function(url,data,removereminder){var self=this;var dims=ips.utils.position.getElemDims(this.scope.parent('div'));this.scope.hide().parent('div').css({width:dims.outerWidth+'px',height:dims.outerHeight+'px'}).addClass('ipsLoading');ips.getAjax()(url,{data:data,type:'post'}).done(function(response,status,jqXHR){if(jqXHR.getAllResponseHeaders().indexOf('X-IPS-FormError: true')!==-1||jqXHR.getAllResponseHeaders().indexOf('X-IPS-FormNoSubmit: true')!==-1||jqXHR.getAllResponseHeaders().indexOf('x-ips-formerror: true')!==-1||jqXHR.getAllResponseHeaders().indexOf('x-ips-formnosubmit: true')!==-1){self.scope.show().html(response).parent('div').removeClass('ipsLoading').css({width:'auto',height:'auto'});}else{self.trigger('reminderItem');if(removereminder){ips.ui.flashMsg.show(ips.getString('event_reminder_removed'));}
else{ips.ui.flashMsg.show(ips.getString('event_reminder_added'));}
self.scope.parents('.ipsHovercard').remove();}}).fail(function(jqXHR,textStatus,errorThrown){window.location=url;}).always(function(){});}});}(jQuery));;