diff --git a/files/client/custom/modules/smart-assistant/src/views/dashlets/smart-assistant.js b/files/client/custom/modules/smart-assistant/src/views/dashlets/smart-assistant.js index fc6628a..99adb08 100644 --- a/files/client/custom/modules/smart-assistant/src/views/dashlets/smart-assistant.js +++ b/files/client/custom/modules/smart-assistant/src/views/dashlets/smart-assistant.js @@ -25,7 +25,19 @@ define('modules/smart-assistant/views/dashlets/smart-assistant', ['view'], funct this._alerts = []; this._summary = {}; this._activeType = null; - this.loadSummary(); + + var self = this; + Espo.Ajax.getRequest('SmartAssistant/action/status').then(function (result) { + if (!result.enabled) { + self.$el.find('.sa-dashlet-cards').html( + '
שירה לא מופעלת. הפעל ב-Admin > Integrations > Smart Assistant
' + ); + return; + } + self.loadSummary(); + }).catch(function () { + self.loadSummary(); + }); }, loadSummary: function () { @@ -65,6 +77,7 @@ define('modules/smart-assistant/views/dashlets/smart-assistant', ['view'], funct var $detail = this.$el.find('.sa-dashlet-detail'); if (!type || type === this._activeType && $detail.html()) { + // Toggle off this._activeType = null; $detail.html(''); this.renderCards(this._summary);