YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Vtiger/resources/Kanban.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";$.Class("Vtiger_Kanban_Js",{},{/**
         * Get params
         */getParams:function getParams(){var params=[];return this.page.find(".js-params").each(function(){var element=$(this);params[element.attr("name")]=element.val();}),$.extend({module:app.getModuleName(),view:"Kanban",board:this.page.find(".js-board-tab.active").data("id")},params)},loadKanban:function loadKanban(){var _this=this,params=this.getParams(),urlParams=Object.assign({},params);delete urlParams.orderBy,app.changeUrl(urlParams);var progress=$.progressIndicator({blockInfo:{enabled:!0,elementToBlock:this.container}});AppConnector.request(params).done(function(responseData){_this.container.html(responseData),_this.registerSortable(),progress.progressIndicator({mode:"hide"});}).fail(function(){progress.progressIndicator({mode:"hide"}),app.showNotify({title:app.vtranslate("JS_ERROR"),type:"error"});});},registerSortable:function registerSortable(){var _this2=this,boards=this.container.find(".js-kanban-records");boards.sortable({containment:this.container,items:boards.find(".js-kanban-record"),cancel:".js-kanban-disabled",connectWith:boards,placeholder:"c-kanban__highlight",revert:!0,tolerance:"pointer",cursor:"move",update:function update(e,ui){if(null==ui.sender){var records=ui.item.closest(".js-kanban-records");Vtiger_Edit_Js.saveAjax({record:ui.item.data("id"),field:records.data("field"),value:records.data("value")}).done(function(){_this2.loadKanban();}).fail(function(error,err){app.errorLog(error,err);});}},start:function start(e,ui){ui.placeholder.height(ui.helper.outerHeight());}});},/**
         * Registers mobile devices.
         */registerMobileDevices:function registerMobileDevices(){app.isTouchDevice()&&this.container.find(".js-kanban-record").each(function(){var element=$(this);element.find(".js-popover-tooltip--record").removeClass("js-popover-tooltip--record");var btns=element.find(".btns"),btnQuickEditModal=btns.find(".js-quick-edit-modal");element.addClass("js-quick-edit-modal"),element.attr("href",btnQuickEditModal.attr("href")),element.attr("data-record",btnQuickEditModal.data("record")),element.attr("data-module",btnQuickEditModal.data("module")),btns.remove(),element.find("a").on("click",function(e){e.stopPropagation();});});},/**
         * Registers Kanban view events.
         */registerEvents:function registerEvents(){var _this3=this;this.page=$("#centerPanel"),this.container=$(".js-kanban-container"),this.registerSortable(),app.showNewScrollbarTopBottom(this.container),this.page.on("click",".js-board-tab",function(e){_this3.page.find(".js-board-tab.active").removeClass("active"),$(e.currentTarget).addClass("active"),_this3.loadKanban();}),this.page.on("change",".js-params",function(){_this3.loadKanban();}),this.page.on("click",".js-list-reload",function(e,data){_this3.page.find("#orderBy").val(JSON.stringify(data.orderby)).trigger("change");}),this.registerMobileDevices();}});
//# sourceMappingURL=Kanban.min.js.map