diff --git a/files/client/custom/modules/smart-assistant/src/views/floating-chat.js b/files/client/custom/modules/smart-assistant/src/views/floating-chat.js index e6219dd..7e3a185 100644 --- a/files/client/custom/modules/smart-assistant/src/views/floating-chat.js +++ b/files/client/custom/modules/smart-assistant/src/views/floating-chat.js @@ -158,10 +158,22 @@ define('modules/smart-assistant/views/floating-chat', ['view'], function (View) }, afterRender: function () { - this.$el.find('.sa-chat-messages').attr('data-empty-text', - this.translate('Chat with the assistant', 'labels', 'SmartAssistant') || 'שוחח/י עם העוזר החכם'); - this.loadAlertCount(); - this._setupRouteListener(); + var self = this; + + Espo.Ajax.getRequest('SmartAssistant/action/status').then(function (result) { + if (!result.enabled) { + self.$el.find('.sa-fab').hide(); + return; + } + + self.$el.find('.sa-fab').show(); + self.$el.find('.sa-chat-messages').attr('data-empty-text', + self.translate('Chat with the assistant', 'labels', 'SmartAssistant') || 'שוחח/י עם העוזר החכם'); + self.loadAlertCount(); + self._setupRouteListener(); + }).catch(function () { + self.$el.find('.sa-fab').hide(); + }); }, _setupRouteListener: function () {