YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Users/resources/Groups.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";function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return "symbol"===_typeof(key)?key:String(key)}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===hint?String:Number)(input)}window.Users_Groups_JS=/*#__PURE__*/function(){function _class2(){_classCallCheck(this,_class2),_defineProperty(this,"container",!1),_defineProperty(this,"dataTable",void 0);}return _createClass(_class2,[{key:"registerDataTable",value:/**
     * Register DataTable
     */function registerDataTable(){var table=this.container.find(".js-data-table"),form=this.container.find("form");return app.registerDataTables(table,{order:[],processing:!0,serverSide:!1,ajax:{url:table.data("url"),type:"POST",data:function data(_data){$.extend(_data,form.serializeFormData());}}})}/**
     * Register remove member
     */},{key:"registerRemoveMember",value:function registerRemoveMember(){var _this=this;this.container.find(".js-data-table").on("click",".js-member-delete",function(e){var url=e.currentTarget.dataset.url;app.showConfirmModal({text:app.vtranslate("JS_LBL_ARE_YOU_SURE_YOU_WANT_TO_DELETE"),confirmedCallback:function confirmedCallback(){var progress=jQuery.progressIndicator();AppConnector.request(url).done(function(){progress.progressIndicator({mode:"hide"}),_this.dataTable.ajax.reload();}).fail(function(){app.showNotify({text:app.vtranslate("JS_ERROR"),type:"error"}),progress.progressIndicator({mode:"hide"});});}});});}/**
     * Register add members
     */},{key:"registerAddMember",value:function registerAddMember(){var _this2=this;this.container.find(".js-data-table").on("click",".js-member-add",function(e){var url=e.currentTarget.dataset.url+"&groupID="+_this2.container.find("form").serializeFormData().groupID;app.showModalWindow(null,url,function(modalContainer){modalContainer.find(".js-modal__save").on("click",function(){var modalForm=modalContainer.find("form");if(modalForm.validationEngine("validate")){var progress=$.progressIndicator({message:app.vtranslate("JS_SAVE_LOADER_INFO"),blockInfo:{enabled:!0}}),formData=modalForm.serializeFormData();app.saveAjax("",[],formData).done(function(response){var result=response.result;progress.progressIndicator({mode:"hide"}),result.success?(app.hideModalWindow(null,"memberList"),_this2.dataTable.ajax.reload()):app.showNotify({text:result.message?result.message:app.vtranslate("JS_ERROR"),type:"error",delay:3e3,hide:!0});}).fail(function(){progress.progressIndicator({mode:"hide"}),app.showNotify({text:app.vtranslate("JS_ERROR"),type:"error"});});}});},{modalId:"memberList"});});}/**
     * Register base events
     * @param {jQuery} modalContainer
     */},{key:"registerEvents",value:function registerEvents(modalContainer){var _this3=this;this.container=modalContainer,this.dataTable=this.registerDataTable(),this.registerRemoveMember(),this.registerAddMember(),this.container.on("change","[name=\"groupID\"]",function(){_this3.dataTable.ajax.reload();});}}]),_class2}();
//# sourceMappingURL=Groups.min.js.map