use of de.symeda.sormas.ui.task.TaskListComponent in project SORMAS-Project by hzi-braunschweig.
the class TravelEntryDataView method initView.
@Override
protected void initView(String params) {
setHeightUndefined();
TravelEntryDto travelEntryDto = FacadeProvider.getTravelEntryFacade().getByUuid(getReference().getUuid());
editComponent = ControllerProvider.getTravelEntryController().getTravelEntryDataEditComponent(getTravelEntryRef().getUuid());
DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
container.setWidth(100, Unit.PERCENTAGE);
container.setMargin(true);
setSubComponent(container);
LayoutWithSidePanel layout = new LayoutWithSidePanel(editComponent, CASE_LOC, DOCUMENTS_LOC, QuarantineOrderDocumentsComponent.QUARANTINE_LOC, TASKS_LOC);
container.addComponent(layout);
CaseReferenceDto resultingCase = travelEntryDto.getResultingCase();
if (resultingCase == null) {
Button createCaseButton = ButtonHelper.createButton(Captions.travelEntryCreateCase, e -> showUnsavedChangesPopup(() -> ControllerProvider.getCaseController().createFromTravelEntry(travelEntryDto)), ValoTheme.BUTTON_PRIMARY, CssStyles.VSPACE_2);
layout.addSidePanelComponent(createCaseButton, CASE_LOC);
} else {
layout.addSidePanelComponent(createCaseInfoLayout(resultingCase.getUuid()), CASE_LOC);
}
DocumentListComponent documentList = null;
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.DOCUMENTS)) {
documentList = new DocumentListComponent(DocumentRelatedEntityType.TRAVEL_ENTRY, getReference(), UserRight.TRAVEL_ENTRY_EDIT, travelEntryDto.isPseudonymized());
layout.addSidePanelComponent(new SideComponentLayout(documentList), DOCUMENTS_LOC);
}
QuarantineOrderDocumentsComponent.addComponentToLayout(layout.getSidePanelComponent(), getTravelEntryRef(), documentList);
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.TASK_MANAGEMENT)) {
TaskListComponent taskList = new TaskListComponent(TaskContext.TRAVEL_ENTRY, getTravelEntryRef(), travelEntryDto.getDisease());
taskList.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addSidePanelComponent(taskList, TASKS_LOC);
}
EditPermissionType travelEntryEditAllowed = FacadeProvider.getTravelEntryFacade().isTravelEntryEditAllowed(travelEntryDto.getUuid());
if (travelEntryEditAllowed.equals(EditPermissionType.ARCHIVING_STATUS_ONLY)) {
layout.disable(ArchivingController.ARCHIVE_DEARCHIVE_BUTTON_ID);
} else if (travelEntryEditAllowed.equals(EditPermissionType.REFUSED)) {
layout.disable();
}
}
use of de.symeda.sormas.ui.task.TaskListComponent 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();
}
}
use of de.symeda.sormas.ui.task.TaskListComponent 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();
}
}
use of de.symeda.sormas.ui.task.TaskListComponent in project SORMAS-Project by hzi-braunschweig.
the class EventDataView method initView.
@Override
protected void initView(String params) {
EventDto event = FacadeProvider.getEventFacade().getEventByUuid(getEventRef().getUuid(), false);
setHeightUndefined();
DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
container.setWidth(100, Unit.PERCENTAGE);
container.setMargin(true);
setSubComponent(container);
editComponent = ControllerProvider.getEventController().getEventDataEditComponent(getEventRef().getUuid(), this::setExternalSurvToolLayoutVisibility);
LayoutWithSidePanel layout = new LayoutWithSidePanel(editComponent, TASKS_LOC, ACTIONS_LOC, DOCUMENTS_LOC, EventDocumentsComponent.DOCGENERATION_LOC, SUPERORDINATE_EVENT_LOC, SUBORDINATE_EVENTS_LOC, EVENT_GROUPS_LOC, SORMAS_TO_SORMAS_LOC, ExternalSurveillanceServiceGateway.EXTERANEL_SURVEILLANCE_TOOL_GATEWAY_LOC, SHORTCUT_LINKS_LOC);
container.addComponent(layout);
externalSurvToolLayout = ExternalSurveillanceServiceGateway.addComponentToLayout(layout.getSidePanelComponent(), editComponent, event);
setExternalSurvToolLayoutVisibility(event.getEventStatus());
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.TASK_MANAGEMENT)) {
TaskListComponent taskList = new TaskListComponent(TaskContext.EVENT, getEventRef(), event.getDisease());
taskList.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addSidePanelComponent(taskList, TASKS_LOC);
}
ActionStatsComponent actionList = new ActionStatsComponent(ActionContext.EVENT, getEventRef());
actionList.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addSidePanelComponent(actionList, ACTIONS_LOC);
DocumentListComponent documentList = null;
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.DOCUMENTS)) {
// TODO: user rights?
documentList = new DocumentListComponent(DocumentRelatedEntityType.EVENT, getEventRef(), UserRight.EVENT_EDIT, event.isPseudonymized());
layout.addSidePanelComponent(new SideComponentLayout(documentList), DOCUMENTS_LOC);
}
EventDocumentsComponent eventDocuments = new EventDocumentsComponent(getEventRef(), documentList);
eventDocuments.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addSidePanelComponent(eventDocuments, EventDocumentsComponent.DOCGENERATION_LOC);
boolean eventHierarchiesFeatureEnabled = FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_HIERARCHIES);
if (eventHierarchiesFeatureEnabled) {
SuperordinateEventComponent superordinateEventComponent = new SuperordinateEventComponent(event, this::showUnsavedChangesPopup);
superordinateEventComponent.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addSidePanelComponent(superordinateEventComponent, SUPERORDINATE_EVENT_LOC);
EventListComponent subordinateEventList = new EventListComponent(event.toReference(), this::showUnsavedChangesPopup);
subordinateEventList.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addSidePanelComponent(subordinateEventList, SUBORDINATE_EVENTS_LOC);
}
boolean eventGroupsFeatureEnabled = FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_GROUPS);
if (eventGroupsFeatureEnabled) {
layout.addSidePanelComponent(new SideComponentLayout(new EventGroupListComponent(event.toReference(), this::showUnsavedChangesPopup)), EVENT_GROUPS_LOC);
}
boolean sormasToSormasEnabled = FacadeProvider.getSormasToSormasFacade().isSharingEventsEnabledForUser();
if (sormasToSormasEnabled || event.getSormasToSormasOriginInfo() != null) {
VerticalLayout sormasToSormasLocLayout = new VerticalLayout();
sormasToSormasLocLayout.setMargin(false);
sormasToSormasLocLayout.setSpacing(false);
SormasToSormasListComponent sormasToSormasListComponent = new SormasToSormasListComponent(event, sormasToSormasEnabled);
sormasToSormasListComponent.addStyleNames(CssStyles.SIDE_COMPONENT);
sormasToSormasLocLayout.addComponent(sormasToSormasListComponent);
layout.addSidePanelComponent(sormasToSormasLocLayout, SORMAS_TO_SORMAS_LOC);
}
VerticalLayout shortcutLinksLayout = new VerticalLayout();
shortcutLinksLayout.setMargin(false);
shortcutLinksLayout.setSpacing(true);
if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_VIEW)) {
Button seeEventCasesBtn = ButtonHelper.createButton("eventLinkToCases", I18nProperties.getCaption(Captions.eventLinkToCases), thisEvent -> ControllerProvider.getCaseController().navigateTo(new CaseCriteria().eventLike(getEventRef().getUuid())), ValoTheme.BUTTON_PRIMARY);
shortcutLinksLayout.addComponent(seeEventCasesBtn);
}
if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW)) {
Button seeEventContactsBtn = ButtonHelper.createButton("eventLinkToContacts", I18nProperties.getCaption(Captions.eventLinkToContacts), thisEvent -> ControllerProvider.getContactController().navigateTo(new ContactCriteria().eventUuid(getEventRef().getUuid())), ValoTheme.BUTTON_PRIMARY);
shortcutLinksLayout.addComponent(seeEventContactsBtn);
}
LocationDto eventLocationDto = ((EventDataForm) editComponent.getWrappedComponent()).getValue().getEventLocation();
if (eventLocationDto.getFacility() != null) {
Button seeEventsWithinTheSameFacility = ButtonHelper.createButton("eventLinkToEventsWithinTheSameFacility", I18nProperties.getCaption(Captions.eventLinkToEventsWithinTheSameFacility), thisEvent -> ControllerProvider.getEventController().navigateTo(new EventCriteria().region(eventLocationDto.getRegion()).district(eventLocationDto.getDistrict()).eventCommunity(eventLocationDto.getCommunity()).typeOfPlace(TypeOfPlace.FACILITY).facilityType(eventLocationDto.getFacilityType()).facility(eventLocationDto.getFacility())), ValoTheme.BUTTON_PRIMARY);
shortcutLinksLayout.addComponent(seeEventsWithinTheSameFacility);
}
layout.addSidePanelComponent(shortcutLinksLayout, SHORTCUT_LINKS_LOC);
if (!UserProvider.getCurrent().hasUserRight(UserRight.EVENT_EDIT)) {
layout.setEnabled(false);
}
EditPermissionType eventEditAllowed = FacadeProvider.getEventFacade().isEventEditAllowed(event.getUuid());
if (eventEditAllowed == EditPermissionType.ARCHIVING_STATUS_ONLY) {
layout.disable(ArchivingController.ARCHIVE_DEARCHIVE_BUTTON_ID);
} else if (eventEditAllowed == EditPermissionType.REFUSED) {
layout.disable();
}
}
Aggregations