From d0ab9118ad70e03d48245331b7212629c87fec01 Mon Sep 17 00:00:00 2001 From: connor-addison-h <70348761+connor-addison-h@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:48:35 -0700 Subject: [PATCH] Revert "Updated Settings UI" This reverts commit 6436e37296f489f2bc7ee6fea7aa1a1a379b9341, reversing changes made to b76d0a345e8ce8cd80cd29f28dced917d3a01db4. --- .../business/services/system/UserService.java | 2 - app/femr/common/models/UserItem.java | 4 + .../ui/controllers/SettingsController.java | 2 +- .../views/partials/authenticated.scala.html | 1 + app/femr/ui/views/triage/index.scala.html | 78 ++++++------------- conf/routes | 5 +- 6 files changed, 30 insertions(+), 62 deletions(-) diff --git a/app/femr/business/services/system/UserService.java b/app/femr/business/services/system/UserService.java index ae9f882dd..9f74d6600 100644 --- a/app/femr/business/services/system/UserService.java +++ b/app/femr/business/services/system/UserService.java @@ -241,7 +241,6 @@ 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) { @@ -250,7 +249,6 @@ 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 289f9289a..f838d1326 100644 --- a/app/femr/common/models/UserItem.java +++ b/app/femr/common/models/UserItem.java @@ -36,6 +36,10 @@ 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 bc95c1441..0e7a2eca5 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 aead12f6c..a30d50e28 100644 --- a/app/femr/ui/views/partials/authenticated.scala.html +++ b/app/femr/ui/views/partials/authenticated.scala.html @@ -1,3 +1,4 @@ +@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 bfa6419d6..917327a96 100644 --- a/app/femr/ui/views/triage/index.scala.html +++ b/app/femr/ui/views/triage/index.scala.html @@ -93,6 +93,13 @@ 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) { @@ -108,44 +115,24 @@ } } } - 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 + function updateFileInputText(languageData, language) { + const fileInputLabel = document.getElementById('chooseFileLabel'); + const fileChosenText = document.getElementById('fileChosenText'); - // 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; - } - } - }); - } + if (fileInputLabel && languageData[language] && languageData[language]['triage_index_choose']) { + fileInputLabel.textContent = languageData[language]['triage_index_choose']; + } - 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']; - } - } + if (fileChosenText && languageData[language] && languageData[language]['triage_index_No']) { + fileChosenText.textContent = languageData[language]['triage_index_No']; } - // Update age classification labels + } + 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) { const classifications = document.querySelectorAll('#classificationRadioWrap label'); classifications.forEach(label => { // Extracting the key from the label's ID (label_infant -> infant) @@ -154,7 +141,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) { @@ -163,25 +150,6 @@ } }); } - - 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 2b0ae74f5..015eb4e75 100644 --- a/conf/routes +++ b/conf/routes @@ -72,10 +72,7 @@ GET /search/typeahead/medicationsWithID @femr.ui.controll GET /search/typeahead/medicationAdministrations @femr.ui.controllers.SearchController.typeaheadMedicationAdministrationsJSONGet() #Settings -GET /settings @femr.ui.controllers.SettingsController.index() -POST /settings/update @femr.ui.controllers.SettingsController.update() - - +GET /settings @femr.ui.controllers.SettingsController.index() #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)