YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Notification/resources/NotificationConfig.min.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */"use strict";jQuery.Class("Notification_NotificationConfig_Js",{},{registerEventForModal:function registerEventForModal(container){var self=this,table=app.registerDataTables(container.find(".js-watching-data-table"));app.showPopoverElementView(container.find(".infoPopover")),container.on("switchChange.bootstrapSwitch",".sendNotificationsSwitch",function(e,state){state?container.find(".schedule").removeClass("d-none"):container.find(".schedule").addClass("d-none");}),container.find("[name=\"saveButton\"]").on("click",function(){var selectedModules=[],sendNoticeModules=[];table.$("[type=\"checkbox\"]").each(function(){var currentTarget=$(this);currentTarget.is(":checked")&&selectedModules.push(currentTarget.val());}),table.$(".sandNoticeOn").each(function(){var value=$(this).closest("tr").data("id");sendNoticeModules.push(value);});var params={module:"Notification",action:"Notification",mode:"saveWatchingModules",selectedModules:selectedModules,sendNotifications:sendNoticeModules,frequency:container.find("select[name=\"frequency\"]").val()},progress=jQuery.progressIndicator();AppConnector.request(params).done(function(){progress.progressIndicator({mode:"hide"}),app.hideModalWindow();}).fail(function(){progress.progressIndicator({mode:"hide"}),app.hideModalWindow();});}),container.find(".selectAllModules").on("click",function(e){e.stopPropagation(),table.$(".watchingModule:not(:disabled)").prop("checked",$(this).is(":checked"));}),container.find(".sentNoticeAll").on("click",function(e){e.stopPropagation();var element=$(e.currentTarget).find(".fas"),val=!element.hasClass("sandNoticeOn");self.changeSendNoticeState(element,val),table.$(".sandNoticeOn,.sandNoticeOff").each(function(){self.changeSendNoticeState($(this),val);});}),table.$(".sentNotice").on("click",function(e){e.stopPropagation();var element=$(e.currentTarget).find(".fas");self.changeSendNoticeState(element);});},changeSendNoticeState:function changeSendNoticeState(element,val){val===void 0?(element.toggleClass("fa-bell fa-bell-slash"),element.toggleClass("sandNoticeOn sandNoticeOff")):!0===val?(element.addClass("fa-bell").removeClass("fa-bell-slash"),element.addClass("sandNoticeOn").removeClass("sandNoticeOff")):(element.addClass("fa-bell-slash").removeClass("fa-bell"),element.addClass("sandNoticeOff").removeClass("sandNoticeOn"));},registerEvents:function registerEvents(){var container=$(".modalNotificationNotificationConfig");this.registerEventForModal(container);}}),jQuery(document).ready(function(){var instance=new Notification_NotificationConfig_Js;instance.registerEvents();});
//# sourceMappingURL=NotificationConfig.min.js.map