diff --git a/entrypoint.sh b/entrypoint.sh index 2ee00263c..8f8c5dbe8 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,7 @@ cd /usr/ui/medplat-ui npm install --legacy-peer-deps -bower install +bower install --allow-root --config.interactive=false cd /usr/web mvn clean install -P docker -Dmaven.test.skip=true diff --git a/medplat-ui/app/ai-assistant/chat.controller.js b/medplat-ui/app/ai-assistant/chat.controller.js new file mode 100644 index 000000000..87e7da971 --- /dev/null +++ b/medplat-ui/app/ai-assistant/chat.controller.js @@ -0,0 +1,59 @@ +(function () { + 'use strict'; + angular.module('imtecho.controllers') + .controller('ChatController', ChatController); + + function ChatController($timeout, $translate) { + var chat = this; + chat.showChat = false; + chat.messages = [ + { text: "Hello! I am AI ANM, your assistant. How can I help you today?", sender: "ai", timestamp: new Date() } + ]; + chat.newMessage = ""; + + chat.toggleChat = function () { + chat.showChat = !chat.showChat; + if (chat.showChat) { + $timeout(scrollBottom, 100); + } + }; + + chat.sendMessage = function () { + if (!chat.newMessage.trim()) return; + + chat.messages.push({ + text: chat.newMessage, + sender: "user", + timestamp: new Date() + }); + + var userMsg = chat.newMessage; + chat.newMessage = ""; + $timeout(scrollBottom, 100); + + // Mock AI response + $timeout(function () { + var response = "I understand you're asking about: " + userMsg + ". I'm currently in testing mode, but I can help you report issues in the 'Manage' section."; + chat.messages.push({ + text: response, + sender: "ai", + timestamp: new Date() + }); + $timeout(scrollBottom, 100); + }, 1000); + }; + + chat.checkEnter = function (event) { + if (event.which === 13) { + chat.sendMessage(); + } + }; + + function scrollBottom() { + var chatBox = document.getElementById('chat-messages'); + if (chatBox) { + chatBox.scrollTop = chatBox.scrollHeight; + } + } + } +})(); diff --git a/medplat-ui/app/ai-assistant/chat.html b/medplat-ui/app/ai-assistant/chat.html new file mode 100644 index 000000000..5d5ea009f --- /dev/null +++ b/medplat-ui/app/ai-assistant/chat.html @@ -0,0 +1,142 @@ +
+ AI ANM +
+ +
+
+
{{ 'CHAT.TITLE' | translate }} (AI ANM)
+ +
+
+
+
{{ msg.text }}
+
{{ msg.timestamp | date:'shortTime' }}
+
+
+ +
+ + \ No newline at end of file diff --git a/medplat-ui/app/app.js b/medplat-ui/app/app.js index f7a75d39b..85cf9666d 100644 --- a/medplat-ui/app/app.js +++ b/medplat-ui/app/app.js @@ -20,9 +20,18 @@ 'ui.mask', 'daterangepicker', 'textAngular', + 'pascalprecht.translate', 'config' ]); - as.config(function (AuthenticateServiceProvider, MaskProvider) { + as.config(function (AuthenticateServiceProvider, MaskProvider, $translateProvider) { + $translateProvider.useStaticFilesLoader({ + prefix: 'app/languages/', + suffix: '.json' + }); + $translateProvider.preferredLanguage('en'); + $translateProvider.fallbackLanguage('en'); + $translateProvider.useSanitizeValueStrategy('sanitizeParameters'); + MaskProvider.setTemplate(''); AuthenticateServiceProvider.setClientDetails('imtecho-ui', 'imtecho-ui-secret'); }); diff --git a/medplat-ui/app/common/controllers/layout.controller.js b/medplat-ui/app/common/controllers/layout.controller.js index 8a54c7997..e2f174ba8 100644 --- a/medplat-ui/app/common/controllers/layout.controller.js +++ b/medplat-ui/app/common/controllers/layout.controller.js @@ -3,9 +3,16 @@ angular.module('imtecho.controllers') .controller('LayoutController', LayoutController); - function LayoutController($filter, $state, AuthenticateService, $uibModal, $interval, Mask, UserDAO, GeneralUtil) { + function LayoutController($filter, $state, AuthenticateService, $uibModal, $interval, Mask, UserDAO, GeneralUtil, $translate, NotificationService) { var layout = this; layout.currentState = $state; + layout.currentLang = $translate.use() || 'en'; + + layout.changeLanguage = function (langKey) { + $translate.use(langKey); + layout.currentLang = langKey; + }; + function init() { layout.userDetail; layout.userObj = {}; @@ -230,5 +237,7 @@ }; init(); + NotificationService.startSimulating(); } + LayoutController.$inject = ['$filter', '$state', 'AuthenticateService', '$uibModal', '$interval', 'Mask', 'UserDAO', 'GeneralUtil', '$translate', 'NotificationService']; })(); diff --git a/medplat-ui/app/common/services/notification.service.js b/medplat-ui/app/common/services/notification.service.js new file mode 100644 index 000000000..492bed676 --- /dev/null +++ b/medplat-ui/app/common/services/notification.service.js @@ -0,0 +1,17 @@ +(function () { + 'use strict'; + angular.module('imtecho.services') + .service('NotificationService', NotificationService); + + function NotificationService($timeout, toaster) { + var self = this; + + self.startSimulating = function () { + // Periodically show random notifications for demo purposes + $timeout(function () { + toaster.pop('info', 'New Ticket', 'A new high priority ticket has been assigned to you: #9876'); + self.startSimulating(); // Continue simulating + }, 60000); // Every 60 seconds + }; + } +})(); diff --git a/medplat-ui/app/common/views/layout.html b/medplat-ui/app/common/views/layout.html index 9bd806d24..a8d1b1606 100644 --- a/medplat-ui/app/common/views/layout.html +++ b/medplat-ui/app/common/views/layout.html @@ -31,6 +31,18 @@ +