Search in sources :

Example 1 with ImmunizationListCriteria

use of de.symeda.sormas.api.immunization.ImmunizationListCriteria in project SORMAS-Project by hzi-braunschweig.

the class PersonDataView method initView.

@Override
protected void initView(String params) {
    setHeightUndefined();
    String htmlLayout = LayoutUtil.fluidRow(LayoutUtil.fluidColumnLoc(8, 0, 12, 0, PERSON_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, CASES_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, CONTACTS_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, EVENT_PARTICIPANTS_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, TRAVEL_ENTRIES_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, IMMUNIZATION_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, VACCINATIONS_LOC));
    DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
    container.setWidth(100, Unit.PERCENTAGE);
    container.setMargin(true);
    setSubComponent(container);
    CustomLayout layout = new CustomLayout();
    layout.addStyleName(CssStyles.ROOT_COMPONENT);
    layout.setTemplateContents(htmlLayout);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeightUndefined();
    container.addComponent(layout);
    editComponent = ControllerProvider.getPersonController().getPersonEditComponent(getReference().getUuid(), UserRight.PERSON_EDIT);
    editComponent.setMargin(false);
    editComponent.setWidth(100, Unit.PERCENTAGE);
    editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
    editComponent.addStyleName(CssStyles.MAIN_COMPONENT);
    layout.addComponent(editComponent, PERSON_LOC);
    if (FacadeProvider.getPersonFacade().isSharedWithoutOwnership(getReference().getUuid())) {
        editComponent.setEnabled(false);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.CASE_SURVEILANCE)) {
        layout.addComponent(new SideComponentLayout(new CaseListComponent(getReference())), CASES_LOC);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.CONTACT_TRACING) && UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW)) {
        layout.addComponent(new SideComponentLayout(new ContactListComponent(getReference())), CONTACTS_LOC);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE)) {
        layout.addComponent(new SideComponentLayout(new EventParticipantListComponent(getReference())), EVENT_PARTICIPANTS_LOC);
    }
    UserProvider currentUser = UserProvider.getCurrent();
    if (FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY) && FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.TRAVEL_ENTRIES) && currentUser != null && currentUser.hasUserRight(UserRight.TRAVEL_ENTRY_VIEW)) {
        TravelEntryListCriteria travelEntryListCriteria = new TravelEntryListCriteria.Builder().withPerson(getReference()).build();
        layout.addComponent(new SideComponentLayout(new TravelEntryListComponent(travelEntryListCriteria, this::showUnsavedChangesPopup)), TRAVEL_ENTRIES_LOC);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.IMMUNIZATION_MANAGEMENT) && currentUser != null && currentUser.hasUserRight(UserRight.IMMUNIZATION_VIEW)) {
        if (!FacadeProvider.getFeatureConfigurationFacade().isPropertyValueTrue(FeatureType.IMMUNIZATION_MANAGEMENT, FeatureTypeProperty.REDUCED)) {
            final ImmunizationListCriteria immunizationListCriteria = new ImmunizationListCriteria.Builder(getReference()).build();
            layout.addComponent(new SideComponentLayout(new ImmunizationListComponent(immunizationListCriteria, this::showUnsavedChangesPopup)), IMMUNIZATION_LOC);
        } else {
            VaccinationListCriteria criteria = new VaccinationListCriteria.Builder(getReference()).build();
            layout.addComponent(new SideComponentLayout(new VaccinationListComponent(criteria)), VACCINATIONS_LOC);
        }
    }
}
Also used : DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) EventParticipantListComponent(de.symeda.sormas.ui.events.eventParticipantLink.EventParticipantListComponent) VaccinationListComponent(de.symeda.sormas.ui.vaccination.list.VaccinationListComponent) TravelEntryListCriteria(de.symeda.sormas.api.travelentry.TravelEntryListCriteria) SideComponentLayout(de.symeda.sormas.ui.utils.components.sidecomponent.SideComponentLayout) VaccinationListCriteria(de.symeda.sormas.api.vaccination.VaccinationListCriteria) UserProvider(de.symeda.sormas.ui.UserProvider) CustomLayout(com.vaadin.ui.CustomLayout) ContactListComponent(de.symeda.sormas.ui.contact.contactlink.ContactListComponent) ImmunizationListCriteria(de.symeda.sormas.api.immunization.ImmunizationListCriteria) CaseListComponent(de.symeda.sormas.ui.caze.caselink.CaseListComponent) TravelEntryListComponent(de.symeda.sormas.ui.travelentry.travelentrylink.TravelEntryListComponent) ImmunizationListComponent(de.symeda.sormas.ui.immunization.immunizationlink.ImmunizationListComponent)

