diff --git a/app/femr/business/services/system/UserService.java b/app/femr/business/services/system/UserService.java index 9f74d6600..ae9f882dd 100644 --- a/app/femr/business/services/system/UserService.java +++ b/app/femr/business/services/system/UserService.java @@ -241,6 +241,7 @@ public ServiceResponse updateUser(UserItem userItem, String newPasswor user.setRoles(newRoles); user.setPasswordReset(userItem.isPasswordReset()); user.setPasswordCreatedDate(DateTime.now()); + user.setLanguageCode(userItem.getLanguageCode()); user = userRepository.updateUser(user); response.setResponseObject(itemModelMapper.createUserItem(user)); } catch (Exception ex) { @@ -249,6 +250,7 @@ public ServiceResponse updateUser(UserItem userItem, String newPasswor return response; } + /** * {@inheritDoc} */ diff --git a/app/femr/common/models/UserItem.java b/app/femr/common/models/UserItem.java index f838d1326..289f9289a 100644 --- a/app/femr/common/models/UserItem.java +++ b/app/femr/common/models/UserItem.java @@ -36,10 +36,6 @@ public class UserItem { private Integer CreatedBy; //Sam Zanni private String languageCode; - public UserItem() { - this.roles = new ArrayList<>(); - } - public String getFirstName() { return firstName; } diff --git a/app/femr/ui/controllers/SettingsController.java b/app/femr/ui/controllers/SettingsController.java index 0e7a2eca5..bc95c1441 100644 --- a/app/femr/ui/controllers/SettingsController.java +++ b/app/femr/ui/controllers/SettingsController.java @@ -94,4 +94,4 @@ private EditViewModel convertToEditViewModel(UserItem userItem) { return editViewModel; } -} \ No newline at end of file +} diff --git a/app/femr/ui/views/partials/authenticated.scala.html b/app/femr/ui/views/partials/authenticated.scala.html index 639dfbaac..143b4beb3 100644 --- a/app/femr/ui/views/partials/authenticated.scala.html +++ b/app/femr/ui/views/partials/authenticated.scala.html @@ -1,4 +1,3 @@ -@import femr.ui.controllers.SettingsController @(currentUser: femr.common.dtos.CurrentUser, assets: AssetsFinder) @import femr.ui.views.partials.helpers.AuthenticatedPartialHelper diff --git a/app/femr/ui/views/triage/index.scala.html b/app/femr/ui/views/triage/index.scala.html index 917327a96..bfa6419d6 100644 --- a/app/femr/ui/views/triage/index.scala.html +++ b/app/femr/ui/views/triage/index.scala.html @@ -93,13 +93,6 @@ function updateGenderLabels(languageData, language) { // Check if the language data exists for the selected language if(languageData[language]) { - // Update the Male button - // if(languageData[language]['triage_index_Gender']) { - // const genderLabelElement = document.querySelector("label[for='genderBtns']"); - // if (genderLabelElement) { - // genderLabelElement.textContent = languageData[language]['triage_index_Gender'] + " "; - // } - // } if(languageData[language]['triage_index_Male']) { const maleBtn = document.getElementById('maleBtn'); if (maleBtn) { @@ -115,24 +108,44 @@ } } } - function updateFileInputText(languageData, language) { - const fileInputLabel = document.getElementById('chooseFileLabel'); - const fileChosenText = document.getElementById('fileChosenText'); - - if (fileInputLabel && languageData[language] && languageData[language]['triage_index_choose']) { - fileInputLabel.textContent = languageData[language]['triage_index_choose']; - } + function updateAgeClassificationLabels(languageData, language) { + const classifications = document.querySelectorAll('#classificationRadioWrap label'); + classifications.forEach(label => { + // Extracting the key from the label's ID (label_infant -> infant) + const classification = label.id.replace('label_', ''); + const span = label.querySelector('span'); // Finds the span inside the current label + const translationKey = "ageClassification_" + classification; // Constructs the translation key - if (fileChosenText && languageData[language] && languageData[language]['triage_index_No']) { - fileChosenText.textContent = languageData[language]['triage_index_No']; - } + // Check if the translation exists for the given key and language + if(languageData[language] && languageData[language][translationKey]) { + const labelText = languageData[language][translationKey]; + // Updating the text inside the span + if (span) { + span.textContent = labelText; + } + } + }); } - document.getElementById('photoInput').addEventListener('change', function() { - const fileChosenText = document.getElementById('fileChosenText'); - fileChosenText.textContent = this.files.length ? this.files[0].name : languageData[currentLanguage]['triage_index_No']; - }); - function updateAgeClassificationLabels(languageData, language) { + function updateLabels(languageData, language) { + // Update gender labels + if (languageData[language]) { + // Update the Male button + if (languageData[language]['triage_index_Male']) { + const maleBtn = document.getElementById('maleBtn'); + if (maleBtn) { + maleBtn.nextSibling.textContent = languageData[language]['triage_index_Male']; + } + } + // Update the Female button + if (languageData[language]['triage_index_Female']) { + const femaleBtn = document.getElementById('femaleBtn'); + if (femaleBtn) { + femaleBtn.nextSibling.textContent = languageData[language]['triage_index_Female']; + } + } + } + // Update age classification labels const classifications = document.querySelectorAll('#classificationRadioWrap label'); classifications.forEach(label => { // Extracting the key from the label's ID (label_infant -> infant) @@ -141,7 +154,7 @@ const translationKey = "ageClassification_" + classification; // Constructs the translation key // Check if the translation exists for the given key and language - if(languageData[language] && languageData[language][translationKey]) { + if (languageData[language] && languageData[language][translationKey]) { const labelText = languageData[language][translationKey]; // Updating the text inside the span if (span) { @@ -150,6 +163,25 @@ } }); } + + function updateFileInputText(languageData, language) { + const fileInputLabel = document.getElementById('chooseFileLabel'); + const fileChosenText = document.getElementById('fileChosenText'); + + if (fileInputLabel && languageData[language] && languageData[language]['triage_index_choose']) { + fileInputLabel.textContent = languageData[language]['triage_index_choose']; + } + + if (fileChosenText && languageData[language] && languageData[language]['triage_index_No']) { + fileChosenText.textContent = languageData[language]['triage_index_No']; + } + } + document.getElementById('photoInput').addEventListener('change', function() { + const fileChosenText = document.getElementById('fileChosenText'); + fileChosenText.textContent = this.files.length ? this.files[0].name : languageData[currentLanguage]['triage_index_No']; + }); + + function updateAgeInputPlaceholders(languageCode) { // Update placeholders const yearsInput = document.getElementById('yearsInput'); // You need to ensure this is the correct ID diff --git a/conf/routes b/conf/routes index 015eb4e75..2b0ae74f5 100644 --- a/conf/routes +++ b/conf/routes @@ -72,7 +72,10 @@ GET /search/typeahead/medicationsWithID @femr.ui.controll GET /search/typeahead/medicationAdministrations @femr.ui.controllers.SearchController.typeaheadMedicationAdministrationsJSONGet() #Settings -GET /settings @femr.ui.controllers.SettingsController.index() +GET /settings @femr.ui.controllers.SettingsController.index() +POST /settings/update @femr.ui.controllers.SettingsController.update() + + #Photo GET /photo/patient/:id @femr.ui.controllers.PhotoController.GetPatientPhoto(id: Integer, showDefault: Boolean ?= false) GET /photo/encounter/:id @femr.ui.controllers.PhotoController.GetPhoto(id: Int)