@@ -173,6 +173,7 @@ public class ContactDataForm extends AbstractEditForm<ContactDto> {
173
173
174
174
private final ViewMode viewMode ;
175
175
private final Disease disease ;
176
+ private final boolean diseaseHasFollowUp ;
176
177
private NullableOptionGroup contactProximity ;
177
178
private ComboBox region ;
178
179
private ComboBox district ;
@@ -212,6 +213,7 @@ public ContactDataForm(Disease disease, ViewMode viewMode, boolean isPseudonymiz
212
213
213
214
this .viewMode = viewMode ;
214
215
this .disease = disease ;
216
+ this .diseaseHasFollowUp = FacadeProvider .getDiseaseConfigurationFacade ().hasFollowUp (disease );
215
217
addFields ();
216
218
}
217
219
@@ -234,12 +236,12 @@ protected void addFields() {
234
236
Label followUpStausHeadingLabel = new Label (I18nProperties .getString (Strings .headingFollowUpStatus ));
235
237
followUpStausHeadingLabel .addStyleName (H3 );
236
238
getContent ().addComponent (followUpStausHeadingLabel , FOLLOW_UP_STATUS_HEADING_LOC );
237
- followUpStausHeadingLabel .setVisible (Disease . INVASIVE_MENINGOCOCCAL_INFECTION != disease );
239
+ followUpStausHeadingLabel .setVisible (diseaseHasFollowUp );
238
240
239
241
Label prophylaxisLabel = new Label (I18nProperties .getString (Strings .headingProphylaxisLoc ));
240
242
prophylaxisLabel .addStyleName (H3 );
241
243
getContent ().addComponent (prophylaxisLabel , PROPHYLAXIS_LOC );
242
- prophylaxisLabel .setVisible (Disease .INVASIVE_MENINGOCOCCAL_INFECTION ==disease );
244
+ prophylaxisLabel .setVisible (Disease .INVASIVE_MENINGOCOCCAL_INFECTION == disease );
243
245
244
246
addField (ContactDto .CONTACT_CLASSIFICATION , NullableOptionGroup .class );
245
247
addField (ContactDto .CONTACT_STATUS , NullableOptionGroup .class );
@@ -272,12 +274,12 @@ protected void addFields() {
272
274
addField (ContactDto .CONTACT_IDENTIFICATION_SOURCE , ComboBox .class );
273
275
TextField contactIdentificationSourceDetails = addField (ContactDto .CONTACT_IDENTIFICATION_SOURCE_DETAILS , TextField .class );
274
276
contactIdentificationSourceDetails .setInputPrompt (I18nProperties .getString (Strings .pleaseSpecify ));
275
- // contactIdentificationSourceDetails.setVisible(false);
277
+ // contactIdentificationSourceDetails.setVisible(false);
276
278
ComboBox tracingApp = addField (ContactDto .TRACING_APP , ComboBox .class );
277
279
TextField tracingAppDetails = addField (ContactDto .TRACING_APP_DETAILS , TextField .class );
278
280
tracingAppDetails .setInputPrompt (I18nProperties .getString (Strings .pleaseSpecify ));
279
- // tracingApp.setVisible(false);
280
- // tracingAppDetails.setVisible(false);
281
+ // tracingApp.setVisible(false);
282
+ // tracingAppDetails.setVisible(false);
281
283
if (isConfiguredServer (CountryHelper .COUNTRY_CODE_GERMANY )) {
282
284
FieldHelper .setVisibleWhen (
283
285
getFieldGroup (),
@@ -468,6 +470,7 @@ protected void addFields() {
468
470
cbOverwriteFollowUpUntil .addValueChangeListener (e -> {
469
471
updateOverwriteFollowUpUntil ();
470
472
});
473
+
471
474
dfQuarantineTo .addValueChangeListener (e -> onQuarantineEndChange ());
472
475
addValueChangeListener (e -> {
473
476
ValidationUtils .initComponentErrorValidator (
@@ -711,13 +714,27 @@ public String getFormattedHtmlMessage() {
711
714
// Prophylaxis details for IMI
712
715
CheckBox prophylaxisPrescribed = addField (ContactDto .PROPHYLAXIS_PRESCRIBED , CheckBox .class );
713
716
prophylaxisPrescribed .setCaption (I18nProperties .getCaption (Captions .Contact_prophylaxisPrescribed ));
714
- // prophylaxisPrescribed.removeStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
717
+ // prophylaxisPrescribed.removeStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
715
718
addField (ContactDto .PRESCRIBED_DRUG , ComboBox .class );
716
719
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 );
718
726
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 ));
721
738
}
722
739
723
740
private void updateContactOfficers () {
@@ -846,6 +863,21 @@ private void updateDiseaseConfiguration(Disease disease) {
846
863
|| (propertyId .equals (ContactDto .CONTACT_CATEGORY ) && isVisibleAllowed ((String ) propertyId ))));
847
864
}
848
865
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
+
849
881
FieldHelper .updateEnumData (
850
882
contactProximity ,
851
883
Arrays .asList (ContactProximity .getValues (disease , FacadeProvider .getConfigFacade ().getCountryLocale ())));
0 commit comments