Example 2 with ImmunizationListCriteria

use of de.symeda.sormas.api.immunization.ImmunizationListCriteria in project SORMAS-Project by hzi-braunschweig.

the class ContactDataView method initView.

@Override
protected void initView(String params) {
    setHeightUndefined();
    ContactDto contactDto = FacadeProvider.getContactFacade().getByUuid(getContactRef().getUuid());
    editComponent = ControllerProvider.getContactController().getContactDataEditComponent(getContactRef().getUuid(), ViewMode.NORMAL, contactDto.isPseudonymized());
    addCreateFromCaseButtonLogic();
    DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
    container.setWidth(100, Unit.PERCENTAGE);
    container.setMargin(true);
    setSubComponent(container);
    LayoutWithSidePanel layout = new LayoutWithSidePanel(editComponent, CASE_LOC, CASE_BUTTONS_LOC, EVENTS_LOC, TASKS_LOC, SAMPLES_LOC, IMMUNIZATION_LOC, VACCINATIONS_LOC, SORMAS_TO_SORMAS_LOC, DOCUMENTS_LOC, QuarantineOrderDocumentsComponent.QUARANTINE_LOC);
    container.addComponent(layout);
    CaseDataDto caseDto = null;
    if (contactDto.getCaze() != null) {
        caseDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(contactDto.getCaze().getUuid());
        layout.addSidePanelComponent(createCaseInfoLayout(caseDto), CASE_LOC);
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_REASSIGN_CASE)) {
        HorizontalLayout buttonsLayout = new HorizontalLayout();
        buttonsLayout.setSpacing(true);
        Button chooseCaseButton = ButtonHelper.createButton(contactDto.getCaze() == null ? Captions.contactChooseSourceCase : Captions.contactChangeCase, null, ValoTheme.BUTTON_PRIMARY, CssStyles.VSPACE_2);
        buttonsLayout.addComponent(chooseCaseButton);
        Button removeCaseButton = ButtonHelper.createButton(Captions.contactRemoveCase, null, ValoTheme.BUTTON_LINK);
        if (contactDto.getCaze() != null) {
            buttonsLayout.addComponent(removeCaseButton);
        }
        chooseCaseButton.addClickListener(e -> {
            VaadinUiUtil.showConfirmationPopup(I18nProperties.getString(Strings.headingDiscardUnsavedChanges), new Label(I18nProperties.getString(Strings.confirmationContactSourceCaseDiscardUnsavedChanges)), I18nProperties.getString(Strings.yes), I18nProperties.getString(Strings.no), 480, confirmed -> {
                if (confirmed) {
                    editComponent.discard();
                    Disease selectedDisease = editComponent.getWrappedComponent().getSelectedDisease();
                    ControllerProvider.getContactController().openSelectCaseForContactWindow(selectedDisease, selectedCase -> {
                        if (selectedCase != null) {
                            editComponent.getWrappedComponent().setSourceCase(selectedCase.toReference());
                            ContactDto contactToChange = FacadeProvider.getContactFacade().getByUuid(getContactRef().getUuid());
                            contactToChange.setCaze(selectedCase.toReference());
                            FacadeProvider.getContactFacade().save(contactToChange);
                            layout.addComponent(createCaseInfoLayout(selectedCase.getUuid()), CASE_LOC);
                            removeCaseButton.setVisible(true);
                            chooseCaseButton.setCaption(I18nProperties.getCaption(Captions.contactChangeCase));
                            ControllerProvider.getContactController().navigateToData(contactDto.getUuid());
                            new Notification(null, I18nProperties.getString(Strings.messageContactCaseChanged), Type.TRAY_NOTIFICATION, false).show(Page.getCurrent());
                        }
                    });
                }
            });
        });
        removeCaseButton.addClickListener(e -> {
            if (contactDto.getRegion() == null || contactDto.getDistrict() == null) {
                // Ask user to fill in a region and district before removing the source case
                VaadinUiUtil.showSimplePopupWindow(I18nProperties.getString(Strings.headingContactDataNotComplete), I18nProperties.getString(Strings.messageSetContactRegionAndDistrict));
            } else {
                VaadinUiUtil.showConfirmationPopup(I18nProperties.getString(Strings.headingRemoveCaseFromContact), new Label(I18nProperties.getString(Strings.confirmationContactSourceCaseDiscardUnsavedChanges)), I18nProperties.getString(Strings.yes), I18nProperties.getString(Strings.no), 480, confirmed -> {
                    if (confirmed) {
                        editComponent.discard();
                        layout.removeComponent(CASE_LOC);
                        editComponent.getWrappedComponent().setSourceCase(null);
                        ContactDto contactToChange = FacadeProvider.getContactFacade().getByUuid(getContactRef().getUuid());
                        contactToChange.setCaze(null);
                        FacadeProvider.getContactFacade().save(contactToChange);
                        removeCaseButton.setVisible(false);
                        chooseCaseButton.setCaption(I18nProperties.getCaption(Captions.contactChooseSourceCase));
                        ControllerProvider.getContactController().navigateToData(contactDto.getUuid());
                        new Notification(null, I18nProperties.getString(Strings.messageContactCaseRemoved), Type.TRAY_NOTIFICATION, false).show(Page.getCurrent());
                    }
                });
            }
        });
        layout.addSidePanelComponent(buttonsLayout, CASE_BUTTONS_LOC);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.TASK_MANAGEMENT)) {
        TaskListComponent taskList = new TaskListComponent(TaskContext.CONTACT, getContactRef(), contactDto.getDisease());
        taskList.addStyleName(CssStyles.SIDE_COMPONENT);
        layout.addSidePanelComponent(taskList, TASKS_LOC);
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_VIEW)) {
        SampleListComponent sampleList = new SampleListComponent(new SampleCriteria().contact(getContactRef()).disease(contactDto.getDisease()).sampleAssociationType(SampleAssociationType.CONTACT), this::showUnsavedChangesPopup);
        SampleListComponentLayout sampleListComponentLayout = new SampleListComponentLayout(sampleList, I18nProperties.getString(Strings.infoCreateNewSampleDiscardsChangesContact));
        layout.addSidePanelComponent(sampleListComponentLayout, SAMPLES_LOC);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE) && UserProvider.getCurrent().hasUserRight(UserRight.EVENT_VIEW)) {
        VerticalLayout eventsLayout = new VerticalLayout();
        eventsLayout.setMargin(false);
        eventsLayout.setSpacing(false);
        EventListComponent eventList = new EventListComponent(getContactRef(), this::showUnsavedChangesPopup);
        eventList.addStyleName(CssStyles.SIDE_COMPONENT);
        eventsLayout.addComponent(eventList);
        layout.addSidePanelComponent(eventsLayout, EVENTS_LOC);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.IMMUNIZATION_MANAGEMENT) && UserProvider.getCurrent().hasUserRight(UserRight.IMMUNIZATION_VIEW)) {
        if (!FacadeProvider.getFeatureConfigurationFacade().isPropertyValueTrue(FeatureType.IMMUNIZATION_MANAGEMENT, FeatureTypeProperty.REDUCED)) {
            final ImmunizationListCriteria immunizationListCriteria = new ImmunizationListCriteria.Builder(contactDto.getPerson()).wihDisease(contactDto.getDisease()).build();
            layout.addSidePanelComponent(new SideComponentLayout(new ImmunizationListComponent(immunizationListCriteria, this::showUnsavedChangesPopup)), IMMUNIZATION_LOC);
        } else {
            VaccinationListCriteria criteria = new VaccinationListCriteria.Builder(contactDto.getPerson()).withDisease(contactDto.getDisease()).build().vaccinationAssociationType(VaccinationAssociationType.CONTACT).contactReference(getContactRef()).region(contactDto.getRegion() != null ? contactDto.getRegion() : caseDto.getResponsibleRegion()).district(contactDto.getDistrict() != null ? contactDto.getDistrict() : caseDto.getResponsibleDistrict());
            layout.addSidePanelComponent(new SideComponentLayout(new VaccinationListComponent(criteria, this::showUnsavedChangesPopup)), VACCINATIONS_LOC);
        }
    }
    boolean sormasToSormasfeatureEnabled = FacadeProvider.getSormasToSormasFacade().isSharingCasesContactsAndSamplesEnabledForUser();
    if (sormasToSormasfeatureEnabled || contactDto.getSormasToSormasOriginInfo() != null) {
        VerticalLayout sormasToSormasLocLayout = new VerticalLayout();
        sormasToSormasLocLayout.setMargin(false);
        sormasToSormasLocLayout.setSpacing(false);
        SormasToSormasListComponent sormasToSormasListComponent = new SormasToSormasListComponent(contactDto, sormasToSormasfeatureEnabled);
        sormasToSormasListComponent.addStyleNames(CssStyles.SIDE_COMPONENT);
        sormasToSormasLocLayout.addComponent(sormasToSormasListComponent);
        layout.addSidePanelComponent(sormasToSormasLocLayout, SORMAS_TO_SORMAS_LOC);
    }
    DocumentListComponent documentList = null;
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.DOCUMENTS)) {
        documentList = new DocumentListComponent(DocumentRelatedEntityType.CONTACT, getContactRef(), UserRight.CONTACT_EDIT, contactDto.isPseudonymized());
        layout.addSidePanelComponent(new SideComponentLayout(documentList), DOCUMENTS_LOC);
    }
    QuarantineOrderDocumentsComponent.addComponentToLayout(layout.getSidePanelComponent(), contactDto, documentList);
    EditPermissionType contactEditAllowed = FacadeProvider.getContactFacade().isContactEditAllowed(contactDto.getUuid());
    if (contactEditAllowed.equals(EditPermissionType.ARCHIVING_STATUS_ONLY)) {
        layout.disable(ArchivingController.ARCHIVE_DEARCHIVE_BUTTON_ID);
    } else if (contactEditAllowed.equals(EditPermissionType.REFUSED)) {
        layout.disable();
    }
}
Also used : Disease(de.symeda.sormas.api.Disease) Label(com.vaadin.ui.Label) EditPermissionType(de.symeda.sormas.api.EditPermissionType) VaccinationListComponent(de.symeda.sormas.ui.vaccination.list.VaccinationListComponent) Notification(com.vaadin.ui.Notification) HorizontalLayout(com.vaadin.ui.HorizontalLayout) SideComponentLayout(de.symeda.sormas.ui.utils.components.sidecomponent.SideComponentLayout) DocumentListComponent(de.symeda.sormas.ui.document.DocumentListComponent) SampleListComponent(de.symeda.sormas.ui.samples.sampleLink.SampleListComponent) Button(com.vaadin.ui.Button) TaskListComponent(de.symeda.sormas.ui.task.TaskListComponent) ContactDto(de.symeda.sormas.api.contact.ContactDto) VerticalLayout(com.vaadin.ui.VerticalLayout) ImmunizationListCriteria(de.symeda.sormas.api.immunization.ImmunizationListCriteria) EventListComponent(de.symeda.sormas.ui.events.eventLink.EventListComponent) DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) SampleCriteria(de.symeda.sormas.api.sample.SampleCriteria) SampleListComponentLayout(de.symeda.sormas.ui.samples.sampleLink.SampleListComponentLayout) SormasToSormasListComponent(de.symeda.sormas.ui.sormastosormas.SormasToSormasListComponent) VaccinationListCriteria(de.symeda.sormas.api.vaccination.VaccinationListCriteria) LayoutWithSidePanel(de.symeda.sormas.ui.utils.LayoutWithSidePanel) ImmunizationListComponent(de.symeda.sormas.ui.immunization.immunizationlink.ImmunizationListComponent)

