From 6d04f60a10a6ec213d150a5c03399b2cbf6cc23a Mon Sep 17 00:00:00 2001 From: Rahul Ramesh <121226043+rahu1ramesh@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:24:49 +0530 Subject: [PATCH] BAH-3968 | Add. Quick Logout Support In Admin, Bed, Doc, OT And Reports * [Rahul] | BAH-3968 | Add. Quick Logout In Bed Mngt * [Rahul] | BAH-3968 | Add. Quick Logout In Doc Upload * [Rahul] | BAH-3968 | Add. Quick Logout In Reports * [Rahul] | BAH-3968 | Add. Quick Logout In OT * [Rahul] | BAH-3968 | Add. Quick Logout In Admin --- ui/app/admin/index.html | 4 +++- ui/app/admin/initialization.js | 14 ++++++++--- ui/app/admin/views/header.html | 24 +++++++++++++++++++ ui/app/adt/views/headerAdt.html | 6 +++-- ui/app/bedmanagement/initialization.js | 4 +++- ui/app/bedmanagement/views/header.html | 12 ++++++++++ ui/app/common/ui-helper/header.html | 5 +++- ui/app/document-upload/app.js | 2 +- ui/app/document-upload/initialization.js | 4 +++- .../document-upload/views/patientHeader.html | 13 +++++++++- ui/app/i18n/document-upload/locale_en.json | 3 ++- ui/app/i18n/ipd/locale_en.json | 3 ++- ui/app/i18n/reports/locale_en.json | 3 ++- ui/app/ot/index.html | 5 ++-- ui/app/ot/initialization.js | 13 +++++++--- ui/app/ot/views/header.html | 12 ++++++++++ ui/app/reports/initialization.js | 10 +++++--- ui/app/reports/views/dashboardHeader.html | 10 ++++++++ 18 files changed, 124 insertions(+), 23 deletions(-) create mode 100644 ui/app/admin/views/header.html diff --git a/ui/app/admin/index.html b/ui/app/admin/index.html index af5d4cbfd4..a03e855217 100644 --- a/ui/app/admin/index.html +++ b/ui/app/admin/index.html @@ -14,7 +14,7 @@ -
+
@@ -71,6 +71,7 @@ + @@ -86,6 +87,7 @@ + diff --git a/ui/app/admin/initialization.js b/ui/app/admin/initialization.js index 07948059ec..d44e689dc8 100644 --- a/ui/app/admin/initialization.js +++ b/ui/app/admin/initialization.js @@ -1,8 +1,16 @@ 'use strict'; angular.module('bahmni.admin') -.factory('initialization', ['$rootScope', '$q', 'appService', 'spinner', - function ($rootScope, $q, appService, spinner) { +.factory('initialization', ['$rootScope', '$q', 'appService', 'spinner', 'configurations', + function ($rootScope, $q, appService, spinner, configurations) { + var loadConfigPromise = function () { + var configNames = ['quickLogoutComboKey', 'contextCookieExpirationTimeInMinutes']; + return configurations.load(configNames).then(function () { + $rootScope.quickLogoutComboKey = configurations.quickLogoutComboKey() || 'Escape'; + $rootScope.cookieExpiryTime = configurations.contextCookieExpirationTimeInMinutes() || 30; + }); + }; + var initApp = function () { return appService.initApp('admin'); }; @@ -11,6 +19,6 @@ angular.module('bahmni.admin') return appService.checkPrivilege("app:admin"); }; - return spinner.forPromise(initApp().then(checkPrivilege)); + return spinner.forPromise(initApp().then(checkPrivilege).then(loadConfigPromise)); } ]); diff --git a/ui/app/admin/views/header.html b/ui/app/admin/views/header.html new file mode 100644 index 0000000000..04fb305243 --- /dev/null +++ b/ui/app/admin/views/header.html @@ -0,0 +1,24 @@ +
+ +
\ No newline at end of file diff --git a/ui/app/adt/views/headerAdt.html b/ui/app/adt/views/headerAdt.html index 7ea9240419..04fb305243 100644 --- a/ui/app/adt/views/headerAdt.html +++ b/ui/app/adt/views/headerAdt.html @@ -13,8 +13,10 @@ diff --git a/ui/app/bedmanagement/initialization.js b/ui/app/bedmanagement/initialization.js index e7c5af40db..f886fcbe85 100644 --- a/ui/app/bedmanagement/initialization.js +++ b/ui/app/bedmanagement/initialization.js @@ -4,13 +4,15 @@ angular.module('bahmni.ipd').factory('initialization', ['$rootScope', '$q', '$ba function ($rootScope, $q, $bahmniCookieStore, appService, configurations, authenticator, spinner, locationService) { var getConfigs = function () { var config = $q.defer(); - var configNames = ['encounterConfig', 'patientConfig', 'genderMap', 'relationshipTypeMap']; + var configNames = ['encounterConfig', 'patientConfig', 'genderMap', 'relationshipTypeMap', 'quickLogoutComboKey', 'contextCookieExpirationTimeInMinutes']; configurations.load(configNames).then(function () { $rootScope.encounterConfig = angular.extend(new EncounterConfig(), configurations.encounterConfig()); $rootScope.patientConfig = configurations.patientConfig(); $rootScope.genderMap = configurations.genderMap(); $rootScope.relationshipTypeMap = configurations.relationshipTypeMap(); $rootScope.diagnosisStatus = ((appService.getAppDescriptor().getConfig("diagnosisStatus") && appService.getAppDescriptor().getConfig("diagnosisStatus").value) || "RULED OUT"); + $rootScope.quickLogoutComboKey = configurations.quickLogoutComboKey() || 'Escape'; + $rootScope.cookieExpiryTime = configurations.contextCookieExpirationTimeInMinutes() || 30; config.resolve(); }); return config.promise; diff --git a/ui/app/bedmanagement/views/header.html b/ui/app/bedmanagement/views/header.html index 40460384d4..9159c15d05 100644 --- a/ui/app/bedmanagement/views/header.html +++ b/ui/app/bedmanagement/views/header.html @@ -2,6 +2,18 @@
+ +
\ No newline at end of file diff --git a/ui/app/common/ui-helper/header.html b/ui/app/common/ui-helper/header.html index 4400e16840..f381da0d37 100644 --- a/ui/app/common/ui-helper/header.html +++ b/ui/app/common/ui-helper/header.html @@ -15,7 +15,10 @@ diff --git a/ui/app/document-upload/app.js b/ui/app/document-upload/app.js index ed01c0327b..dda8d4502f 100644 --- a/ui/app/document-upload/app.js +++ b/ui/app/document-upload/app.js @@ -27,7 +27,7 @@ angular.module('documentupload').config(['$stateProvider', '$httpProvider', '$ur controller: 'PatientsListController' }, 'additional-header': { - templateUrl: '../common/ui-helper/header.html' + templateUrl: 'views/patientHeader.html' } }, resolve: { diff --git a/ui/app/document-upload/initialization.js b/ui/app/document-upload/initialization.js index f403365931..f881d848fd 100644 --- a/ui/app/document-upload/initialization.js +++ b/ui/app/document-upload/initialization.js @@ -8,9 +8,11 @@ angular.module('opd.documentupload').factory('initialization', $rootScope.appConfig = url.param(); var getConfigs = function () { - var configNames = ['genderMap']; + var configNames = ['genderMap', 'quickLogoutComboKey', 'contextCookieExpirationTimeInMinutes']; return configurations.load(configNames).then(function () { $rootScope.genderMap = configurations.genderMap(); + $rootScope.quickLogoutComboKey = configurations.quickLogoutComboKey() || 'Escape'; + $rootScope.cookieExpiryTime = configurations.contextCookieExpirationTimeInMinutes() || 30; }); }; diff --git a/ui/app/document-upload/views/patientHeader.html b/ui/app/document-upload/views/patientHeader.html index 6ede7677bc..d5e0d7025c 100644 --- a/ui/app/document-upload/views/patientHeader.html +++ b/ui/app/document-upload/views/patientHeader.html @@ -2,7 +2,18 @@
- + +
diff --git a/ui/app/i18n/document-upload/locale_en.json b/ui/app/i18n/document-upload/locale_en.json index 8b5648a938..2d57392d37 100644 --- a/ui/app/i18n/document-upload/locale_en.json +++ b/ui/app/i18n/document-upload/locale_en.json @@ -34,5 +34,6 @@ "VISIT_TO_LABEL": "To:", "FILE_TYPE_NOT_SUPPORTED_MESSAGE": "File type is not supported", "FILE_SIZE_LIMIT_EXCEEDED_MESSAGE": "File size limit exceeded. Please upload a file less than {{maxAllowedSize}} MB.", - "SIZE_LIMIT_EXCEEDED_MESSAGE": "File size limit exceeded. Please upload a smaller file" + "SIZE_LIMIT_EXCEEDED_MESSAGE": "File size limit exceeded. Please upload a smaller file", + "LOGOUT_TRANSLATION_KEY": "Logout" } diff --git a/ui/app/i18n/ipd/locale_en.json b/ui/app/i18n/ipd/locale_en.json index 095b4a9849..c0623c2391 100644 --- a/ui/app/i18n/ipd/locale_en.json +++ b/ui/app/i18n/ipd/locale_en.json @@ -76,5 +76,6 @@ "IS_SUCCESSFULLY_ASSIGNED_MESSAGE": "is assigned successfully", "BED": "Bed", "CARE_VIEW_LABEL": "Change to Care View", - "MESSAGE_AUTO_CONVERT_TO_IPD_VISIT": "{{visitType}} Visit Started Successfully" + "MESSAGE_AUTO_CONVERT_TO_IPD_VISIT": "{{visitType}} Visit Started Successfully", + "LOGOUT_TRANSLATION_KEY": "Logout" } diff --git a/ui/app/i18n/reports/locale_en.json b/ui/app/i18n/reports/locale_en.json index 3c1dd130c6..94244b0d4e 100644 --- a/ui/app/i18n/reports/locale_en.json +++ b/ui/app/i18n/reports/locale_en.json @@ -45,5 +45,6 @@ "DELETE_LABEL": "Delete", "EDIT_LABEL": "Edit", "REPORT_DATE_RANGE": "Select Date Range", - "START_DATE_CANNOT_LATER_THAN_STOP_DATE": "start date can not be later than stop date" + "START_DATE_CANNOT_LATER_THAN_STOP_DATE": "start date can not be later than stop date", + "LOGOUT_TRANSLATION_KEY": "Logout" } \ No newline at end of file diff --git a/ui/app/ot/index.html b/ui/app/ot/index.html index 31706643a6..b9f958fe9a 100644 --- a/ui/app/ot/index.html +++ b/ui/app/ot/index.html @@ -103,7 +103,7 @@ - + @@ -154,8 +154,6 @@ - - @@ -191,6 +189,7 @@ + diff --git a/ui/app/ot/initialization.js b/ui/app/ot/initialization.js index 8107498215..bfe38e8964 100644 --- a/ui/app/ot/initialization.js +++ b/ui/app/ot/initialization.js @@ -1,7 +1,14 @@ 'use strict'; -angular.module('bahmni.ot').factory('initialization', ['$rootScope', '$q', 'surgicalAppointmentHelper', 'appService', 'surgicalAppointmentService', 'authenticator', 'spinner', - function ($rootScope, $q, surgicalAppointmentHelper, appService, surgicalAppointmentService, authenticator, spinner) { +angular.module('bahmni.ot').factory('initialization', ['$rootScope', '$q', 'surgicalAppointmentHelper', 'appService', 'surgicalAppointmentService', 'authenticator', 'spinner', 'configurations', + function ($rootScope, $q, surgicalAppointmentHelper, appService, surgicalAppointmentService, authenticator, spinner, configurations) { + var loadConfigPromise = function () { + var configNames = ['quickLogoutComboKey', 'contextCookieExpirationTimeInMinutes']; + return configurations.load(configNames).then(function () { + $rootScope.quickLogoutComboKey = configurations.quickLogoutComboKey() || 'Escape'; + $rootScope.cookieExpiryTime = configurations.contextCookieExpirationTimeInMinutes() || 30; + }); + }; var initApp = function () { return appService.initApp('ot', {'app': true, 'extension': true}).then(function (data) { var providerNames = data.getConfigValue("primarySurgeonsForOT"); @@ -13,6 +20,6 @@ angular.module('bahmni.ot').factory('initialization', ['$rootScope', '$q', 'surg }); }); }; - return spinner.forPromise(authenticator.authenticateUser().then(initApp)); + return spinner.forPromise(authenticator.authenticateUser().then(initApp).then(loadConfigPromise)); } ]); diff --git a/ui/app/ot/views/header.html b/ui/app/ot/views/header.html index 4cf44b3255..5404971e55 100644 --- a/ui/app/ot/views/header.html +++ b/ui/app/ot/views/header.html @@ -2,6 +2,18 @@
+ +
diff --git a/ui/app/reports/initialization.js b/ui/app/reports/initialization.js index 503a0cc867..603d8f9d38 100644 --- a/ui/app/reports/initialization.js +++ b/ui/app/reports/initialization.js @@ -1,11 +1,15 @@ 'use strict'; angular.module('bahmni.reports').factory('initialization', - ['authenticator', 'appService', 'spinner', 'configurations', - function (authenticator, appService, spinner, configurations) { + ['$rootScope', 'authenticator', 'appService', 'spinner', 'configurations', + function ($rootScope, authenticator, appService, spinner, configurations) { return function (appName) { var loadConfigPromise = function () { - return configurations.load([]); + var configNames = ['quickLogoutComboKey', 'contextCookieExpirationTimeInMinutes']; + return configurations.load(configNames).then(function () { + $rootScope.quickLogoutComboKey = configurations.quickLogoutComboKey() || 'Escape'; + $rootScope.cookieExpiryTime = configurations.contextCookieExpirationTimeInMinutes() || 30; + }); }; var initApp = function () { return appService.initApp(appName || 'reports', {'app': true, 'extension': true }, null, ["reports"]); diff --git a/ui/app/reports/views/dashboardHeader.html b/ui/app/reports/views/dashboardHeader.html index c04eae6a81..0c3a13c7ca 100644 --- a/ui/app/reports/views/dashboardHeader.html +++ b/ui/app/reports/views/dashboardHeader.html @@ -2,6 +2,16 @@
+ +
\ No newline at end of file