Skip to content

Commit

Permalink
Revert "Updated Settings UI"
Browse files Browse the repository at this point in the history
This reverts commit 6436e37, reversing
changes made to b76d0a3.
  • Loading branch information
connor-addison-h committed Jun 6, 2024
1 parent 7a71044 commit d0ab911
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 62 deletions.
2 changes: 0 additions & 2 deletions app/femr/business/services/system/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ public ServiceResponse<UserItem> 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) {
Expand All @@ -250,7 +249,6 @@ public ServiceResponse<UserItem> updateUser(UserItem userItem, String newPasswor
return response;
}


/**
* {@inheritDoc}
*/
Expand Down
4 changes: 4 additions & 0 deletions app/femr/common/models/UserItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion app/femr/ui/controllers/SettingsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ private EditViewModel convertToEditViewModel(UserItem userItem) {
return editViewModel;
}

}
}
1 change: 1 addition & 0 deletions app/femr/ui/views/partials/authenticated.scala.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import femr.ui.controllers.SettingsController
@(currentUser: femr.common.dtos.CurrentUser, assets: AssetsFinder)

@import femr.ui.views.partials.helpers.AuthenticatedPartialHelper
Expand Down
78 changes: 23 additions & 55 deletions app/femr/ui/views/triage/index.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand All @@ -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) {
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d0ab911

Please sign in to comment.