From 49c42e3d203dcc9dd39480d65b5eb39310962b2b Mon Sep 17 00:00:00 2001 From: Chaim Date: Tue, 31 Mar 2026 23:10:29 +0000 Subject: [PATCH] feat: add status endpoint, hide FAB/dashlet when integration disabled --- .../src/views/floating-chat.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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 () {