Example 3 with ImmunizationListCriteria

use of de.symeda.sormas.api.immunization.ImmunizationListCriteria in project SORMAS-Project by hzi-braunschweig.

the class CaseDataView method initView.

@Override
protected void initView(String params) {
    setHeightUndefined();
    CaseDataDto caze = FacadeProvider.getCaseFacade().getCaseDataByUuid(getCaseRef().getUuid());
    DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
    container.setWidth(100, Unit.PERCENTAGE);
    container.setMargin(true);
    setSubComponent(container);
    editComponent = ControllerProvider.getCaseController().getCaseDataEditComponent(getCaseRef().getUuid(), ViewMode.NORMAL);
    LayoutWithSidePanel layout = new LayoutWithSidePanel(editComponent, TASKS_LOC, SAMPLES_LOC, EVENTS_LOC, IMMUNIZATION_LOC, VACCINATIONS_LOC, SORMAS_TO_SORMAS_LOC, SMS_LOC, ExternalSurveillanceServiceGateway.EXTERANEL_SURVEILLANCE_TOOL_GATEWAY_LOC, SURVEILLANCE_REPORTS_LOC, DOCUMENTS_LOC, QuarantineOrderDocumentsComponent.QUARANTINE_LOC);
    container.addComponent(layout);
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.TASK_MANAGEMENT)) {
        TaskListComponent taskList = new TaskListComponent(TaskContext.CASE, getCaseRef(), caze.getDisease());
        taskList.addStyleName(CssStyles.SIDE_COMPONENT);
        layout.addSidePanelComponent(taskList, TASKS_LOC);
    }
    final boolean externalMessagesEnabled = FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.MANUAL_EXTERNAL_MESSAGES);
    final boolean isSmsServiceSetUp = FacadeProvider.getConfigFacade().isSmsServiceSetUp();
    if (isSmsServiceSetUp && externalMessagesEnabled && UserProvider.getCurrent().hasUserRight(UserRight.SEND_MANUAL_EXTERNAL_MESSAGES)) {
        SmsListComponent smsList = new SmsListComponent(getCaseRef(), caze.getPerson());
        smsList.addStyleName(CssStyles.SIDE_COMPONENT);
        layout.addSidePanelComponent(smsList, SMS_LOC);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.SAMPLES_LAB) && UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_VIEW) && !caze.checkIsUnreferredPortHealthCase()) {
        SampleListComponent sampleList = new SampleListComponent(new SampleCriteria().caze(getCaseRef()).sampleAssociationType(SampleAssociationType.CASE).disease(caze.getDisease()), this::showUnsavedChangesPopup);
        SampleListComponentLayout sampleListComponentLayout = new SampleListComponentLayout(sampleList, I18nProperties.getString(Strings.infoCreateNewSampleDiscardsChangesCase));
        layout.addSidePanelComponent(sampleListComponentLayout, SAMPLES_LOC);
    }
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE) && UserProvider.getCurrent().hasUserRight(UserRight.EVENT_VIEW)) {
        VerticalLayout eventLayout = new VerticalLayout();
        eventLayout.setMargin(false);
        eventLayout.setSpacing(false);
        EventListComponent eventList = new EventListComponent(getCaseRef(), this::showUnsavedChangesPopup);
        eventList.addStyleName(CssStyles.SIDE_COMPONENT);
        eventLayout.addComponent(eventList);
        layout.addSidePanelComponent(eventLayout, EVENTS_LOC);
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.IMMUNIZATION_VIEW) && FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.IMMUNIZATION_MANAGEMENT)) {
        if (!FacadeProvider.getFeatureConfigurationFacade().isPropertyValueTrue(FeatureType.IMMUNIZATION_MANAGEMENT, FeatureTypeProperty.REDUCED)) {
            final ImmunizationListCriteria immunizationListCriteria = new ImmunizationListCriteria.Builder(caze.getPerson()).wihDisease(caze.getDisease()).build();
            layout.addSidePanelComponent(new SideComponentLayout(new ImmunizationListComponent(immunizationListCriteria, this::showUnsavedChangesPopup)), IMMUNIZATION_LOC);
        } else {
            VaccinationListCriteria criteria = new VaccinationListCriteria.Builder(caze.getPerson()).withDisease(caze.getDisease()).build().vaccinationAssociationType(VaccinationAssociationType.CASE).caseReference(getCaseRef()).region(caze.getResponsibleRegion()).district(caze.getResponsibleDistrict());
            layout.addSidePanelComponent(new SideComponentLayout(new VaccinationListComponent(criteria, this::showUnsavedChangesPopup)), VACCINATIONS_LOC);
        }
    }
    boolean sormasToSormasEnabled = FacadeProvider.getSormasToSormasFacade().isSharingCasesContactsAndSamplesEnabledForUser();
    if (sormasToSormasEnabled || caze.getSormasToSormasOriginInfo() != null) {
        VerticalLayout sormasToSormasLocLayout = new VerticalLayout();
        sormasToSormasLocLayout.setMargin(false);
        sormasToSormasLocLayout.setSpacing(false);
        SormasToSormasListComponent sormasToSormasListComponent = new SormasToSormasListComponent(caze, sormasToSormasEnabled);
        sormasToSormasListComponent.addStyleNames(CssStyles.SIDE_COMPONENT);
        sormasToSormasLocLayout.addComponent(sormasToSormasListComponent);
        layout.addSidePanelComponent(sormasToSormasLocLayout, SORMAS_TO_SORMAS_LOC);
    }
    ExternalSurveillanceServiceGateway.addComponentToLayout(layout.getSidePanelComponent(), editComponent, caze);
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.SURVEILLANCE_REPORTS)) {
        SurveillanceReportListComponent surveillanceReportList = new SurveillanceReportListComponent(caze.toReference());
        surveillanceReportList.addStyleNames(CssStyles.SIDE_COMPONENT);
        VerticalLayout surveillanceReportListLocLayout = new VerticalLayout();
        surveillanceReportListLocLayout.setMargin(false);
        surveillanceReportListLocLayout.setSpacing(false);
        surveillanceReportListLocLayout.addComponent(surveillanceReportList);
        layout.addSidePanelComponent(surveillanceReportListLocLayout, SURVEILLANCE_REPORTS_LOC);
    }
    DocumentListComponent documentList = null;
    if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.DOCUMENTS)) {
        documentList = new DocumentListComponent(DocumentRelatedEntityType.CASE, getCaseRef(), UserRight.CASE_EDIT, caze.isPseudonymized());
        layout.addSidePanelComponent(new SideComponentLayout(documentList), DOCUMENTS_LOC);
    }
    QuarantineOrderDocumentsComponent.addComponentToLayout(layout.getSidePanelComponent(), caze, documentList);
    EditPermissionType caseEditAllowed = FacadeProvider.getCaseFacade().isCaseEditAllowed(caze.getUuid());
    if (caseEditAllowed.equals(EditPermissionType.ARCHIVING_STATUS_ONLY)) {
        layout.disable(ArchivingController.ARCHIVE_DEARCHIVE_BUTTON_ID);
    } else if (caseEditAllowed.equals(EditPermissionType.REFUSED)) {
        layout.disable();
    }
}
Also used : DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) SmsListComponent(de.symeda.sormas.ui.caze.messaging.SmsListComponent) SampleCriteria(de.symeda.sormas.api.sample.SampleCriteria) SampleListComponentLayout(de.symeda.sormas.ui.samples.sampleLink.SampleListComponentLayout) SormasToSormasListComponent(de.symeda.sormas.ui.sormastosormas.SormasToSormasListComponent) EditPermissionType(de.symeda.sormas.api.EditPermissionType) VaccinationListComponent(de.symeda.sormas.ui.vaccination.list.VaccinationListComponent) SideComponentLayout(de.symeda.sormas.ui.utils.components.sidecomponent.SideComponentLayout) VaccinationListCriteria(de.symeda.sormas.api.vaccination.VaccinationListCriteria) DocumentListComponent(de.symeda.sormas.ui.document.DocumentListComponent) LayoutWithSidePanel(de.symeda.sormas.ui.utils.LayoutWithSidePanel) SampleListComponent(de.symeda.sormas.ui.samples.sampleLink.SampleListComponent) SurveillanceReportListComponent(de.symeda.sormas.ui.caze.surveillancereport.SurveillanceReportListComponent) TaskListComponent(de.symeda.sormas.ui.task.TaskListComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) ImmunizationListCriteria(de.symeda.sormas.api.immunization.ImmunizationListCriteria) EventListComponent(de.symeda.sormas.ui.events.eventLink.EventListComponent) ImmunizationListComponent(de.symeda.sormas.ui.immunization.immunizationlink.ImmunizationListComponent)

