YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Accounts/resources/Detail.min.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

/*+***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *************************************************************************************/"use strict";Vtiger_Detail_Js("Accounts_Detail_Js",{},{//It stores the Account Hierarchy response data
accountHierarchyResponseCache:{},/**
         * function to get the AccountHierarchy response data
         * @returns {Promise}
         */getAccountHierarchyResponseData:function getAccountHierarchyResponseData(params){var thisInstance=this,aDeferred=jQuery.Deferred();//Check in the cache
return jQuery.isEmptyObject(thisInstance.accountHierarchyResponseCache)?AppConnector.request(params).done(function(data){thisInstance.accountHierarchyResponseCache=data,aDeferred.resolve(thisInstance.accountHierarchyResponseCache);}):aDeferred.resolve(thisInstance.accountHierarchyResponseCache),aDeferred.promise()},/*
         * function to display the AccountHierarchy response data
         */displayAccountHierarchyResponseData:function displayAccountHierarchyResponseData(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();});},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"),url="index.php?module=Accounts&view=AccountHierarchy&record="+app.getRecordId();hierarchyButton.on("click",".js-detail__icon, .recordLabelValue",function(){thisInstance.getAccountHierarchyResponseData(url).done(function(data){thisInstance.displayAccountHierarchyResponseData(data);});});},registerEvents:function registerEvents(){this._super(),this.registerHierarchyRecordCount(),this.registerShowHierarchy();}});
//# sourceMappingURL=Detail.min.js.map