Skip to content

Commit

Permalink
Merge pull request #13178 from SORMAS-Foundation/feature-13157_Disabl…
Browse files Browse the repository at this point in the history
…e_contact_management_for_RSV_cases

#13157 - Disable Contact Management for RSV Cases
  • Loading branch information
leventegal-she authored Nov 11, 2024
2 parents 66df146 + b99f4bb commit 8fe745c
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected void addFields() {
diseaseCheckBox = new CheckBox(I18nProperties.getCaption(Captions.bulkDisease));
diseaseCheckBox.setReadOnly(!UiUtil.permitted(UserRight.CASE_CHANGE_DISEASE));
getContent().addComponent(diseaseCheckBox, DISEASE_CHECKBOX);
ComboBox diseaseField = addDiseaseField(CaseBulkEditData.DISEASE, false);
ComboBox diseaseField = addDiseaseField(CaseBulkEditData.DISEASE, false, false);
diseaseField.setEnabled(false);
addField(CaseBulkEditData.DISEASE_DETAILS, TextField.class);
addField(CaseBulkEditData.PLAGUE_TYPE, NullableOptionGroup.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ protected void addFields() {
addField(CaseDataDto.CASE_REFERENCE_NUMBER, TextField.class);

addField(CaseDataDto.REPORT_DATE, DateField.class);
ComboBox diseaseField = addDiseaseField(CaseDataDto.DISEASE, false, true);
ComboBox diseaseField = addDiseaseField(CaseDataDto.DISEASE, false, true, false);
diseaseVariantField = addField(CaseDataDto.DISEASE_VARIANT, ComboBox.class);
diseaseVariantDetailsField = addField(CaseDataDto.DISEASE_VARIANT_DETAILS, TextField.class);
diseaseVariantDetailsField.setVisible(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ protected void addFields() {
Collections.singletonList(CaseIdentificationSource.SCREENING),
true);

ComboBox diseaseField = addDiseaseField(CaseDataDto.DISEASE, false);
ComboBox diseaseField = addDiseaseField(CaseDataDto.DISEASE, false, false);
ComboBox diseaseVariantField = addCustomizableEnumField(CaseDataDto.DISEASE_VARIANT);
TextField diseaseVariantDetailsField = addField(CaseDataDto.DISEASE_VARIANT_DETAILS, TextField.class);
diseaseVariantDetailsField.setVisible(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected void addFields() {

reportDate = addField(ContactDto.REPORT_DATE_TIME, DateField.class);
addField(CaseDataDto.CASE_REFERENCE_NUMBER, TextField.class);
ComboBox cbDisease = addDiseaseField(ContactDto.DISEASE, false, true);
ComboBox cbDisease = addDiseaseField(ContactDto.DISEASE, false, true, true);
addField(ContactDto.DISEASE_DETAILS, TextField.class);

personCreateForm = new PersonCreateForm(false, false, false, showPersonSearchButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ protected void addFields() {
}
ComboBox relationToCase = addField(ContactDto.RELATION_TO_CASE, ComboBox.class);
addField(ContactDto.RELATION_DESCRIPTION, TextField.class);
cbDisease = addDiseaseField(ContactDto.DISEASE, false);
cbDisease = addDiseaseField(ContactDto.DISEASE, false, true);
cbDisease.setNullSelectionAllowed(false);
addField(ContactDto.DISEASE_DETAILS, TextField.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected void addFields() {
getContent().addComponent(locationHeadingLabel, LOCATION_HEADING_LOC);

addField(EventDto.UUID, TextField.class);
ComboBox diseaseField = addDiseaseField(EventDto.DISEASE, false, isCreateForm);
ComboBox diseaseField = addDiseaseField(EventDto.DISEASE, false, isCreateForm, false);
addField(EventDto.DISEASE_DETAILS, TextField.class);
ComboBox diseaseVariantField = addCustomizableEnumField(EventDto.DISEASE_VARIANT);
diseaseVariantField.setNullSelectionAllowed(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected void addFields() {
TextField externalIdField = addField(ImmunizationDto.EXTERNAL_ID, TextField.class);
style(externalIdField, ERROR_COLOR_PRIMARY);

ComboBox diseaseField = addDiseaseField(ImmunizationDto.DISEASE, false, true);
ComboBox diseaseField = addDiseaseField(ImmunizationDto.DISEASE, false, true, false);
addField(ImmunizationDto.DISEASE_DETAILS, TextField.class);

ComboBox meansOfImmunizationField = addField(ImmunizationDto.MEANS_OF_IMMUNIZATION, ComboBox.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected void addFields() {
UserField reportingUser = addField(ImmunizationDto.REPORTING_USER, UserField.class);
reportingUser.setParentPseudonymizedSupplier(() -> getValue().isPseudonymized());

ComboBox cbDisease = addDiseaseField(ImmunizationDto.DISEASE, false);
ComboBox cbDisease = addDiseaseField(ImmunizationDto.DISEASE, false, false);
addField(ImmunizationDto.DISEASE_DETAILS, TextField.class);

ComboBox meansOfImmunizationField = addField(ImmunizationDto.MEANS_OF_IMMUNIZATION, ComboBox.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ protected void addFields() {
TextField tfPlaceOfBirthFacilityDetails = addField(PersonDto.PLACE_OF_BIRTH_FACILITY_DETAILS, TextField.class);

causeOfDeathField = addField(PersonDto.CAUSE_OF_DEATH, ComboBox.class);
causeOfDeathDiseaseField = addDiseaseField(PersonDto.CAUSE_OF_DEATH_DISEASE, true);
causeOfDeathDiseaseField = addDiseaseField(PersonDto.CAUSE_OF_DEATH_DISEASE, true, false);
causeOfDeathDetailsField = addField(PersonDto.CAUSE_OF_DEATH_DETAILS, TextField.class);

// Set requirements that don't need visibility changes and read only status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected void addFields() {
typingIdField.setVisible(false);

// Tested Desease or Tested Pathogen, depending on sample type
ComboBox diseaseField = addDiseaseField(PathogenTestDto.TESTED_DISEASE, true, create);
ComboBox diseaseField = addDiseaseField(PathogenTestDto.TESTED_DISEASE, true, create, false);
addField(PathogenTestDto.TESTED_DISEASE_DETAILS, TextField.class);
ComboBox diseaseVariantField = addCustomizableEnumField(PathogenTestDto.TESTED_DISEASE_VARIANT);
diseaseVariantField.setNullSelectionAllowed(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected void addFields() {
addField(SelfReportDto.CASE_REFERENCE);

//disease related fieldss
ComboBox diseaseField = addDiseaseField(SelfReportDto.DISEASE, false);
ComboBox diseaseField = addDiseaseField(SelfReportDto.DISEASE, false, false);
addField(SelfReportDto.DISEASE_DETAILS, TextField.class);
diseaseField.setRequired(true);
ComboBox diseaseVariantField = addCustomizableEnumField(SelfReportDto.DISEASE_VARIANT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ protected void addFields() {
TextField externalIdField = addField(TravelEntryDto.EXTERNAL_ID, TextField.class);
style(externalIdField, ERROR_COLOR_PRIMARY);

ComboBox diseaseField = addDiseaseField(TravelEntryDto.DISEASE, false);
ComboBox diseaseField = addDiseaseField(TravelEntryDto.DISEASE, false, false);
ComboBox diseaseVariantField = addCustomizableEnumField(TravelEntryDto.DISEASE_VARIANT);
diseaseVariantField.setNullSelectionAllowed(true);
diseaseVariantField.setVisible(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected void addFields() {
TextField externalIdField = addField(TravelEntryDto.EXTERNAL_ID, TextField.class);
style(externalIdField, ERROR_COLOR_PRIMARY);

ComboBox diseaseField = addDiseaseField(TravelEntryDto.DISEASE, false, true);
ComboBox diseaseField = addDiseaseField(TravelEntryDto.DISEASE, false, true, false);
ComboBox diseaseVariantField = addField(TravelEntryDto.DISEASE_VARIANT, ComboBox.class);
diseaseVariantField.setNullSelectionAllowed(true);
diseaseVariantField.setVisible(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package de.symeda.sormas.ui.utils;

import static com.vaadin.v7.data.fieldgroup.DefaultFieldGroupFieldFactory.CAPTION_PROPERTY_ID;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -197,8 +199,8 @@ public void discard() throws SourceException {
super.discard();
}

protected ComboBox addDiseaseField(String fieldId, boolean showNonPrimaryDiseases) {
return addDiseaseField(fieldId, showNonPrimaryDiseases, false);
protected ComboBox addDiseaseField(String fieldId, boolean showNonPrimaryDiseases, boolean hideFollowUpDisabledDiseases) {
return addDiseaseField(fieldId, showNonPrimaryDiseases, false, hideFollowUpDisabledDiseases);
}

/**
Expand All @@ -213,10 +215,19 @@ protected ComboBox addDiseaseField(String fieldId, boolean showNonPrimaryDisease
* If only a single diseases is active on the server, set it as the default value
*/
@SuppressWarnings("unchecked")
protected ComboBox addDiseaseField(String fieldId, boolean showNonPrimaryDiseases, boolean setServerDiseaseAsDefault) {
protected ComboBox addDiseaseField(
String fieldId,
boolean showNonPrimaryDiseases,
boolean setServerDiseaseAsDefault,
boolean hideFollowUpDisabledDiseases) {

diseaseField = addField(fieldId, ComboBox.class);
this.setServerDiseaseAsDefault = setServerDiseaseAsDefault;

if (hideFollowUpDisabledDiseases) {
removeFollowUpDisabledDiseases(diseaseField);
}

if (showNonPrimaryDiseases) {
addNonPrimaryDiseasesTo(diseaseField);
}
Expand All @@ -230,9 +241,10 @@ protected ComboBox addDiseaseField(String fieldId, boolean showNonPrimaryDisease
Object value = e.getProperty().getValue();
if (value != null && !diseaseField.containsId(value)) {
Item newItem = diseaseField.addItem(value);
newItem.getItemProperty(SormasFieldGroupFieldFactory.CAPTION_PROPERTY_ID).setValue(value.toString());
newItem.getItemProperty(CAPTION_PROPERTY_ID).setValue(value.toString());
}
});

return diseaseField;
}

Expand Down Expand Up @@ -499,7 +511,16 @@ protected void addNonPrimaryDiseasesTo(ComboBox diseaseField) {
}

Item newItem = diseaseField.addItem(disease);
newItem.getItemProperty(SormasFieldGroupFieldFactory.CAPTION_PROPERTY_ID).setValue(disease.toString());
newItem.getItemProperty(CAPTION_PROPERTY_ID).setValue(disease.toString());
}
}

protected void removeFollowUpDisabledDiseases(ComboBox diseaseField) {
List<Disease> allDiseasesWithFollowUp = FacadeProvider.getDiseaseConfigurationFacade().getAllDiseasesWithFollowUp(true, true, true);
diseaseField.removeAllItems();
for (Object r : allDiseasesWithFollowUp) {
Item newItem = diseaseField.addItem(r);
newItem.getItemProperty(CAPTION_PROPERTY_ID).setValue(r.toString());
}
}

Expand Down

0 comments on commit 8fe745c

Please sign in to comment.