Example 4 with ImmunizationListCriteria

use of de.symeda.sormas.api.immunization.ImmunizationListCriteria 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();
    }
}
Also used : DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) SampleCriteria(de.symeda.sormas.api.sample.SampleCriteria) SampleListComponentLayout(de.symeda.sormas.ui.samples.sampleLink.SampleListComponentLayout) SormasToSormasListComponent(de.symeda.sormas.ui.sormastosormas.SormasToSormasListComponent) EventDto(de.symeda.sormas.api.event.EventDto) EditPermissionType(de.symeda.sormas.api.EditPermissionType) EventParticipantDto(de.symeda.sormas.api.event.EventParticipantDto) VaccinationListComponent(de.symeda.sormas.ui.vaccination.list.VaccinationListComponent) VaccinationListCriteria(de.symeda.sormas.api.vaccination.VaccinationListCriteria) SideComponentLayout(de.symeda.sormas.ui.utils.components.sidecomponent.SideComponentLayout) LayoutWithSidePanel(de.symeda.sormas.ui.utils.LayoutWithSidePanel) SampleListComponent(de.symeda.sormas.ui.samples.sampleLink.SampleListComponent) ContactListComponent(de.symeda.sormas.ui.contact.ContactListComponent) EventParticipantReferenceDto(de.symeda.sormas.api.event.EventParticipantReferenceDto) VerticalLayout(com.vaadin.ui.VerticalLayout) ImmunizationListCriteria(de.symeda.sormas.api.immunization.ImmunizationListCriteria) ImmunizationListComponent(de.symeda.sormas.ui.immunization.immunizationlink.ImmunizationListComponent)

