Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 647a234

Browse files
Merge branch 'development' of https://github.com/hzi-braunschweig/SORMAS-Project into development
2 parents 3f2123b + 2681067 commit 647a234

2 files changed

Lines changed: 41 additions & 38 deletions

File tree

sormas-ui/src/main/java/de/symeda/sormas/ui/task/TaskGridFilterForm.java

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import java.util.Date;
77
import java.util.stream.Stream;
88

9-
import org.apache.commons.lang3.StringUtils;
10-
119
import com.vaadin.server.Page;
1210
import com.vaadin.ui.CustomLayout;
1311
import com.vaadin.ui.HorizontalLayout;
@@ -69,24 +67,27 @@ protected void addFields() {
6967
addField(FieldConfiguration.pixelSized(TaskIndexDto.TASK_STATUS, 140));
7068

7169
final UserDto user = UserProvider.getCurrent().getUser();
72-
if (user.getRegion() == null && user.getDistrict() == null) {
73-
final ComboBox regionField = addField(FieldConfiguration.pixelSized(TaskIndexDto.REGION, 200));
74-
regionField.addItems(FacadeProvider.getRegionFacade().getAllActiveAsReference());
75-
76-
final ComboBox districtField = addDistrictField();
77-
districtField.setEnabled(false);
78-
79-
regionField.addValueChangeListener(e -> {
80-
RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue();
81-
if (StringUtils.isNotBlank(region.getUuid())) {
82-
districtField.setEnabled(true);
83-
FieldHelper.updateItems(districtField, FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid()));
84-
} else {
85-
districtField.setEnabled(false);
86-
}
87-
});
88-
} else if (user.getDistrict() == null) {
89-
FieldHelper.updateItems(addDistrictField(), FacadeProvider.getDistrictFacade().getAllActiveByRegion(user.getRegion().getUuid()));
70+
if (user.getDistrict() == null) {
71+
if (user.getRegion() == null) {
72+
final ComboBox regionField = addField(FieldConfiguration.pixelSized(TaskIndexDto.REGION, 200));
73+
regionField.addItems(FacadeProvider.getRegionFacade().getAllActiveAsReference());
74+
75+
final ComboBox districtField = addDistrictField();
76+
districtField.setEnabled(false);
77+
78+
regionField.addValueChangeListener(e -> {
79+
RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue();
80+
boolean hasRegion = null != region;
81+
districtField.setEnabled(hasRegion);
82+
if (hasRegion) {
83+
FieldHelper.updateItems(districtField, FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid()));
84+
} else {
85+
districtField.setValue(null);
86+
}
87+
});
88+
} else {
89+
FieldHelper.updateItems(addDistrictField(), FacadeProvider.getDistrictFacade().getAllActiveByRegion(user.getRegion().getUuid()));
90+
}
9091
}
9192

9293
addField(FieldConfiguration.withCaptionAndPixelSized(TaskCriteria.FREE_TEXT, I18nProperties.getString(Strings.promptTaskSearchField), 200));

sormas-ui/src/main/java/de/symeda/sormas/ui/task/TaskListEntry.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,22 @@ public TaskListEntry(TaskIndexDto task) {
6565

6666
Label taskTypeLabel = new Label(DataHelper.toStringNullable(task.getTaskType()));
6767
CssStyles.style(taskTypeLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE);
68-
taskTypeLabel.setWidth(50, Unit.PERCENTAGE);
68+
taskTypeLabel.setWidth(100, Unit.PERCENTAGE);
6969
topLeftLayout.addComponent(taskTypeLabel);
7070

71+
Label statusLabel = new Label(DataHelper.toStringNullable(task.getTaskStatus()));
72+
CssStyles.style(statusLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE);
73+
topLeftLayout.addComponent(statusLabel);
74+
75+
Label priorityLabel = new Label(
76+
DataHelper.toStringNullable(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.PRIORITY) + ": " + task.getPriority()));
77+
if (TaskPriority.HIGH == task.getPriority()) {
78+
priorityLabel.addStyleName(CssStyles.LABEL_IMPORTANT);
79+
} else if (TaskPriority.NORMAL == task.getPriority()) {
80+
priorityLabel.addStyleName(CssStyles.LABEL_NEUTRAL);
81+
}
82+
topLeftLayout.addComponent(priorityLabel);
83+
7184
Label suggestedStartLabel = new Label(
7285
I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.SUGGESTED_START) + ": "
7386
+ DateFormatHelper.formatDate(task.getSuggestedStart()));
@@ -83,25 +96,14 @@ public TaskListEntry(TaskIndexDto task) {
8396
VerticalLayout topRightLayout = new VerticalLayout();
8497

8598
topRightLayout.addStyleName(CssStyles.ALIGN_RIGHT);
86-
topRightLayout.setMargin(false);
87-
topRightLayout.setSpacing(false);
88-
89-
Label statusLabel = new Label(DataHelper.toStringNullable(task.getTaskStatus()));
90-
CssStyles.style(statusLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE);
91-
topRightLayout.addComponent(statusLabel);
92-
93-
Label priorityLabel = new Label(
94-
DataHelper.toStringNullable(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.PRIORITY) + ": " + task.getPriority()));
95-
if (TaskPriority.HIGH == task.getPriority()) {
96-
priorityLabel.addStyleName(CssStyles.LABEL_IMPORTANT);
97-
} else if (TaskPriority.NORMAL == task.getPriority()) {
98-
priorityLabel.addStyleName(CssStyles.LABEL_NEUTRAL);
99-
}
100-
topRightLayout.addComponent(priorityLabel);
99+
/*
100+
* topRightLayout.setMargin(false);
101+
* topRightLayout.setSpacing(false);
102+
*/
101103

102104
Label userLabel =
103105
new Label(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.ASSIGNEE_USER) + ": " + task.getAssigneeUser().getCaption());
104-
topRightLayout.addComponent(userLabel);
106+
topLeftLayout.addComponent(userLabel);
105107

106108
topLayout.addComponent(topRightLayout);
107109
topLayout.setComponentAlignment(topRightLayout, Alignment.TOP_RIGHT);
@@ -143,7 +145,7 @@ public void addEditListener(int rowIndex, ClickListener editClickListener) {
143145
CssStyles.BUTTON_COMPACT);
144146

145147
addComponent(editButton);
146-
setComponentAlignment(editButton, Alignment.MIDDLE_RIGHT);
148+
setComponentAlignment(editButton, Alignment.TOP_RIGHT);
147149
setExpandRatio(editButton, 0);
148150
}
149151

0 commit comments

Comments
 (0)