use of de.symeda.sormas.ui.contact.ContactListComponent in project SORMAS-Project by hzi-braunschweig.
the class EventParticipantDataView method initView.
@Override
protected void initView(String params) {
EventParticipantDto eventParticipant = FacadeProvider.getEventParticipantFacade().getEventParticipantByUuid(getReference().getUuid());
setHeightUndefined();
final EventParticipantReferenceDto eventParticipantRef = getReference();
editComponent = ControllerProvider.getEventParticipantController().getEventParticipantDataEditComponent(eventParticipantRef.getUuid());
DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
container.setWidth(100, Unit.PERCENTAGE);
container.setMargin(true);
setSubComponent(container);
LayoutWithSidePanel layout = new LayoutWithSidePanel(editComponent, SAMPLES_LOC, CONTACTS_LOC, IMMUNIZATION_LOC, VACCINATIONS_LOC, QUARANTINE_LOC, SORMAS_TO_SORMAS_LOC);
container.addComponent(layout);
EventDto event = FacadeProvider.getEventFacade().getEventByUuid(eventParticipant.getEvent().getUuid(), false);
SampleCriteria sampleCriteria = new SampleCriteria().eventParticipant(eventParticipantRef);
if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_VIEW)) {
SampleListComponent sampleList = new SampleListComponent(sampleCriteria.eventParticipant(eventParticipantRef).disease(event.getDisease()).sampleAssociationType(SampleAssociationType.EVENT_PARTICIPANT), this::showUnsavedChangesPopup);
SampleListComponentLayout sampleListComponentLayout = new SampleListComponentLayout(sampleList, I18nProperties.getString(Strings.infoCreateNewSampleDiscardsChangesEventParticipant));
layout.addSidePanelComponent(sampleListComponentLayout, SAMPLES_LOC);
}
if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW)) {
VerticalLayout contactsLayout = new VerticalLayout();
contactsLayout.setMargin(false);
contactsLayout.setSpacing(false);
ContactListComponent contactList = new ContactListComponent(eventParticipantRef, this::showUnsavedChangesPopup);
contactList.addStyleName(CssStyles.SIDE_COMPONENT);
contactsLayout.addComponent(contactList);
layout.addSidePanelComponent(contactsLayout, CONTACTS_LOC);
}
boolean sormasToSormasEnabled = FacadeProvider.getSormasToSormasFacade().isSharingEventsEnabledForUser();
if (sormasToSormasEnabled || eventParticipant.getSormasToSormasOriginInfo() != null) {
VerticalLayout sormasToSormasLocLayout = new VerticalLayout();
sormasToSormasLocLayout.setMargin(false);
sormasToSormasLocLayout.setSpacing(false);
SormasToSormasListComponent sormasToSormasListComponent = new SormasToSormasListComponent(eventParticipant, sormasToSormasEnabled);
sormasToSormasListComponent.addStyleNames(CssStyles.SIDE_COMPONENT);
sormasToSormasLocLayout.addComponent(sormasToSormasListComponent);
layout.addSidePanelComponent(sormasToSormasLocLayout, SORMAS_TO_SORMAS_LOC);
}
VaccinationListCriteria vaccinationCriteria = new VaccinationListCriteria.Builder(eventParticipant.getPerson().toReference()).withDisease(event.getDisease()).build();
QuarantineOrderDocumentsComponent.addComponentToLayout(layout.getSidePanelComponent(), eventParticipantRef, DocumentWorkflow.QUARANTINE_ORDER_EVENT_PARTICIPANT, sampleCriteria, vaccinationCriteria);
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.IMMUNIZATION_MANAGEMENT) && UserProvider.getCurrent().hasUserRight(UserRight.IMMUNIZATION_VIEW) && event.getDisease() != null) {
if (!FacadeProvider.getFeatureConfigurationFacade().isPropertyValueTrue(FeatureType.IMMUNIZATION_MANAGEMENT, FeatureTypeProperty.REDUCED)) {
final ImmunizationListCriteria immunizationListCriteria = new ImmunizationListCriteria.Builder(eventParticipant.getPerson().toReference()).wihDisease(event.getDisease()).build();
layout.addSidePanelComponent(new SideComponentLayout(new ImmunizationListComponent(immunizationListCriteria, this::showUnsavedChangesPopup)), IMMUNIZATION_LOC);
} else {
VaccinationListCriteria criteria = vaccinationCriteria.vaccinationAssociationType(VaccinationAssociationType.EVENT_PARTICIPANT).eventParticipantReference(getReference()).region(eventParticipant.getRegion() != null ? eventParticipant.getRegion() : event.getEventLocation().getRegion()).district(eventParticipant.getDistrict() != null ? eventParticipant.getDistrict() : event.getEventLocation().getDistrict());
layout.addSidePanelComponent(new SideComponentLayout(new VaccinationListComponent(criteria, this::showUnsavedChangesPopup)), VACCINATIONS_LOC);
}
}
EditPermissionType eventParticipantEditAllowed = FacadeProvider.getEventParticipantFacade().isEventParticipantEditAllowed(eventParticipantRef.getUuid());
if (eventParticipantEditAllowed.equals(EditPermissionType.ARCHIVING_STATUS_ONLY)) {
layout.disable(ArchivingController.ARCHIVE_DEARCHIVE_BUTTON_ID);
} else if (eventParticipantEditAllowed.equals(EditPermissionType.REFUSED)) {
layout.disable();
}
}
Aggregations