@@ -173,6 +173,7 @@ public class ContactDataForm extends AbstractEditForm<ContactDto> {
173173
174174 private final ViewMode viewMode ;
175175 private final Disease disease ;
176+ private final boolean diseaseHasFollowUp ;
176177 private NullableOptionGroup contactProximity ;
177178 private ComboBox region ;
178179 private ComboBox district ;
@@ -212,6 +213,7 @@ public ContactDataForm(Disease disease, ViewMode viewMode, boolean isPseudonymiz
212213
213214 this .viewMode = viewMode ;
214215 this .disease = disease ;
216+ this .diseaseHasFollowUp = FacadeProvider .getDiseaseConfigurationFacade ().hasFollowUp (disease );
215217 addFields ();
216218 }
217219
@@ -234,12 +236,12 @@ protected void addFields() {
234236 Label followUpStausHeadingLabel = new Label (I18nProperties .getString (Strings .headingFollowUpStatus ));
235237 followUpStausHeadingLabel .addStyleName (H3 );
236238 getContent ().addComponent (followUpStausHeadingLabel , FOLLOW_UP_STATUS_HEADING_LOC );
237- followUpStausHeadingLabel .setVisible (Disease . INVASIVE_MENINGOCOCCAL_INFECTION != disease );
239+ followUpStausHeadingLabel .setVisible (diseaseHasFollowUp );
238240
239241 Label prophylaxisLabel = new Label (I18nProperties .getString (Strings .headingProphylaxisLoc ));
240242 prophylaxisLabel .addStyleName (H3 );
241243 getContent ().addComponent (prophylaxisLabel , PROPHYLAXIS_LOC );
242- prophylaxisLabel .setVisible (Disease .INVASIVE_MENINGOCOCCAL_INFECTION ==disease );
244+ prophylaxisLabel .setVisible (Disease .INVASIVE_MENINGOCOCCAL_INFECTION == disease );
243245
244246 addField (ContactDto .CONTACT_CLASSIFICATION , NullableOptionGroup .class );
245247 addField (ContactDto .CONTACT_STATUS , NullableOptionGroup .class );
@@ -272,12 +274,12 @@ protected void addFields() {
272274 addField (ContactDto .CONTACT_IDENTIFICATION_SOURCE , ComboBox .class );
273275 TextField contactIdentificationSourceDetails = addField (ContactDto .CONTACT_IDENTIFICATION_SOURCE_DETAILS , TextField .class );
274276 contactIdentificationSourceDetails .setInputPrompt (I18nProperties .getString (Strings .pleaseSpecify ));
275- // contactIdentificationSourceDetails.setVisible(false);
277+ // contactIdentificationSourceDetails.setVisible(false);
276278 ComboBox tracingApp = addField (ContactDto .TRACING_APP , ComboBox .class );
277279 TextField tracingAppDetails = addField (ContactDto .TRACING_APP_DETAILS , TextField .class );
278280 tracingAppDetails .setInputPrompt (I18nProperties .getString (Strings .pleaseSpecify ));
279- // tracingApp.setVisible(false);
280- // tracingAppDetails.setVisible(false);
281+ // tracingApp.setVisible(false);
282+ // tracingAppDetails.setVisible(false);
281283 if (isConfiguredServer (CountryHelper .COUNTRY_CODE_GERMANY )) {
282284 FieldHelper .setVisibleWhen (
283285 getFieldGroup (),
@@ -468,6 +470,7 @@ protected void addFields() {
468470 cbOverwriteFollowUpUntil .addValueChangeListener (e -> {
469471 updateOverwriteFollowUpUntil ();
470472 });
473+
471474 dfQuarantineTo .addValueChangeListener (e -> onQuarantineEndChange ());
472475 addValueChangeListener (e -> {
473476 ValidationUtils .initComponentErrorValidator (
@@ -711,13 +714,27 @@ public String getFormattedHtmlMessage() {
711714 // Prophylaxis details for IMI
712715 CheckBox prophylaxisPrescribed = addField (ContactDto .PROPHYLAXIS_PRESCRIBED , CheckBox .class );
713716 prophylaxisPrescribed .setCaption (I18nProperties .getCaption (Captions .Contact_prophylaxisPrescribed ));
714- // prophylaxisPrescribed.removeStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
717+ // prophylaxisPrescribed.removeStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
715718 addField (ContactDto .PRESCRIBED_DRUG , ComboBox .class );
716719 addField (ContactDto .PRESCRIBED_DRUG_TEXT , TextField .class );
717- FieldHelper .setVisibleWhen (getFieldGroup (), ContactDto .PRESCRIBED_DRUG , ContactDto .PROPHYLAXIS_PRESCRIBED , Collections .singletonList (Boolean .TRUE ), true );
720+ FieldHelper .setVisibleWhen (
721+ getFieldGroup (),
722+ ContactDto .PRESCRIBED_DRUG ,
723+ ContactDto .PROPHYLAXIS_PRESCRIBED ,
724+ Collections .singletonList (Boolean .TRUE ),
725+ true );
718726 FieldHelper .setRequiredWhenNotNull (getFieldGroup (), ContactDto .PROPHYLAXIS_PRESCRIBED , ContactDto .PRESCRIBED_DRUG );
719- FieldHelper .setVisibleWhen (getFieldGroup (), ContactDto .PRESCRIBED_DRUG_TEXT , ContactDto .PRESCRIBED_DRUG , Collections .singletonList (PrescribedDrug .OTHER ), true );
720- FieldHelper .setRequiredWhen (getFieldGroup (), ContactDto .PRESCRIBED_DRUG , Arrays .asList (ContactDto .PRESCRIBED_DRUG_TEXT ), Arrays .asList (PrescribedDrug .OTHER ));
727+ FieldHelper .setVisibleWhen (
728+ getFieldGroup (),
729+ ContactDto .PRESCRIBED_DRUG_TEXT ,
730+ ContactDto .PRESCRIBED_DRUG ,
731+ Collections .singletonList (PrescribedDrug .OTHER ),
732+ true );
733+ FieldHelper .setRequiredWhen (
734+ getFieldGroup (),
735+ ContactDto .PRESCRIBED_DRUG ,
736+ Arrays .asList (ContactDto .PRESCRIBED_DRUG_TEXT ),
737+ Arrays .asList (PrescribedDrug .OTHER ));
721738 }
722739
723740 private void updateContactOfficers () {
@@ -846,6 +863,21 @@ private void updateDiseaseConfiguration(Disease disease) {
846863 || (propertyId .equals (ContactDto .CONTACT_CATEGORY ) && isVisibleAllowed ((String ) propertyId ))));
847864 }
848865
866+ final boolean diseaseHasFollowUp = FacadeProvider .getDiseaseConfigurationFacade ().hasFollowUp (disease );
867+ // Hide follow-up if disease does not have it enabled
868+ //followUpStausHeadingLabel.setVisible(this.diseaseHasFollowUp);
869+ FieldHelper .setMultipleVisible (
870+ getFieldGroup (),
871+ Arrays .asList (
872+ ContactDto .FOLLOW_UP_STATUS ,
873+ ContactDto .FOLLOW_UP_STATUS_CHANGE_DATE ,
874+ ContactDto .FOLLOW_UP_STATUS_CHANGE_USER ,
875+ ContactDto .FOLLOW_UP_COMMENT ,
876+ ContactDto .FOLLOW_UP_UNTIL ,
877+ ContactDto .OVERWRITE_FOLLOW_UP_UNTIL ),
878+ field -> diseaseHasFollowUp ,
879+ field -> false );
880+
849881 FieldHelper .updateEnumData (
850882 contactProximity ,
851883 Arrays .asList (ContactProximity .getValues (disease , FacadeProvider .getConfigFacade ().getCountryLocale ())));
0 commit comments