/
var
/
www
/
html
/
lgpd
/
message
/
amd
/
build
/
Upload File
HOME
define ("core_message/notification_preference",["jquery","core/ajax","core/notification","core_message/notification_processor"],function(a,b,c,d){var e={PROCESSOR:"[data-processor-name]",STATE_INPUTS:"[data-state] input"},f=function(b,c){this.root=a(b);this.userId=c};f.prototype.getPreferenceKey=function(){return this.root.attr("data-preference-key")};f.prototype.getLoggedInPreferenceKey=function(){return this.getPreferenceKey()+"_loggedin"};f.prototype.getLoggedOffPreferenceKey=function(){return this.getPreferenceKey()+"_loggedoff"};f.prototype.getProcessors=function(){return this.root.find(e.PROCESSOR).map(function(b,c){return new d(a(c))})};f.prototype.startLoading=function(){this.root.addClass("loading");this.root.find(e.STATE_INPUTS).prop("disabled",!0)};f.prototype.stopLoading=function(){this.root.removeClass("loading");this.root.find(e.STATE_INPUTS).prop("disabled",!1)};f.prototype.isLoading=function(){return this.root.hasClass("loading")};f.prototype.save=function(){if(this.isLoading()){return a.Deferred().resolve()}this.startLoading();var d="",e="";this.getProcessors().each(function(a,b){if(b.isLoggedInEnabled()){if(""===d){d=b.getName()}else{d+=","+b.getName()}}if(b.isLoggedOffEnabled()){if(""===e){e=b.getName()}else{e+=","+b.getName()}}});if(""===d){d="none"}if(""===e){e="none"}var f={userid:this.userId,preferences:[{type:this.getLoggedInPreferenceKey(),value:d},{type:this.getLoggedOffPreferenceKey(),value:e}]};return b.call([{methodname:"core_user_update_user_preferences",args:f}])[0].fail(c.exception).always(function(){this.stopLoading()}.bind(this))};return f}); //# sourceMappingURL=notification_preference.min.js.map