Aggregations

ImmunizationListCriteria (de.symeda.sormas.api.immunization.ImmunizationListCriteria)4 VaccinationListCriteria (de.symeda.sormas.api.vaccination.VaccinationListCriteria)4 ImmunizationListComponent (de.symeda.sormas.ui.immunization.immunizationlink.ImmunizationListComponent)4 DetailSubComponentWrapper (de.symeda.sormas.ui.utils.DetailSubComponentWrapper)4 SideComponentLayout (de.symeda.sormas.ui.utils.components.sidecomponent.SideComponentLayout)4 VaccinationListComponent (de.symeda.sormas.ui.vaccination.list.VaccinationListComponent)4 VerticalLayout (com.vaadin.ui.VerticalLayout)3 EditPermissionType (de.symeda.sormas.api.EditPermissionType)3 SampleCriteria (de.symeda.sormas.api.sample.SampleCriteria)3 SampleListComponent (de.symeda.sormas.ui.samples.sampleLink.SampleListComponent)3 SampleListComponentLayout (de.symeda.sormas.ui.samples.sampleLink.SampleListComponentLayout)3 SormasToSormasListComponent (de.symeda.sormas.ui.sormastosormas.SormasToSormasListComponent)3 LayoutWithSidePanel (de.symeda.sormas.ui.utils.LayoutWithSidePanel)3 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)2 DocumentListComponent (de.symeda.sormas.ui.document.DocumentListComponent)2 EventListComponent (de.symeda.sormas.ui.events.eventLink.EventListComponent)2 TaskListComponent (de.symeda.sormas.ui.task.TaskListComponent)2 Button (com.vaadin.ui.Button)1 CustomLayout (com.vaadin.ui.CustomLayout)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1