YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/MultiCompany/resources/Detail.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";Vtiger_Detail_Js("MultiCompany_Detail_Js",{},{//It stores the IStorages Hierarchy response data
hierarchyResponseCache:{},/*
         * function to get the IStoragesHierarchy response data
         */getHierarchyResponseData:function getHierarchyResponseData(params){var thisInstance=this,aDeferred=jQuery.Deferred();//Check in the cache
return jQuery.isEmptyObject(thisInstance.hierarchyResponseCache)?AppConnector.request(params).done(function(data){thisInstance.hierarchyResponseCache=data,aDeferred.resolve(thisInstance.hierarchyResponseCache);}):aDeferred.resolve(thisInstance.hierarchyResponseCache),aDeferred.promise()},/*
         * function to display the IStorages Hierarchy response data
         */displayHierarchyResponseData:function displayHierarchyResponseData(data){var callbackFunction=function(){app.showScrollBar($("#hierarchyScroll"),{height:"300px",railVisible:!0,size:"6px"});};app.showModalWindow(data,function(modalContainer){App.Components.Scrollbar.xy($("#hierarchyScroll",modalContainer)),"function"==typeof callbackFunction&&300<$("#hierarchyScroll",modalContainer).height()&&callbackFunction(data);});},registerHierarchyRecordCount:function registerHierarchyRecordCount(){var hierarchyButton=$(".detailViewTitle .hierarchy");if(hierarchyButton.length){var params={module:app.getModuleName(),action:"RelationAjax",record:app.getRecordId(),mode:"getHierarchyCount"};AppConnector.request(params).done(function(response){response.success&&$(".detailViewTitle .hierarchy .badge").html(response.result);});}},registerShowHierarchy:function registerShowHierarchy(){var thisInstance=this,hierarchyButton=$(".detailViewTitle"),params={module:app.getModuleName(),view:"Hierarchy",record:app.getRecordId()};hierarchyButton.on("click",".js-detail__icon",function(){thisInstance.getHierarchyResponseData(params).done(function(data){thisInstance.displayHierarchyResponseData(data);});});},registerEvents:function registerEvents(){this._super(),this.registerHierarchyRecordCount(),this.registerShowHierarchy();}});
//# sourceMappingURL=Detail.min.js.map